@carlonicora/nextjs-jsonapi 1.0.3 → 1.0.5

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 (515) hide show
  1. package/dist/{AbstractService-BKlpJA61.d.mts → AbstractService-B2n_JdiC.d.mts} +1 -1
  2. package/dist/{AbstractService-D9eSVKNa.d.ts → AbstractService-DtQTYovo.d.ts} +1 -1
  3. package/dist/{content.interface-Dg2lt_An.d.mts → AuthComponent-CPLvEerw.d.mts} +11 -15
  4. package/dist/{content.interface-BhyAiOFq.d.ts → AuthComponent-m6Qp4Hz6.d.ts} +11 -15
  5. package/dist/{BlockNoteEditor-UVO3VZZE.mjs → BlockNoteEditor-BLVXQPXV.mjs} +14 -18
  6. package/dist/{BlockNoteEditor-UVO3VZZE.mjs.map → BlockNoteEditor-BLVXQPXV.mjs.map} +1 -1
  7. package/dist/{BlockNoteEditor-VFWG6LXI.js → BlockNoteEditor-ZTDHULFT.js} +15 -19
  8. package/dist/BlockNoteEditor-ZTDHULFT.js.map +1 -0
  9. package/dist/JsonApiRequest-O7BGUMFO.mjs +23 -0
  10. package/dist/JsonApiRequest-VARLNKAF.js +23 -0
  11. package/dist/JsonApiRequest-VARLNKAF.js.map +1 -0
  12. package/dist/chunk-2LM6LCJW.mjs +1 -0
  13. package/dist/chunk-3APORDYP.mjs +7783 -0
  14. package/dist/chunk-3APORDYP.mjs.map +1 -0
  15. package/dist/{chunk-TMVHSY3Y.js → chunk-5ZEADNNP.js} +36 -17
  16. package/dist/chunk-5ZEADNNP.js.map +1 -0
  17. package/dist/{chunk-ECDTZBYO.mjs → chunk-74F6BBHH.mjs} +21 -2
  18. package/dist/chunk-74F6BBHH.mjs.map +1 -0
  19. package/dist/{chunk-GYWPEPOH.mjs → chunk-7C5RAEBO.mjs} +72 -68
  20. package/dist/chunk-7C5RAEBO.mjs.map +1 -0
  21. package/dist/chunk-A5DDIABK.js +1 -0
  22. package/dist/{chunk-TEGF6ZWG.js → chunk-AGAJMJ4T.js} +47 -9
  23. package/dist/chunk-AGAJMJ4T.js.map +1 -0
  24. package/dist/{chunk-CXQOWQSY.js → chunk-AYHKQWHH.js} +15 -2
  25. package/dist/chunk-AYHKQWHH.js.map +1 -0
  26. package/dist/{chunk-I2REI7OA.js → chunk-HMHGLXWC.js} +33 -15
  27. package/dist/chunk-HMHGLXWC.js.map +1 -0
  28. package/dist/chunk-IWFGEPAA.mjs +1 -0
  29. package/dist/chunk-JC3WJK65.js +1 -0
  30. package/dist/{chunk-L6EQEAXU.mjs → chunk-PYF2U6WG.mjs} +25 -7
  31. package/dist/chunk-PYF2U6WG.mjs.map +1 -0
  32. package/dist/{chunk-YDVTFM7X.mjs → chunk-RBIVEH2K.mjs} +42 -4
  33. package/dist/chunk-RBIVEH2K.mjs.map +1 -0
  34. package/dist/{chunk-V2JJPI7N.js → chunk-RZO2LOW4.js} +237 -233
  35. package/dist/chunk-RZO2LOW4.js.map +1 -0
  36. package/dist/{chunk-X4BIHJ2B.mjs → chunk-SM63SZCP.mjs} +15 -2
  37. package/dist/chunk-SM63SZCP.mjs.map +1 -0
  38. package/dist/chunk-WEC4YMOS.js +7783 -0
  39. package/dist/chunk-WEC4YMOS.js.map +1 -0
  40. package/dist/client/index.d.mts +21 -2
  41. package/dist/client/index.d.ts +21 -2
  42. package/dist/client/index.js +18 -245
  43. package/dist/client/index.js.map +1 -1
  44. package/dist/client/index.mjs +28 -255
  45. package/dist/client/index.mjs.map +1 -1
  46. package/dist/components/index.d.mts +293 -8
  47. package/dist/components/index.d.ts +293 -8
  48. package/dist/components/index.js +78 -2323
  49. package/dist/components/index.js.map +1 -1
  50. package/dist/components/index.mjs +172 -2417
  51. package/dist/components/index.mjs.map +1 -1
  52. package/dist/{config-hXufftVS.d.ts → config-BmnK65TD.d.mts} +1 -0
  53. package/dist/{config-hXufftVS.d.mts → config-BmnK65TD.d.ts} +1 -0
  54. package/dist/config-DQeAo9Kf.d.mts +49 -0
  55. package/dist/config-DQeAo9Kf.d.ts +49 -0
  56. package/dist/contexts/index.d.mts +109 -21
  57. package/dist/contexts/index.d.ts +109 -21
  58. package/dist/contexts/index.js +39 -7
  59. package/dist/contexts/index.js.map +1 -1
  60. package/dist/contexts/index.mjs +40 -8
  61. package/dist/core/index.d.mts +3 -4
  62. package/dist/core/index.d.ts +3 -4
  63. package/dist/core/index.js +3 -7
  64. package/dist/core/index.js.map +1 -1
  65. package/dist/core/index.mjs +4 -8
  66. package/dist/{d3.link.interface-QMdB22bC.d.mts → d3.link.interface-ClC4Irqp.d.mts} +2 -1
  67. package/dist/{d3.link.interface-QMdB22bC.d.ts → d3.link.interface-ClC4Irqp.d.ts} +2 -1
  68. package/dist/features/index.d.mts +17 -86
  69. package/dist/features/index.d.ts +17 -86
  70. package/dist/features/index.js +7 -16
  71. package/dist/features/index.js.map +1 -1
  72. package/dist/features/index.mjs +10 -19
  73. package/dist/hooks/index.d.mts +18 -43
  74. package/dist/hooks/index.d.ts +18 -43
  75. package/dist/hooks/index.js +20 -7
  76. package/dist/hooks/index.js.map +1 -1
  77. package/dist/hooks/index.mjs +19 -6
  78. package/dist/index.d.mts +10 -6
  79. package/dist/index.d.ts +10 -6
  80. package/dist/index.js +13 -10
  81. package/dist/index.js.map +1 -1
  82. package/dist/index.mjs +22 -19
  83. package/dist/interfaces/index.d.mts +2 -1
  84. package/dist/interfaces/index.d.ts +2 -1
  85. package/dist/notification.interface-BBgMUdLR.d.mts +14 -0
  86. package/dist/notification.interface-gyvT-Z2F.d.ts +14 -0
  87. package/dist/permissions/index.d.mts +2 -3
  88. package/dist/permissions/index.d.ts +2 -3
  89. package/dist/server/index.d.mts +38 -18
  90. package/dist/server/index.d.ts +38 -18
  91. package/dist/server/index.js +70 -2
  92. package/dist/server/index.js.map +1 -1
  93. package/dist/server/index.mjs +68 -0
  94. package/dist/server/index.mjs.map +1 -1
  95. package/dist/types-BUAlgqqh.d.ts +39 -0
  96. package/dist/{types-DluCaP1I.d.ts → types-Bl61ob-7.d.mts} +19 -2
  97. package/dist/{types-lQVA8d_P.d.mts → types-Bl61ob-7.d.ts} +19 -2
  98. package/dist/types-iVdVY7ba.d.mts +39 -0
  99. package/dist/useSocket-Cn7fB_B1.d.mts +25 -0
  100. package/dist/useSocket-DzMKRKCA.d.ts +25 -0
  101. package/dist/user.fields-CbdObSmS.d.mts +18 -0
  102. package/dist/user.fields-CbdObSmS.d.ts +18 -0
  103. package/dist/utils/index.d.mts +1 -2
  104. package/dist/utils/index.d.ts +1 -2
  105. package/package.json +6 -3
  106. package/src/atoms/index.ts +1 -0
  107. package/src/atoms/recentPagesAtom.ts +10 -0
  108. package/src/client/context/JsonApiContext.ts +61 -0
  109. package/src/client/context/JsonApiProvider.tsx +27 -0
  110. package/src/client/context/index.ts +2 -0
  111. package/src/client/hooks/index.ts +3 -0
  112. package/src/client/hooks/useJsonApiGet.ts +188 -0
  113. package/src/client/hooks/useJsonApiMutation.ts +193 -0
  114. package/src/client/hooks/useRehydration.ts +47 -0
  115. package/src/client/index.ts +24 -0
  116. package/src/client/request.ts +97 -0
  117. package/src/client/token.ts +10 -0
  118. package/src/components/containers/PageContainer.tsx +15 -0
  119. package/src/components/containers/ReactMarkdownContainer.tsx +119 -0
  120. package/src/components/containers/TabsContainer.tsx +93 -0
  121. package/src/components/containers/index.ts +3 -0
  122. package/src/components/contents/AttributeElement.tsx +20 -0
  123. package/src/components/contents/index.ts +1 -0
  124. package/src/components/details/AllowedUsersDetails.tsx +23 -0
  125. package/src/components/details/index.ts +1 -0
  126. package/src/components/editors/BlockNoteDiffInlineContent.tsx +152 -0
  127. package/src/components/editors/BlockNoteEditor.tsx +404 -0
  128. package/src/components/editors/BlockNoteEditorContainer.tsx +13 -0
  129. package/src/components/editors/BlockNoteEditorFormattingToolbar.tsx +38 -0
  130. package/src/components/editors/index.ts +1 -0
  131. package/src/components/errors/ErrorDetails.tsx +41 -0
  132. package/src/components/errors/errorToast.ts +9 -0
  133. package/src/components/errors/index.ts +2 -0
  134. package/src/components/forms/CommonAssociationForm.tsx +162 -0
  135. package/src/components/forms/CommonDeleter.tsx +94 -0
  136. package/src/components/forms/CommonEditorButtons.tsx +30 -0
  137. package/src/components/forms/CommonEditorHeader.tsx +35 -0
  138. package/src/components/forms/CommonEditorTrigger.tsx +26 -0
  139. package/src/components/forms/DatePickerPopover.tsx +219 -0
  140. package/src/components/forms/DateRangeSelector.tsx +110 -0
  141. package/src/components/forms/FileUploader.tsx +324 -0
  142. package/src/components/forms/FormCheckbox.tsx +66 -0
  143. package/src/components/forms/FormContainerGeneric.tsx +39 -0
  144. package/src/components/forms/FormDate.tsx +247 -0
  145. package/src/components/forms/FormDateTime.tsx +231 -0
  146. package/src/components/forms/FormInput.tsx +110 -0
  147. package/src/components/forms/FormPassword.tsx +54 -0
  148. package/src/components/forms/FormPlaceAutocomplete.tsx +286 -0
  149. package/src/components/forms/FormSelect.tsx +72 -0
  150. package/src/components/forms/FormSlider.tsx +51 -0
  151. package/src/components/forms/FormSwitch.tsx +25 -0
  152. package/src/components/forms/FormTextarea.tsx +44 -0
  153. package/src/components/forms/MultiFileUploader.tsx +107 -0
  154. package/src/components/forms/PasswordInput.tsx +47 -0
  155. package/src/components/forms/index.ts +22 -0
  156. package/src/components/index.ts +16 -0
  157. package/src/components/navigations/Breadcrumb.tsx +83 -0
  158. package/src/components/navigations/ContentTitle.tsx +39 -0
  159. package/src/components/navigations/Header.tsx +27 -0
  160. package/src/components/navigations/ModeToggleSwitch.tsx +25 -0
  161. package/src/components/navigations/PageSection.tsx +64 -0
  162. package/src/components/navigations/RecentPagesNavigator.tsx +52 -0
  163. package/src/components/navigations/index.ts +6 -0
  164. package/src/components/pages/PageContainerContentDetails.tsx +76 -0
  165. package/src/components/pages/PageContentContainer.tsx +31 -0
  166. package/src/components/pages/index.ts +2 -0
  167. package/src/components/tables/ContentListTable.tsx +166 -0
  168. package/src/components/tables/ContentTableSearch.tsx +105 -0
  169. package/src/components/tables/cells/cell.component.tsx +18 -0
  170. package/src/components/tables/cells/cell.date.tsx +16 -0
  171. package/src/components/tables/cells/cell.id.tsx +27 -0
  172. package/src/components/tables/cells/cell.link.tsx +18 -0
  173. package/src/components/tables/cells/cell.text.tsx +12 -0
  174. package/src/components/tables/cells/cell.url.tsx +13 -0
  175. package/src/components/tables/cells/index.ts +5 -0
  176. package/src/components/tables/index.ts +3 -0
  177. package/src/contexts/CommonContext.tsx +52 -0
  178. package/src/contexts/SharedContext.tsx +37 -0
  179. package/src/contexts/SocketContext.tsx +65 -0
  180. package/src/contexts/index.ts +7 -0
  181. package/src/core/abstracts/AbstractApiData.ts +138 -0
  182. package/src/core/abstracts/AbstractService.ts +263 -0
  183. package/src/core/abstracts/index.ts +2 -0
  184. package/src/core/endpoint/EndpointCreator.ts +97 -0
  185. package/src/core/endpoint/index.ts +1 -0
  186. package/src/core/factories/JsonApiDataFactory.ts +12 -0
  187. package/src/core/factories/RehydrationFactory.ts +30 -0
  188. package/src/core/factories/index.ts +2 -0
  189. package/src/core/fields/FieldSelector.ts +15 -0
  190. package/src/core/fields/index.ts +1 -0
  191. package/src/core/index.ts +20 -0
  192. package/src/core/interfaces/ApiData.ts +8 -0
  193. package/src/core/interfaces/ApiDataInterface.ts +15 -0
  194. package/src/core/interfaces/ApiRequestDataTypeInterface.ts +14 -0
  195. package/src/core/interfaces/ApiResponseInterface.ts +17 -0
  196. package/src/core/interfaces/JsonApiHydratedDataInterface.ts +5 -0
  197. package/src/core/interfaces/index.ts +5 -0
  198. package/{dist/chunk-DO2HLAZO.js → src/core/registry/DataClassRegistry.ts} +20 -17
  199. package/src/core/registry/ModuleRegistrar.ts +43 -0
  200. package/src/core/registry/ModuleRegistry.ts +64 -0
  201. package/src/core/registry/index.ts +3 -0
  202. package/src/core/utils/index.ts +2 -0
  203. package/src/core/utils/rehydrate.ts +24 -0
  204. package/src/core/utils/translateResponse.ts +125 -0
  205. package/src/features/auth/auth.module.ts +9 -0
  206. package/src/features/auth/components/containers/AuthContainer.tsx +32 -0
  207. package/src/features/auth/components/containers/index.ts +1 -0
  208. package/src/features/auth/components/details/LandingComponent.tsx +39 -0
  209. package/src/features/auth/components/details/index.ts +1 -0
  210. package/src/features/auth/components/forms/AcceptInvitation.tsx +136 -0
  211. package/src/features/auth/components/forms/ActivateAccount.tsx +75 -0
  212. package/src/features/auth/components/forms/Cookies.tsx +32 -0
  213. package/src/features/auth/components/forms/ForgotPassword.tsx +108 -0
  214. package/src/features/auth/components/forms/Login.tsx +118 -0
  215. package/src/features/auth/components/forms/Logout.tsx +19 -0
  216. package/src/features/auth/components/forms/RefreshUser.tsx +39 -0
  217. package/src/features/auth/components/forms/Register.tsx +150 -0
  218. package/src/features/auth/components/forms/ResetPassword.tsx +126 -0
  219. package/src/features/auth/components/forms/index.ts +9 -0
  220. package/src/features/auth/components/index.ts +3 -0
  221. package/src/features/auth/config.ts +57 -0
  222. package/src/features/auth/contexts/AuthContext.tsx +77 -0
  223. package/src/features/auth/contexts/index.ts +1 -0
  224. package/src/features/auth/data/auth.interface.ts +31 -0
  225. package/src/features/auth/data/auth.service.ts +159 -0
  226. package/src/features/auth/data/auth.ts +54 -0
  227. package/src/features/auth/data/index.ts +3 -0
  228. package/src/features/auth/enums/AuthComponent.ts +9 -0
  229. package/src/features/auth/enums/index.ts +1 -0
  230. package/src/features/auth/index.ts +4 -0
  231. package/src/features/auth/utils/AuthCookies.ts +134 -0
  232. package/src/features/auth/utils/index.ts +1 -0
  233. package/src/features/company/company.module.ts +10 -0
  234. package/src/features/company/components/containers/AdminCompanyContainer.tsx +26 -0
  235. package/src/features/company/components/containers/CompanyContainer.tsx +17 -0
  236. package/src/features/company/components/containers/index.ts +2 -0
  237. package/src/features/company/components/details/CompanyDetails.tsx +26 -0
  238. package/src/features/company/components/details/index.ts +1 -0
  239. package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +151 -0
  240. package/src/features/company/components/forms/CompanyConfigurationSecurityForm.tsx +97 -0
  241. package/src/features/company/components/forms/CompanyDeleter.tsx +121 -0
  242. package/src/features/company/components/forms/CompanyEditor.tsx +245 -0
  243. package/src/features/company/components/forms/CompanyLicense.tsx +213 -0
  244. package/src/features/company/components/forms/index.ts +5 -0
  245. package/src/features/company/components/index.ts +4 -0
  246. package/src/features/company/components/lists/CompaniesList.tsx +31 -0
  247. package/src/features/company/components/lists/index.ts +1 -0
  248. package/src/features/company/contexts/CompanyContext.tsx +99 -0
  249. package/src/features/company/contexts/index.ts +0 -0
  250. package/src/features/company/data/company.fields.ts +6 -0
  251. package/src/features/company/data/company.interface.ts +28 -0
  252. package/src/features/company/data/company.service.ts +73 -0
  253. package/src/features/company/data/company.ts +104 -0
  254. package/src/features/company/data/index.ts +4 -0
  255. package/src/features/company/hooks/index.ts +1 -0
  256. package/src/features/company/hooks/useCompanyTableStructure.tsx +82 -0
  257. package/src/features/company/index.ts +2 -0
  258. package/src/features/content/content.module.ts +20 -0
  259. package/src/features/content/data/content.fields.ts +13 -0
  260. package/src/features/content/data/content.interface.ts +23 -0
  261. package/src/features/content/data/content.service.ts +75 -0
  262. package/src/features/content/data/content.ts +85 -0
  263. package/src/features/content/data/index.ts +4 -0
  264. package/src/features/content/index.ts +2 -0
  265. package/src/features/feature/components/forms/FormFeatures.tsx +150 -0
  266. package/src/features/feature/components/forms/index.ts +1 -0
  267. package/src/features/feature/components/index.ts +1 -0
  268. package/src/features/feature/data/feature.interface.ts +9 -0
  269. package/src/features/feature/data/feature.service.ts +19 -0
  270. package/src/features/feature/data/feature.ts +33 -0
  271. package/src/features/feature/data/index.ts +3 -0
  272. package/src/features/feature/feature.module.ts +10 -0
  273. package/src/features/feature/index.ts +2 -0
  274. package/src/features/index.ts +12 -0
  275. package/src/features/module/data/index.ts +2 -0
  276. package/src/features/module/data/module.interface.ts +12 -0
  277. package/src/features/module/data/module.ts +42 -0
  278. package/src/features/module/index.ts +2 -0
  279. package/src/features/module/module.module.ts +10 -0
  280. package/src/features/notification/components/common/NotificationErrorBoundary.tsx +51 -0
  281. package/src/features/notification/components/common/index.ts +1 -0
  282. package/src/features/notification/components/containers/NotificationsListContainer.tsx +44 -0
  283. package/src/features/notification/components/containers/index.ts +1 -0
  284. package/src/features/notification/components/index.ts +5 -0
  285. package/src/features/notification/components/lists/NotificationsList.tsx +129 -0
  286. package/src/features/notification/components/lists/index.ts +1 -0
  287. package/src/features/notification/components/modals/NotificationModal.tsx +220 -0
  288. package/src/features/notification/components/modals/index.ts +1 -0
  289. package/src/features/notification/components/notifications/Notification.tsx +120 -0
  290. package/src/features/notification/components/notifications/PushNotificationProvider.tsx +9 -0
  291. package/src/features/notification/components/notifications/index.ts +2 -0
  292. package/src/features/notification/contexts/NotificationContext.tsx +187 -0
  293. package/src/features/notification/contexts/index.ts +1 -0
  294. package/src/features/notification/data/index.ts +4 -0
  295. package/src/features/notification/data/notification.fields.ts +8 -0
  296. package/src/features/notification/data/notification.interface.ts +14 -0
  297. package/src/features/notification/data/notification.service.ts +34 -0
  298. package/src/features/notification/data/notification.ts +51 -0
  299. package/src/features/notification/index.ts +2 -0
  300. package/src/features/notification/notification.module.ts +10 -0
  301. package/src/features/push/data/index.ts +3 -0
  302. package/src/features/push/data/push.interface.ts +8 -0
  303. package/src/features/push/data/push.service.ts +17 -0
  304. package/src/features/push/data/push.ts +18 -0
  305. package/src/features/push/index.ts +2 -0
  306. package/src/features/push/push.module.ts +10 -0
  307. package/src/features/role/components/containers/RoleContainer.tsx +18 -0
  308. package/src/features/role/components/containers/index.ts +1 -0
  309. package/src/features/role/components/details/RoleDetails.tsx +21 -0
  310. package/src/features/role/components/details/index.ts +1 -0
  311. package/src/features/role/components/forms/FormRoles.tsx +82 -0
  312. package/src/features/role/components/forms/RemoveUserFromRole.tsx +108 -0
  313. package/src/features/role/components/forms/UserRoleAdd.tsx +128 -0
  314. package/src/features/role/components/forms/index.ts +3 -0
  315. package/src/features/role/components/index.ts +4 -0
  316. package/src/features/role/components/lists/RolesList.tsx +27 -0
  317. package/src/features/role/components/lists/UserRolesList.tsx +31 -0
  318. package/src/features/role/components/lists/index.ts +2 -0
  319. package/src/features/role/contexts/RoleContext.tsx +84 -0
  320. package/src/features/role/contexts/index.ts +1 -0
  321. package/src/features/role/data/index.ts +4 -0
  322. package/src/features/role/data/role.fields.ts +8 -0
  323. package/src/features/role/data/role.interface.ts +16 -0
  324. package/src/features/role/data/role.service.ts +117 -0
  325. package/src/features/role/data/role.ts +62 -0
  326. package/src/features/role/hooks/index.ts +1 -0
  327. package/src/features/role/hooks/useRoleTableStructure.tsx +72 -0
  328. package/src/features/role/index.ts +2 -0
  329. package/src/features/role/role.module.ts +10 -0
  330. package/src/features/s3/data/index.ts +3 -0
  331. package/src/features/s3/data/s3.interface.ts +11 -0
  332. package/src/features/s3/data/s3.service.ts +30 -0
  333. package/src/features/s3/data/s3.ts +60 -0
  334. package/src/features/s3/index.ts +2 -0
  335. package/src/features/s3/s3.module.ts +10 -0
  336. package/src/features/search/index.ts +1 -0
  337. package/src/features/search/interfaces/index.ts +1 -0
  338. package/src/features/search/interfaces/search.result.interface.ts +3 -0
  339. package/src/features/user/author.module.ts +10 -0
  340. package/src/features/user/components/containers/UserContainer.tsx +23 -0
  341. package/src/features/user/components/containers/UserIndexContainer.tsx +12 -0
  342. package/src/features/user/components/containers/UsersListContainer.tsx +36 -0
  343. package/src/features/user/components/containers/index.ts +3 -0
  344. package/src/features/user/components/details/UserDetails.tsx +74 -0
  345. package/src/features/user/components/details/UserIndexDetails.tsx +28 -0
  346. package/src/features/user/components/details/index.ts +2 -0
  347. package/src/features/user/components/forms/RoleUserAdd.tsx +93 -0
  348. package/src/features/user/components/forms/UserAvatarEditor.tsx +78 -0
  349. package/src/features/user/components/forms/UserDeleter.tsx +49 -0
  350. package/src/features/user/components/forms/UserEditor.tsx +319 -0
  351. package/src/features/user/components/forms/UserMultiSelect.tsx +218 -0
  352. package/src/features/user/components/forms/UserReactivator.tsx +79 -0
  353. package/src/features/user/components/forms/UserResentInvitationEmail.tsx +88 -0
  354. package/src/features/user/components/forms/UserSelector.tsx +185 -0
  355. package/src/features/user/components/forms/index.ts +8 -0
  356. package/src/features/user/components/index.ts +5 -0
  357. package/src/features/user/components/lists/AdminUsersList.tsx +41 -0
  358. package/src/features/user/components/lists/CompanyUsersList.tsx +44 -0
  359. package/src/features/user/components/lists/ContributorsList.tsx +41 -0
  360. package/src/features/user/components/lists/RelevantUsersList.tsx +30 -0
  361. package/src/features/user/components/lists/RoleUsersList.tsx +31 -0
  362. package/src/features/user/components/lists/UserListInAdd.tsx +53 -0
  363. package/src/features/user/components/lists/UsersList.tsx +30 -0
  364. package/src/features/user/components/lists/UsersListByContentIds.tsx +30 -0
  365. package/src/features/user/components/lists/index.ts +8 -0
  366. package/src/features/user/components/widgets/UserAvatar.tsx +86 -0
  367. package/src/features/user/components/widgets/UserAvatarList.tsx +31 -0
  368. package/src/features/user/components/widgets/UserSearchPopover.tsx +89 -0
  369. package/src/features/user/components/widgets/index.ts +1 -0
  370. package/src/features/user/contexts/CurrentUserContext.tsx +156 -0
  371. package/src/features/user/contexts/UserContext.tsx +106 -0
  372. package/src/features/user/contexts/index.ts +2 -0
  373. package/src/features/user/data/index.ts +4 -0
  374. package/src/features/user/data/user.fields.ts +8 -0
  375. package/src/features/user/data/user.interface.ts +41 -0
  376. package/src/features/user/data/user.service.ts +246 -0
  377. package/src/features/user/data/user.ts +162 -0
  378. package/src/features/user/hooks/index.ts +2 -0
  379. package/src/features/user/hooks/useUserSearch.ts +53 -0
  380. package/src/features/user/hooks/useUserTableStructure.tsx +115 -0
  381. package/src/features/user/index.ts +3 -0
  382. package/src/features/user/user.module.ts +21 -0
  383. package/src/hooks/TableGeneratorRegistry.ts +53 -0
  384. package/src/hooks/index.ts +37 -0
  385. package/src/hooks/types.ts +35 -0
  386. package/src/hooks/url.rewriter.ts +22 -0
  387. package/src/hooks/useCustomD3Graph.tsx +707 -0
  388. package/src/hooks/useDataListRetriever.ts +349 -0
  389. package/src/hooks/useDebounce.ts +33 -0
  390. package/src/hooks/useNotificationSync.ts +20 -0
  391. package/src/hooks/usePageTracker.ts +69 -0
  392. package/src/hooks/usePageUrlGenerator.ts +50 -0
  393. package/src/hooks/usePushNotifications.ts +82 -0
  394. package/src/hooks/useSocket.ts +201 -0
  395. package/src/hooks/useTableGenerator.ts +20 -0
  396. package/src/i18n/config.ts +74 -0
  397. package/src/i18n/index.ts +18 -0
  398. package/src/index.ts +20 -0
  399. package/src/interfaces/breadcrumb.item.data.interface.ts +4 -0
  400. package/src/interfaces/d3.link.interface.ts +8 -0
  401. package/src/interfaces/d3.node.interface.ts +12 -0
  402. package/src/interfaces/index.ts +3 -0
  403. package/src/permissions/check.ts +127 -0
  404. package/src/permissions/index.ts +2 -0
  405. package/src/permissions/types.ts +109 -0
  406. package/src/roles/config.ts +46 -0
  407. package/src/roles/index.ts +1 -0
  408. package/src/server/ServerSession.ts +103 -0
  409. package/src/server/cache.ts +28 -0
  410. package/src/server/index.ts +4 -0
  411. package/src/server/request.ts +113 -0
  412. package/src/server/token.ts +10 -0
  413. package/src/shadcnui/custom/kanban.tsx +1001 -0
  414. package/src/shadcnui/custom/link.tsx +18 -0
  415. package/src/shadcnui/custom/multi-select.tsx +382 -0
  416. package/src/shadcnui/index.ts +49 -0
  417. package/src/shadcnui/ui/accordion.tsx +52 -0
  418. package/src/shadcnui/ui/alert-dialog.tsx +141 -0
  419. package/src/shadcnui/ui/alert.tsx +43 -0
  420. package/src/shadcnui/ui/avatar.tsx +50 -0
  421. package/src/shadcnui/ui/badge.tsx +40 -0
  422. package/src/shadcnui/ui/breadcrumb.tsx +115 -0
  423. package/src/shadcnui/ui/button.tsx +51 -0
  424. package/src/shadcnui/ui/calendar.tsx +73 -0
  425. package/src/shadcnui/ui/card.tsx +43 -0
  426. package/src/shadcnui/ui/carousel.tsx +225 -0
  427. package/src/shadcnui/ui/chart.tsx +320 -0
  428. package/src/shadcnui/ui/checkbox.tsx +29 -0
  429. package/src/shadcnui/ui/collapsible.tsx +11 -0
  430. package/src/shadcnui/ui/command.tsx +155 -0
  431. package/src/shadcnui/ui/context-menu.tsx +179 -0
  432. package/src/shadcnui/ui/dialog.tsx +96 -0
  433. package/src/shadcnui/ui/drawer.tsx +89 -0
  434. package/src/shadcnui/ui/dropdown-menu.tsx +205 -0
  435. package/src/shadcnui/ui/form.tsx +138 -0
  436. package/src/shadcnui/ui/hover-card.tsx +29 -0
  437. package/src/shadcnui/ui/input.tsx +21 -0
  438. package/src/shadcnui/ui/label.tsx +26 -0
  439. package/src/shadcnui/ui/navigation-menu.tsx +168 -0
  440. package/src/shadcnui/ui/popover.tsx +33 -0
  441. package/src/shadcnui/ui/progress.tsx +25 -0
  442. package/src/shadcnui/ui/radio-group.tsx +37 -0
  443. package/src/shadcnui/ui/resizable.tsx +47 -0
  444. package/src/shadcnui/ui/scroll-area.tsx +40 -0
  445. package/src/shadcnui/ui/select.tsx +164 -0
  446. package/src/shadcnui/ui/separator.tsx +28 -0
  447. package/src/shadcnui/ui/sheet.tsx +139 -0
  448. package/src/shadcnui/ui/sidebar.tsx +677 -0
  449. package/src/shadcnui/ui/skeleton.tsx +13 -0
  450. package/src/shadcnui/ui/slider.tsx +25 -0
  451. package/src/shadcnui/ui/sonner.tsx +25 -0
  452. package/src/shadcnui/ui/switch.tsx +31 -0
  453. package/src/shadcnui/ui/table.tsx +120 -0
  454. package/src/shadcnui/ui/tabs.tsx +55 -0
  455. package/src/shadcnui/ui/textarea.tsx +24 -0
  456. package/src/shadcnui/ui/toggle.tsx +39 -0
  457. package/src/shadcnui/ui/tooltip.tsx +61 -0
  458. package/src/unified/JsonApiRequest.ts +348 -0
  459. package/src/unified/index.ts +1 -0
  460. package/src/utils/blocknote-diff.util.ts +815 -0
  461. package/src/utils/blocknote-word-diff-renderer.util.ts +413 -0
  462. package/src/utils/cn.ts +6 -0
  463. package/src/utils/compose-refs.ts +61 -0
  464. package/src/utils/date-formatter.ts +53 -0
  465. package/src/utils/exists.ts +7 -0
  466. package/src/utils/index.ts +15 -0
  467. package/src/utils/schemas/entity.object.schema.ts +8 -0
  468. package/src/utils/schemas/index.ts +2 -0
  469. package/src/utils/schemas/user.object.schema.ts +9 -0
  470. package/src/utils/table-options.ts +67 -0
  471. package/src/utils/use-mobile.tsx +21 -0
  472. package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.mts +0 -20
  473. package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.ts +0 -20
  474. package/dist/BlockNoteEditor-VFWG6LXI.js.map +0 -1
  475. package/dist/JsonApiRequest-S3ICLM7B.mjs +0 -20
  476. package/dist/JsonApiRequest-ZZLSP26T.js +0 -20
  477. package/dist/JsonApiRequest-ZZLSP26T.js.map +0 -1
  478. package/dist/chunk-366S2JCC.mjs +0 -31
  479. package/dist/chunk-366S2JCC.mjs.map +0 -1
  480. package/dist/chunk-5W6AKZE6.mjs +0 -131
  481. package/dist/chunk-5W6AKZE6.mjs.map +0 -1
  482. package/dist/chunk-A3J3AAYM.mjs +0 -97
  483. package/dist/chunk-A3J3AAYM.mjs.map +0 -1
  484. package/dist/chunk-AWONBQQP.js +0 -97
  485. package/dist/chunk-AWONBQQP.js.map +0 -1
  486. package/dist/chunk-CXQOWQSY.js.map +0 -1
  487. package/dist/chunk-DKKMWBP4.mjs +0 -1
  488. package/dist/chunk-DKKMWBP4.mjs.map +0 -1
  489. package/dist/chunk-DO2HLAZO.js.map +0 -1
  490. package/dist/chunk-DZXDB3K2.mjs +0 -17
  491. package/dist/chunk-DZXDB3K2.mjs.map +0 -1
  492. package/dist/chunk-ECDTZBYO.mjs.map +0 -1
  493. package/dist/chunk-FY4SXJGU.js +0 -806
  494. package/dist/chunk-FY4SXJGU.js.map +0 -1
  495. package/dist/chunk-GYWPEPOH.mjs.map +0 -1
  496. package/dist/chunk-H6FMOA6B.js +0 -1
  497. package/dist/chunk-H6FMOA6B.js.map +0 -1
  498. package/dist/chunk-I2REI7OA.js.map +0 -1
  499. package/dist/chunk-J4Q36PMP.js +0 -31
  500. package/dist/chunk-J4Q36PMP.js.map +0 -1
  501. package/dist/chunk-L6EQEAXU.mjs.map +0 -1
  502. package/dist/chunk-MFO27OHB.mjs +0 -48
  503. package/dist/chunk-MFO27OHB.mjs.map +0 -1
  504. package/dist/chunk-RAF7PNLG.js +0 -131
  505. package/dist/chunk-RAF7PNLG.js.map +0 -1
  506. package/dist/chunk-RUR22SVM.js +0 -17
  507. package/dist/chunk-RUR22SVM.js.map +0 -1
  508. package/dist/chunk-TEGF6ZWG.js.map +0 -1
  509. package/dist/chunk-TMVHSY3Y.js.map +0 -1
  510. package/dist/chunk-V2JJPI7N.js.map +0 -1
  511. package/dist/chunk-WWWMJZEF.mjs +0 -806
  512. package/dist/chunk-WWWMJZEF.mjs.map +0 -1
  513. package/dist/chunk-X4BIHJ2B.mjs.map +0 -1
  514. package/dist/chunk-YDVTFM7X.mjs.map +0 -1
  515. /package/dist/{JsonApiRequest-S3ICLM7B.mjs.map → JsonApiRequest-O7BGUMFO.mjs.map} +0 -0
