hazo_auth 1.4.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (478) hide show
  1. package/README.md +25 -38
  2. package/SETUP_CHECKLIST.md +708 -0
  3. package/dist/app/api/hazo_auth/change_password/route.d.ts +8 -0
  4. package/dist/app/api/hazo_auth/change_password/route.d.ts.map +1 -0
  5. package/dist/app/api/hazo_auth/change_password/route.js +98 -0
  6. package/dist/app/api/hazo_auth/forgot_password/route.d.ts +8 -0
  7. package/dist/app/api/hazo_auth/forgot_password/route.d.ts.map +1 -0
  8. package/dist/app/api/hazo_auth/forgot_password/route.js +78 -0
  9. package/dist/app/api/hazo_auth/get_auth/route.d.ts +10 -0
  10. package/dist/app/api/hazo_auth/get_auth/route.d.ts.map +1 -0
  11. package/dist/app/api/hazo_auth/get_auth/route.js +63 -0
  12. package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts +14 -0
  13. package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts.map +1 -0
  14. package/dist/app/api/hazo_auth/invalidate_cache/route.js +96 -0
  15. package/dist/app/api/hazo_auth/library_photos/route.d.ts +13 -0
  16. package/dist/app/api/hazo_auth/library_photos/route.d.ts.map +1 -0
  17. package/dist/app/api/hazo_auth/library_photos/route.js +55 -0
  18. package/dist/app/api/hazo_auth/login/route.d.ts +12 -0
  19. package/dist/app/api/hazo_auth/login/route.d.ts.map +1 -0
  20. package/dist/app/api/hazo_auth/login/route.js +140 -0
  21. package/dist/app/api/hazo_auth/logout/route.d.ts +8 -0
  22. package/dist/app/api/hazo_auth/logout/route.d.ts.map +1 -0
  23. package/dist/app/api/hazo_auth/logout/route.js +71 -0
  24. package/dist/app/api/hazo_auth/me/route.d.ts +3 -0
  25. package/dist/app/api/hazo_auth/me/route.d.ts.map +1 -0
  26. package/dist/app/api/hazo_auth/me/route.js +34 -0
  27. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts +7 -0
  28. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts.map +1 -0
  29. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.js +43 -0
  30. package/dist/app/api/hazo_auth/register/route.d.ts +9 -0
  31. package/dist/app/api/hazo_auth/register/route.d.ts.map +1 -0
  32. package/dist/app/api/hazo_auth/register/route.js +80 -0
  33. package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts +8 -0
  34. package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts.map +1 -0
  35. package/dist/app/api/hazo_auth/remove_profile_picture/route.js +64 -0
  36. package/dist/app/api/hazo_auth/resend_verification/route.d.ts +8 -0
  37. package/dist/app/api/hazo_auth/resend_verification/route.d.ts.map +1 -0
  38. package/dist/app/api/hazo_auth/resend_verification/route.js +79 -0
  39. package/dist/app/api/hazo_auth/reset_password/route.d.ts +8 -0
  40. package/dist/app/api/hazo_auth/reset_password/route.d.ts.map +1 -0
  41. package/dist/app/api/hazo_auth/reset_password/route.js +76 -0
  42. package/dist/app/api/hazo_auth/update_user/route.d.ts +9 -0
  43. package/dist/app/api/hazo_auth/update_user/route.d.ts.map +1 -0
  44. package/dist/app/api/hazo_auth/update_user/route.js +95 -0
  45. package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts +9 -0
  46. package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts.map +1 -0
  47. package/dist/app/api/hazo_auth/upload_profile_picture/route.js +204 -0
  48. package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts +6 -0
  49. package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts.map +1 -0
  50. package/dist/app/api/hazo_auth/validate_reset_token/route.js +58 -0
  51. package/dist/app/api/hazo_auth/verify_email/route.d.ts +11 -0
  52. package/dist/app/api/hazo_auth/verify_email/route.d.ts.map +1 -0
  53. package/dist/app/api/hazo_auth/verify_email/route.js +63 -0
  54. package/dist/cli/generate.d.ts +2 -0
  55. package/dist/cli/generate.d.ts.map +1 -0
  56. package/dist/cli/generate.js +117 -0
  57. package/dist/cli/index.d.ts +3 -0
  58. package/dist/cli/index.d.ts.map +1 -0
  59. package/dist/cli/index.js +120 -0
  60. package/dist/cli/validate.d.ts +15 -0
  61. package/dist/cli/validate.d.ts.map +1 -0
  62. package/dist/cli/validate.js +509 -0
  63. package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +2 -2
  64. package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
  65. package/dist/components/layouts/email_verification/config/email_verification_field_config.js +1 -1
  66. package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts +2 -2
  67. package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
  68. package/dist/components/layouts/email_verification/hooks/use_email_verification.js +2 -2
  69. package/dist/components/layouts/email_verification/index.d.ts +3 -3
  70. package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
  71. package/dist/components/layouts/email_verification/index.js +9 -9
  72. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +2 -2
  73. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
  74. package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +1 -1
  75. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts +2 -2
  76. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
  77. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +2 -2
  78. package/dist/components/layouts/forgot_password/index.d.ts +2 -2
  79. package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
  80. package/dist/components/layouts/forgot_password/index.js +8 -8
  81. package/dist/components/layouts/login/config/login_field_config.d.ts +2 -2
  82. package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
  83. package/dist/components/layouts/login/config/login_field_config.js +1 -1
  84. package/dist/components/layouts/login/hooks/use_login_form.d.ts +2 -2
  85. package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
  86. package/dist/components/layouts/login/hooks/use_login_form.js +4 -4
  87. package/dist/components/layouts/login/index.d.ts +2 -2
  88. package/dist/components/layouts/login/index.d.ts.map +1 -1
  89. package/dist/components/layouts/login/index.js +9 -9
  90. package/dist/components/layouts/my_settings/components/editable_field.js +3 -3
  91. package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts +1 -1
  92. package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
  93. package/dist/components/layouts/my_settings/components/password_change_dialog.js +4 -4
  94. package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +7 -7
  95. package/dist/components/layouts/my_settings/components/profile_picture_display.js +1 -1
  96. package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +3 -3
  97. package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +5 -5
  98. package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +4 -4
  99. package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +1 -1
  100. package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
  101. package/dist/components/layouts/my_settings/config/my_settings_field_config.js +1 -1
  102. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +1 -1
  103. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
  104. package/dist/components/layouts/my_settings/hooks/use_my_settings.js +1 -1
  105. package/dist/components/layouts/my_settings/index.d.ts +2 -2
  106. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  107. package/dist/components/layouts/my_settings/index.js +9 -9
  108. package/dist/components/layouts/register/config/register_field_config.d.ts +2 -2
  109. package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
  110. package/dist/components/layouts/register/config/register_field_config.js +1 -1
  111. package/dist/components/layouts/register/hooks/use_register_form.d.ts +3 -3
  112. package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
  113. package/dist/components/layouts/register/hooks/use_register_form.js +2 -2
  114. package/dist/components/layouts/register/index.d.ts +2 -2
  115. package/dist/components/layouts/register/index.d.ts.map +1 -1
  116. package/dist/components/layouts/register/index.js +9 -9
  117. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +2 -2
  118. package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
  119. package/dist/components/layouts/reset_password/config/reset_password_field_config.js +1 -1
  120. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts +3 -3
  121. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
  122. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +2 -2
  123. package/dist/components/layouts/reset_password/index.d.ts +2 -2
  124. package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
  125. package/dist/components/layouts/reset_password/index.js +8 -8
  126. package/dist/components/layouts/shared/components/already_logged_in_guard.js +4 -4
  127. package/dist/components/layouts/shared/components/auth_page_shell.js +3 -3
  128. package/dist/components/layouts/shared/components/form_action_buttons.d.ts +1 -1
  129. package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
  130. package/dist/components/layouts/shared/components/form_action_buttons.js +1 -1
  131. package/dist/components/layouts/shared/components/form_field_wrapper.js +2 -2
  132. package/dist/components/layouts/shared/components/logout_button.js +2 -2
  133. package/dist/components/layouts/shared/components/password_field.js +3 -3
  134. package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +1 -1
  135. package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
  136. package/dist/components/layouts/shared/components/profile_pic_menu.js +4 -4
  137. package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +2 -2
  138. package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +3 -3
  139. package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +1 -1
  140. package/dist/components/layouts/shared/components/two_column_auth_layout.js +1 -1
  141. package/dist/components/layouts/shared/components/unauthorized_guard.js +2 -2
  142. package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts +1 -1
  143. package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -1
  144. package/dist/components/layouts/shared/utils/validation.d.ts +1 -1
  145. package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
  146. package/dist/components/layouts/user_management/components/roles_matrix.js +7 -7
  147. package/dist/components/layouts/user_management/index.js +11 -11
  148. package/dist/components/ui/alert-dialog.js +2 -2
  149. package/dist/components/ui/avatar.js +1 -1
  150. package/dist/components/ui/button.js +1 -1
  151. package/dist/components/ui/card.d.ts +9 -0
  152. package/dist/components/ui/card.d.ts.map +1 -0
  153. package/dist/components/ui/card.js +45 -0
  154. package/dist/components/ui/checkbox.js +1 -1
  155. package/dist/components/ui/dialog.js +1 -1
  156. package/dist/components/ui/dropdown-menu.js +1 -1
  157. package/dist/components/ui/hazo_ui_tooltip.js +1 -1
  158. package/dist/components/ui/input.js +1 -1
  159. package/dist/components/ui/label.js +1 -1
  160. package/dist/components/ui/separator.js +1 -1
  161. package/dist/components/ui/sheet.js +1 -1
  162. package/dist/components/ui/sidebar.d.ts +2 -2
  163. package/dist/components/ui/sidebar.d.ts.map +1 -1
  164. package/dist/components/ui/sidebar.js +8 -8
  165. package/dist/components/ui/skeleton.js +1 -1
  166. package/dist/components/ui/switch.js +1 -1
  167. package/dist/components/ui/table.js +1 -1
  168. package/dist/components/ui/tabs.js +1 -1
  169. package/dist/components/ui/tooltip.js +1 -1
  170. package/dist/components/ui/vertical-tabs.js +1 -1
  171. package/dist/hooks/use-mobile.d.ts.map +1 -1
  172. package/dist/hooks/use-mobile.js +17 -3
  173. package/dist/lib/already_logged_in_config.server.js +1 -1
  174. package/dist/lib/app_logger.js +1 -1
  175. package/dist/lib/auth/auth_cache.d.ts +1 -1
  176. package/dist/lib/auth/auth_cache.d.ts.map +1 -1
  177. package/dist/lib/auth/auth_utils.server.js +2 -2
  178. package/dist/lib/auth/hazo_get_auth.server.d.ts +1 -1
  179. package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
  180. package/dist/lib/auth/hazo_get_auth.server.js +7 -7
  181. package/dist/lib/auth/server_auth.js +2 -2
  182. package/dist/lib/auth_utility_config.server.js +1 -1
  183. package/dist/lib/config/config_loader.server.js +1 -1
  184. package/dist/lib/email_verification_config.server.js +1 -1
  185. package/dist/lib/file_types_config.server.js +1 -1
  186. package/dist/lib/forgot_password_config.server.js +1 -1
  187. package/dist/lib/hazo_connect_instance.server.js +2 -2
  188. package/dist/lib/hazo_connect_setup.server.js +2 -2
  189. package/dist/lib/login_config.server.js +2 -2
  190. package/dist/lib/messages_config.server.js +1 -1
  191. package/dist/lib/my_settings_config.server.js +7 -7
  192. package/dist/lib/password_requirements_config.server.js +1 -1
  193. package/dist/lib/profile_pic_menu_config.server.js +1 -1
  194. package/dist/lib/profile_picture_config.server.js +2 -2
  195. package/dist/lib/register_config.server.js +4 -4
  196. package/dist/lib/reset_password_config.server.js +3 -3
  197. package/dist/lib/services/email_service.js +2 -2
  198. package/dist/lib/services/email_verification_service.js +3 -3
  199. package/dist/lib/services/login_service.js +3 -3
  200. package/dist/lib/services/password_change_service.js +3 -3
  201. package/dist/lib/services/password_reset_service.js +3 -3
  202. package/dist/lib/services/profile_picture_remove_service.js +3 -3
  203. package/dist/lib/services/profile_picture_service.d.ts +1 -1
  204. package/dist/lib/services/profile_picture_service.d.ts.map +1 -1
  205. package/dist/lib/services/profile_picture_service.js +5 -5
  206. package/dist/lib/services/registration_service.js +8 -8
  207. package/dist/lib/services/token_service.js +2 -2
  208. package/dist/lib/services/user_profiles_service.js +2 -2
  209. package/dist/lib/services/user_update_service.d.ts +1 -1
  210. package/dist/lib/services/user_update_service.d.ts.map +1 -1
  211. package/dist/lib/services/user_update_service.js +4 -4
  212. package/dist/lib/ui_shell_config.server.js +1 -1
  213. package/dist/lib/ui_sizes_config.server.js +1 -1
  214. package/dist/lib/user_fields_config.server.js +1 -1
  215. package/dist/lib/user_management_config.server.js +1 -1
  216. package/dist/lib/utils/error_sanitizer.d.ts +1 -1
  217. package/dist/lib/utils/error_sanitizer.d.ts.map +1 -1
  218. package/dist/server/config/config_loader.d.ts +1 -1
  219. package/dist/server/config/config_loader.d.ts.map +1 -1
  220. package/dist/server/config/config_loader.js +1 -1
  221. package/dist/server/index.js +2 -2
  222. package/dist/server/logging/logger_service.d.ts +1 -1
  223. package/dist/server/logging/logger_service.d.ts.map +1 -1
  224. package/dist/server/routes/change_password.d.ts +2 -0
  225. package/dist/server/routes/change_password.d.ts.map +1 -0
  226. package/dist/server/routes/change_password.js +2 -0
  227. package/dist/server/routes/forgot_password.d.ts +2 -0
  228. package/dist/server/routes/forgot_password.d.ts.map +1 -0
  229. package/dist/server/routes/forgot_password.js +2 -0
  230. package/dist/server/routes/get_auth.d.ts +2 -0
  231. package/dist/server/routes/get_auth.d.ts.map +1 -0
  232. package/dist/server/routes/get_auth.js +2 -0
  233. package/dist/server/routes/index.d.ts +18 -0
  234. package/dist/server/routes/index.d.ts.map +1 -0
  235. package/dist/server/routes/index.js +24 -0
  236. package/dist/server/routes/invalidate_cache.d.ts +2 -0
  237. package/dist/server/routes/invalidate_cache.d.ts.map +1 -0
  238. package/dist/server/routes/invalidate_cache.js +2 -0
  239. package/dist/server/routes/library_photos.d.ts +2 -0
  240. package/dist/server/routes/library_photos.d.ts.map +1 -0
  241. package/dist/server/routes/library_photos.js +2 -0
  242. package/dist/server/routes/login.d.ts +2 -0
  243. package/dist/server/routes/login.d.ts.map +1 -0
  244. package/dist/server/routes/login.js +2 -0
  245. package/dist/server/routes/logout.d.ts +2 -0
  246. package/dist/server/routes/logout.d.ts.map +1 -0
  247. package/dist/server/routes/logout.js +2 -0
  248. package/dist/server/routes/me.d.ts +2 -0
  249. package/dist/server/routes/me.d.ts.map +1 -0
  250. package/dist/server/routes/me.js +2 -0
  251. package/dist/server/routes/profile_picture_filename.d.ts +2 -0
  252. package/dist/server/routes/profile_picture_filename.d.ts.map +1 -0
  253. package/dist/server/routes/profile_picture_filename.js +3 -0
  254. package/dist/server/routes/register.d.ts +2 -0
  255. package/dist/server/routes/register.d.ts.map +1 -0
  256. package/dist/server/routes/register.js +2 -0
  257. package/dist/server/routes/remove_profile_picture.d.ts +2 -0
  258. package/dist/server/routes/remove_profile_picture.d.ts.map +1 -0
  259. package/dist/server/routes/remove_profile_picture.js +2 -0
  260. package/dist/server/routes/resend_verification.d.ts +2 -0
  261. package/dist/server/routes/resend_verification.d.ts.map +1 -0
  262. package/dist/server/routes/resend_verification.js +2 -0
  263. package/dist/server/routes/reset_password.d.ts +2 -0
  264. package/dist/server/routes/reset_password.d.ts.map +1 -0
  265. package/dist/server/routes/reset_password.js +2 -0
  266. package/dist/server/routes/update_user.d.ts +2 -0
  267. package/dist/server/routes/update_user.d.ts.map +1 -0
  268. package/dist/server/routes/update_user.js +2 -0
  269. package/dist/server/routes/upload_profile_picture.d.ts +2 -0
  270. package/dist/server/routes/upload_profile_picture.d.ts.map +1 -0
  271. package/dist/server/routes/upload_profile_picture.js +2 -0
  272. package/dist/server/routes/validate_reset_token.d.ts +2 -0
  273. package/dist/server/routes/validate_reset_token.d.ts.map +1 -0
  274. package/dist/server/routes/validate_reset_token.js +2 -0
  275. package/dist/server/routes/verify_email.d.ts +2 -0
  276. package/dist/server/routes/verify_email.d.ts.map +1 -0
  277. package/dist/server/routes/verify_email.js +2 -0
  278. package/dist/server/server.js +2 -2
  279. package/package.json +14 -115
  280. package/components.json +0 -22
  281. package/instrumentation.ts +0 -32
  282. package/migrations/001_add_token_type_to_refresh_tokens.sql +0 -14
  283. package/migrations/002_add_name_to_hazo_users.sql +0 -7
  284. package/migrations/003_add_url_on_logon_to_hazo_users.sql +0 -8
  285. package/next.config.mjs +0 -67
  286. package/postcss.config.mjs +0 -8
  287. package/public/file.svg +0 -1
  288. package/public/globe.svg +0 -1
  289. package/public/next.svg +0 -1
  290. package/public/vercel.svg +0 -1
  291. package/public/window.svg +0 -1
  292. package/scripts/apply_migration.ts +0 -118
  293. package/scripts/init_users.ts +0 -378
  294. package/src/app/api/hazo_auth/auth/upload_profile_picture/route.ts +0 -268
  295. package/src/app/api/hazo_auth/change_password/route.ts +0 -132
  296. package/src/app/api/hazo_auth/forgot_password/route.ts +0 -107
  297. package/src/app/api/hazo_auth/get_auth/route.ts +0 -89
  298. package/src/app/api/hazo_auth/invalidate_cache/route.ts +0 -139
  299. package/src/app/api/hazo_auth/library_photos/route.ts +0 -73
  300. package/src/app/api/hazo_auth/login/route.ts +0 -181
  301. package/src/app/api/hazo_auth/logout/route.ts +0 -89
  302. package/src/app/api/hazo_auth/me/route.ts +0 -47
  303. package/src/app/api/hazo_auth/profile_picture/[filename]/route.ts +0 -67
  304. package/src/app/api/hazo_auth/register/route.ts +0 -109
  305. package/src/app/api/hazo_auth/remove_profile_picture/route.ts +0 -86
  306. package/src/app/api/hazo_auth/resend_verification/route.ts +0 -108
  307. package/src/app/api/hazo_auth/reset_password/route.ts +0 -107
  308. package/src/app/api/hazo_auth/update_user/route.ts +0 -126
  309. package/src/app/api/hazo_auth/upload_profile_picture/route.ts +0 -268
  310. package/src/app/api/hazo_auth/user_management/permissions/route.ts +0 -367
  311. package/src/app/api/hazo_auth/user_management/roles/route.ts +0 -442
  312. package/src/app/api/hazo_auth/user_management/users/roles/route.ts +0 -367
  313. package/src/app/api/hazo_auth/user_management/users/route.ts +0 -239
  314. package/src/app/api/hazo_auth/validate_reset_token/route.ts +0 -83
  315. package/src/app/api/hazo_auth/verify_email/route.ts +0 -88
  316. package/src/app/api/migrations/apply/route.ts +0 -91
  317. package/src/app/favicon.ico +0 -0
  318. package/src/app/fonts/GeistMonoVF.woff +0 -0
  319. package/src/app/fonts/GeistVF.woff +0 -0
  320. package/src/app/globals.css +0 -89
  321. package/src/app/hazo_auth/forgot_password/forgot_password_page_client.tsx +0 -60
  322. package/src/app/hazo_auth/forgot_password/page.tsx +0 -24
  323. package/src/app/hazo_auth/login/login_page_client.tsx +0 -86
  324. package/src/app/hazo_auth/login/page.tsx +0 -38
  325. package/src/app/hazo_auth/my_settings/my_settings_page_client.tsx +0 -120
  326. package/src/app/hazo_auth/my_settings/page.tsx +0 -40
  327. package/src/app/hazo_auth/register/page.tsx +0 -36
  328. package/src/app/hazo_auth/register/register_page_client.tsx +0 -81
  329. package/src/app/hazo_auth/reset_password/page.tsx +0 -29
  330. package/src/app/hazo_auth/reset_password/reset_password_page_client.tsx +0 -81
  331. package/src/app/hazo_auth/user_management/page.tsx +0 -14
  332. package/src/app/hazo_auth/user_management/user_management_page_client.tsx +0 -16
  333. package/src/app/hazo_auth/verify_email/page.tsx +0 -24
  334. package/src/app/hazo_auth/verify_email/verify_email_page_client.tsx +0 -60
  335. package/src/app/hazo_connect/api/sqlite/data/route.ts +0 -203
  336. package/src/app/hazo_connect/api/sqlite/schema/route.ts +0 -45
  337. package/src/app/hazo_connect/api/sqlite/tables/route.ts +0 -36
  338. package/src/app/hazo_connect/sqlite_admin/page.tsx +0 -51
  339. package/src/app/hazo_connect/sqlite_admin/sqlite-admin-client.tsx +0 -984
  340. package/src/app/layout.tsx +0 -43
  341. package/src/app/page.tsx +0 -170
  342. package/src/components/index.ts +0 -7
  343. package/src/components/layouts/email_verification/config/email_verification_field_config.ts +0 -86
  344. package/src/components/layouts/email_verification/hooks/use_email_verification.ts +0 -297
  345. package/src/components/layouts/email_verification/index.tsx +0 -297
  346. package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +0 -58
  347. package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +0 -179
  348. package/src/components/layouts/forgot_password/index.tsx +0 -168
  349. package/src/components/layouts/index.ts +0 -26
  350. package/src/components/layouts/login/config/login_field_config.ts +0 -67
  351. package/src/components/layouts/login/hooks/use_login_form.ts +0 -286
  352. package/src/components/layouts/login/index.tsx +0 -252
  353. package/src/components/layouts/my_settings/components/editable_field.tsx +0 -177
  354. package/src/components/layouts/my_settings/components/password_change_dialog.tsx +0 -301
  355. package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +0 -385
  356. package/src/components/layouts/my_settings/components/profile_picture_display.tsx +0 -66
  357. package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +0 -143
  358. package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +0 -311
  359. package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +0 -341
  360. package/src/components/layouts/my_settings/config/my_settings_field_config.ts +0 -61
  361. package/src/components/layouts/my_settings/hooks/use_my_settings.ts +0 -458
  362. package/src/components/layouts/my_settings/index.tsx +0 -351
  363. package/src/components/layouts/register/config/register_field_config.ts +0 -101
  364. package/src/components/layouts/register/hooks/use_register_form.ts +0 -275
  365. package/src/components/layouts/register/index.tsx +0 -226
  366. package/src/components/layouts/reset_password/config/reset_password_field_config.ts +0 -86
  367. package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +0 -276
  368. package/src/components/layouts/reset_password/index.tsx +0 -294
  369. package/src/components/layouts/shared/components/already_logged_in_guard.tsx +0 -95
  370. package/src/components/layouts/shared/components/auth_page_shell.tsx +0 -36
  371. package/src/components/layouts/shared/components/field_error_message.tsx +0 -29
  372. package/src/components/layouts/shared/components/form_action_buttons.tsx +0 -64
  373. package/src/components/layouts/shared/components/form_field_wrapper.tsx +0 -44
  374. package/src/components/layouts/shared/components/form_header.tsx +0 -36
  375. package/src/components/layouts/shared/components/logout_button.tsx +0 -76
  376. package/src/components/layouts/shared/components/password_field.tsx +0 -72
  377. package/src/components/layouts/shared/components/profile_pic_menu.tsx +0 -321
  378. package/src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx +0 -40
  379. package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +0 -214
  380. package/src/components/layouts/shared/components/standalone_layout_wrapper.tsx +0 -53
  381. package/src/components/layouts/shared/components/two_column_auth_layout.tsx +0 -44
  382. package/src/components/layouts/shared/components/unauthorized_guard.tsx +0 -78
  383. package/src/components/layouts/shared/components/visual_panel.tsx +0 -41
  384. package/src/components/layouts/shared/config/layout_customization.ts +0 -95
  385. package/src/components/layouts/shared/data/layout_data_client.ts +0 -19
  386. package/src/components/layouts/shared/hooks/use_auth_status.ts +0 -103
  387. package/src/components/layouts/shared/hooks/use_hazo_auth.ts +0 -158
  388. package/src/components/layouts/shared/index.ts +0 -34
  389. package/src/components/layouts/shared/utils/ip_address.ts +0 -37
  390. package/src/components/layouts/shared/utils/validation.ts +0 -66
  391. package/src/components/layouts/user_management/components/roles_matrix.tsx +0 -607
  392. package/src/components/layouts/user_management/index.tsx +0 -1295
  393. package/src/components/ui/alert-dialog.tsx +0 -141
  394. package/src/components/ui/avatar.tsx +0 -50
  395. package/src/components/ui/button.tsx +0 -57
  396. package/src/components/ui/checkbox.tsx +0 -30
  397. package/src/components/ui/dialog.tsx +0 -122
  398. package/src/components/ui/dropdown-menu.tsx +0 -201
  399. package/src/components/ui/hazo_ui_tooltip.tsx +0 -67
  400. package/src/components/ui/index.ts +0 -22
  401. package/src/components/ui/input.tsx +0 -22
  402. package/src/components/ui/label.tsx +0 -26
  403. package/src/components/ui/separator.tsx +0 -31
  404. package/src/components/ui/sheet.tsx +0 -139
  405. package/src/components/ui/sidebar.tsx +0 -773
  406. package/src/components/ui/skeleton.tsx +0 -15
  407. package/src/components/ui/sonner.tsx +0 -31
  408. package/src/components/ui/switch.tsx +0 -29
  409. package/src/components/ui/table.tsx +0 -120
  410. package/src/components/ui/tabs.tsx +0 -55
  411. package/src/components/ui/tooltip.tsx +0 -32
  412. package/src/components/ui/vertical-tabs.tsx +0 -59
  413. package/src/hooks/use-mobile.tsx +0 -19
  414. package/src/index.ts +0 -7
  415. package/src/lib/already_logged_in_config.server.ts +0 -46
  416. package/src/lib/app_logger.ts +0 -24
  417. package/src/lib/auth/auth_cache.ts +0 -220
  418. package/src/lib/auth/auth_rate_limiter.ts +0 -121
  419. package/src/lib/auth/auth_types.ts +0 -65
  420. package/src/lib/auth/auth_utils.server.ts +0 -196
  421. package/src/lib/auth/hazo_get_auth.server.ts +0 -333
  422. package/src/lib/auth/index.ts +0 -23
  423. package/src/lib/auth/server_auth.ts +0 -88
  424. package/src/lib/auth_utility_config.server.ts +0 -136
  425. package/src/lib/config/config_loader.server.ts +0 -164
  426. package/src/lib/email_verification_config.server.ts +0 -32
  427. package/src/lib/file_types_config.server.ts +0 -25
  428. package/src/lib/forgot_password_config.server.ts +0 -32
  429. package/src/lib/hazo_connect_instance.server.ts +0 -101
  430. package/src/lib/hazo_connect_setup.server.ts +0 -194
  431. package/src/lib/hazo_connect_setup.ts +0 -54
  432. package/src/lib/index.ts +0 -44
  433. package/src/lib/login_config.server.ts +0 -71
  434. package/src/lib/messages_config.server.ts +0 -45
  435. package/src/lib/migrations/apply_migration.ts +0 -105
  436. package/src/lib/my_settings_config.server.ts +0 -135
  437. package/src/lib/password_requirements_config.server.ts +0 -39
  438. package/src/lib/profile_pic_menu_config.server.ts +0 -138
  439. package/src/lib/profile_picture_config.server.ts +0 -56
  440. package/src/lib/register_config.server.ts +0 -73
  441. package/src/lib/reset_password_config.server.ts +0 -75
  442. package/src/lib/services/email_service.ts +0 -581
  443. package/src/lib/services/email_verification_service.ts +0 -270
  444. package/src/lib/services/index.ts +0 -15
  445. package/src/lib/services/login_service.ts +0 -134
  446. package/src/lib/services/password_change_service.ts +0 -154
  447. package/src/lib/services/password_reset_service.ts +0 -405
  448. package/src/lib/services/profile_picture_remove_service.ts +0 -120
  449. package/src/lib/services/profile_picture_service.ts +0 -215
  450. package/src/lib/services/profile_picture_source_mapper.ts +0 -62
  451. package/src/lib/services/registration_service.ts +0 -184
  452. package/src/lib/services/token_service.ts +0 -240
  453. package/src/lib/services/user_profiles_service.ts +0 -143
  454. package/src/lib/services/user_update_service.ts +0 -141
  455. package/src/lib/ui_shell_config.server.ts +0 -73
  456. package/src/lib/ui_sizes_config.server.ts +0 -37
  457. package/src/lib/user_fields_config.server.ts +0 -31
  458. package/src/lib/user_management_config.server.ts +0 -39
  459. package/src/lib/utils/api_route_helpers.ts +0 -60
  460. package/src/lib/utils/error_sanitizer.ts +0 -75
  461. package/src/lib/utils.ts +0 -11
  462. package/src/middleware.ts +0 -94
  463. package/src/routes/index.ts +0 -34
  464. package/src/server/config/config_loader.ts +0 -496
  465. package/src/server/index.ts +0 -38
  466. package/src/server/logging/logger_service.ts +0 -56
  467. package/src/server/routes/root_router.ts +0 -16
  468. package/src/server/server.ts +0 -28
  469. package/src/server/types/app_types.ts +0 -74
  470. package/src/server/types/express.d.ts +0 -16
  471. package/src/stories/email_verification_layout.stories.tsx +0 -137
  472. package/src/stories/forgot_password_layout.stories.tsx +0 -85
  473. package/src/stories/login_layout.stories.tsx +0 -85
  474. package/src/stories/project_overview.stories.tsx +0 -33
  475. package/src/stories/register_layout.stories.tsx +0 -107
  476. package/tailwind.config.ts +0 -77
  477. package/tsconfig.build.json +0 -39
  478. package/tsconfig.json +0 -28