@@ -1,11 +1,9 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
3
3
 
4
- var _chunkRUR22SVMjs = require('../chunk-RUR22SVM.js');
5
4
 
6
5
 
7
6
 
8
- var _chunkAWONBQQPjs = require('../chunk-AWONBQQP.js');
9
7
 
10
8
 
11
9
 
@@ -81,2343 +79,100 @@ var _chunkAWONBQQPjs = require('../chunk-AWONBQQP.js');
81
79
 
82
80
 
83
81
 
84
- var _chunkA5DDIABKjs = require('../chunk-A5DDIABK.js');
85
82
 
86
83
 
87
- var _chunkJC3WJK65js = require('../chunk-JC3WJK65.js');
88
84
 
89
85
 
90
86
 
91
87
 
92
88
 
93
- var _chunkFY4SXJGUjs = require('../chunk-FY4SXJGU.js');
94
89
 
95
90
 
96
91
 
97
92
 
98
93
 
99
- var _chunkCXQOWQSYjs = require('../chunk-CXQOWQSY.js');
100
94
 
101
95
 
102
- var _chunk3FBCC4G3js = require('../chunk-3FBCC4G3.js');
103
96
 
104
97
 
105
98
 
106
- var _chunkRAF7PNLGjs = require('../chunk-RAF7PNLG.js');
107
- require('../chunk-6GKHCVF6.js');
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ var _chunkWEC4YMOSjs = require('../chunk-WEC4YMOS.js');
109
+ require('../chunk-IBS6NI7D.js');
110
+ require('../chunk-A5DDIABK.js');
111
+ require('../chunk-JC3WJK65.js');
112
+ require('../chunk-RZO2LOW4.js');
113
+ require('../chunk-LXKSUWAV.js');
114
+ require('../chunk-AYHKQWHH.js');
115
+ require('../chunk-5ZEADNNP.js');
108
116
  require('../chunk-4HCRAOS5.js');
109
- require('../chunk-I2REI7OA.js');
110
- require('../chunk-TEGF6ZWG.js');
111
- require('../chunk-J4Q36PMP.js');
112
- require('../chunk-DO2HLAZO.js');
113
-
114
-
115
- var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
116
-
117
- // src/components/navigations/Breadcrumb.tsx
118
- var _nextintl = require('next-intl');
119
- var _react = require('react'); var React2 = _interopRequireWildcard(_react);
120
- var _jsxruntime = require('react/jsx-runtime');
121
- var ITEMS_TO_DISPLAY = 3;
122
- function Breadcrumb2({ items }) {
123
- const generateUrl = _chunkFY4SXJGUjs.usePageUrlGenerator.call(void 0, );
124
- const t = _nextintl.useTranslations.call(void 0, );
125
- const [open, setOpen] = _react.useState.call(void 0, false);
126
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Breadcrumb, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.BreadcrumbList, { children: [
127
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: generateUrl({ page: `/` }), children: t(`generic.home`) }) }),
128
- items.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {}),
129
- items.length > ITEMS_TO_DISPLAY ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
130
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: items[0].href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: items[0].href, children: items[0].name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: items[0].name }) }),
131
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {}),
132
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DropdownMenu, { open, onOpenChange: setOpen, children: [
133
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuTrigger, { className: "flex items-center gap-1", "aria-label": "Toggle menu", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbEllipsis, { className: "h-4 w-4" }) }),
134
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuContent, { align: "start", children: items.slice(1, -ITEMS_TO_DISPLAY + 1).map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuItem, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: item.href ? item.href : "#", children: item.name }) }, index)) })
135
- ] }) }),
136
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {}),
137
- items.slice(-ITEMS_TO_DISPLAY + 1).map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
138
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: item.href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: item.href, children: item.name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: item.name }) }),
139
- index < items.slice(-ITEMS_TO_DISPLAY + 1).length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {})
140
- ] }, index))
141
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: items.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
142
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: item.href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: item.href, children: item.name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: item.name }) }),
143
- index < items.length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {})
144
- ] }, index)) })
145
- ] }) });
146
- }
147
- _chunk7QVYU63Ejs.__name.call(void 0, Breadcrumb2, "Breadcrumb");
148
-
149
- // src/components/navigations/ContentTitle.tsx
150
-
151
-
152
- function ContentTitle({ type, element, functions, className }) {
153
- const [clientFunctions, setClientFunctions] = _react.useState.call(void 0, null);
154
- const [isClient, setIsClient] = _react.useState.call(void 0, false);
155
- _react.useEffect.call(void 0, () => {
156
- setIsClient(true);
157
- setClientFunctions(functions);
158
- }, [functions]);
159
- if (!element) return null;
160
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, `mb-4 flex w-full flex-col`, className), children: [
161
- (type || isClient) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-row items-center justify-between gap-x-4", children: [
162
- type && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `text-muted-foreground text-xl font-light`, children: type }),
163
- isClient && clientFunctions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-row items-center justify-start", children: clientFunctions })
164
- ] }),
165
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `text-primary w-full text-3xl font-semibold`, children: element })
166
- ] });
167
- }
168
- _chunk7QVYU63Ejs.__name.call(void 0, ContentTitle, "ContentTitle");
169
-
170
- // src/components/navigations/Header.tsx
171
-
172
- function Header({ children }) {
173
- const { breadcrumbs } = _chunkRAF7PNLGjs.useSharedContext.call(void 0, );
174
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "header", { className: `sticky top-0 z-10 flex h-12 flex-col items-center justify-start gap-x-4 border-b`, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-sidebar flex h-12 w-full flex-row items-center justify-between pl-2 pr-4", children: [
175
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SidebarTrigger, { "aria-label": "Toggle sidebar" }),
176
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-row items-center justify-start", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Breadcrumb2, { items: breadcrumbs }) }),
177
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-64 flex-row items-center justify-end gap-x-4 whitespace-nowrap", children: children ? children : null })
178
- ] }) });
179
- }
180
- _chunk7QVYU63Ejs.__name.call(void 0, Header, "Header");
181
-
182
- // src/components/navigations/ModeToggleSwitch.tsx
183
- var _lucidereact = require('lucide-react');
184
- var _nextthemes = require('next-themes');
185
-
186
- function ModeToggleSwitch() {
187
- const { theme, setTheme } = _nextthemes.useTheme.call(void 0, );
188
- const handleToggle = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
189
- setTheme(theme === "light" ? "dark" : "light");
190
- }, "handleToggle");
191
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Switch, { checked: theme === "dark", onCheckedChange: handleToggle, className: "relative", children: theme === "dark" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoonIcon, { className: "text-primary-foreground h-4 w-4" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SunIcon, { className: "text-primary h-4 w-4" }) }) });
192
- }
193
- _chunk7QVYU63Ejs.__name.call(void 0, ModeToggleSwitch, "ModeToggleSwitch");
194
-
195
- // src/components/navigations/PageSection.tsx
196
-
197
-
198
- var _uuid = require('uuid');
199
-
200
- function PageSection({ children, title, options, open, small, onToggle }) {
201
- const [isOpen, setIsOpen] = _react.useState.call(void 0, _nullishCoalesce(open, () => ( true)));
202
- const [shouldRender, setShouldRender] = _react.useState.call(void 0, _nullishCoalesce(open, () => ( true)));
203
- _react.useEffect.call(void 0, () => {
204
- if (onToggle) {
205
- onToggle(isOpen);
206
- }
207
- }, [isOpen]);
208
- const toggleOpen = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => setIsOpen(!isOpen), "toggleOpen");
209
- _react.useEffect.call(void 0, () => {
210
- if (isOpen) {
211
- setShouldRender(true);
212
- } else {
213
- const timer = setTimeout(() => setShouldRender(false), 300);
214
- return () => clearTimeout(timer);
215
- }
216
- }, [isOpen]);
217
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
218
- "section",
219
- {
220
- id: title ? title.toLowerCase().replaceAll(" ", "") : _uuid.v4.call(void 0, ),
221
- className: `${isOpen ? "mb-4" : "my-0"} flex w-full scroll-mt-40 flex-col`,
222
- children: [
223
- title && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
224
- "div",
225
- {
226
- className: `${isOpen ? "mb-4" : "mb-0"} flex w-full justify-between border-b ${small ? `border-muted` : `border-primary`} pb-1`,
227
- children: [
228
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full cursor-pointer items-center justify-start gap-x-2", onClick: toggleOpen, children: [
229
- isOpen ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon, { className: `text-primary h-4 w-4` }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRightIcon, { className: "text-primary h-4 w-4" }),
230
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: `flex w-full ${small === true ? `text-sm` : `text-lg`} text-primary font-semibold`, children: title })
231
- ] }),
232
- options && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: options })
233
- ]
234
- }
235
- ),
236
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `overflow-hidden transition-all duration-300 ${isOpen ? "" : "max-h-0"}`, children: shouldRender && children })
237
- ]
238
- }
239
- );
240
- }
241
- _chunk7QVYU63Ejs.__name.call(void 0, PageSection, "PageSection");
242
-
243
- // src/components/navigations/RecentPagesNavigator.tsx
244
- var _jotai = require('jotai');
245
-
246
-
247
-
248
- function RecentPagesNavigator() {
249
- const recentPages = _jotai.useAtomValue.call(void 0, _chunk3FBCC4G3js.recentPagesAtom);
250
- const t = _nextintl.useTranslations.call(void 0, );
251
- const { state } = _chunkA5DDIABKjs.useSidebar.call(void 0, );
252
- if (recentPages.length === 0) {
253
- return null;
254
- }
255
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DropdownMenu, { children: [
256
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full cursor-pointer items-center gap-2", children: state === "collapsed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.HistoryIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t(`generic.recent_pages`) }) }) }),
257
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DropdownMenuContent, { align: "start", className: "w-96", children: [
258
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuLabel, { children: t(`generic.recent_pages`) }),
259
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuSeparator, {}),
260
- recentPages.map((page, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: page.url, className: "flex items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
261
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "truncate text-sm", children: page.title }),
262
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground text-xs font-normal", children: t(`types.${page.moduleType}`, { count: 1 }) })
263
- ] }) }) }, `${page.url}-${index}`))
264
- ] })
265
- ] });
266
- }
267
- _chunk7QVYU63Ejs.__name.call(void 0, RecentPagesNavigator, "RecentPagesNavigator");
268
-
269
- // src/components/containers/PageContainer.tsx
270
-
271
- function PageContainer({ children, testId, className }) {
272
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex h-full w-full flex-col`, "data-testid": testId, children: [
273
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header, {}),
274
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "main", { className: _chunkJC3WJK65js.cn.call(void 0, `flex w-full flex-1 flex-col gap-y-4 pt-4 pl-4 pr-4`, className), children })
275
- ] });
276
- }
277
- _chunk7QVYU63Ejs.__name.call(void 0, PageContainer, "PageContainer");
278
-
279
- // src/components/containers/ReactMarkdownContainer.tsx
280
-
281
-
282
-
283
- var _reactmarkdown = require('react-markdown'); var _reactmarkdown2 = _interopRequireDefault(_reactmarkdown);
284
- var _remarkgfm = require('remark-gfm'); var _remarkgfm2 = _interopRequireDefault(_remarkgfm);
285
-
286
- function ReactMarkdownContainer({
287
- content,
288
- collapsible = false,
289
- initialLines = 4,
290
- size = "normal"
291
- }) {
292
- const t = _nextintl.useTranslations.call(void 0, "generic.buttons");
293
- const [isExpanded, setIsExpanded] = _react.useState.call(void 0, false);
294
- const [showExpandButton, setShowExpandButton] = _react.useState.call(void 0, false);
295
- const contentRef = _react.useRef.call(void 0, null);
296
- _react.useEffect.call(void 0, () => {
297
- if (collapsible && contentRef.current && !isExpanded) {
298
- const isOverflowing = contentRef.current.scrollHeight > contentRef.current.clientHeight;
299
- setShowExpandButton(isOverflowing);
300
- }
301
- }, [collapsible, content, isExpanded]);
302
- const handleToggle = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
303
- setIsExpanded(!isExpanded);
304
- }, "handleToggle");
305
- const clampStyle = collapsible && !isExpanded ? {
306
- display: "-webkit-box",
307
- WebkitLineClamp: initialLines,
308
- WebkitBoxOrient: "vertical",
309
- overflow: "hidden"
310
- } : {};
311
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
312
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
313
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: contentRef, style: clampStyle, className: "transition-all duration-300 ease-in-out", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
314
- _reactmarkdown2.default,
315
- {
316
- remarkPlugins: [_remarkgfm2.default],
317
- components: {
318
- p: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: size === "small" ? "text-xs" : "", children }), "p"),
319
- li: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { className: size === "small" ? "text-xs" : "", children }), "li"),
320
- table: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "table", { className: "w-full table-auto border-collapse border", children }), "table"),
321
- th: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: `border px-4 py-2 text-left ${size === "small" ? "px-2 py-1 text-xs" : ""}`, children }), "th"),
322
- td: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: `border px-4 py-2 ${size === "small" ? "px-2 py-1 text-xs" : ""}`, children }), "td"),
323
- tr: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { className: "even:bg-gray-50", children }), "tr"),
324
- ul: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: `list-disc ${size === "small" ? "pl-3" : "pl-4"}`, children }), "ul"),
325
- ol: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: `list-decimal ${size === "small" ? "pl-3" : "pl-4"}`, children }), "ol"),
326
- h1: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: size === "small" ? "my-1 mt-2 text-sm font-bold" : "my-2 mt-4 text-3xl font-medium", children }), "h1"),
327
- h2: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
328
- "h2",
329
- {
330
- className: size === "small" ? "my-1 mt-2 text-sm font-semibold" : "my-2 mt-4 text-2xl font-semibold",
331
- children
332
- }
333
- ), "h2"),
334
- h3: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: size === "small" ? "my-1 mt-2 text-sm font-medium" : "my-2 mt-4 text-xl font-semibold", children }), "h3"),
335
- h4: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: size === "small" ? "my-1 mt-2 text-sm font-medium" : "my-2 mt-4 text-lg font-semibold", children }), "h4")
336
- },
337
- children: content
338
- }
339
- ) }),
340
- collapsible && !isExpanded && showExpandButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pointer-events-none absolute right-0 bottom-0 left-0 h-12 bg-gradient-to-t from-white to-transparent" })
341
- ] }),
342
- collapsible && showExpandButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
343
- "button",
344
- {
345
- onClick: handleToggle,
346
- className: "flex items-center gap-1 rounded-md px-3 py-1.5 text-sm text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900",
347
- "aria-label": isExpanded ? t("show_less") : t("show_more"),
348
- children: [
349
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isExpanded ? t("show_less") : t("show_more") }),
350
- isExpanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { className: "h-4 w-4" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, { className: "h-4 w-4" })
351
- ]
352
- }
353
- ) })
354
- ] });
355
- }
356
- _chunk7QVYU63Ejs.__name.call(void 0, ReactMarkdownContainer, "ReactMarkdownContainer");
357
-
358
- // src/components/containers/TabsContainer.tsx
359
-
360
- function TabsContainer({
361
- tabs,
362
- defaultTab,
363
- tabsListClassName,
364
- tabsTriggerClassName,
365
- scrollAreaClassName,
366
- style,
367
- additionalComponent
368
- }) {
369
- const { hasPermissionToModules } = _chunkRAF7PNLGjs.useCurrentUserContext.call(void 0, );
370
- const validTabs = tabs.filter(
371
- (tab) => tab.modules && tab.action ? hasPermissionToModules({ modules: tab.modules, action: tab.action }) : true
372
- );
373
- if (validTabs.length === 0) return null;
374
- const defaultValue = _nullishCoalesce(defaultTab, () => ( tabs[0].label));
375
- if (validTabs.length === 1) {
376
- return validTabs[0].content;
377
- }
378
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Tabs, { defaultValue, className: "w-full", children: [
379
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full items-center justify-between", children: [
380
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
381
- _chunkA5DDIABKjs.TabsList,
382
- {
383
- className: _chunkJC3WJK65js.cn.call(void 0,
384
- `${style ? `my-4 flex w-full justify-start rounded-none border-b bg-transparent pb-0` : ``}`,
385
- tabsListClassName
386
- ),
387
- children: validTabs.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
388
- _chunkA5DDIABKjs.TabsTrigger,
389
- {
390
- value: tab.label,
391
- className: _chunkJC3WJK65js.cn.call(void 0,
392
- `${style ? `text-muted-foreground border-accent data-[state=active]:text-foreground hover:text-foreground cursor-pointer rounded-none bg-transparent pb-2 text-sm font-light hover:border-0 data-[state=active]:border-b data-[state=active]:font-medium data-[state=active]:shadow-none` : `text-primary text-xs`}`,
393
- tabsTriggerClassName
394
- ),
395
- children: _nullishCoalesce(tab.contentLabel, () => ( tab.label))
396
- },
397
- tab.label
398
- ))
399
- }
400
- ),
401
- additionalComponent && additionalComponent
402
- ] }),
403
- scrollAreaClassName ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ScrollArea, { className: scrollAreaClassName, children: validTabs.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsContent, { value: tab.label, children: tab.content }, tab.label)) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: validTabs.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsContent, { value: tab.label, children: tab.content }, tab.label)) })
404
- ] });
405
- }
406
- _chunk7QVYU63Ejs.__name.call(void 0, TabsContainer, "TabsContainer");
407
-
408
- // src/components/contents/AttributeElement.tsx
409
-
410
- function AttributeElement({ inline, title, value, className }) {
411
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, `flex ${inline === true ? "flex-row" : "flex-col"} my-1 justify-start`, className), children: [
412
- title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `${inline === true ? "min-w-48 pr-4" : "w-full"} text-sm font-semibold`, children: title }),
413
- value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col text-sm", children: value })
414
- ] });
415
- }
416
- _chunk7QVYU63Ejs.__name.call(void 0, AttributeElement, "AttributeElement");
417
-
418
- // src/components/details/AllowedUsersDetails.tsx
419
-
420
-
421
- function AllowedUsersDetails({ showTitle, content }) {
422
- const t = _nextintl.useTranslations.call(void 0, );
423
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-2 flex w-full flex-col gap-y-2", children: [
424
- showTitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-xs font-semibold", children: t("generic.permissions") }),
425
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full items-center justify-start gap-x-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAWONBQQPjs.ContributorsList, { content }) })
426
- ] });
427
- }
428
- _chunk7QVYU63Ejs.__name.call(void 0, AllowedUsersDetails, "AllowedUsersDetails");
429
-
430
- // src/components/editors/BlockNoteEditorContainer.tsx
431
- var _dynamic = require('next/dynamic'); var _dynamic2 = _interopRequireDefault(_dynamic);
432
-
433
-
434
- var BlockNoteEditor = _dynamic2.default.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("../BlockNoteEditor-VFWG6LXI.js"))), {
435
- ssr: false
436
- });
437
- var BlockNoteEditorContainer = React2.default.memo(/* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, function EditorContainer(props) {
438
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlockNoteEditor, { ...props });
439
- }, "EditorContainer"));
440
-
441
- // src/components/errors/ErrorDetails.tsx
442
- var _image = require('next/image'); var _image2 = _interopRequireDefault(_image);
443
-
444
- function ErrorDetails({ title, message, code }) {
445
- if (code === 403)
446
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-xl max-w-xl", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Card, { className: "w-full", children: [
447
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardHeader, { children: [
448
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardTitle, { className: "text-foreground flex flex-col items-center gap-y-4 pb-10 text-4xl", children: [
449
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _image2.default, { src: "/phlow-logo.webp", alt: "Phlow", width: 100, height: 100, priority: true }),
450
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: "Unauthorised" })
451
- ] }),
452
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardDescription, { className: "text-center text-lg", children: "We are sorry, but you are not allowed to access this content." })
453
- ] }),
454
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardContent, {})
455
- ] }) });
456
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-xl max-w-xl", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Card, { className: "w-full", children: [
457
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardHeader, { children: [
458
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardTitle, { className: "text-foreground flex flex-col items-center gap-y-4 pb-10 text-center text-4xl", children: [
459
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _image2.default, { src: "/phlow-logo.webp", alt: "Phlow", width: 100, height: 100, priority: true }),
460
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: code }),
461
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: title })
462
- ] }),
463
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardDescription, { className: "text-center text-lg", children: message })
464
- ] }),
465
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardContent, {})
466
- ] }) });
467
- }
468
- _chunk7QVYU63Ejs.__name.call(void 0, ErrorDetails, "ErrorDetails");
469
-
470
- // src/components/forms/CommonAssociationForm.tsx
471
-
472
-
473
- var _sonner = require('sonner');
474
-
475
- function CommonAssociationTrigger({
476
- sourceType,
477
- destinationType,
478
- hasDestination,
479
- onTrigger
480
- }) {
481
- const t = _nextintl.useTranslations.call(void 0, );
482
- if (hasDestination)
483
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "hover:text-accent cursor-pointer", onClick: onTrigger, children: "Join" });
484
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { variant: `outline`, size: `sm`, onClick: onTrigger, children: t(`generic.association.label`, {
485
- source: sourceType,
486
- destination: destinationType
487
- }) });
488
- }
489
- _chunk7QVYU63Ejs.__name.call(void 0, CommonAssociationTrigger, "CommonAssociationTrigger");
490
- function CommonAssociationCommandDialog({
491
- show,
492
- setShow,
493
- data,
494
- source,
495
- destination,
496
- destinationName,
497
- children
498
- }) {
499
- const t = _nextintl.useTranslations.call(void 0, );
500
- const searchTermRef = _react.useRef.call(void 0, "");
501
- const [searchTerm, setSearchTerm] = _react.useState.call(void 0, "");
502
- const refreshList = _react.useCallback.call(void 0,
503
- async (searchedTerm) => {
504
- if (searchedTerm === searchTermRef.current) return;
505
- searchTermRef.current = searchedTerm;
506
- await data.search(searchedTerm);
507
- },
508
- [searchTerm, data]
509
- );
510
- const updateSearchTerm = _chunkFY4SXJGUjs.useDebounce.call(void 0, refreshList, 500);
511
- _react.useEffect.call(void 0, () => {
512
- if (show) updateSearchTerm(searchTerm);
513
- }, [show, searchTerm]);
514
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CommandDialog, { open: show, onOpenChange: setShow, children: [
515
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DialogHeader, { className: "flex flex-col items-start p-4 pb-0", children: [
516
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogTitle, { children: t(`generic.association.label`, {
517
- source,
518
- destination
519
- }) }),
520
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogDescription, { children: t(`generic.association.description`, {
521
- source,
522
- destination,
523
- destination_name: destinationName
524
- }) })
525
- ] }),
526
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Command, { shouldFilter: false, className: "p-4", children: [
527
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
528
- _chunkA5DDIABKjs.CommandInput,
529
- {
530
- placeholder: t(`generic.search.placeholder`, { type: source }),
531
- value: searchTerm,
532
- onValueChange: setSearchTerm
533
- }
534
- ),
535
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CommandList, { className: "mt-3 h-auto max-h-96 min-h-96 max-w-full overflow-y-auto overflow-x-hidden", children: [
536
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CommandEmpty, { children: t(`generic.search.no_results`, { type: source }) }),
537
- children
538
- ] })
539
- ] })
540
- ] });
541
- }
542
- _chunk7QVYU63Ejs.__name.call(void 0, CommonAssociationCommandDialog, "CommonAssociationCommandDialog");
543
- var triggerAssociationToast = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
544
- if (params.level) {
545
- _sonner.toast.message(
546
- params.t(`generic.association.label`, {
547
- source: params.source,
548
- destination: params.destination
549
- }),
550
- {
551
- description: params.t(`generic.association.success_level`, {
552
- source: params.source,
553
- destination: params.destination,
554
- source_name: params.source_name,
555
- destination_name: params.destination_name,
556
- level: params.level
557
- })
558
- }
559
- );
560
- } else {
561
- _sonner.toast.message(
562
- params.t(`generic.association.label`, {
563
- source: params.source,
564
- destination: params.destination
565
- }),
566
- {
567
- description: params.t(`generic.association.success`, {
568
- source: params.source,
569
- destination: params.destination,
570
- source_name: params.source_name,
571
- destination_name: params.destination_name
572
- })
573
- }
574
- );
575
- }
576
- }, "triggerAssociationToast");
577
-
578
- // src/components/forms/CommonDeleter.tsx
579
-
580
-
581
-
582
- function CommonDeleter({ deleteFunction, redirectTo, type, forceShow }) {
583
- const t = _chunkCXQOWQSYjs.useI18nTranslations.call(void 0, );
584
- const router = _chunkCXQOWQSYjs.useI18nRouter.call(void 0, );
585
- const [open, setOpen] = _react.useState.call(void 0, forceShow || false);
586
- const [isDeleting, setIsDeleting] = _react.useState.call(void 0, false);
587
- const handleDelete = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
588
- setIsDeleting(true);
589
- try {
590
- await deleteFunction();
591
- setOpen(false);
592
- if (redirectTo) router.push(redirectTo);
593
- } catch (error) {
594
- _chunkRUR22SVMjs.errorToast.call(void 0, { title: t(`generic.errors.delete`), error });
595
- }
596
- setIsDeleting(false);
597
- }, "handleDelete");
598
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.AlertDialog, { open, onOpenChange: setOpen, children: [
599
- forceShow ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { size: "sm", variant: "ghost", className: "text-muted-foreground hover:text-destructive", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Trash2Icon, {}) }) }),
600
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.AlertDialogContent, { className: `flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`, children: [
601
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.AlertDialogHeader, { children: [
602
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.AlertDialogTitle, { children: t(`generic.delete.title`, { type: t(`types.${type}`, { count: 1 }) }) }),
603
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.AlertDialogDescription, { children: t(`generic.delete.subtitle`, { type: t(`types.${type}`, { count: 1 }) }) })
604
- ] }),
605
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-destructive p-4 text-sm", children: t(`generic.delete.description`, { type: t(`types.${type}`, { count: 1 }) }) }),
606
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end", children: [
607
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
608
- _chunkA5DDIABKjs.Button,
609
- {
610
- className: "mr-2",
611
- variant: "outline",
612
- type: `button`,
613
- onClick: () => setOpen(false),
614
- disabled: isDeleting,
615
- children: t(`generic.buttons.cancel`)
616
- }
617
- ),
618
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
619
- _chunkA5DDIABKjs.Button,
620
- {
621
- type: "submit",
622
- onClick: (e) => {
623
- e.preventDefault();
624
- handleDelete();
625
- },
626
- variant: "destructive",
627
- disabled: isDeleting,
628
- children: isDeleting ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
629
- t(`generic.buttons.is_deleting`),
630
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.LoaderCircleIcon, { className: "animate-spin-slow h-5 w-5" })
631
- ] }) : t(`generic.buttons.delete`)
632
- }
633
- )
634
- ] })
635
- ] })
636
- ] });
637
- }
638
- _chunk7QVYU63Ejs.__name.call(void 0, CommonDeleter, "CommonDeleter");
639
-
640
- // src/components/forms/CommonEditorButtons.tsx
641
-
642
-
643
- function CommonEditorButtons({ isEdit, form, disabled, setOpen }) {
644
- const t = _nextintl.useTranslations.call(void 0, );
645
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end", children: [
646
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
647
- _chunkA5DDIABKjs.Button,
648
- {
649
- className: "mr-2",
650
- variant: "outline",
651
- type: `button`,
652
- onClick: () => setOpen(false),
653
- "data-testid": `modal-button-cancel`,
654
- children: t(`generic.buttons.cancel`)
655
- }
656
- ),
657
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { type: "submit", disabled: form.formState.isSubmitting || disabled, "data-testid": `modal-button-create`, children: isEdit ? t(`generic.buttons.confirm_update`) : t(`generic.buttons.confirm_create`) })
658
- ] });
659
- }
660
- _chunk7QVYU63Ejs.__name.call(void 0, CommonEditorButtons, "CommonEditorButtons");
661
-
662
- // src/components/forms/CommonEditorHeader.tsx
663
-
664
-
665
- function CommonEditorHeader({ type, name }) {
666
- const t = _nextintl.useTranslations.call(void 0, );
667
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DialogHeader, { children: [
668
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogTitle, { children: name ? t(`generic.edit.update.title`, {
669
- type
670
- }) : t(`generic.edit.create.title`, { type }) }),
671
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogDescription, { children: name ? t(`generic.edit.update.description`, {
672
- type,
673
- name
674
- }) : t(`generic.edit.create.description`, {
675
- type
676
- }) })
677
- ] });
678
- }
679
- _chunk7QVYU63Ejs.__name.call(void 0, CommonEditorHeader, "CommonEditorHeader");
680
-
681
- // src/components/forms/CommonEditorTrigger.tsx
682
-
683
-
684
-
685
- function CommonEditorTrigger({ isEdit, edit, create }) {
686
- const t = _nextintl.useTranslations.call(void 0, );
687
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogTrigger, { asChild: true, children: isEdit ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { size: "sm", variant: `ghost`, className: "text-muted-foreground", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.PencilIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { size: "sm", variant: `outline`, children: create ? create : t(`generic.buttons.create`) }) });
688
- }
689
- _chunk7QVYU63Ejs.__name.call(void 0, CommonEditorTrigger, "CommonEditorTrigger");
690
-
691
- // src/components/forms/DatePickerPopover.tsx
692
- var _datefns = require('date-fns');
693
-
694
-
695
-
696
- var DatePickerPopover = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
697
- children,
698
- value,
699
- onSelect,
700
- minDate,
701
- align = "start",
702
- className
703
- }) => {
704
- const locale = _chunkCXQOWQSYjs.useI18nLocale.call(void 0, );
705
- const dateFnsLocale = _chunkCXQOWQSYjs.useI18nDateFnsLocale.call(void 0, );
706
- const [isOpen, setIsOpen] = _react.useState.call(void 0, false);
707
- const [displayMonth, setDisplayMonth] = _react.useState.call(void 0, () => value || /* @__PURE__ */ new Date());
708
- const dateFormatter = _react.useMemo.call(void 0,
709
- () => new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric" }),
710
- [locale]
711
- );
712
- const formatDate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (date) => dateFormatter.format(date), "formatDate");
713
- const datePlaceholder = _react.useMemo.call(void 0, () => {
714
- const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
715
- return parts.map((part) => {
716
- if (part.type === "day") return "dd";
717
- if (part.type === "month") return "mm";
718
- if (part.type === "year") return "yyyy";
719
- return part.value;
720
- }).join("");
721
- }, [dateFormatter]);
722
- const dateFormatPattern = _react.useMemo.call(void 0, () => {
723
- const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
724
- return parts.map((part) => {
725
- if (part.type === "day") return "dd";
726
- if (part.type === "month") return "MM";
727
- if (part.type === "year") return "yyyy";
728
- return part.value;
729
- }).join("");
730
- }, [dateFormatter]);
731
- const [inputValue, setInputValue] = _react.useState.call(void 0, () => value ? formatDate(value) : "");
732
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
733
- const yearOptions = Array.from({ length: currentYear - 1900 + 11 }, (_, i) => 1900 + i);
734
- const monthNames = _react.useMemo.call(void 0, () => {
735
- const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
736
- return Array.from({ length: 12 }, (_, i) => {
737
- const monthName = formatter.format(new Date(2e3, i, 1));
738
- return monthName.charAt(0).toUpperCase() + monthName.slice(1);
739
- });
740
- }, [locale]);
741
- const handleInputChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (inputValue2) => {
742
- setInputValue(inputValue2);
743
- const parsedDate = _datefns.parse.call(void 0, inputValue2, dateFormatPattern, /* @__PURE__ */ new Date());
744
- if (_datefns.isValid.call(void 0, parsedDate)) {
745
- onSelect(parsedDate);
746
- setDisplayMonth(parsedDate);
747
- } else if (inputValue2 === "") {
748
- onSelect(void 0);
749
- }
750
- }, "handleInputChange");
751
- const handleCalendarSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (selectedDate) => {
752
- onSelect(selectedDate);
753
- if (selectedDate) {
754
- setInputValue(formatDate(selectedDate));
755
- setDisplayMonth(selectedDate);
756
- } else {
757
- setInputValue("");
758
- }
759
- setIsOpen(false);
760
- }, "handleCalendarSelect");
761
- const handleClear = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
762
- e.stopPropagation();
763
- onSelect(void 0);
764
- setInputValue("");
765
- }, "handleClear");
766
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
767
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children }),
768
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: _chunkJC3WJK65js.cn.call(void 0, "w-auto p-0", className), align, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3", children: [
769
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative mb-3", children: [
770
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
771
- _chunkA5DDIABKjs.Input,
772
- {
773
- value: inputValue,
774
- onChange: (e) => handleInputChange(e.target.value),
775
- placeholder: datePlaceholder,
776
- className: "pr-16",
777
- onClick: (e) => e.stopPropagation()
778
- }
779
- ),
780
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center space-x-1", children: [
781
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
782
- "button",
783
- {
784
- type: "button",
785
- className: "flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",
786
- onClick: (e) => e.stopPropagation(),
787
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Calendar, { className: "h-4 w-4 opacity-50" })
788
- }
789
- ),
790
- value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
791
- "button",
792
- {
793
- type: "button",
794
- className: "flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",
795
- onClick: handleClear,
796
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleXIcon, { className: "h-4 w-4 opacity-50 hover:opacity-100" })
797
- }
798
- )
799
- ] })
800
- ] }),
801
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-3 flex gap-2", children: [
802
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
803
- _chunkA5DDIABKjs.Select,
804
- {
805
- value: displayMonth.getMonth().toString(),
806
- onValueChange: (value2) => {
807
- const newMonth = parseInt(value2);
808
- const newDate = new Date(displayMonth.getFullYear(), newMonth, 1);
809
- setDisplayMonth(newDate);
810
- },
811
- children: [
812
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[130px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
813
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: monthNames.map((month, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: index.toString(), children: month }, index)) })
814
- ]
815
- }
816
- ),
817
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
818
- _chunkA5DDIABKjs.Select,
819
- {
820
- value: displayMonth.getFullYear().toString(),
821
- onValueChange: (value2) => {
822
- const newYear = parseInt(value2);
823
- const newDate = new Date(newYear, displayMonth.getMonth(), 1);
824
- setDisplayMonth(newDate);
825
- },
826
- children: [
827
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
828
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: yearOptions.reverse().map((year) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: year.toString(), children: year }, year)) })
829
- ]
830
- }
831
- )
832
- ] }),
833
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
834
- _chunkA5DDIABKjs.Calendar,
835
- {
836
- mode: "single",
837
- selected: value,
838
- onSelect: handleCalendarSelect,
839
- disabled: (date) => minDate && date < minDate ? true : false,
840
- locale: dateFnsLocale,
841
- weekStartsOn: 1,
842
- month: displayMonth,
843
- onMonthChange: setDisplayMonth
844
- }
845
- )
846
- ] }) })
847
- ] });
848
- }, "DatePickerPopover");
849
-
850
- // src/components/forms/DateRangeSelector.tsx
851
-
852
-
853
-
854
-
855
- function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth }) {
856
- const [date, setDate] = _react.useState.call(void 0,
857
- avoidSettingDates ? void 0 : {
858
- from: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
859
- to: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 0)
860
- }
861
- );
862
- const [open, setOpen] = _react.useState.call(void 0, false);
863
- const [prevRange, setPrevRange] = _react.useState.call(void 0, date);
864
- _react.useEffect.call(void 0, () => {
865
- if (_optionalChain([date, 'optionalAccess', _2 => _2.from]) && _optionalChain([date, 'optionalAccess', _3 => _3.to]) && date.to > date.from && (_optionalChain([prevRange, 'optionalAccess', _4 => _4.from, 'optionalAccess', _5 => _5.getTime, 'call', _6 => _6()]) !== date.from.getTime() || _optionalChain([prevRange, 'optionalAccess', _7 => _7.to, 'optionalAccess', _8 => _8.getTime, 'call', _9 => _9()]) !== date.to.getTime())) {
866
- onDateChange(date);
867
- setPrevRange(date);
868
- setOpen(false);
869
- }
870
- }, [date, prevRange, onDateChange]);
871
- const handleSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (range) => {
872
- if (!range) {
873
- setDate(void 0);
874
- return;
875
- }
876
- if (range.from && (!_optionalChain([date, 'optionalAccess', _10 => _10.from]) || range.from.getTime() !== date.from.getTime())) {
877
- setDate({ from: range.from, to: void 0 });
878
- } else {
879
- setDate(range);
880
- }
881
- }, "handleSelect");
882
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, "grid gap-2"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open, onOpenChange: setOpen, children: [
883
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
884
- _chunkA5DDIABKjs.Button,
885
- {
886
- id: "date",
887
- variant: "outline",
888
- className: _chunkJC3WJK65js.cn.call(void 0, "w-[300px] justify-start text-left font-normal", !date && "text-muted-foreground"),
889
- children: [
890
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CalendarIcon, {}),
891
- _optionalChain([date, 'optionalAccess', _11 => _11.from]) ? date.to ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
892
- _datefns.format.call(void 0, date.from, "LLL dd, y"),
893
- " - ",
894
- _datefns.format.call(void 0, date.to, "LLL dd, y")
895
- ] }) : _datefns.format.call(void 0, date.from, "LLL dd, y") : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Pick a date" })
896
- ]
897
- }
898
- ) }),
899
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2 p-2", children: [
900
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
901
- _chunkA5DDIABKjs.Calendar,
902
- {
903
- mode: "range",
904
- defaultMonth: _nullishCoalesce(_optionalChain([date, 'optionalAccess', _12 => _12.from]), () => ( (showPreviousMonth ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1) : void 0))),
905
- selected: date,
906
- onSelect: handleSelect,
907
- numberOfMonths: 2
908
- }
909
- ),
910
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
911
- _chunkA5DDIABKjs.Button,
912
- {
913
- variant: "secondary",
914
- type: "button",
915
- onClick: () => {
916
- setDate(void 0);
917
- setPrevRange(void 0);
918
- onDateChange(void 0);
919
- setOpen(false);
920
- },
921
- className: "cursor-pointer",
922
- disabled: !date,
923
- children: "Clear"
924
- }
925
- )
926
- ] }) })
927
- ] }) });
928
- }
929
- _chunk7QVYU63Ejs.__name.call(void 0, DateRangeSelector, "DateRangeSelector");
930
-
931
- // src/components/forms/FileUploader.tsx
932
-
933
-
934
-
935
-
936
-
937
-
938
-
939
-
940
-
941
-
942
-
943
- var _reactdropzone = require('react-dropzone');
944
-
945
-
946
- var FileUploaderContext = _react.createContext.call(void 0, null);
947
- var useFileUpload = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
948
- const context = _react.useContext.call(void 0, FileUploaderContext);
949
- if (!context) {
950
- throw new Error("useFileUpload must be used within a FileUploaderProvider");
951
- }
952
- return context;
953
- }, "useFileUpload");
954
- var FileUploader = _react.forwardRef.call(void 0,
955
- ({ className, dropzoneOptions, value, onValueChange, reSelect, orientation = "vertical", children, dir, ...props }, ref) => {
956
- const [isFileTooBig, setIsFileTooBig] = _react.useState.call(void 0, false);
957
- const [isLOF, setIsLOF] = _react.useState.call(void 0, false);
958
- const [activeIndex, setActiveIndex] = _react.useState.call(void 0, -1);
959
- const { maxFiles = 1, maxSize = 4 * 1024 * 1024, multiple = true } = dropzoneOptions;
960
- const t = _nextintl.useTranslations.call(void 0, );
961
- const reSelectAll = maxFiles === 1 ? true : reSelect;
962
- const direction = dir === "rtl" ? "rtl" : "ltr";
963
- const removeFileFromSet = _react.useCallback.call(void 0,
964
- (i) => {
965
- if (!value) return;
966
- const newFiles = value.filter((_, index) => index !== i);
967
- onValueChange(newFiles);
968
- },
969
- [value, onValueChange]
970
- );
971
- const handleKeyDown = _react.useCallback.call(void 0,
972
- (e) => {
973
- e.preventDefault();
974
- e.stopPropagation();
975
- if (!value) return;
976
- const moveNext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
977
- const nextIndex = activeIndex + 1;
978
- setActiveIndex(nextIndex > value.length - 1 ? 0 : nextIndex);
979
- }, "moveNext");
980
- const movePrev = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
981
- const nextIndex = activeIndex - 1;
982
- setActiveIndex(nextIndex < 0 ? value.length - 1 : nextIndex);
983
- }, "movePrev");
984
- const prevKey = orientation === "horizontal" ? direction === "ltr" ? "ArrowLeft" : "ArrowRight" : "ArrowUp";
985
- const nextKey = orientation === "horizontal" ? direction === "ltr" ? "ArrowRight" : "ArrowLeft" : "ArrowDown";
986
- if (e.key === nextKey) {
987
- moveNext();
988
- } else if (e.key === prevKey) {
989
- movePrev();
990
- } else if (e.key === "Enter" || e.key === "Space") {
991
- if (activeIndex === -1) {
992
- _optionalChain([dropzoneState, 'access', _13 => _13.inputRef, 'access', _14 => _14.current, 'optionalAccess', _15 => _15.click, 'call', _16 => _16()]);
993
- }
994
- } else if (e.key === "Delete" || e.key === "Backspace") {
995
- if (activeIndex !== -1) {
996
- removeFileFromSet(activeIndex);
997
- if (value.length - 1 === 0) {
998
- setActiveIndex(-1);
999
- return;
1000
- }
1001
- movePrev();
1002
- }
1003
- } else if (e.key === "Escape") {
1004
- setActiveIndex(-1);
1005
- }
1006
- },
1007
- [value, activeIndex, removeFileFromSet]
1008
- );
1009
- const onDrop = _react.useCallback.call(void 0,
1010
- (acceptedFiles, rejectedFiles) => {
1011
- const files = acceptedFiles;
1012
- if (!files) {
1013
- _sonner.toast.error(t("generic.errors.file"), {
1014
- description: t("generic.errors.file_large")
1015
- });
1016
- return;
1017
- }
1018
- const newValues = value ? [...value] : [];
1019
- if (reSelectAll) {
1020
- newValues.splice(0, newValues.length);
1021
- }
1022
- files.forEach((file) => {
1023
- if (newValues.length < maxFiles) {
1024
- newValues.push(file);
1025
- }
1026
- });
1027
- onValueChange(newValues);
1028
- if (rejectedFiles.length > 0) {
1029
- for (let i = 0; i < rejectedFiles.length; i++) {
1030
- if (_optionalChain([rejectedFiles, 'access', _17 => _17[i], 'access', _18 => _18.errors, 'access', _19 => _19[0], 'optionalAccess', _20 => _20.code]) === "file-too-large") {
1031
- _sonner.toast.error(t("generic.errors.file"), {
1032
- description: t(`generic.errors.file_max`, { size: maxSize / 1024 / 1024 })
1033
- });
1034
- break;
1035
- }
1036
- if (_optionalChain([rejectedFiles, 'access', _21 => _21[i], 'access', _22 => _22.errors, 'access', _23 => _23[0], 'optionalAccess', _24 => _24.message])) {
1037
- _sonner.toast.error(t(`generic.errors.file`), {
1038
- description: rejectedFiles[i].errors[0].message
1039
- });
1040
- break;
1041
- }
1042
- }
1043
- }
1044
- },
1045
- [reSelectAll, value]
1046
- );
1047
- _react.useEffect.call(void 0, () => {
1048
- if (!value) return;
1049
- if (value.length === maxFiles) {
1050
- return;
1051
- }
1052
- setIsLOF(false);
1053
- }, [value, maxFiles]);
1054
- const opts = dropzoneOptions ? dropzoneOptions : { maxFiles, maxSize, multiple };
1055
- const dropzoneState = _reactdropzone.useDropzone.call(void 0, {
1056
- ...opts,
1057
- onDrop,
1058
- onDropRejected: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => setIsFileTooBig(true), "onDropRejected"),
1059
- onDropAccepted: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => setIsFileTooBig(false), "onDropAccepted")
1060
- });
1061
- const { isDragActive } = dropzoneState;
1062
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1063
- FileUploaderContext.Provider,
1064
- {
1065
- value: {
1066
- dropzoneState,
1067
- isLOF,
1068
- isFileTooBig,
1069
- removeFileFromSet,
1070
- activeIndex,
1071
- setActiveIndex,
1072
- orientation,
1073
- direction
1074
- },
1075
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1076
- "div",
1077
- {
1078
- ref,
1079
- tabIndex: 0,
1080
- onKeyDownCapture: handleKeyDown,
1081
- className: _chunkJC3WJK65js.cn.call(void 0,
1082
- "grid w-full overflow-hidden focus:outline-none",
1083
- className,
1084
- // Original className from props
1085
- {
1086
- "gap-2": value && value.length > 0,
1087
- "bg-muted border-primary border-dashed": isDragActive
1088
- // Apply drag-active styles to the main FileUploader div
1089
- }
1090
- ),
1091
- dir,
1092
- ...props,
1093
- children
1094
- }
1095
- )
1096
- }
1097
- );
1098
- }
1099
- );
1100
- FileUploader.displayName = "FileUploader";
1101
- var FileUploaderContent = _react.forwardRef.call(void 0,
1102
- ({ children, className, ...props }, ref) => {
1103
- const { orientation } = useFileUpload();
1104
- const containerRef = _react.useRef.call(void 0, null);
1105
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, "w-full px-1"), ref: containerRef, "aria-description": "content file holder", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1106
- "div",
1107
- {
1108
- ...props,
1109
- ref,
1110
- className: _chunkJC3WJK65js.cn.call(void 0,
1111
- "flex gap-1 rounded-xl",
1112
- orientation === "horizontal" ? "flex-raw flex-wrap" : "flex-col",
1113
- className
1114
- ),
1115
- children
1116
- }
1117
- ) });
1118
- }
1119
- );
1120
- FileUploaderContent.displayName = "FileUploaderContent";
1121
- var FileUploaderItem = _react.forwardRef.call(void 0,
1122
- ({ className, index, children, ...props }, ref) => {
1123
- const { removeFileFromSet, activeIndex, direction } = useFileUpload();
1124
- const isSelected = index === activeIndex;
1125
- const t = _nextintl.useTranslations.call(void 0, );
1126
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1127
- "div",
1128
- {
1129
- ref,
1130
- className: _chunkJC3WJK65js.cn.call(void 0,
1131
- _chunkA5DDIABKjs.buttonVariants.call(void 0, { variant: "ghost" }),
1132
- "relative h-6 cursor-pointer justify-between p-1",
1133
- className,
1134
- isSelected ? "bg-muted" : ""
1135
- ),
1136
- ...props,
1137
- children: [
1138
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full w-full items-center gap-1.5 leading-none font-medium tracking-tight", children }),
1139
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1140
- "button",
1141
- {
1142
- type: "button",
1143
- className: _chunkJC3WJK65js.cn.call(void 0, "absolute", direction === "rtl" ? "top-1 left-1" : "top-1 right-1"),
1144
- onClick: () => removeFileFromSet(index),
1145
- children: [
1146
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: t(`generic.remove_item`, { index }) }),
1147
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Trash2, { className: "hover:stroke-destructive h-4 w-4 duration-200 ease-in-out" })
1148
- ]
1149
- }
1150
- )
1151
- ]
1152
- }
1153
- );
1154
- }
1155
- );
1156
- FileUploaderItem.displayName = "FileUploaderItem";
1157
- var FileInput = _react.forwardRef.call(void 0,
1158
- ({ className, children, ...props }, ref) => {
1159
- const { dropzoneState, isFileTooBig, isLOF } = useFileUpload();
1160
- const rootProps = isLOF ? {} : dropzoneState.getRootProps();
1161
- const { isDragActive: parentIsDragActive } = dropzoneState;
1162
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1163
- "div",
1164
- {
1165
- ref,
1166
- ...props,
1167
- className: _chunkJC3WJK65js.cn.call(void 0, `relative w-full ${isLOF ? "cursor-not-allowed opacity-50" : "cursor-pointer"}`, className),
1168
- children: [
1169
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1170
- "div",
1171
- {
1172
- className: _chunkJC3WJK65js.cn.call(void 0,
1173
- "w-full rounded-lg duration-300 ease-in-out",
1174
- // Simpler border logic: if parent is drag-active, it controls the border.
1175
- // Otherwise, FileInput can show its own accept/reject/default border.
1176
- {
1177
- "border-green-500": dropzoneState.isDragAccept && !parentIsDragActive,
1178
- "border-red-500": (dropzoneState.isDragReject || isFileTooBig) && !parentIsDragActive,
1179
- "border-gray-300": !dropzoneState.isDragAccept && !dropzoneState.isDragReject && !isFileTooBig && !parentIsDragActive
1180
- },
1181
- // className from props should be last to allow overrides if necessary
1182
- className
1183
- ),
1184
- ...rootProps,
1185
- children
1186
- }
1187
- ),
1188
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1189
- _chunkA5DDIABKjs.Input,
1190
- {
1191
- ref: dropzoneState.inputRef,
1192
- disabled: isLOF,
1193
- ...dropzoneState.getInputProps(),
1194
- className: `${isLOF ? "cursor-not-allowed" : ""}`
1195
- }
1196
- )
1197
- ]
1198
- }
1199
- );
1200
- }
1201
- );
1202
- FileInput.displayName = "FileInput";
1203
-
1204
- // src/components/forms/FormCheckbox.tsx
1205
-
1206
- function FormCheckbox({ form, id, name, labelBefore, description, isRequired }) {
1207
- const simpleLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
1208
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { htmlFor: id, className: `font-normal ${labelBefore ? "" : "ml-3"}`, children: name });
1209
- }, "simpleLabel");
1210
- const label = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
1211
- if (description) return simpleLabel();
1212
- else
1213
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Tooltip, { children: [
1214
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TooltipTrigger, { asChild: true, children: simpleLabel() }),
1215
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TooltipContent, { children: description })
1216
- ] });
1217
- }, "label");
1218
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1219
- _chunkA5DDIABKjs.FormField,
1220
- {
1221
- control: form.control,
1222
- name: id,
1223
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1224
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-4", children: [
1225
- labelBefore && label(),
1226
- labelBefore && isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" }),
1227
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Checkbox, { id, defaultChecked: field.value, onCheckedChange: field.onChange }),
1228
- !labelBefore && label(),
1229
- !labelBefore && isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1230
- ] }) }),
1231
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1232
- ] })
1233
- }
1234
- ) });
1235
- }
1236
- _chunk7QVYU63Ejs.__name.call(void 0, FormCheckbox, "FormCheckbox");
1237
-
1238
- // src/components/forms/FormContainerGeneric.tsx
1239
-
1240
- function FormContainerGeneric({
1241
- form,
1242
- id,
1243
- name,
1244
- children,
1245
- isRequired = false
1246
- }) {
1247
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1248
- _chunkA5DDIABKjs.FormField,
1249
- {
1250
- control: form.control,
1251
- name: id,
1252
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1253
- name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1254
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: name }),
1255
- isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1256
- ] }),
1257
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children }),
1258
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1259
- ] })
1260
- }
1261
- ) });
1262
- }
1263
- _chunk7QVYU63Ejs.__name.call(void 0, FormContainerGeneric, "FormContainerGeneric");
1264
-
1265
- // src/components/forms/FormDate.tsx
1266
-
1267
-
1268
-
1269
-
1270
- function FormDate({
1271
- form,
1272
- id,
1273
- name,
1274
- minDate,
1275
- onChange,
1276
- isRequired = false
1277
- }) {
1278
- const locale = _chunkCXQOWQSYjs.useI18nLocale.call(void 0, );
1279
- const dateFnsLocale = _chunkCXQOWQSYjs.useI18nDateFnsLocale.call(void 0, );
1280
- const [open, setOpen] = _react.useState.call(void 0, false);
1281
- const [displayMonth, setDisplayMonth] = _react.useState.call(void 0, () => {
1282
- const currentValue = form.getValues(id);
1283
- return currentValue || /* @__PURE__ */ new Date();
1284
- });
1285
- const dateFormatter = _react.useMemo.call(void 0,
1286
- () => new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric" }),
1287
- [locale]
1288
- );
1289
- const formatDate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (date) => dateFormatter.format(date), "formatDate");
1290
- const datePlaceholder = _react.useMemo.call(void 0, () => {
1291
- const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
1292
- return parts.map((part) => {
1293
- if (part.type === "day") return "dd";
1294
- if (part.type === "month") return "mm";
1295
- if (part.type === "year") return "yyyy";
1296
- return part.value;
1297
- }).join("");
1298
- }, [dateFormatter]);
1299
- const dateFormatPattern = _react.useMemo.call(void 0, () => {
1300
- const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
1301
- return parts.map((part) => {
1302
- if (part.type === "day") return "dd";
1303
- if (part.type === "month") return "MM";
1304
- if (part.type === "year") return "yyyy";
1305
- return part.value;
1306
- }).join("");
1307
- }, [dateFormatter]);
1308
- const [inputValue, setInputValue] = _react.useState.call(void 0, () => {
1309
- const currentValue = form.getValues(id);
1310
- return currentValue ? formatDate(currentValue) : "";
1311
- });
1312
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
1313
- const yearOptions = Array.from({ length: currentYear - 1900 + 1 }, (_, i) => 1900 + i);
1314
- const monthNames = _react.useMemo.call(void 0, () => {
1315
- const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
1316
- return Array.from({ length: 12 }, (_, i) => {
1317
- const monthName = formatter.format(new Date(2e3, i, 1));
1318
- return monthName.charAt(0).toUpperCase() + monthName.slice(1);
1319
- });
1320
- }, [locale]);
1321
- const handleInputChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value, field) => {
1322
- setInputValue(value);
1323
- const parsedDate = _datefns.parse.call(void 0, value, dateFormatPattern, /* @__PURE__ */ new Date());
1324
- if (_datefns.isValid.call(void 0, parsedDate)) {
1325
- field.onChange(parsedDate);
1326
- setDisplayMonth(parsedDate);
1327
- if (onChange) onChange(parsedDate);
1328
- } else if (value === "") {
1329
- field.onChange(void 0);
1330
- if (onChange) onChange(void 0);
1331
- }
1332
- }, "handleInputChange");
1333
- const handleCalendarSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (selectedDate, field) => {
1334
- field.onChange(selectedDate);
1335
- if (selectedDate) {
1336
- setInputValue(formatDate(selectedDate));
1337
- setDisplayMonth(selectedDate);
1338
- } else {
1339
- setInputValue("");
1340
- }
1341
- if (onChange) onChange(selectedDate);
1342
- }, "handleCalendarSelect");
1343
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1344
- _chunkA5DDIABKjs.FormField,
1345
- {
1346
- control: form.control,
1347
- name: id,
1348
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"} w-full`, children: [
1349
- name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "dlex items-center", children: [
1350
- name,
1351
- " ",
1352
- isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1353
- ] }),
1354
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "relative", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open, onOpenChange: setOpen, modal: true, children: [
1355
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1356
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1357
- _chunkA5DDIABKjs.Input,
1358
- {
1359
- value: inputValue,
1360
- onChange: (e) => handleInputChange(e.target.value, field),
1361
- placeholder: datePlaceholder,
1362
- className: "pr-16"
1363
- }
1364
- ),
1365
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center space-x-1", children: [
1366
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1367
- "button",
1368
- {
1369
- type: "button",
1370
- className: "hover:bg-muted flex h-8 w-8 items-center justify-center rounded-md",
1371
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Calendar, { className: "h-4 w-4 opacity-50" })
1372
- }
1373
- ) }),
1374
- field.value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1375
- "button",
1376
- {
1377
- type: "button",
1378
- className: "hover:bg-muted flex h-8 w-8 items-center justify-center rounded-md",
1379
- onClick: () => {
1380
- field.onChange(void 0);
1381
- setInputValue("");
1382
- if (onChange) onChange(void 0);
1383
- },
1384
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleXIcon, { className: "h-4 w-4 opacity-50 hover:opacity-100" })
1385
- }
1386
- )
1387
- ] })
1388
- ] }),
1389
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3", children: [
1390
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-3 flex gap-2", children: [
1391
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1392
- _chunkA5DDIABKjs.Select,
1393
- {
1394
- value: displayMonth.getMonth().toString(),
1395
- onValueChange: (value) => {
1396
- const newMonth = parseInt(value);
1397
- const newDate = new Date(displayMonth.getFullYear(), newMonth, 1);
1398
- setDisplayMonth(newDate);
1399
- },
1400
- children: [
1401
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[130px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
1402
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: monthNames.map((month, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: index.toString(), children: month }, index)) })
1403
- ]
1404
- }
1405
- ),
1406
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1407
- _chunkA5DDIABKjs.Select,
1408
- {
1409
- value: displayMonth.getFullYear().toString(),
1410
- onValueChange: (value) => {
1411
- const newYear = parseInt(value);
1412
- const newDate = new Date(newYear, displayMonth.getMonth(), 1);
1413
- setDisplayMonth(newDate);
1414
- },
1415
- children: [
1416
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
1417
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: yearOptions.reverse().map((year) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: year.toString(), children: year }, year)) })
1418
- ]
1419
- }
1420
- )
1421
- ] }),
1422
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1423
- _chunkA5DDIABKjs.Calendar,
1424
- {
1425
- mode: "single",
1426
- selected: field.value,
1427
- onSelect: (e) => {
1428
- handleCalendarSelect(e, field);
1429
- setOpen(false);
1430
- },
1431
- disabled: (date) => minDate && date < minDate ? true : false,
1432
- locale: dateFnsLocale,
1433
- weekStartsOn: 1,
1434
- month: displayMonth,
1435
- onMonthChange: setDisplayMonth
1436
- }
1437
- )
1438
- ] }) })
1439
- ] }) }) }),
1440
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1441
- ] })
1442
- }
1443
- ) });
1444
- }
1445
- _chunk7QVYU63Ejs.__name.call(void 0, FormDate, "FormDate");
1446
-
1447
- // src/components/forms/FormDateTime.tsx
1448
-
1449
-
1450
-
1451
- function FormDateTime({
1452
- form,
1453
- id,
1454
- name,
1455
- minDate,
1456
- onChange,
1457
- allowEmpty
1458
- }) {
1459
- const [open, setOpen] = _react.useState.call(void 0, false);
1460
- const t = _chunkCXQOWQSYjs.useI18nTranslations.call(void 0, );
1461
- const locale = _chunkCXQOWQSYjs.useI18nLocale.call(void 0, );
1462
- const dateFnsLocale = _chunkCXQOWQSYjs.useI18nDateFnsLocale.call(void 0, );
1463
- const dateTimeFormatter = _react.useMemo.call(void 0,
1464
- () => new Intl.DateTimeFormat(locale, {
1465
- year: "numeric",
1466
- month: "long",
1467
- day: "numeric",
1468
- hour: "2-digit",
1469
- minute: "2-digit"
1470
- }),
1471
- [locale]
1472
- );
1473
- const formatDateTime = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (date) => dateTimeFormatter.format(date), "formatDateTime");
1474
- const [selectedHours, setSelectedHours] = _react.useState.call(void 0, (/* @__PURE__ */ new Date()).getHours());
1475
- const [selectedMinutes, setSelectedMinutes] = _react.useState.call(void 0, roundToNearestFiveMinutes((/* @__PURE__ */ new Date()).getMinutes()));
1476
- const hoursOptions = Array.from({ length: 24 }, (_, i) => {
1477
- const hour = i;
1478
- return {
1479
- value: hour,
1480
- label: hour.toString().padStart(2, "0")
1481
- };
1482
- });
1483
- const minutesOptions = Array.from({ length: 12 }, (_, i) => {
1484
- const minute = i * 5;
1485
- return {
1486
- value: minute,
1487
- label: minute.toString().padStart(2, "0")
1488
- };
1489
- });
1490
- function roundToNearestFiveMinutes(minutes) {
1491
- return Math.round(minutes / 5) * 5 % 60;
1492
- }
1493
- _chunk7QVYU63Ejs.__name.call(void 0, roundToNearestFiveMinutes, "roundToNearestFiveMinutes");
1494
- const handleTimeChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (hours, minutes) => {
1495
- const currentDate = form.getValues(id);
1496
- if (currentDate) {
1497
- const updatedDate = new Date(currentDate);
1498
- updatedDate.setHours(hours);
1499
- updatedDate.setMinutes(minutes);
1500
- form.setValue(id, updatedDate);
1501
- if (onChange) onChange(updatedDate);
1502
- }
1503
- }, "handleTimeChange");
1504
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1505
- _chunkA5DDIABKjs.FormField,
1506
- {
1507
- control: form.control,
1508
- name: id,
1509
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"} w-full`, children: [
1510
- name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name }),
1511
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "relative flex flex-row", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open, onOpenChange: setOpen, modal: true, children: [
1512
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-row items-center justify-between", children: [
1513
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1514
- _chunkA5DDIABKjs.Button,
1515
- {
1516
- variant: "outline",
1517
- className: _chunkJC3WJK65js.cn.call(void 0, "w-full pl-3 text-left font-normal", !field.value && "text-muted-foreground"),
1518
- children: [
1519
- field.value ? formatDateTime(field.value) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t(`generic.pick_date_time`) }),
1520
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Calendar, { className: "ml-auto h-4 w-4 opacity-50" })
1521
- ]
1522
- }
1523
- ) }) }),
1524
- field.value && allowEmpty !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1525
- _lucidereact.CircleXIcon,
1526
- {
1527
- className: "text-muted hover:text-destructive ml-2 h-6 w-6 cursor-pointer",
1528
- onClick: () => {
1529
- if (onChange) onChange(void 0);
1530
- form.setValue(id, "");
1531
- }
1532
- }
1533
- )
1534
- ] }),
1535
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: "w-auto p-4", align: "start", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col space-y-4", children: [
1536
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1537
- _chunkA5DDIABKjs.Calendar,
1538
- {
1539
- mode: "single",
1540
- selected: field.value,
1541
- onSelect: (date) => {
1542
- if (date) {
1543
- const newDate = new Date(date);
1544
- if (field.value) {
1545
- const currentDate = new Date(field.value);
1546
- newDate.setHours(currentDate.getHours(), currentDate.getMinutes());
1547
- } else {
1548
- newDate.setHours(selectedHours, selectedMinutes);
1549
- }
1550
- form.setValue(id, newDate);
1551
- if (onChange) onChange(newDate);
1552
- setSelectedHours(newDate.getHours());
1553
- setSelectedMinutes(roundToNearestFiveMinutes(newDate.getMinutes()));
1554
- }
1555
- },
1556
- disabled: (date) => minDate && date < minDate ? true : false,
1557
- locale: dateFnsLocale
1558
- }
1559
- ),
1560
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-row items-end justify-center space-x-4", children: [
1561
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col space-y-2", children: [
1562
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Label, { htmlFor: "hours-select", children: t(`generic.hours`) }),
1563
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1564
- _chunkA5DDIABKjs.Select,
1565
- {
1566
- value: String(field.value ? new Date(field.value).getHours() : selectedHours),
1567
- onValueChange: (value) => {
1568
- const hours = parseInt(value);
1569
- setSelectedHours(hours);
1570
- handleTimeChange(
1571
- hours,
1572
- field.value ? roundToNearestFiveMinutes(new Date(field.value).getMinutes()) : selectedMinutes
1573
- );
1574
- },
1575
- children: [
1576
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { id: "hours-select", className: "w-[70px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, { placeholder: "Hour" }) }),
1577
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: hoursOptions.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: String(option.value), children: option.label }, option.value)) })
1578
- ]
1579
- }
1580
- )
1581
- ] }),
1582
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-[9px] text-xl", children: ":" }),
1583
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col space-y-2", children: [
1584
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Label, { htmlFor: "minutes-select", children: t(`generic.minutes`) }),
1585
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1586
- _chunkA5DDIABKjs.Select,
1587
- {
1588
- value: String(
1589
- field.value ? roundToNearestFiveMinutes(new Date(field.value).getMinutes()) : selectedMinutes
1590
- ),
1591
- onValueChange: (value) => {
1592
- const minutes = parseInt(value);
1593
- setSelectedMinutes(minutes);
1594
- handleTimeChange(field.value ? new Date(field.value).getHours() : selectedHours, minutes);
1595
- },
1596
- children: [
1597
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { id: "minutes-select", className: "w-[70px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, { placeholder: "Min" }) }),
1598
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: minutesOptions.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: String(option.value), children: option.label }, option.value)) })
1599
- ]
1600
- }
1601
- )
1602
- ] })
1603
- ] }),
1604
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1605
- _chunkA5DDIABKjs.Button,
1606
- {
1607
- className: "mt-2",
1608
- onClick: () => {
1609
- setOpen(false);
1610
- },
1611
- children: t(`generic.buttons.select_date`)
1612
- }
1613
- )
1614
- ] }) })
1615
- ] }) }) }),
1616
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1617
- ] })
1618
- }
1619
- ) });
1620
- }
1621
- _chunk7QVYU63Ejs.__name.call(void 0, FormDateTime, "FormDateTime");
1622
-
1623
- // src/components/forms/FormInput.tsx
1624
-
1625
-
1626
- function FormInput({
1627
- form,
1628
- id,
1629
- name,
1630
- placeholder,
1631
- type,
1632
- onBlur,
1633
- disabled,
1634
- onKeyDown,
1635
- autoFocus,
1636
- onChange,
1637
- testId,
1638
- isRequired = false
1639
- }) {
1640
- const t = _nextintl.useTranslations.call(void 0, );
1641
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1642
- _chunkA5DDIABKjs.FormField,
1643
- {
1644
- control: form.control,
1645
- name: id,
1646
- render: ({ field }) => {
1647
- const handleBlur = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
1648
- let value = e.target.value;
1649
- if (type === "link" && value) {
1650
- if (!/^https?:\/\//i.test(value)) {
1651
- value = "https://" + value;
1652
- field.onChange(value);
1653
- }
1654
- try {
1655
- new URL(value);
1656
- form.clearErrors(id);
1657
- } catch (error) {
1658
- form.setError(id, {
1659
- type: "validate",
1660
- message: t(`generic.errors.valid_url`)
1661
- });
1662
- }
1663
- }
1664
- if (onBlur) await onBlur();
1665
- field.onBlur();
1666
- }, "handleBlur");
1667
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1668
- name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1669
- name,
1670
- isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1671
- ] }),
1672
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1673
- type === "currency" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground absolute top-0 left-0 pt-2 pl-3", children: "\u20AC" }),
1674
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1675
- _chunkA5DDIABKjs.Input,
1676
- {
1677
- "data-testid": testId,
1678
- ...field,
1679
- autoFocus: autoFocus === true,
1680
- type: type === "number" || type === "currency" ? "number" : type === "password" ? "password" : "text",
1681
- className: `w-full ${type === "number" || type === "currency" ? "text-end" : ""}`,
1682
- disabled: disabled === true || form.formState.isSubmitting,
1683
- placeholder: placeholder || "",
1684
- onBlur: handleBlur,
1685
- onKeyDown,
1686
- onChange: (e) => {
1687
- if (type === "number" || type === "currency") {
1688
- const value = e.target.value.replace(/[^0-9]/g, "");
1689
- field.onChange(+value);
1690
- if (onChange) onChange(+value);
1691
- } else {
1692
- field.onChange(e.target.value);
1693
- if (onChange) onChange(e.target.value);
1694
- }
1695
- }
1696
- }
1697
- )
1698
- ] }) }),
1699
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, { "data-testid": testId ? `${testId}-error` : void 0 })
1700
- ] });
1701
- }
1702
- }
1703
- ) });
1704
- }
1705
- _chunk7QVYU63Ejs.__name.call(void 0, FormInput, "FormInput");
1706
-
1707
- // src/components/forms/PasswordInput.tsx
1708
-
1709
-
1710
-
1711
-
1712
- var PasswordInput = React2.forwardRef(({ className, type, ...props }, ref) => {
1713
- const [showPassword, setShowPassword] = React2.useState(false);
1714
- const disabled = props.value === "" || props.value === void 0 || props.disabled;
1715
- const t = _nextintl.useTranslations.call(void 0, );
1716
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1717
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Input, { type: showPassword ? "text" : "password", className: _chunkJC3WJK65js.cn.call(void 0, "", className), ref, ...props }),
1718
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1719
- _chunkA5DDIABKjs.Button,
1720
- {
1721
- type: "button",
1722
- variant: "ghost",
1723
- size: "sm",
1724
- className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
1725
- onClick: () => setShowPassword((prev) => !prev),
1726
- disabled,
1727
- children: [
1728
- showPassword && !disabled ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.EyeIcon, { className: "h-4 w-4", "aria-hidden": "true" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.EyeOffIcon, { className: "h-4 w-4", "aria-hidden": "true" }),
1729
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: showPassword ? t(`generic.hide_password`) : t(`generic.show_password`) })
1730
- ]
1731
- }
1732
- ),
1733
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `
1734
- .hide-password-toggle::-ms-reveal,
1735
- .hide-password-toggle::-ms-clear {
1736
- visibility: hidden;
1737
- pointer-events: none;
1738
- display: none;
1739
- }
1740
- ` })
1741
- ] });
1742
- });
1743
- PasswordInput.displayName = "PasswordInput";
1744
-
1745
- // src/components/forms/FormPassword.tsx
1746
-
1747
- function FormPassword({
1748
- form,
1749
- id,
1750
- name,
1751
- placeholder,
1752
- onBlur,
1753
- disabled,
1754
- testId,
1755
- isRequired
1756
- }) {
1757
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1758
- _chunkA5DDIABKjs.FormField,
1759
- {
1760
- control: form.control,
1761
- name: id,
1762
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1763
- name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: [
1764
- name,
1765
- isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1766
- ] }),
1767
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1768
- PasswordInput,
1769
- {
1770
- ...field,
1771
- className: `w-full`,
1772
- disabled: disabled === true || form.formState.isSubmitting,
1773
- placeholder: placeholder ? placeholder : "",
1774
- onBlur,
1775
- "data-testid": testId
1776
- }
1777
- ) }),
1778
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, { "data-testid": testId ? `${testId}-error` : void 0 })
1779
- ] })
1780
- }
1781
- ) });
1782
- }
1783
- _chunk7QVYU63Ejs.__name.call(void 0, FormPassword, "FormPassword");
1784
-
1785
- // src/components/forms/FormPlaceAutocomplete.tsx
1786
-
1787
-
1788
- function FormPlaceAutocomplete({
1789
- form,
1790
- id,
1791
- name,
1792
- placeholder,
1793
- disabled,
1794
- testId,
1795
- isRequired = false,
1796
- onPlaceSelect,
1797
- className,
1798
- includeTypes
1799
- }) {
1800
- const [inputValue, setInputValue] = _react.useState.call(void 0, "");
1801
- const [suggestions, setSuggestions] = _react.useState.call(void 0, []);
1802
- const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
1803
- const [showSuggestions, setShowSuggestions] = _react.useState.call(void 0, false);
1804
- const [loadError, setLoadError] = _react.useState.call(void 0, false);
1805
- const [apiKey, setApiKey] = _react.useState.call(void 0, null);
1806
- const debounceRef = _react.useRef.call(void 0, null);
1807
- const containerRef = _react.useRef.call(void 0, null);
1808
- _react.useEffect.call(void 0, () => {
1809
- const key = process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY;
1810
- if (!key) {
1811
- console.error("Google Maps API key not found. Please set NEXT_PUBLIC_GOOGLE_MAPS_API_KEY environment variable.");
1812
- setLoadError(true);
1813
- return;
1814
- }
1815
- setApiKey(key);
1816
- }, []);
1817
- _react.useEffect.call(void 0, () => {
1818
- const formValue = form.getValues(id);
1819
- if (formValue !== inputValue) {
1820
- setInputValue(formValue || "");
1821
- }
1822
- }, [form.watch(id), id, inputValue]);
1823
- const fetchSuggestions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (input) => {
1824
- if (!apiKey) return;
1825
- try {
1826
- setIsLoading(true);
1827
- const response = await fetch(`https://places.googleapis.com/v1/places:autocomplete`, {
1828
- method: "POST",
1829
- headers: {
1830
- "Content-Type": "application/json",
1831
- "X-Goog-Api-Key": apiKey
1832
- },
1833
- body: JSON.stringify({
1834
- input,
1835
- includedPrimaryTypes: includeTypes || ["street_address", "premise", "subpremise"],
1836
- languageCode: "en"
1837
- })
1838
- });
1839
- if (!response.ok) {
1840
- throw new Error(`Places API error: ${response.status}`);
1841
- }
1842
- const data = await response.json();
1843
- if (data.suggestions) {
1844
- const formattedSuggestions = data.suggestions.map((suggestion) => ({
1845
- place_id: _optionalChain([suggestion, 'access', _25 => _25.placePrediction, 'optionalAccess', _26 => _26.placeId]) || "",
1846
- description: _optionalChain([suggestion, 'access', _27 => _27.placePrediction, 'optionalAccess', _28 => _28.text, 'optionalAccess', _29 => _29.text]) || "",
1847
- structured_formatting: {
1848
- main_text: _optionalChain([suggestion, 'access', _30 => _30.placePrediction, 'optionalAccess', _31 => _31.structuredFormat, 'optionalAccess', _32 => _32.mainText, 'optionalAccess', _33 => _33.text]) || "",
1849
- secondary_text: _optionalChain([suggestion, 'access', _34 => _34.placePrediction, 'optionalAccess', _35 => _35.structuredFormat, 'optionalAccess', _36 => _36.secondaryText, 'optionalAccess', _37 => _37.text]) || ""
1850
- }
1851
- }));
1852
- setSuggestions(formattedSuggestions);
1853
- setShowSuggestions(true);
1854
- } else {
1855
- setSuggestions([]);
1856
- }
1857
- } catch (error) {
1858
- console.error("Error fetching place suggestions:", error);
1859
- setSuggestions([]);
1860
- } finally {
1861
- setIsLoading(false);
1862
- }
1863
- }, "fetchSuggestions");
1864
- const handleInputChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => {
1865
- setInputValue(value);
1866
- form.setValue(id, value);
1867
- if (debounceRef.current) {
1868
- clearTimeout(debounceRef.current);
1869
- }
1870
- if (value.length > 2 && apiKey) {
1871
- debounceRef.current = setTimeout(() => {
1872
- fetchSuggestions(value);
1873
- }, 300);
1874
- } else {
1875
- setSuggestions([]);
1876
- setShowSuggestions(false);
1877
- setIsLoading(false);
1878
- }
1879
- }, "handleInputChange");
1880
- const handleSuggestionSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (suggestion) => {
1881
- setInputValue(suggestion.description);
1882
- form.setValue(id, suggestion.description);
1883
- setShowSuggestions(false);
1884
- setSuggestions([]);
1885
- if (onPlaceSelect) {
1886
- onPlaceSelect(suggestion);
1887
- }
1888
- }, "handleSuggestionSelect");
1889
- _react.useEffect.call(void 0, () => {
1890
- const handleClickOutside = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (event) => {
1891
- if (containerRef.current && !containerRef.current.contains(event.target)) {
1892
- setShowSuggestions(false);
1893
- }
1894
- }, "handleClickOutside");
1895
- document.addEventListener("mousedown", handleClickOutside);
1896
- return () => {
1897
- document.removeEventListener("mousedown", handleClickOutside);
1898
- };
1899
- }, []);
1900
- _react.useEffect.call(void 0, () => {
1901
- return () => {
1902
- if (debounceRef.current) {
1903
- clearTimeout(debounceRef.current);
1904
- }
1905
- };
1906
- }, []);
1907
- if (loadError) {
1908
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1909
- _chunkA5DDIABKjs.FormField,
1910
- {
1911
- control: form.control,
1912
- name: id,
1913
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1914
- name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1915
- name,
1916
- isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1917
- ] }),
1918
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1919
- _chunkA5DDIABKjs.Input,
1920
- {
1921
- ...field,
1922
- placeholder,
1923
- disabled,
1924
- "data-testid": testId,
1925
- className: _chunkJC3WJK65js.cn.call(void 0, "w-full", className)
1926
- }
1927
- ) }),
1928
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1929
- ] })
1930
- }
1931
- ) });
1932
- }
1933
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", ref: containerRef, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1934
- _chunkA5DDIABKjs.FormField,
1935
- {
1936
- control: form.control,
1937
- name: id,
1938
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1939
- name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1940
- name,
1941
- isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1942
- ] }),
1943
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1944
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1945
- _chunkA5DDIABKjs.Input,
1946
- {
1947
- value: inputValue,
1948
- onChange: (e) => handleInputChange(e.target.value),
1949
- onBlur: field.onBlur,
1950
- onFocus: () => {
1951
- if (suggestions.length > 0) {
1952
- setShowSuggestions(true);
1953
- }
1954
- },
1955
- placeholder,
1956
- disabled: disabled || !apiKey,
1957
- "data-testid": testId,
1958
- className: _chunkJC3WJK65js.cn.call(void 0, "w-full", className)
1959
- }
1960
- ),
1961
- isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary h-4 w-4 animate-spin rounded-full border-2 border-t-transparent" }) }),
1962
- showSuggestions && suggestions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-background absolute left-0 right-0 top-full z-50 mt-1 max-h-60 overflow-auto rounded-md border shadow-lg", children: suggestions.map((suggestion, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1963
- "div",
1964
- {
1965
- className: "hover:bg-muted cursor-pointer px-3 py-2 text-sm",
1966
- onClick: () => handleSuggestionSelect(suggestion),
1967
- children: [
1968
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "font-medium", children: _optionalChain([suggestion, 'access', _38 => _38.structured_formatting, 'optionalAccess', _39 => _39.main_text]) }),
1969
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: _optionalChain([suggestion, 'access', _40 => _40.structured_formatting, 'optionalAccess', _41 => _41.secondary_text]) })
1970
- ]
1971
- },
1972
- suggestion.place_id || index
1973
- )) })
1974
- ] }) }),
1975
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1976
- ] })
1977
- }
1978
- ) });
1979
- }
1980
- _chunk7QVYU63Ejs.__name.call(void 0, FormPlaceAutocomplete, "FormPlaceAutocomplete");
1981
-
1982
- // src/components/forms/FormSelect.tsx
1983
-
1984
- function FormSelect({
1985
- form,
1986
- id,
1987
- name,
1988
- placeholder,
1989
- disabled,
1990
- values,
1991
- onChange,
1992
- useRows,
1993
- testId
1994
- }) {
1995
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `flex w-full flex-col`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1996
- _chunkA5DDIABKjs.FormField,
1997
- {
1998
- control: form.control,
1999
- name: id,
2000
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `flex w-full ${useRows ? `flex-row items-center justify-between gap-x-4` : `flex-col`}`, children: [
2001
- name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: `${useRows ? `min-w-28` : ``}`, children: name }),
2002
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2003
- _chunkA5DDIABKjs.Select,
2004
- {
2005
- onValueChange: (e) => {
2006
- field.onChange(e);
2007
- if (onChange) onChange(e);
2008
- },
2009
- defaultValue: field.value,
2010
- "data-testid": testId,
2011
- children: [
2012
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { className: "w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, { placeholder }) }) }),
2013
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: values.map((type) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: type.id, children: type.text }, type.id)) })
2014
- ]
2015
- }
2016
- ),
2017
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
2018
- ] })
2019
- }
2020
- ) });
2021
- }
2022
- _chunk7QVYU63Ejs.__name.call(void 0, FormSelect, "FormSelect");
2023
-
2024
- // src/components/forms/FormSlider.tsx
2025
- var _reacthookform = require('react-hook-form');
2026
-
2027
- function FormSlider({
2028
- form,
2029
- id,
2030
- name,
2031
- disabled,
2032
- showPercentage
2033
- }) {
2034
- const value = _reacthookform.useWatch.call(void 0, { control: form.control, name: id });
2035
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2036
- _chunkA5DDIABKjs.FormField,
2037
- {
2038
- control: form.control,
2039
- name: id,
2040
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
2041
- name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name }),
2042
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2043
- showPercentage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mb-2 flex w-full justify-center text-xs", children: `${value}%` }),
2044
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2045
- _chunkA5DDIABKjs.Slider,
2046
- {
2047
- onValueChange: (value2) => form.setValue(id, value2[0]),
2048
- value: [value],
2049
- max: 100,
2050
- step: 5,
2051
- disabled: disabled === true || form.formState.isSubmitting
2052
- }
2053
- )
2054
- ] }) }),
2055
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
2056
- ] })
2057
- }
2058
- ) });
2059
- }
2060
- _chunk7QVYU63Ejs.__name.call(void 0, FormSlider, "FormSlider");
2061
-
2062
- // src/components/forms/FormSwitch.tsx
2063
-
2064
- function FormSwitch({ form, id, name, disabled }) {
2065
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2066
- _chunkA5DDIABKjs.FormField,
2067
- {
2068
- control: form.control,
2069
- name: id,
2070
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
2071
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-row gap-x-4", children: [
2072
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Switch, { checked: field.value, onCheckedChange: field.onChange }),
2073
- name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name })
2074
- ] }) }),
2075
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
2076
- ] })
2077
- }
2078
- ) });
2079
- }
2080
- _chunk7QVYU63Ejs.__name.call(void 0, FormSwitch, "FormSwitch");
2081
-
2082
- // src/components/forms/FormTextarea.tsx
2083
-
2084
- function FormTextarea({
2085
- form,
2086
- id,
2087
- name,
2088
- className,
2089
- placeholder,
2090
- testId
2091
- }) {
2092
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2093
- _chunkA5DDIABKjs.FormField,
2094
- {
2095
- control: form.control,
2096
- name: id,
2097
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: "mb-5", children: [
2098
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name }),
2099
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2100
- _chunkA5DDIABKjs.Textarea,
2101
- {
2102
- ...field,
2103
- className: _chunkJC3WJK65js.cn.call(void 0, "min-h-96 w-full", className),
2104
- disabled: form.formState.isSubmitting,
2105
- placeholder,
2106
- "data-testid": testId
2107
- }
2108
- ) }),
2109
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, { "data-testid": testId ? `${testId}-error` : void 0 })
2110
- ] })
2111
- }
2112
- ) });
2113
- }
2114
- _chunk7QVYU63Ejs.__name.call(void 0, FormTextarea, "FormTextarea");
2115
-
2116
- // src/components/pages/PageContainerContentDetails.tsx
2117
-
2118
-
2119
- function PageContainerContentDetails({ items, section, module, id }) {
2120
- const rewriteUrl = _chunkFY4SXJGUjs.useUrlRewriter.call(void 0, );
2121
- const [isScrolled, setIsScrolled] = _react.useState.call(void 0, false);
2122
- const sentinelRef = _react.useRef.call(void 0, null);
2123
- _react.useEffect.call(void 0, () => {
2124
- const sentinel = sentinelRef.current;
2125
- if (!sentinel) return;
2126
- const observer = new IntersectionObserver(
2127
- ([entry]) => {
2128
- setIsScrolled(!entry.isIntersecting);
2129
- },
2130
- {
2131
- threshold: 0,
2132
- rootMargin: "0px"
2133
- }
2134
- );
2135
- observer.observe(sentinel);
2136
- return () => {
2137
- observer.disconnect();
2138
- };
2139
- }, []);
2140
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2141
- _chunkA5DDIABKjs.Tabs,
2142
- {
2143
- defaultValue: section || items[0].title,
2144
- onValueChange: (a) => rewriteUrl({ page: module, id, childPage: a }),
2145
- children: [
2146
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: sentinelRef, className: "h-0" }),
2147
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `bg-background sticky top-0 z-10 mb-2 pb-2 transition-shadow ${isScrolled ? "border-b" : ""}`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsList, { children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsTrigger, { value: item.title, children: item.title }, item.title)) }) }),
2148
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pr-4", children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsContent, { value: item.title, children: item.content }, item.title)) })
2149
- ]
2150
- }
2151
- );
2152
- }
2153
- _chunk7QVYU63Ejs.__name.call(void 0, PageContainerContentDetails, "PageContainerContentDetails");
2154
-
2155
- // src/components/pages/PageContentContainer.tsx
2156
-
2157
- function PageContentContainer({ details, footer, content }) {
2158
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-[calc(100vh-(--spacing(16)))] w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.ResizablePanelGroup, { direction: "horizontal", className: "items-stretch", autoSaveId: "page-content-layout", children: [
2159
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ResizablePanel, { id: "left-panel", defaultSize: 32, minSize: 20, maxSize: 40, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "@container flex h-full flex-col pr-4", children: [
2160
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 overflow-y-auto", children: details }),
2161
- footer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-y-2 pt-2 pb-2", children: footer })
2162
- ] }) }),
2163
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ResizableHandle, { withHandle: true }),
2164
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ResizablePanel, { id: "right-panel", className: "pl-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full overflow-y-auto", children: content }) })
2165
- ] }) });
2166
- }
2167
- _chunk7QVYU63Ejs.__name.call(void 0, PageContentContainer, "PageContentContainer");
2168
-
2169
- // src/components/tables/cells/cell.component.tsx
2170
- var cellComponent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2171
- return {
2172
- id: params.name,
2173
- accessorKey: params.name,
2174
- header: params.title,
2175
- cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => params.component, "cell"),
2176
- enableSorting: false,
2177
- enableHiding: false
2178
- };
2179
- }, "cellComponent");
2180
-
2181
- // src/components/tables/cells/cell.date.tsx
2182
-
2183
- var cellDate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2184
- return {
2185
- id: params.name,
2186
- accessorKey: params.name,
2187
- header: params.title,
2188
- cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: row.getValue(params.name).toLocaleDateString("en", { dateStyle: "medium" }) }), "cell"),
2189
- enableSorting: false,
2190
- enableHiding: false
2191
- };
2192
- }, "cellDate");
2193
-
2194
- // src/components/tables/cells/cell.id.tsx
2195
-
2196
- var cellId = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2197
- return {
2198
- id: params.name,
2199
- accessorKey: params.name,
2200
- header: "",
2201
- cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => params.toggleId ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2202
- _chunkA5DDIABKjs.Checkbox,
2203
- {
2204
- checked: _optionalChain([params, 'access', _42 => _42.checkedIds, 'optionalAccess', _43 => _43.includes, 'call', _44 => _44(row.getValue(params.name))]) || false,
2205
- onCheckedChange: (value) => {
2206
- row.toggleSelected(!!value);
2207
- _optionalChain([params, 'access', _45 => _45.toggleId, 'optionalCall', _46 => _46(row.getValue(params.name))]);
2208
- },
2209
- "aria-label": "Select row"
2210
- }
2211
- ) : null, "cell"),
2212
- enableSorting: false,
2213
- enableHiding: true
2214
- };
2215
- }, "cellId");
2216
-
2217
- // src/components/tables/cells/cell.link.tsx
2218
-
2219
- var cellLink = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2220
- return {
2221
- id: params.name,
2222
- accessorKey: params.name,
2223
- header: params.title,
2224
- cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: params.generateUrl(row.getValue(params.id)), children: row.getValue(params.name) }), "cell"),
2225
- enableSorting: false,
2226
- enableHiding: false
2227
- };
2228
- }, "cellLink");
2229
-
2230
- // src/components/tables/cells/cell.url.tsx
2231
-
2232
- var cellUrl = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2233
- return {
2234
- id: params.name,
2235
- accessorKey: params.name,
2236
- header: params.title,
2237
- cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: row.getValue(params.name), children: row.getValue(params.name) }), "cell"),
2238
- enableSorting: false,
2239
- enableHiding: false
2240
- };
2241
- }, "cellUrl");
2242
-
2243
- // src/components/tables/ContentListTable.tsx
2244
- var _reacttable = require('@tanstack/react-table');
2245
- var _reacticons = require('@radix-ui/react-icons');
2246
-
2247
-
2248
- // src/components/tables/ContentTableSearch.tsx
2249
-
2250
-
2251
-
2252
-
2253
- function ContentTableSearch({ data }) {
2254
- const t = _nextintl.useTranslations.call(void 0, );
2255
- const searchTermRef = _react.useRef.call(void 0, "");
2256
- const inputRef = _react.useRef.call(void 0, null);
2257
- const [searchTerm, setSearchTerm] = _react.useState.call(void 0, "");
2258
- const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
2259
- const [isSearching, setIsSearching] = _react.useState.call(void 0, false);
2260
- const isExpanded = isFocused || searchTerm.length > 0;
2261
- const search = _react.useCallback.call(void 0,
2262
- async (searchedTerm) => {
2263
- try {
2264
- if (searchedTerm === searchTermRef.current) return;
2265
- searchTermRef.current = searchedTerm;
2266
- await data.search(searchedTerm);
2267
- } finally {
2268
- setIsSearching(false);
2269
- }
2270
- },
2271
- [searchTermRef, data]
2272
- );
2273
- const updateSearchTerm = _chunkFY4SXJGUjs.useDebounce.call(void 0, search, 500);
2274
- _react.useEffect.call(void 0, () => {
2275
- setIsSearching(true);
2276
- updateSearchTerm(searchTerm);
2277
- }, [updateSearchTerm, searchTerm]);
2278
- const handleSearchIconClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2279
- if (!isExpanded) {
2280
- setIsFocused(true);
2281
- setTimeout(() => _optionalChain([inputRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.focus, 'call', _49 => _49()]), 50);
2282
- }
2283
- }, "handleSearchIconClick");
2284
- const handleBlur = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2285
- if (searchTerm.length === 0) {
2286
- setIsFocused(false);
2287
- }
2288
- }, "handleBlur");
2289
- const handleClear = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2290
- setSearchTerm("");
2291
- search("");
2292
- setIsFocused(false);
2293
- }, "handleClear");
2294
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2295
- "div",
2296
- {
2297
- className: `relative flex h-6 items-center text-xs font-normal transition-all duration-300 ease-in-out ${isExpanded ? "w-64" : "w-6"}`,
2298
- children: [
2299
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2300
- _lucidereact.Search,
2301
- {
2302
- className: `absolute top-1 left-1 h-4 w-4 transition-colors ${isExpanded ? "text-muted-foreground" : "text-muted-foreground hover:text-foreground cursor-pointer"}`,
2303
- onClick: handleSearchIconClick
2304
- }
2305
- ),
2306
- isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2307
- _chunkA5DDIABKjs.Input,
2308
- {
2309
- ref: inputRef,
2310
- onKeyDown: (e) => {
2311
- if (e.key === "Escape") {
2312
- handleClear();
2313
- }
2314
- },
2315
- onFocus: () => setIsFocused(true),
2316
- onBlur: handleBlur,
2317
- placeholder: t(`generic.search.placeholder_global`),
2318
- type: "text",
2319
- className: "border-border/50 focus-visible:border-border h-10 w-full pr-8 pl-8 text-xs shadow-none focus-visible:ring-0",
2320
- onChange: (e) => setSearchTerm(e.target.value),
2321
- value: searchTerm
2322
- }
2323
- ),
2324
- isExpanded && isSearching && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "text-muted-foreground absolute top-1 right-1 h-4 w-4 animate-spin" }),
2325
- isExpanded && !isSearching && searchTermRef.current && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2326
- _lucidereact.X,
2327
- {
2328
- className: "text-muted-foreground hover:text-foreground absolute top-1 right-1 h-4 w-4 cursor-pointer",
2329
- onClick: handleClear
2330
- }
2331
- )
2332
- ]
2333
- }
2334
- );
2335
- }
2336
- _chunk7QVYU63Ejs.__name.call(void 0, ContentTableSearch, "ContentTableSearch");
2337
-
2338
- // src/components/tables/ContentListTable.tsx
2339
-
2340
- var EMPTY_ARRAY = [];
2341
- var ContentListTable = _react.memo.call(void 0, /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, function ContentListTable2(props) {
2342
- const { data, fields, checkedIds, toggleId, allowSearch, filters } = props;
2343
- const { data: tableData, columns: tableColumns } = _chunkFY4SXJGUjs.useTableGenerator.call(void 0, props.tableGeneratorType, {
2344
- data: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _50 => _50.data]), () => ( EMPTY_ARRAY)),
2345
- fields,
2346
- checkedIds,
2347
- toggleId,
2348
- dataRetriever: data,
2349
- context: props.context
2350
- });
2351
- const columnVisibility = _react.useMemo.call(void 0,
2352
- () => fields.reduce(
2353
- (acc, columnId) => {
2354
- acc[columnId] = true;
2355
- return acc;
2356
- },
2357
- {}
2358
- ),
2359
- [fields]
2360
- );
2361
- const table = _reacttable.useReactTable.call(void 0, {
2362
- data: tableData,
2363
- columns: tableColumns,
2364
- getCoreRowModel: _reacttable.getCoreRowModel.call(void 0, ),
2365
- initialState: {
2366
- columnVisibility
2367
- }
2368
- });
2369
- const rowModel = tableData ? table.getRowModel() : null;
2370
- const showFooter = !!(props.functions || data.next || data.previous);
2371
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-md border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Table, { children: [
2372
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.TableHeader, { className: "bg-muted font-semibold", children: [
2373
- props.title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableHead, { className: "bg-card text-primary p-4 text-left font-bold", colSpan: tableColumns.length, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full items-center justify-between gap-x-2", children: [
2374
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full", children: props.title }),
2375
- (props.functions || props.filters || allowSearch) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2376
- props.functions,
2377
- props.filters,
2378
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentTableSearch, { data })
2379
- ] })
2380
- ] }) }) }),
2381
- table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: headerGroup.headers.map((header) => {
2382
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableHead, { children: header.isPlaceholder ? null : _reacttable.flexRender.call(void 0, header.column.columnDef.header, header.getContext()) }, header.id);
2383
- }) }, headerGroup.id))
2384
- ] }),
2385
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableBody, { children: rowModel && _optionalChain([rowModel, 'access', _51 => _51.rows, 'optionalAccess', _52 => _52.length]) ? rowModel.rows.map((row) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableCell, { children: _reacttable.flexRender.call(void 0, cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableCell, { colSpan: tableColumns.length, className: "h-24 text-center", children: "No results." }) }) }),
2386
- showFooter && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableCell, { colSpan: tableColumns.length, className: "bg-card py-4 text-right", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-end space-x-2", children: [
2387
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2388
- _chunkA5DDIABKjs.Button,
2389
- {
2390
- variant: "outline",
2391
- size: "sm",
2392
- onClick: (e) => {
2393
- e.preventDefault();
2394
- _optionalChain([data, 'access', _53 => _53.previous, 'optionalCall', _54 => _54(true)]);
2395
- },
2396
- disabled: !data.previous,
2397
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CaretLeftIcon, { className: "h-4 w-4" })
2398
- }
2399
- ),
2400
- data.pageInfo && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground text-xs", children: [
2401
- data.pageInfo.startItem,
2402
- "-",
2403
- data.pageInfo.endItem
2404
- ] }),
2405
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2406
- _chunkA5DDIABKjs.Button,
2407
- {
2408
- variant: "outline",
2409
- size: "sm",
2410
- onClick: (e) => {
2411
- e.preventDefault();
2412
- _optionalChain([data, 'access', _55 => _55.next, 'optionalCall', _56 => _56(true)]);
2413
- },
2414
- disabled: !data.next,
2415
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CaretRightIcon, { className: "h-4 w-4" })
2416
- }
2417
- )
2418
- ] }) }) }) })
2419
- ] }) }) });
2420
- }, "ContentListTable"));
117
+ require('../chunk-3FBCC4G3.js');
118
+ require('../chunk-HMHGLXWC.js');
119
+ require('../chunk-AGAJMJ4T.js');
120
+ require('../chunk-6GKHCVF6.js');
121
+ require('../chunk-7QVYU63E.js');
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
2421
176
 