@@ -1,773 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { Slot } from "@radix-ui/react-slot"
5
- import { cva, type VariantProps } from "class-variance-authority"
6
- import { PanelLeft } from "lucide-react"
7
-
8
- import { useIsMobile } from "hazo_auth/hooks/use-mobile"
9
- import { cn } from "hazo_auth/lib/utils"
10
- import { Button } from "hazo_auth/components/ui/button"
11
- import { Input } from "hazo_auth/components/ui/input"
12
- import { Separator } from "hazo_auth/components/ui/separator"
13
- import {
14
- Sheet,
15
- SheetContent,
16
- SheetDescription,
17
- SheetHeader,
18
- SheetTitle,
19
- } from "hazo_auth/components/ui/sheet"
20
- import { Skeleton } from "hazo_auth/components/ui/skeleton"
21
- import {
22
- Tooltip,
23
- TooltipContent,
24
- TooltipProvider,
25
- TooltipTrigger,
26
- } from "hazo_auth/components/ui/tooltip"
27
-
28
- const SIDEBAR_COOKIE_NAME = "sidebar_state"
29
- const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
30
- const SIDEBAR_WIDTH = "16rem"
31
- const SIDEBAR_WIDTH_MOBILE = "18rem"
32
- const SIDEBAR_WIDTH_ICON = "3rem"
33
- const SIDEBAR_KEYBOARD_SHORTCUT = "b"
34
-
35
- type SidebarContextProps = {
36
- state: "expanded" | "collapsed"
37
- open: boolean
38
- setOpen: (open: boolean) => void
39
- openMobile: boolean
40
- setOpenMobile: (open: boolean) => void
41
- isMobile: boolean
42
- toggleSidebar: () => void
43
- }
44
-
45
- const SidebarContext = React.createContext<SidebarContextProps | null>(null)
46
-
47
- function useSidebar() {
48
- const context = React.useContext(SidebarContext)
49
- if (!context) {
50
- throw new Error("useSidebar must be used within a SidebarProvider.")
51
- }
52
-
53
- return context
54
- }
55
-
56
- const SidebarProvider = React.forwardRef<
57
- HTMLDivElement,
58
- React.ComponentProps<"div"> & {
59
- defaultOpen?: boolean
60
- open?: boolean
61
- onOpenChange?: (open: boolean) => void
62
- }
63
- >(
64
- (
65
- {
66
- defaultOpen = true,
67
- open: openProp,
68
- onOpenChange: setOpenProp,
69
- className,
70
- style,
71
- children,
72
- ...props
73
- },
74
- ref
75
- ) => {
76
- const isMobile = useIsMobile()
77
- const [openMobile, setOpenMobile] = React.useState(false)
78
-
79
- // This is the internal state of the sidebar.
80
- // We use openProp and setOpenProp for control from outside the component.
81
- const [_open, _setOpen] = React.useState(defaultOpen)
82
- const open = openProp ?? _open
83
- const setOpen = React.useCallback(
84
- (value: boolean | ((value: boolean) => boolean)) => {
85
- const openState = typeof value === "function" ? value(open) : value
86
- if (setOpenProp) {
87
- setOpenProp(openState)
88
- } else {
89
- _setOpen(openState)
90
- }
91
-
92
- // This sets the cookie to keep the sidebar state.
93
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
94
- },
95
- [setOpenProp, open]
96
- )
97
-
98
- // Helper to toggle the sidebar.
99
- const toggleSidebar = React.useCallback(() => {
100
- return isMobile
101
- ? setOpenMobile((open) => !open)
102
- : setOpen((open) => !open)
103
- }, [isMobile, setOpen, setOpenMobile])
104
-
105
- // Adds a keyboard shortcut to toggle the sidebar.
106
- React.useEffect(() => {
107
- const handleKeyDown = (event: KeyboardEvent) => {
108
- if (
109
- event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
110
- (event.metaKey || event.ctrlKey)
111
- ) {
112
- event.preventDefault()
113
- toggleSidebar()
114
- }
115
- }
116
-
117
- window.addEventListener("keydown", handleKeyDown)
118
- return () => window.removeEventListener("keydown", handleKeyDown)
119
- }, [toggleSidebar])
120
-
121
- // We add a state so that we can do data-state="expanded" or "collapsed".
122
- // This makes it easier to style the sidebar with Tailwind classes.
123
- const state = open ? "expanded" : "collapsed"
124
-
125
- const contextValue = React.useMemo<SidebarContextProps>(
126
- () => ({
127
- state,
128
- open,
129
- setOpen,
130
- isMobile,
131
- openMobile,
132
- setOpenMobile,
133
- toggleSidebar,
134
- }),
135
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
136
- )
137
-
138
- return (
139
- <SidebarContext.Provider value={contextValue}>
140
- <TooltipProvider delayDuration={0}>
141
- <div
142
- style={
143
- {
144
- "--sidebar-width": SIDEBAR_WIDTH,
145
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
146
- ...style,
147
- } as React.CSSProperties
148
- }
149
- className={cn(
150
- "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
151
- className
152
- )}
153
- ref={ref}
154
- {...props}
155
- >
156
- {children}
157
- </div>
158
- </TooltipProvider>
159
- </SidebarContext.Provider>
160
- )
161
- }
162
- )
163
- SidebarProvider.displayName = "SidebarProvider"
164
-
165
- const Sidebar = React.forwardRef<
166
- HTMLDivElement,
167
- React.ComponentProps<"div"> & {
168
- side?: "left" | "right"
169
- variant?: "sidebar" | "floating" | "inset"
170
- collapsible?: "offcanvas" | "icon" | "none"
171
- }
172
- >(
173
- (
174
- {
175
- side = "left",
176
- variant = "sidebar",
177
- collapsible = "offcanvas",
178
- className,
179
- children,
180
- ...props
181
- },
182
- ref
183
- ) => {
184
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
185
-
186
- if (collapsible === "none") {
187
- return (
188
- <div
189
- className={cn(
190
- "flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",
191
- className
192
- )}
193
- ref={ref}
194
- {...props}
195
- >
196
- {children}
197
- </div>
198
- )
199
- }
200
-
201
- if (isMobile) {
202
- return (
203
- <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
204
- <SheetContent
205
- data-sidebar="sidebar"
206
- data-mobile="true"
207
- className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
208
- style={
209
- {
210
- "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
211
- } as React.CSSProperties
212
- }
213
- side={side}
214
- >
215
- <SheetHeader className="sr-only">
216
- <SheetTitle>Sidebar</SheetTitle>
217
- <SheetDescription>Displays the mobile sidebar.</SheetDescription>
218
- </SheetHeader>
219
- <div className="flex h-full w-full flex-col">{children}</div>
220
- </SheetContent>
221
- </Sheet>
222
- )
223
- }
224
-
225
- return (
226
- <div
227
- ref={ref}
228
- className="group peer hidden text-sidebar-foreground md:block"
229
- data-state={state}
230
- data-collapsible={state === "collapsed" ? collapsible : ""}
231
- data-variant={variant}
232
- data-side={side}
233
- >
234
- {/* This is what handles the sidebar gap on desktop */}
235
- <div
236
- className={cn(
237
- "relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear",
238
- "group-data-[collapsible=offcanvas]:w-0",
239
- "group-data-[side=right]:rotate-180",
240
- variant === "floating" || variant === "inset"
241
- ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
242
- : "group-data-[collapsible=icon]:w-[--sidebar-width-icon]"
243
- )}
244
- />
245
- <div
246
- className={cn(
247
- "fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",
248
- side === "left"
249
- ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
250
- : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
251
- // Adjust the padding for floating and inset variants.
252
- variant === "floating" || variant === "inset"
253
- ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
254
- : "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
255
- className
256
- )}
257
- {...props}
258
- >
259
- <div
260
- data-sidebar="sidebar"
261
- className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
262
- >
263
- {children}
264
- </div>
265
- </div>
266
- </div>
267
- )
268
- }
269
- )
270
- Sidebar.displayName = "Sidebar"
271
-
272
- const SidebarTrigger = React.forwardRef<
273
- React.ElementRef<typeof Button>,
274
- React.ComponentProps<typeof Button>
275
- >(({ className, onClick, ...props }, ref) => {
276
- const { toggleSidebar } = useSidebar()
277
-
278
- return (
279
- <Button
280
- ref={ref}
281
- data-sidebar="trigger"
282
- variant="ghost"
283
- size="icon"
284
- className={cn("h-7 w-7", className)}
285
- onClick={(event) => {
286
- onClick?.(event)
287
- toggleSidebar()
288
- }}
289
- {...props}
290
- >
291
- <PanelLeft />
292
- <span className="sr-only">Toggle Sidebar</span>
293
- </Button>
294
- )
295
- })
296
- SidebarTrigger.displayName = "SidebarTrigger"
297
-
298
- const SidebarRail = React.forwardRef<
299
- HTMLButtonElement,
300
- React.ComponentProps<"button">
301
- >(({ className, ...props }, ref) => {
302
- const { toggleSidebar } = useSidebar()
303
-
304
- return (
305
- <button
306
- ref={ref}
307
- data-sidebar="rail"
308
- aria-label="Toggle Sidebar"
309
- tabIndex={-1}
310
- onClick={toggleSidebar}
311
- title="Toggle Sidebar"
312
- className={cn(
313
- "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
314
- "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
315
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
316
- "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
317
- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
318
- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
319
- className
320
- )}
321
- {...props}
322
- />
323
- )
324
- })
325
- SidebarRail.displayName = "SidebarRail"
326
-
327
- const SidebarInset = React.forwardRef<
328
- HTMLDivElement,
329
- React.ComponentProps<"main">
330
- >(({ className, ...props }, ref) => {
331
- return (
332
- <main
333
- ref={ref}
334
- className={cn(
335
- "relative flex w-full flex-1 flex-col bg-background",
336
- "md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
337
- className
338
- )}
339
- {...props}
340
- />
341
- )
342
- })
343
- SidebarInset.displayName = "SidebarInset"
344
-
345
- const SidebarInput = React.forwardRef<
346
- React.ElementRef<typeof Input>,
347
- React.ComponentProps<typeof Input>
348
- >(({ className, ...props }, ref) => {
349
- return (
350
- <Input
351
- ref={ref}
352
- data-sidebar="input"
353
- className={cn(
354
- "h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
355
- className
356
- )}
357
- {...props}
358
- />
359
- )
360
- })
361
- SidebarInput.displayName = "SidebarInput"
362
-
363
- const SidebarHeader = React.forwardRef<
364
- HTMLDivElement,
365
- React.ComponentProps<"div">
366
- >(({ className, ...props }, ref) => {
367
- return (
368
- <div
369
- ref={ref}
370
- data-sidebar="header"
371
- className={cn("flex flex-col gap-2 p-2", className)}
372
- {...props}
373
- />
374
- )
375
- })
376
- SidebarHeader.displayName = "SidebarHeader"
377
-
378
- const SidebarFooter = React.forwardRef<
379
- HTMLDivElement,
380
- React.ComponentProps<"div">
381
- >(({ className, ...props }, ref) => {
382
- return (
383
- <div
384
- ref={ref}
385
- data-sidebar="footer"
386
- className={cn("flex flex-col gap-2 p-2", className)}
387
- {...props}
388
- />
389
- )
390
- })
391
- SidebarFooter.displayName = "SidebarFooter"
392
-
393
- const SidebarSeparator = React.forwardRef<
394
- React.ElementRef<typeof Separator>,
395
- React.ComponentProps<typeof Separator>
396
- >(({ className, ...props }, ref) => {
397
- return (
398
- <Separator
399
- ref={ref}
400
- data-sidebar="separator"
401
- className={cn("mx-2 w-auto bg-sidebar-border", className)}
402
- {...props}
403
- />
404
- )
405
- })
406
- SidebarSeparator.displayName = "SidebarSeparator"
407
-
408
- const SidebarContent = React.forwardRef<
409
- HTMLDivElement,
410
- React.ComponentProps<"div">
411
- >(({ className, ...props }, ref) => {
412
- return (
413
- <div
414
- ref={ref}
415
- data-sidebar="content"
416
- className={cn(
417
- "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
418
- className
419
- )}
420
- {...props}
421
- />
422
- )
423
- })
424
- SidebarContent.displayName = "SidebarContent"
425
-
426
- const SidebarGroup = React.forwardRef<
427
- HTMLDivElement,
428
- React.ComponentProps<"div">
429
- >(({ className, ...props }, ref) => {
430
- return (
431
- <div
432
- ref={ref}
433
- data-sidebar="group"
434
- className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
435
- {...props}
436
- />
437
- )
438
- })
439
- SidebarGroup.displayName = "SidebarGroup"
440
-
441
- const SidebarGroupLabel = React.forwardRef<
442
- HTMLDivElement,
443
- React.ComponentProps<"div"> & { asChild?: boolean }
444
- >(({ className, asChild = false, ...props }, ref) => {
445
- const Comp = asChild ? Slot : "div"
446
-
447
- return (
448
- <Comp
449
- ref={ref}
450
- data-sidebar="group-label"
451
- className={cn(
452
- "flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
453
- "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
454
- className
455
- )}
456
- {...props}
457
- />
458
- )
459
- })
460
- SidebarGroupLabel.displayName = "SidebarGroupLabel"
461
-
462
- const SidebarGroupAction = React.forwardRef<
463
- HTMLButtonElement,
464
- React.ComponentProps<"button"> & { asChild?: boolean }
465
- >(({ className, asChild = false, ...props }, ref) => {
466
- const Comp = asChild ? Slot : "button"
467
-
468
- return (
469
- <Comp
470
- ref={ref}
471
- data-sidebar="group-action"
472
- className={cn(
473
- "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
474
- // Increases the hit area of the button on mobile.
475
- "after:absolute after:-inset-2 after:md:hidden",
476
- "group-data-[collapsible=icon]:hidden",
477
- className
478
- )}
479
- {...props}
480
- />
481
- )
482
- })
483
- SidebarGroupAction.displayName = "SidebarGroupAction"
484
-
485
- const SidebarGroupContent = React.forwardRef<
486
- HTMLDivElement,
487
- React.ComponentProps<"div">
488
- >(({ className, ...props }, ref) => (
489
- <div
490
- ref={ref}
491
- data-sidebar="group-content"
492
- className={cn("w-full text-sm", className)}
493
- {...props}
494
- />
495
- ))
496
- SidebarGroupContent.displayName = "SidebarGroupContent"
497
-
498
- const SidebarMenu = React.forwardRef<
499
- HTMLUListElement,
500
- React.ComponentProps<"ul">
501
- >(({ className, ...props }, ref) => (
502
- <ul
503
- ref={ref}
504
- data-sidebar="menu"
505
- className={cn("flex w-full min-w-0 flex-col gap-1", className)}
506
- {...props}
507
- />
508
- ))
509
- SidebarMenu.displayName = "SidebarMenu"
510
-
511
- const SidebarMenuItem = React.forwardRef<
512
- HTMLLIElement,
513
- React.ComponentProps<"li">
514
- >(({ className, ...props }, ref) => (
515
- <li
516
- ref={ref}
517
- data-sidebar="menu-item"
518
- className={cn("group/menu-item relative", className)}
519
- {...props}
520
- />
521
- ))
522
- SidebarMenuItem.displayName = "SidebarMenuItem"
523
-
524
- const sidebarMenuButtonVariants = cva(
525
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
526
- {
527
- variants: {
528
- variant: {
529
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
530
- outline:
531
- "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
532
- },
533
- size: {
534
- default: "h-8 text-sm",
535
- sm: "h-7 text-xs",
536
- lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
537
- },
538
- },
539
- defaultVariants: {
540
- variant: "default",
541
- size: "default",
542
- },
543
- }
544
- )
545
-
546
- const SidebarMenuButton = React.forwardRef<
547
- HTMLButtonElement,
548
- React.ComponentProps<"button"> & {
549
- asChild?: boolean
550
- isActive?: boolean
551
- tooltip?: string | React.ComponentProps<typeof TooltipContent>
552
- } & VariantProps<typeof sidebarMenuButtonVariants>
553
- >(
554
- (
555
- {
556
- asChild = false,
557
- isActive = false,
558
- variant = "default",
559
- size = "default",
560
- tooltip,
561
- className,
562
- ...props
563
- },
564
- ref
565
- ) => {
566
- const Comp = asChild ? Slot : "button"
567
- const { isMobile, state } = useSidebar()
568
-
569
- const button = (
570
- <Comp
571
- ref={ref}
572
- data-sidebar="menu-button"
573
- data-size={size}
574
- data-active={isActive}
575
- className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
576
- {...props}
577
- />
578
- )
579
-
580
- if (!tooltip) {
581
- return button
582
- }
583
-
584
- if (typeof tooltip === "string") {
585
- tooltip = {
586
- children: tooltip,
587
- }
588
- }
589
-
590
- return (
591
- <Tooltip>
592
- <TooltipTrigger asChild>{button}</TooltipTrigger>
593
- <TooltipContent
594
- side="right"
595
- align="center"
596
- hidden={state !== "collapsed" || isMobile}
597
- {...tooltip}
598
- />
599
- </Tooltip>
600
- )
601
- }
602
- )
603
- SidebarMenuButton.displayName = "SidebarMenuButton"
604
-
605
- const SidebarMenuAction = React.forwardRef<
606
- HTMLButtonElement,
607
- React.ComponentProps<"button"> & {
608
- asChild?: boolean
609
- showOnHover?: boolean
610
- }
611
- >(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
612
- const Comp = asChild ? Slot : "button"
613
-
614
- return (
615
- <Comp
616
- ref={ref}
617
- data-sidebar="menu-action"
618
- className={cn(
619
- "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
620
- // Increases the hit area of the button on mobile.
621
- "after:absolute after:-inset-2 after:md:hidden",
622
- "peer-data-[size=sm]/menu-button:top-1",
623
- "peer-data-[size=default]/menu-button:top-1.5",
624
- "peer-data-[size=lg]/menu-button:top-2.5",
625
- "group-data-[collapsible=icon]:hidden",
626
- showOnHover &&
627
- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
628
- className
629
- )}
630
- {...props}
631
- />
632
- )
633
- })
634
- SidebarMenuAction.displayName = "SidebarMenuAction"
635
-
636
- const SidebarMenuBadge = React.forwardRef<
637
- HTMLDivElement,
638
- React.ComponentProps<"div">
639
- >(({ className, ...props }, ref) => (
640
- <div
641
- ref={ref}
642
- data-sidebar="menu-badge"
643
- className={cn(
644
- "pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground",
645
- "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
646
- "peer-data-[size=sm]/menu-button:top-1",
647
- "peer-data-[size=default]/menu-button:top-1.5",
648
- "peer-data-[size=lg]/menu-button:top-2.5",
649
- "group-data-[collapsible=icon]:hidden",
650
- className
651
- )}
652
- {...props}
653
- />
654
- ))
655
- SidebarMenuBadge.displayName = "SidebarMenuBadge"
656
-
657
- const SidebarMenuSkeleton = React.forwardRef<
658
- HTMLDivElement,
659
- React.ComponentProps<"div"> & {
660
- showIcon?: boolean
661
- }
662
- >(({ className, showIcon = false, ...props }, ref) => {
663
- // Random width between 50 to 90%.
664
- const width = React.useMemo(() => {
665
- return `${Math.floor(Math.random() * 40) + 50}%`
666
- }, [])
667
-
668
- return (
669
- <div
670
- ref={ref}
671
- data-sidebar="menu-skeleton"
672
- className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
673
- {...props}
674
- >
675
- {showIcon && (
676
- <Skeleton
677
- className="size-4 rounded-md"
678
- data-sidebar="menu-skeleton-icon"
679
- />
680
- )}
681
- <Skeleton
682
- className="h-4 max-w-[--skeleton-width] flex-1"
683
- data-sidebar="menu-skeleton-text"
684
- style={
685
- {
686
- "--skeleton-width": width,
687
- } as React.CSSProperties
688
- }
689
- />
690
- </div>
691
- )
692
- })
693
- SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton"
694
-
695
- const SidebarMenuSub = React.forwardRef<
696
- HTMLUListElement,
697
- React.ComponentProps<"ul">
698
- >(({ className, ...props }, ref) => (
699
- <ul
700
- ref={ref}
701
- data-sidebar="menu-sub"
702
- className={cn(
703
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
704
- "group-data-[collapsible=icon]:hidden",
705
- className
706
- )}
707
- {...props}
708
- />
709
- ))
710
- SidebarMenuSub.displayName = "SidebarMenuSub"
711
-
712
- const SidebarMenuSubItem = React.forwardRef<
713
- HTMLLIElement,
714
- React.ComponentProps<"li">
715
- >(({ ...props }, ref) => <li ref={ref} {...props} />)
716
- SidebarMenuSubItem.displayName = "SidebarMenuSubItem"
717
-
718
- const SidebarMenuSubButton = React.forwardRef<
719
- HTMLAnchorElement,
720
- React.ComponentProps<"a"> & {
721
- asChild?: boolean
722
- size?: "sm" | "md"
723
- isActive?: boolean
724
- }
725
- >(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
726
- const Comp = asChild ? Slot : "a"
727
-
728
- return (
729
- <Comp
730
- ref={ref}
731
- data-sidebar="menu-sub-button"
732
- data-size={size}
733
- data-active={isActive}
734
- className={cn(
735
- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
736
- "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
737
- size === "sm" && "text-xs",
738
- size === "md" && "text-sm",
739
- "group-data-[collapsible=icon]:hidden",
740
- className
741
- )}
742
- {...props}
743
- />
744
- )
745
- })
746
- SidebarMenuSubButton.displayName = "SidebarMenuSubButton"
747
-
748
- export {
749
- Sidebar,
750
- SidebarContent,
751
- SidebarFooter,
752
- SidebarGroup,
753
- SidebarGroupAction,
754
- SidebarGroupContent,
755
- SidebarGroupLabel,
756
- SidebarHeader,
757
- SidebarInput,
758
- SidebarInset,
759
- SidebarMenu,
760
- SidebarMenuAction,
761
- SidebarMenuBadge,
762
- SidebarMenuButton,
763
- SidebarMenuItem,
764
- SidebarMenuSkeleton,
765
- SidebarMenuSub,
766
- SidebarMenuSubButton,
767
- SidebarMenuSubItem,
768
- SidebarProvider,
769
- SidebarRail,
770
- SidebarSeparator,
771
- SidebarTrigger,
772
- useSidebar,
773
- }