2422
177
 
2423
178
 
@@ -2470,5 +225,5 @@ var ContentListTable = _react.memo.call(void 0, /* @__PURE__ */ _chunk7QVYU63Ejs
2470
225
 
2471
226
 
2472
227
 
2473
- exports.AllowedUsersDetails = AllowedUsersDetails; exports.AttributeElement = AttributeElement; exports.BlockNoteEditorContainer = BlockNoteEditorContainer; exports.Breadcrumb = Breadcrumb2; exports.CommonAssociationCommandDialog = CommonAssociationCommandDialog; exports.CommonAssociationTrigger = CommonAssociationTrigger; exports.CommonDeleter = CommonDeleter; exports.CommonEditorButtons = CommonEditorButtons; exports.CommonEditorHeader = CommonEditorHeader; exports.CommonEditorTrigger = CommonEditorTrigger; exports.ContentListTable = ContentListTable; exports.ContentTableSearch = ContentTableSearch; exports.ContentTitle = ContentTitle; exports.ContributorsList = _chunkAWONBQQPjs.ContributorsList; exports.DatePickerPopover = DatePickerPopover; exports.DateRangeSelector = DateRangeSelector; exports.ErrorDetails = ErrorDetails; exports.FileInput = FileInput; exports.FileUploader = FileUploader; exports.FileUploaderContent = FileUploaderContent; exports.FileUploaderItem = FileUploaderItem; exports.FormCheckbox = FormCheckbox; exports.FormContainerGeneric = FormContainerGeneric; exports.FormDate = FormDate; exports.FormDateTime = FormDateTime; exports.FormInput = FormInput; exports.FormPassword = FormPassword; exports.FormPlaceAutocomplete = FormPlaceAutocomplete; exports.FormSelect = FormSelect; exports.FormSlider = FormSlider; exports.FormSwitch = FormSwitch; exports.FormTextarea = FormTextarea; exports.Header = Header; exports.ModeToggleSwitch = ModeToggleSwitch; exports.PageContainer = PageContainer; exports.PageContainerContentDetails = PageContainerContentDetails; exports.PageContentContainer = PageContentContainer; exports.PageSection = PageSection; exports.PasswordInput = PasswordInput; exports.ReactMarkdownContainer = ReactMarkdownContainer; exports.RecentPagesNavigator = RecentPagesNavigator; exports.TabsContainer = TabsContainer; exports.UserAvatar = _chunkAWONBQQPjs.UserAvatar; exports.cellComponent = cellComponent; exports.cellDate = cellDate; exports.cellId = cellId; exports.cellLink = cellLink; exports.cellUrl = cellUrl; exports.errorToast = _chunkRUR22SVMjs.errorToast; exports.triggerAssociationToast = triggerAssociationToast; exports.useFileUpload = useFileUpload;
228
+ exports.AcceptInvitation = _chunkWEC4YMOSjs.AcceptInvitation; exports.ActivateAccount = _chunkWEC4YMOSjs.ActivateAccount; exports.AddUserToRole = _chunkWEC4YMOSjs.AddUserToRole; exports.AdminCompanyContainer = _chunkWEC4YMOSjs.AdminCompanyContainer; exports.AdminUsersList = _chunkWEC4YMOSjs.AdminUsersList; exports.AllowedUsersDetails = _chunkWEC4YMOSjs.AllowedUsersDetails; exports.AttributeElement = _chunkWEC4YMOSjs.AttributeElement; exports.AuthContainer = _chunkWEC4YMOSjs.AuthContainer; exports.BlockNoteEditorContainer = _chunkWEC4YMOSjs.BlockNoteEditorContainer; exports.Breadcrumb = _chunkWEC4YMOSjs.Breadcrumb; exports.CommonAssociationCommandDialog = _chunkWEC4YMOSjs.CommonAssociationCommandDialog; exports.CommonAssociationTrigger = _chunkWEC4YMOSjs.CommonAssociationTrigger; exports.CommonDeleter = _chunkWEC4YMOSjs.CommonDeleter; exports.CommonEditorButtons = _chunkWEC4YMOSjs.CommonEditorButtons; exports.CommonEditorHeader = _chunkWEC4YMOSjs.CommonEditorHeader; exports.CommonEditorTrigger = _chunkWEC4YMOSjs.CommonEditorTrigger; exports.CompaniesList = _chunkWEC4YMOSjs.CompaniesList; exports.CompanyConfigurationEditor = _chunkWEC4YMOSjs.CompanyConfigurationEditor; exports.CompanyConfigurationSecurityForm = _chunkWEC4YMOSjs.CompanyConfigurationSecurityForm; exports.CompanyContainer = _chunkWEC4YMOSjs.CompanyContainer; exports.CompanyDeleter = _chunkWEC4YMOSjs.CompanyDeleter; exports.CompanyDetails = _chunkWEC4YMOSjs.CompanyDetails; exports.CompanyEditor = _chunkWEC4YMOSjs.CompanyEditor; exports.CompanyUsersList = _chunkWEC4YMOSjs.CompanyUsersList; exports.ContentListTable = _chunkWEC4YMOSjs.ContentListTable; exports.ContentTableSearch = _chunkWEC4YMOSjs.ContentTableSearch; exports.ContentTitle = _chunkWEC4YMOSjs.ContentTitle; exports.ContributorsList = _chunkWEC4YMOSjs.ContributorsList; exports.Cookies = _chunkWEC4YMOSjs.Cookies; exports.DatePickerPopover = _chunkWEC4YMOSjs.DatePickerPopover; exports.DateRangeSelector = _chunkWEC4YMOSjs.DateRangeSelector; exports.ErrorDetails = _chunkWEC4YMOSjs.ErrorDetails; exports.FileInput = _chunkWEC4YMOSjs.FileInput; exports.FileUploader = _chunkWEC4YMOSjs.FileUploader; exports.FileUploaderContent = _chunkWEC4YMOSjs.FileUploaderContent; exports.FileUploaderItem = _chunkWEC4YMOSjs.FileUploaderItem; exports.ForgotPassword = _chunkWEC4YMOSjs.ForgotPassword; exports.FormCheckbox = _chunkWEC4YMOSjs.FormCheckbox; exports.FormContainerGeneric = _chunkWEC4YMOSjs.FormContainerGeneric; exports.FormDate = _chunkWEC4YMOSjs.FormDate; exports.FormDateTime = _chunkWEC4YMOSjs.FormDateTime; exports.FormFeatures = _chunkWEC4YMOSjs.FormFeatures; exports.FormInput = _chunkWEC4YMOSjs.FormInput; exports.FormPassword = _chunkWEC4YMOSjs.FormPassword; exports.FormPlaceAutocomplete = _chunkWEC4YMOSjs.FormPlaceAutocomplete; exports.FormRoles = _chunkWEC4YMOSjs.FormRoles; exports.FormSelect = _chunkWEC4YMOSjs.FormSelect; exports.FormSlider = _chunkWEC4YMOSjs.FormSlider; exports.FormSwitch = _chunkWEC4YMOSjs.FormSwitch; exports.FormTextarea = _chunkWEC4YMOSjs.FormTextarea; exports.Header = _chunkWEC4YMOSjs.Header; exports.LandingComponent = _chunkWEC4YMOSjs.LandingComponent; exports.Login = _chunkWEC4YMOSjs.Login; exports.Logout = _chunkWEC4YMOSjs.Logout; exports.ModeToggleSwitch = _chunkWEC4YMOSjs.ModeToggleSwitch; exports.NotificationErrorBoundary = _chunkWEC4YMOSjs.NotificationErrorBoundary; exports.NotificationMenuItem = _chunkWEC4YMOSjs.NotificationMenuItem; exports.NotificationModal = _chunkWEC4YMOSjs.NotificationModal; exports.NotificationToast = _chunkWEC4YMOSjs.NotificationToast; exports.NotificationsList = _chunkWEC4YMOSjs.NotificationsList; exports.NotificationsListContainer = _chunkWEC4YMOSjs.NotificationsListContainer; exports.PageContainer = _chunkWEC4YMOSjs.PageContainer; exports.PageContainerContentDetails = _chunkWEC4YMOSjs.PageContainerContentDetails; exports.PageContentContainer = _chunkWEC4YMOSjs.PageContentContainer; exports.PageSection = _chunkWEC4YMOSjs.PageSection; exports.PasswordInput = _chunkWEC4YMOSjs.PasswordInput; exports.PushNotificationProvider = _chunkWEC4YMOSjs.PushNotificationProvider; exports.ReactMarkdownContainer = _chunkWEC4YMOSjs.ReactMarkdownContainer; exports.RecentPagesNavigator = _chunkWEC4YMOSjs.RecentPagesNavigator; exports.RefreshUser = _chunkWEC4YMOSjs.RefreshUser; exports.RelevantUsersList = _chunkWEC4YMOSjs.RelevantUsersList; exports.RemoveUserFromRole = _chunkWEC4YMOSjs.RemoveUserFromRole; exports.ResetPassword = _chunkWEC4YMOSjs.ResetPassword; exports.RoleContainer = _chunkWEC4YMOSjs.RoleContainer; exports.RoleDetails = _chunkWEC4YMOSjs.RoleDetails; exports.RoleUsersList = _chunkWEC4YMOSjs.RoleUsersList; exports.RolesList = _chunkWEC4YMOSjs.RolesList; exports.TabsContainer = _chunkWEC4YMOSjs.TabsContainer; exports.UserAvatar = _chunkWEC4YMOSjs.UserAvatar; exports.UserAvatarEditor = _chunkWEC4YMOSjs.UserAvatarEditor; exports.UserContainer = _chunkWEC4YMOSjs.UserContainer; exports.UserDeleter = _chunkWEC4YMOSjs.UserDeleter; exports.UserDetails = _chunkWEC4YMOSjs.UserDetails; exports.UserEditor = _chunkWEC4YMOSjs.UserEditor; exports.UserIndexContainer = _chunkWEC4YMOSjs.UserIndexContainer; exports.UserIndexDetails = _chunkWEC4YMOSjs.UserIndexDetails; exports.UserListInAdd = _chunkWEC4YMOSjs.UserListInAdd; exports.UserMultiSelect = _chunkWEC4YMOSjs.UserMultiSelect; exports.UserReactivator = _chunkWEC4YMOSjs.UserReactivator; exports.UserResentInvitationEmail = _chunkWEC4YMOSjs.UserResentInvitationEmail; exports.UserRoleAdd = _chunkWEC4YMOSjs.UserRoleAdd; exports.UserRolesList = _chunkWEC4YMOSjs.UserRolesList; exports.UserSelector = _chunkWEC4YMOSjs.UserSelector; exports.UsersList = _chunkWEC4YMOSjs.UsersList; exports.UsersListByContentIds = _chunkWEC4YMOSjs.UsersListByContentIds; exports.UsersListContainer = _chunkWEC4YMOSjs.UsersListContainer; exports.cellComponent = _chunkWEC4YMOSjs.cellComponent; exports.cellDate = _chunkWEC4YMOSjs.cellDate; exports.cellId = _chunkWEC4YMOSjs.cellId; exports.cellLink = _chunkWEC4YMOSjs.cellLink; exports.cellUrl = _chunkWEC4YMOSjs.cellUrl; exports.errorToast = _chunkWEC4YMOSjs.errorToast; exports.generateNotificationData = _chunkWEC4YMOSjs.generateNotificationData; exports.triggerAssociationToast = _chunkWEC4YMOSjs.triggerAssociationToast; exports.useFileUpload = _chunkWEC4YMOSjs.useFileUpload;
2474
229
  //# sourceMappingURL=index.js.map