@m5kdev/web-ui 0.7.0 → 0.8.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.
- package/dist/src/animations/card.motion.d.ts +7 -2
- package/dist/src/animations/card.motion.js +25 -6
- package/dist/src/animations/card.motion.js.map +1 -0
- package/dist/src/components/AvatarUpload.d.ts +14 -5
- package/dist/src/components/AvatarUpload.js +105 -63
- package/dist/src/components/AvatarUpload.js.map +1 -0
- package/dist/src/components/Button.d.ts +14 -4
- package/dist/src/components/Button.js +13 -4
- package/dist/src/components/Button.js.map +1 -0
- package/dist/src/components/Calendar.d.ts +33 -31
- package/dist/src/components/Calendar.js +14 -6
- package/dist/src/components/Calendar.js.map +1 -0
- package/dist/src/components/{Calendar.css → Calendar2.css} +757 -684
- package/dist/src/components/CardsSelect.d.ts +25 -21
- package/dist/src/components/CardsSelect.js +75 -42
- package/dist/src/components/CardsSelect.js.map +1 -0
- package/dist/src/components/CollapsibleSidebarMenuItem.d.ts +22 -9
- package/dist/src/components/CollapsibleSidebarMenuItem.js +31 -8
- package/dist/src/components/CollapsibleSidebarMenuItem.js.map +1 -0
- package/dist/src/components/ColorPicker.d.ts +15 -4
- package/dist/src/components/ColorPicker.js +46 -16
- package/dist/src/components/ColorPicker.js.map +1 -0
- package/dist/src/components/CopyButton.d.ts +18 -6
- package/dist/src/components/CopyButton.js +28 -19
- package/dist/src/components/CopyButton.js.map +1 -0
- package/dist/src/components/CropDialog.d.ts +20 -8
- package/dist/src/components/CropDialog.js +108 -62
- package/dist/src/components/CropDialog.js.map +1 -0
- package/dist/src/components/DialogProvider.d.ts +22 -14
- package/dist/src/components/DialogProvider.js +67 -45
- package/dist/src/components/DialogProvider.js.map +1 -0
- package/dist/src/components/ErrorFallback.d.ts +13 -4
- package/dist/src/components/ErrorFallback.js +29 -4
- package/dist/src/components/ErrorFallback.js.map +1 -0
- package/dist/src/components/FileDropzone.d.ts +12 -4
- package/dist/src/components/FileDropzone.js +98 -60
- package/dist/src/components/FileDropzone.js.map +1 -0
- package/dist/src/components/MultiSelectDropdown.d.ts +25 -22
- package/dist/src/components/MultiSelectDropdown.js +99 -49
- package/dist/src/components/MultiSelectDropdown.js.map +1 -0
- package/dist/src/components/Orb.d.ts +17 -6
- package/dist/src/components/Orb.js +263 -255
- package/dist/src/components/Orb.js.map +1 -0
- package/dist/src/components/PageAlert.d.ts +20 -15
- package/dist/src/components/PageAlert.js +67 -39
- package/dist/src/components/PageAlert.js.map +1 -0
- package/dist/src/components/SelectChips.d.ts +21 -10
- package/dist/src/components/SelectChips.js +21 -9
- package/dist/src/components/SelectChips.js.map +1 -0
- package/dist/src/components/SidebarItem.d.ts +18 -7
- package/dist/src/components/SidebarItem.js +16 -4
- package/dist/src/components/SidebarItem.js.map +1 -0
- package/dist/src/components/Steps.d.ts +21 -16
- package/dist/src/components/Steps.js +193 -27
- package/dist/src/components/Steps.js.map +1 -0
- package/dist/src/components/TablerIconPicker.d.ts +13 -2
- package/dist/src/components/TablerIconPicker.js +4254 -4234
- package/dist/src/components/TablerIconPicker.js.map +1 -0
- package/dist/src/components/app-header.d.ts +14 -6
- package/dist/src/components/app-header.js +27 -6
- package/dist/src/components/app-header.js.map +1 -0
- package/dist/src/components/blur-card.d.ts +25 -11
- package/dist/src/components/blur-card.js +134 -31
- package/dist/src/components/blur-card.js.map +1 -0
- package/dist/src/components/features-section-demo-1.d.ts +22 -6
- package/dist/src/components/features-section-demo-1.js +119 -47
- package/dist/src/components/features-section-demo-1.js.map +1 -0
- package/dist/src/components/features-section-demo-2.d.ts +7 -1
- package/dist/src/components/features-section-demo-2.js +80 -49
- package/dist/src/components/features-section-demo-2.js.map +1 -0
- package/dist/src/components/features-section-demo-3.d.ts +16 -8
- package/dist/src/components/features-section-demo-3.js +239 -103
- package/dist/src/components/features-section-demo-3.js.map +1 -0
- package/dist/src/components/mode-toggle.d.ts +7 -1
- package/dist/src/components/mode-toggle.js +42 -7
- package/dist/src/components/mode-toggle.js.map +1 -0
- package/dist/src/components/nav-main.d.ts +20 -12
- package/dist/src/components/nav-main.js +31 -5
- package/dist/src/components/nav-main.js.map +1 -0
- package/dist/src/components/pricing-cards.d.ts +7 -1
- package/dist/src/components/pricing-cards.js +125 -24
- package/dist/src/components/pricing-cards.js.map +1 -0
- package/dist/src/components/shared/ButtonCopy.d.ts +17 -6
- package/dist/src/components/shared/ButtonCopy.js +31 -20
- package/dist/src/components/shared/ButtonCopy.js.map +1 -0
- package/dist/src/components/team-switcher.d.ts +16 -8
- package/dist/src/components/team-switcher.js +70 -8
- package/dist/src/components/team-switcher.js.map +1 -0
- package/dist/src/components/theme-provider.d.ts +18 -8
- package/dist/src/components/theme-provider.js +42 -38
- package/dist/src/components/theme-provider.js.map +1 -0
- package/dist/src/components/typewriter.d.ts +35 -14
- package/dist/src/components/typewriter.js +45 -36
- package/dist/src/components/typewriter.js.map +1 -0
- package/dist/src/components/ui/alert-dialog.d.ts +48 -13
- package/dist/src/components/ui/alert-dialog.js +58 -15
- package/dist/src/components/ui/alert-dialog.js.map +1 -0
- package/dist/src/components/ui/alert.d.ts +24 -8
- package/dist/src/components/ui/alert.js +28 -15
- package/dist/src/components/ui/alert.js.map +1 -0
- package/dist/src/components/ui/avatar.d.ts +9 -5
- package/dist/src/components/ui/avatar.js +23 -7
- package/dist/src/components/ui/avatar.js.map +1 -0
- package/dist/src/components/ui/badge.d.ts +17 -8
- package/dist/src/components/ui/badge.js +17 -14
- package/dist/src/components/ui/badge.js.map +1 -0
- package/dist/src/components/ui/bento-grid.d.ts +26 -11
- package/dist/src/components/ui/bento-grid.js +30 -6
- package/dist/src/components/ui/bento-grid.js.map +1 -0
- package/dist/src/components/ui/bento-grid2.d.ts +30 -14
- package/dist/src/components/ui/bento-grid2.js +45 -9
- package/dist/src/components/ui/bento-grid2.js.map +1 -0
- package/dist/src/components/ui/breadcrumb.d.ts +27 -15
- package/dist/src/components/ui/breadcrumb.js +54 -14
- package/dist/src/components/ui/breadcrumb.js.map +1 -0
- package/dist/src/components/ui/button.d.ts +14 -9
- package/dist/src/components/ui/button.js +37 -26
- package/dist/src/components/ui/button.js.map +1 -0
- package/dist/src/components/ui/card.d.ts +12 -8
- package/dist/src/components/ui/card.js +38 -10
- package/dist/src/components/ui/card.js.map +1 -0
- package/dist/src/components/ui/checkbox.d.ts +6 -2
- package/dist/src/components/ui/checkbox.js +17 -5
- package/dist/src/components/ui/checkbox.js.map +1 -0
- package/dist/src/components/ui/collapsible.d.ts +9 -4
- package/dist/src/components/ui/collapsible.js +5 -1
- package/dist/src/components/ui/collapsible.js.map +1 -0
- package/dist/src/components/ui/dialog.d.ts +44 -12
- package/dist/src/components/ui/dialog.js +64 -14
- package/dist/src/components/ui/dialog.js.map +1 -0
- package/dist/src/components/ui/dropdown-menu.d.ts +32 -24
- package/dist/src/components/ui/dropdown-menu.js +64 -14
- package/dist/src/components/ui/dropdown-menu.js.map +1 -0
- package/dist/src/components/ui/floating-navbar.d.ts +18 -9
- package/dist/src/components/ui/floating-navbar.js +49 -35
- package/dist/src/components/ui/floating-navbar.js.map +1 -0
- package/dist/src/components/ui/form.d.ts +30 -21
- package/dist/src/components/ui/form.js +76 -44
- package/dist/src/components/ui/form.js.map +1 -0
- package/dist/src/components/ui/image.d.ts +6 -2
- package/dist/src/components/ui/image.js +51 -11
- package/dist/src/components/ui/image.js.map +1 -0
- package/dist/src/components/ui/input.d.ts +6 -2
- package/dist/src/components/ui/input.js +14 -5
- package/dist/src/components/ui/input.js.map +1 -0
- package/dist/src/components/ui/label.d.ts +8 -3
- package/dist/src/components/ui/label.js +13 -5
- package/dist/src/components/ui/label.js.map +1 -0
- package/dist/src/components/ui/pagination.d.ts +39 -12
- package/dist/src/components/ui/pagination.js +64 -14
- package/dist/src/components/ui/pagination.js.map +1 -0
- package/dist/src/components/ui/progress.d.ts +6 -2
- package/dist/src/components/ui/progress.js +16 -4
- package/dist/src/components/ui/progress.js.map +1 -0
- package/dist/src/components/ui/resizable-navbar.d.ts +84 -43
- package/dist/src/components/ui/resizable-navbar.js +126 -74
- package/dist/src/components/ui/resizable-navbar.js.map +1 -0
- package/dist/src/components/ui/segment-control.d.ts +10 -7
- package/dist/src/components/ui/segment-control.js +83 -38
- package/dist/src/components/ui/segment-control.js.map +1 -0
- package/dist/src/components/ui/select.d.ts +16 -12
- package/dist/src/components/ui/select.js +63 -14
- package/dist/src/components/ui/select.js.map +1 -0
- package/dist/src/components/ui/separator.d.ts +6 -2
- package/dist/src/components/ui/separator.js +14 -4
- package/dist/src/components/ui/separator.js.map +1 -0
- package/dist/src/components/ui/sheet.d.ts +30 -19
- package/dist/src/components/ui/sheet.js +52 -23
- package/dist/src/components/ui/sheet.js.map +1 -0
- package/dist/src/components/ui/sidebar.d.ts +69 -62
- package/dist/src/components/ui/sidebar.js +326 -171
- package/dist/src/components/ui/sidebar.js.map +1 -0
- package/dist/src/components/ui/skeleton.d.ts +9 -1
- package/dist/src/components/ui/skeleton.js +10 -3
- package/dist/src/components/ui/skeleton.js.map +1 -0
- package/dist/src/components/ui/slider.d.ts +6 -2
- package/dist/src/components/ui/slider.js +16 -4
- package/dist/src/components/ui/slider.js.map +1 -0
- package/dist/src/components/ui/sonner.d.ts +10 -3
- package/dist/src/components/ui/sonner.js +18 -11
- package/dist/src/components/ui/sonner.js.map +1 -0
- package/dist/src/components/ui/spinner.d.ts +21 -10
- package/dist/src/components/ui/spinner.js +24 -24
- package/dist/src/components/ui/spinner.js.map +1 -0
- package/dist/src/components/ui/switch.d.ts +6 -2
- package/dist/src/components/ui/switch.js +13 -4
- package/dist/src/components/ui/switch.js.map +1 -0
- package/dist/src/components/ui/table.d.ts +39 -10
- package/dist/src/components/ui/table.js +51 -11
- package/dist/src/components/ui/table.js.map +1 -0
- package/dist/src/components/ui/tabs.d.ts +23 -6
- package/dist/src/components/ui/tabs.js +27 -7
- package/dist/src/components/ui/tabs.js.map +1 -0
- package/dist/src/components/ui/textarea.d.ts +10 -2
- package/dist/src/components/ui/textarea.js +11 -3
- package/dist/src/components/ui/textarea.js.map +1 -0
- package/dist/src/components/ui/timeline.d.ts +16 -9
- package/dist/src/components/ui/timeline.js +87 -24
- package/dist/src/components/ui/timeline.js.map +1 -0
- package/dist/src/components/ui/toast.d.ts +19 -14
- package/dist/src/components/ui/toast.js +48 -22
- package/dist/src/components/ui/toast.js.map +1 -0
- package/dist/src/components/ui/tooltip.d.ts +23 -6
- package/dist/src/components/ui/tooltip.js +27 -7
- package/dist/src/components/ui/tooltip.js.map +1 -0
- package/dist/src/components/ui/typewriter-effect.d.ts +28 -14
- package/dist/src/components/ui/typewriter-effect.js +102 -72
- package/dist/src/components/ui/typewriter-effect.js.map +1 -0
- package/dist/src/hooks/use-mobile.d.ts +5 -1
- package/dist/src/hooks/use-mobile.js +18 -13
- package/dist/src/hooks/use-mobile.js.map +1 -0
- package/dist/src/hooks/useDialog.d.ts +8 -4
- package/dist/src/hooks/useDialog.js +24 -20
- package/dist/src/hooks/useDialog.js.map +1 -0
- package/dist/src/icons/GoogleIcon.d.ts +9 -5
- package/dist/src/icons/GoogleIcon.js +32 -3
- package/dist/src/icons/GoogleIcon.js.map +1 -0
- package/dist/src/icons/LinkedInIcon.d.ts +9 -5
- package/dist/src/icons/LinkedInIcon.js +27 -3
- package/dist/src/icons/LinkedInIcon.js.map +1 -0
- package/dist/src/icons/MicrosoftIcon.d.ts +9 -5
- package/dist/src/icons/MicrosoftIcon.js +31 -3
- package/dist/src/icons/MicrosoftIcon.js.map +1 -0
- package/dist/src/lib/chatwoot.d.ts +19 -10
- package/dist/src/lib/chatwoot.js +25 -27
- package/dist/src/lib/chatwoot.js.map +1 -0
- package/dist/src/lib/utils.d.ts +7 -2
- package/dist/src/lib/utils.js +7 -2
- package/dist/src/lib/utils.js.map +1 -0
- package/dist/src/modules/app/components/AppLoader.d.ts +8 -2
- package/dist/src/modules/app/components/AppLoader.js +14 -3
- package/dist/src/modules/app/components/AppLoader.js.map +1 -0
- package/dist/src/modules/app/components/AppShell.d.ts +15 -6
- package/dist/src/modules/app/components/AppShell.js +14 -5
- package/dist/src/modules/app/components/AppShell.js.map +1 -0
- package/dist/src/modules/app/components/AppSidebar.d.ts +16 -6
- package/dist/src/modules/app/components/AppSidebar.js +17 -4
- package/dist/src/modules/app/components/AppSidebar.js.map +1 -0
- package/dist/src/modules/app/components/AppSidebarContent.d.ts +22 -13
- package/dist/src/modules/app/components/AppSidebarContent.js +34 -5
- package/dist/src/modules/app/components/AppSidebarContent.js.map +1 -0
- package/dist/src/modules/app/components/AppSidebarHeader.d.ts +18 -8
- package/dist/src/modules/app/components/AppSidebarHeader.js +37 -6
- package/dist/src/modules/app/components/AppSidebarHeader.js.map +1 -0
- package/dist/src/modules/app/components/AppSidebarInvites.d.ts +11 -3
- package/dist/src/modules/app/components/AppSidebarInvites.js +39 -8
- package/dist/src/modules/app/components/AppSidebarInvites.js.map +1 -0
- package/dist/src/modules/app/components/AppSidebarUser.d.ts +20 -10
- package/dist/src/modules/app/components/AppSidebarUser.js +121 -12
- package/dist/src/modules/app/components/AppSidebarUser.js.map +1 -0
- package/dist/src/modules/auth/components/AdminUserManagement.d.ts +11 -4
- package/dist/src/modules/auth/components/AdminUserManagement.js +970 -418
- package/dist/src/modules/auth/components/AdminUserManagement.js.map +1 -0
- package/dist/src/modules/auth/components/AdminWaitlist.d.ts +11 -4
- package/dist/src/modules/auth/components/AdminWaitlist.js +284 -115
- package/dist/src/modules/auth/components/AdminWaitlist.js.map +1 -0
- package/dist/src/modules/auth/components/AuthLayout.d.ts +12 -4
- package/dist/src/modules/auth/components/AuthLayout.js +17 -3
- package/dist/src/modules/auth/components/AuthLayout.js.map +1 -0
- package/dist/src/modules/auth/components/AuthProviders.d.ts +17 -6
- package/dist/src/modules/auth/components/AuthProviders.js +80 -41
- package/dist/src/modules/auth/components/AuthProviders.js.map +1 -0
- package/dist/src/modules/auth/components/AuthRouter.d.ts +16 -7
- package/dist/src/modules/auth/components/AuthRouter.js +46 -10
- package/dist/src/modules/auth/components/AuthRouter.js.map +1 -0
- package/dist/src/modules/auth/components/ClaimAccountRoute.d.ts +12 -4
- package/dist/src/modules/auth/components/ClaimAccountRoute.js +202 -139
- package/dist/src/modules/auth/components/ClaimAccountRoute.js.map +1 -0
- package/dist/src/modules/auth/components/ErrorAuthRoute.d.ts +7 -1
- package/dist/src/modules/auth/components/ErrorAuthRoute.js +125 -89
- package/dist/src/modules/auth/components/ErrorAuthRoute.js.map +1 -0
- package/dist/src/modules/auth/components/ForgotPasswordForm.d.ts +7 -1
- package/dist/src/modules/auth/components/ForgotPasswordForm.js +49 -23
- package/dist/src/modules/auth/components/ForgotPasswordForm.js.map +1 -0
- package/dist/src/modules/auth/components/ForgotPasswordRoute.d.ts +7 -1
- package/dist/src/modules/auth/components/ForgotPasswordRoute.js +34 -6
- package/dist/src/modules/auth/components/ForgotPasswordRoute.js.map +1 -0
- package/dist/src/modules/auth/components/InviteFriends.d.ts +12 -4
- package/dist/src/modules/auth/components/InviteFriends.js +275 -69
- package/dist/src/modules/auth/components/InviteFriends.js.map +1 -0
- package/dist/src/modules/auth/components/LastUsedBadge.d.ts +17 -5
- package/dist/src/modules/auth/components/LastUsedBadge.js +16 -6
- package/dist/src/modules/auth/components/LastUsedBadge.js.map +1 -0
- package/dist/src/modules/auth/components/LoginForm.d.ts +11 -3
- package/dist/src/modules/auth/components/LoginForm.js +107 -40
- package/dist/src/modules/auth/components/LoginForm.js.map +1 -0
- package/dist/src/modules/auth/components/LoginRoute.d.ts +11 -3
- package/dist/src/modules/auth/components/LoginRoute.js +41 -8
- package/dist/src/modules/auth/components/LoginRoute.js.map +1 -0
- package/dist/src/modules/auth/components/LogoutRoute.d.ts +7 -1
- package/dist/src/modules/auth/components/LogoutRoute.js +18 -12
- package/dist/src/modules/auth/components/LogoutRoute.js.map +1 -0
- package/dist/src/modules/auth/components/OrganizationAcceptInvitationRoute.d.ts +21 -8
- package/dist/src/modules/auth/components/OrganizationAcceptInvitationRoute.js +107 -97
- package/dist/src/modules/auth/components/OrganizationAcceptInvitationRoute.js.map +1 -0
- package/dist/src/modules/auth/components/OrganizationMembersRoute.d.ts +58 -48
- package/dist/src/modules/auth/components/OrganizationMembersRoute.js +448 -349
- package/dist/src/modules/auth/components/OrganizationMembersRoute.js.map +1 -0
- package/dist/src/modules/auth/components/OrganizationPreferences.d.ts +27 -16
- package/dist/src/modules/auth/components/OrganizationPreferences.js +129 -124
- package/dist/src/modules/auth/components/OrganizationPreferences.js.map +1 -0
- package/dist/src/modules/auth/components/OrganizationSettingsRoute.d.ts +27 -18
- package/dist/src/modules/auth/components/OrganizationSettingsRoute.js +184 -144
- package/dist/src/modules/auth/components/OrganizationSettingsRoute.js.map +1 -0
- package/dist/src/modules/auth/components/OrganizationSwitcher.d.ts +17 -6
- package/dist/src/modules/auth/components/OrganizationSwitcher.js +91 -69
- package/dist/src/modules/auth/components/OrganizationSwitcher.js.map +1 -0
- package/dist/src/modules/auth/components/PreferencesEditor.d.ts +44 -33
- package/dist/src/modules/auth/components/PreferencesEditor.js +82 -58
- package/dist/src/modules/auth/components/PreferencesEditor.js.map +1 -0
- package/dist/src/modules/auth/components/ProfileRoute.d.ts +7 -1
- package/dist/src/modules/auth/components/ProfileRoute.js +79 -36
- package/dist/src/modules/auth/components/ProfileRoute.js.map +1 -0
- package/dist/src/modules/auth/components/RangeNuqsDatePicker.d.ts +44 -30
- package/dist/src/modules/auth/components/RangeNuqsDatePicker.js +234 -242
- package/dist/src/modules/auth/components/RangeNuqsDatePicker.js.map +1 -0
- package/dist/src/modules/auth/components/ResetPasswordForm.d.ts +7 -1
- package/dist/src/modules/auth/components/ResetPasswordForm.js +97 -35
- package/dist/src/modules/auth/components/ResetPasswordForm.js.map +1 -0
- package/dist/src/modules/auth/components/ResetPasswordRoute.d.ts +7 -1
- package/dist/src/modules/auth/components/ResetPasswordRoute.js +34 -6
- package/dist/src/modules/auth/components/ResetPasswordRoute.js.map +1 -0
- package/dist/src/modules/auth/components/SignupFormRoute.d.ts +15 -5
- package/dist/src/modules/auth/components/SignupFormRoute.js +142 -99
- package/dist/src/modules/auth/components/SignupFormRoute.js.map +1 -0
- package/dist/src/modules/auth/components/SignupRoute.d.ts +13 -5
- package/dist/src/modules/auth/components/SignupRoute.js +59 -13
- package/dist/src/modules/auth/components/SignupRoute.js.map +1 -0
- package/dist/src/modules/auth/components/UserPreferences.d.ts +22 -11
- package/dist/src/modules/auth/components/UserPreferences.js +24 -12
- package/dist/src/modules/auth/components/UserPreferences.js.map +1 -0
- package/dist/src/modules/auth/components/WaitlistCard.d.ts +11 -4
- package/dist/src/modules/auth/components/WaitlistCard.js +63 -28
- package/dist/src/modules/auth/components/WaitlistCard.js.map +1 -0
- package/dist/src/modules/auth/components/WaitlistCodeValidation.d.ts +13 -5
- package/dist/src/modules/auth/components/WaitlistCodeValidation.js +42 -40
- package/dist/src/modules/auth/components/WaitlistCodeValidation.js.map +1 -0
- package/dist/src/modules/billing/components/BillingBetaPage.d.ts +15 -6
- package/dist/src/modules/billing/components/BillingBetaPage.js +155 -8
- package/dist/src/modules/billing/components/BillingBetaPage.js.map +1 -0
- package/dist/src/modules/billing/components/BillingInvoicePage.d.ts +13 -5
- package/dist/src/modules/billing/components/BillingInvoicePage.js +160 -30
- package/dist/src/modules/billing/components/BillingInvoicePage.js.map +1 -0
- package/dist/src/modules/billing/components/BillingPlanSelect.d.ts +11 -4
- package/dist/src/modules/billing/components/BillingPlanSelect.js +10 -7
- package/dist/src/modules/billing/components/BillingPlanSelect.js.map +1 -0
- package/dist/src/modules/billing/components/BillingRouter.d.ts +15 -7
- package/dist/src/modules/billing/components/BillingRouter.js +19 -6
- package/dist/src/modules/billing/components/BillingRouter.js.map +1 -0
- package/dist/src/modules/billing/components/BillingSinglePlanSelect.d.ts +17 -7
- package/dist/src/modules/billing/components/BillingSinglePlanSelect.js +163 -42
- package/dist/src/modules/billing/components/BillingSinglePlanSelect.js.map +1 -0
- package/dist/src/modules/table/components/ColumnOrderAndVisibility.d.ts +18 -8
- package/dist/src/modules/table/components/ColumnOrderAndVisibility.js +81 -38
- package/dist/src/modules/table/components/ColumnOrderAndVisibility.js.map +1 -0
- package/dist/src/modules/table/components/NuqsTable.d.ts +33 -21
- package/dist/src/modules/table/components/NuqsTable.js +295 -221
- package/dist/src/modules/table/components/NuqsTable.js.map +1 -0
- package/dist/src/modules/table/components/TableFiltering.d.ts +33 -21
- package/dist/src/modules/table/components/TableFiltering.js +408 -226
- package/dist/src/modules/table/components/TableFiltering.js.map +1 -0
- package/dist/src/modules/table/components/TableGroupBy.d.ts +18 -8
- package/dist/src/modules/table/components/TableGroupBy.js +56 -16
- package/dist/src/modules/table/components/TableGroupBy.js.map +1 -0
- package/dist/src/modules/table/components/TablePagination.d.ts +17 -7
- package/dist/src/modules/table/components/TablePagination.js +64 -32
- package/dist/src/modules/table/components/TablePagination.js.map +1 -0
- package/dist/src/modules/table/components/table.types.d.ts +15 -10
- package/dist/src/modules/table/components/table.types.js +0 -1
- package/dist/src/modules/table/filterTransformers.d.ts +35 -30
- package/dist/src/modules/table/filterTransformers.js +198 -261
- package/dist/src/modules/table/filterTransformers.js.map +1 -0
- package/dist/src/types.d.ts +8 -3
- package/dist/src/types.js +0 -1
- package/package.json +8 -6
- package/dist/translations/en/web-ui.json +0 -209
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
|
@@ -1,359 +1,458 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Card, CardBody, CardHeader, Chip, Input, Select, SelectItem, Spinner, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, } from "@heroui/react";
|
|
3
|
-
import { authClient } from "@m5kdev/frontend/modules/auth/auth.lib";
|
|
4
|
-
import { useSession } from "@m5kdev/frontend/modules/auth/hooks/useSession";
|
|
5
|
-
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { Copy, Trash2, UserPlus, Users } from "lucide-react";
|
|
7
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { Button, Card, CardBody, CardHeader, Chip, Input, Select, SelectItem, Spinner, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from "@heroui/react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Copy, Trash2, UserPlus, Users } from "lucide-react";
|
|
8
5
|
import { useTranslation } from "react-i18next";
|
|
9
6
|
import { toast } from "sonner";
|
|
10
|
-
|
|
7
|
+
import { authClient } from "@m5kdev/frontend/modules/auth/auth.lib";
|
|
8
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
import { useSession } from "@m5kdev/frontend/modules/auth/hooks/useSession";
|
|
10
|
+
//#region src/modules/auth/components/OrganizationMembersRoute.tsx
|
|
11
|
+
const ORGANIZATION_ROLES = [
|
|
12
|
+
"member",
|
|
13
|
+
"admin",
|
|
14
|
+
"owner"
|
|
15
|
+
];
|
|
11
16
|
function isOrganizationRole(role) {
|
|
12
|
-
|
|
17
|
+
return ORGANIZATION_ROLES.includes(role);
|
|
13
18
|
}
|
|
14
19
|
function OrganizationStateCard({ title, message }) {
|
|
15
|
-
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "p-6",
|
|
22
|
+
children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
23
|
+
className: "text-lg font-semibold",
|
|
24
|
+
children: title
|
|
25
|
+
}), /* @__PURE__ */ jsx(CardBody, { children: message })] })
|
|
26
|
+
});
|
|
16
27
|
}
|
|
17
|
-
function useOrganizationAccess({ managerRoles, onInvalidateScopedQueries
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
activeOrganizationId,
|
|
44
|
-
activeOrganizationRole,
|
|
45
|
-
canManageOrganization,
|
|
46
|
-
refreshOrganizationQueries,
|
|
47
|
-
};
|
|
28
|
+
function useOrganizationAccess({ managerRoles, onInvalidateScopedQueries }) {
|
|
29
|
+
const { data: session, registerSession } = useSession();
|
|
30
|
+
const queryClient = useQueryClient();
|
|
31
|
+
const activeOrganizationId = session?.session.activeOrganizationId ?? "";
|
|
32
|
+
const activeOrganizationRole = (session?.session)?.activeOrganizationRole ?? "";
|
|
33
|
+
return {
|
|
34
|
+
activeOrganizationId,
|
|
35
|
+
activeOrganizationRole,
|
|
36
|
+
canManageOrganization: useMemo(() => new Set(managerRoles ?? ["admin", "owner"]), [managerRoles]).has(activeOrganizationRole),
|
|
37
|
+
refreshOrganizationQueries: useCallback(async () => {
|
|
38
|
+
await Promise.allSettled([
|
|
39
|
+
queryClient.invalidateQueries({ queryKey: ["auth-organization-list"] }),
|
|
40
|
+
queryClient.invalidateQueries({ queryKey: ["auth-organization-details", activeOrganizationId] }),
|
|
41
|
+
queryClient.invalidateQueries({ queryKey: ["auth-organization-members", activeOrganizationId] }),
|
|
42
|
+
queryClient.invalidateQueries({ queryKey: ["auth-organization-invitations", activeOrganizationId] })
|
|
43
|
+
]);
|
|
44
|
+
registerSession(() => {
|
|
45
|
+
onInvalidateScopedQueries?.();
|
|
46
|
+
});
|
|
47
|
+
}, [
|
|
48
|
+
activeOrganizationId,
|
|
49
|
+
onInvalidateScopedQueries,
|
|
50
|
+
queryClient,
|
|
51
|
+
registerSession
|
|
52
|
+
])
|
|
53
|
+
};
|
|
48
54
|
}
|
|
49
|
-
function useOrganizationConfig({ assignableRoles
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
resolvedRoleLabels: translatedRoleLabels,
|
|
101
|
-
resolvedAssignableRoles,
|
|
102
|
-
};
|
|
55
|
+
function useOrganizationConfig({ assignableRoles }) {
|
|
56
|
+
const { t } = useTranslation();
|
|
57
|
+
return {
|
|
58
|
+
resolvedLabels: useMemo(() => ({
|
|
59
|
+
loadError: t("web-ui:organization.members.loadError"),
|
|
60
|
+
membersTitle: t("web-ui:organization.members.title"),
|
|
61
|
+
membersNoActive: t("web-ui:organization.members.noActive"),
|
|
62
|
+
membersManageOnly: t("web-ui:organization.members.manageOnly"),
|
|
63
|
+
membersDescription: (organizationName) => t("web-ui:organization.members.description", { name: organizationName }),
|
|
64
|
+
defaultOrganizationName: t("web-ui:organization.members.defaultName"),
|
|
65
|
+
loadMembersError: t("web-ui:organization.members.loadMembersError"),
|
|
66
|
+
loadInvitationsError: t("web-ui:organization.members.loadInvitationsError"),
|
|
67
|
+
roleUpdateSuccess: t("web-ui:organization.members.roleUpdateSuccess"),
|
|
68
|
+
roleUpdateError: t("web-ui:organization.members.roleUpdateError"),
|
|
69
|
+
removeMemberSuccess: t("web-ui:organization.members.removeMemberSuccess"),
|
|
70
|
+
removeMemberError: t("web-ui:organization.members.removeMemberError"),
|
|
71
|
+
emailRequired: t("web-ui:organization.members.emailRequired"),
|
|
72
|
+
inviteSuccess: t("web-ui:organization.members.inviteSuccess"),
|
|
73
|
+
inviteError: t("web-ui:organization.members.inviteError"),
|
|
74
|
+
cancelInvitationSuccess: t("web-ui:organization.members.cancelInvitationSuccess"),
|
|
75
|
+
cancelInvitationError: t("web-ui:organization.members.cancelInvitationError"),
|
|
76
|
+
inviteLinkCopied: t("web-ui:organization.members.inviteLinkCopied"),
|
|
77
|
+
copyInviteLinkError: t("web-ui:organization.members.copyInviteLinkError"),
|
|
78
|
+
unknownName: t("web-ui:organization.members.unknownName"),
|
|
79
|
+
invitedUser: t("web-ui:organization.members.invitedUser"),
|
|
80
|
+
emailLabel: t("web-ui:organization.members.emailLabel"),
|
|
81
|
+
emailPlaceholder: t("web-ui:organization.members.emailPlaceholder"),
|
|
82
|
+
roleLabel: t("web-ui:organization.members.roleLabel"),
|
|
83
|
+
inviteButton: t("web-ui:organization.members.inviteButton"),
|
|
84
|
+
tableTitle: t("web-ui:organization.members.tableTitle"),
|
|
85
|
+
columnName: t("web-ui:organization.members.columnName"),
|
|
86
|
+
columnEmail: t("web-ui:organization.members.columnEmail"),
|
|
87
|
+
columnRole: t("web-ui:organization.members.columnRole"),
|
|
88
|
+
columnStatus: t("web-ui:organization.members.columnStatus"),
|
|
89
|
+
columnActions: t("web-ui:organization.members.columnActions"),
|
|
90
|
+
tableEmpty: t("web-ui:organization.members.tableEmpty"),
|
|
91
|
+
roleFor: (name) => t("web-ui:organization.members.roleFor", { name }),
|
|
92
|
+
statusActive: t("web-ui:organization.members.statusActive"),
|
|
93
|
+
statusInvited: t("web-ui:organization.members.statusInvited"),
|
|
94
|
+
removeMember: t("web-ui:organization.members.removeMember"),
|
|
95
|
+
copyInviteLink: t("web-ui:organization.members.copyInviteLink"),
|
|
96
|
+
cancelInvitation: t("web-ui:organization.members.cancelInvitation"),
|
|
97
|
+
roleUnknown: t("web-ui:organization.members.roleUnknown")
|
|
98
|
+
}), [t]),
|
|
99
|
+
resolvedRoleLabels: useMemo(() => ({
|
|
100
|
+
member: t("web-ui:organization.roles.member"),
|
|
101
|
+
admin: t("web-ui:organization.roles.admin"),
|
|
102
|
+
owner: t("web-ui:organization.roles.owner")
|
|
103
|
+
}), [t]),
|
|
104
|
+
resolvedAssignableRoles: useMemo(() => assignableRoles && assignableRoles.length > 0 ? assignableRoles : [...ORGANIZATION_ROLES], [assignableRoles])
|
|
105
|
+
};
|
|
103
106
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
107
|
+
function OrganizationMembersRoute({ managerRoles, assignableRoles, invitationAcceptPath, onInvalidateScopedQueries }) {
|
|
108
|
+
const { resolvedLabels, resolvedRoleLabels, resolvedAssignableRoles } = useOrganizationConfig({ assignableRoles });
|
|
109
|
+
const { activeOrganizationId, activeOrganizationRole, canManageOrganization, refreshOrganizationQueries } = useOrganizationAccess({
|
|
110
|
+
managerRoles,
|
|
111
|
+
onInvalidateScopedQueries
|
|
112
|
+
});
|
|
113
|
+
const [inviteEmail, setInviteEmail] = useState("");
|
|
114
|
+
const [inviteRole, setInviteRole] = useState(resolvedAssignableRoles[0] ?? "member");
|
|
115
|
+
const isMountedRef = useRef(true);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
return () => {
|
|
118
|
+
isMountedRef.current = false;
|
|
119
|
+
};
|
|
120
|
+
}, []);
|
|
121
|
+
const refreshOrganizationQueriesStable = useCallback(() => refreshOrganizationQueries(), [refreshOrganizationQueries]);
|
|
122
|
+
const updateRoleMutation = useMutation({
|
|
123
|
+
mutationFn: async ({ memberId, role, organizationId }) => {
|
|
124
|
+
const { error } = await authClient.organization.updateMemberRole({
|
|
125
|
+
memberId,
|
|
126
|
+
role,
|
|
127
|
+
organizationId
|
|
128
|
+
});
|
|
129
|
+
if (error) throw new Error(error.message ?? resolvedLabels.roleUpdateError);
|
|
130
|
+
},
|
|
131
|
+
onSuccess: async () => {
|
|
132
|
+
await refreshOrganizationQueriesStable();
|
|
133
|
+
toast.success(resolvedLabels.roleUpdateSuccess);
|
|
134
|
+
},
|
|
135
|
+
onError: (error) => {
|
|
136
|
+
toast.error(error instanceof Error ? error.message : resolvedLabels.roleUpdateError);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const removeMemberMutation = useMutation({
|
|
140
|
+
mutationFn: async ({ memberId, organizationId }) => {
|
|
141
|
+
const { error } = await authClient.organization.removeMember({
|
|
142
|
+
memberIdOrEmail: memberId,
|
|
143
|
+
organizationId
|
|
144
|
+
});
|
|
145
|
+
if (error) throw new Error(error.message ?? resolvedLabels.removeMemberError);
|
|
146
|
+
},
|
|
147
|
+
onSuccess: async () => {
|
|
148
|
+
await refreshOrganizationQueriesStable();
|
|
149
|
+
toast.success(resolvedLabels.removeMemberSuccess);
|
|
150
|
+
},
|
|
151
|
+
onError: (error) => {
|
|
152
|
+
toast.error(error instanceof Error ? error.message : resolvedLabels.removeMemberError);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const createInvitationMutation = useMutation({
|
|
156
|
+
mutationFn: async ({ email, role, organizationId }) => {
|
|
157
|
+
const { error } = await authClient.organization.inviteMember({
|
|
158
|
+
organizationId,
|
|
159
|
+
email: email.trim(),
|
|
160
|
+
role
|
|
161
|
+
});
|
|
162
|
+
if (error) throw new Error(error.message ?? resolvedLabels.inviteError);
|
|
163
|
+
},
|
|
164
|
+
onSuccess: async () => {
|
|
165
|
+
await refreshOrganizationQueriesStable();
|
|
166
|
+
toast.success(resolvedLabels.inviteSuccess);
|
|
167
|
+
if (isMountedRef.current) {
|
|
168
|
+
setInviteEmail("");
|
|
169
|
+
setInviteRole(resolvedAssignableRoles[0] ?? "member");
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
onError: (error) => {
|
|
173
|
+
toast.error(error instanceof Error ? error.message : resolvedLabels.inviteError);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
const cancelInvitationMutation = useMutation({
|
|
177
|
+
mutationFn: async ({ invitationId }) => {
|
|
178
|
+
const { error } = await authClient.organization.cancelInvitation({ invitationId });
|
|
179
|
+
if (error) throw new Error(error.message ?? resolvedLabels.cancelInvitationError);
|
|
180
|
+
},
|
|
181
|
+
onSuccess: async () => {
|
|
182
|
+
await refreshOrganizationQueriesStable();
|
|
183
|
+
toast.success(resolvedLabels.cancelInvitationSuccess);
|
|
184
|
+
},
|
|
185
|
+
onError: (error) => {
|
|
186
|
+
toast.error(error instanceof Error ? error.message : resolvedLabels.cancelInvitationError);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const updatingMemberId = updateRoleMutation.isPending && updateRoleMutation.variables ? updateRoleMutation.variables.memberId : null;
|
|
190
|
+
const removingMemberId = removeMemberMutation.isPending && removeMemberMutation.variables ? removeMemberMutation.variables.memberId : null;
|
|
191
|
+
const cancelingInvitationId = cancelInvitationMutation.isPending && cancelInvitationMutation.variables ? cancelInvitationMutation.variables.invitationId : null;
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
if (!resolvedAssignableRoles.includes(inviteRole)) setInviteRole(resolvedAssignableRoles[0] ?? "member");
|
|
194
|
+
}, [inviteRole, resolvedAssignableRoles]);
|
|
195
|
+
const organizationQuery = useQuery({
|
|
196
|
+
queryKey: ["auth-organization-details", activeOrganizationId],
|
|
197
|
+
enabled: Boolean(activeOrganizationId && canManageOrganization),
|
|
198
|
+
queryFn: async () => {
|
|
199
|
+
const { data, error } = await authClient.organization.getFullOrganization({ query: {
|
|
200
|
+
organizationId: activeOrganizationId,
|
|
201
|
+
membersLimit: 200
|
|
202
|
+
} });
|
|
203
|
+
if (error) throw new Error(error.message ?? resolvedLabels.loadError);
|
|
204
|
+
return data;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const membersQuery = useQuery({
|
|
208
|
+
queryKey: ["auth-organization-members", activeOrganizationId],
|
|
209
|
+
enabled: Boolean(activeOrganizationId && canManageOrganization),
|
|
210
|
+
queryFn: async () => {
|
|
211
|
+
const { data, error } = await authClient.organization.listMembers({ query: {
|
|
212
|
+
organizationId: activeOrganizationId,
|
|
213
|
+
limit: 200,
|
|
214
|
+
offset: 0
|
|
215
|
+
} });
|
|
216
|
+
if (error) throw new Error(error.message ?? resolvedLabels.loadMembersError);
|
|
217
|
+
return data?.members ?? [];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
const invitationsQuery = useQuery({
|
|
221
|
+
queryKey: ["auth-organization-invitations", activeOrganizationId],
|
|
222
|
+
enabled: Boolean(activeOrganizationId && canManageOrganization),
|
|
223
|
+
queryFn: async () => {
|
|
224
|
+
const { data, error } = await authClient.organization.listInvitations({ query: { organizationId: activeOrganizationId } });
|
|
225
|
+
if (error) throw new Error(error.message ?? resolvedLabels.loadInvitationsError);
|
|
226
|
+
return data ?? [];
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
const members = membersQuery.data ?? [];
|
|
230
|
+
const invitations = invitationsQuery.data ?? [];
|
|
231
|
+
const rows = useMemo(() => {
|
|
232
|
+
const memberRows = members.map((member) => ({
|
|
233
|
+
kind: "member",
|
|
234
|
+
id: `member-${member.id}`,
|
|
235
|
+
displayName: member.user?.name || resolvedLabels.unknownName,
|
|
236
|
+
email: member.user?.email || "-",
|
|
237
|
+
role: member.role,
|
|
238
|
+
status: "active",
|
|
239
|
+
memberId: member.id
|
|
240
|
+
}));
|
|
241
|
+
const invitationRows = invitations.map((invitation) => ({
|
|
242
|
+
kind: "invitation",
|
|
243
|
+
id: `invitation-${invitation.id}`,
|
|
244
|
+
displayName: resolvedLabels.invitedUser,
|
|
245
|
+
email: invitation.email,
|
|
246
|
+
role: invitation.role,
|
|
247
|
+
status: "invited",
|
|
248
|
+
invitationId: invitation.id
|
|
249
|
+
}));
|
|
250
|
+
return [...memberRows, ...invitationRows].sort((left, right) => {
|
|
251
|
+
if (left.status === right.status) return left.email.localeCompare(right.email);
|
|
252
|
+
return left.status === "active" ? -1 : 1;
|
|
253
|
+
});
|
|
254
|
+
}, [
|
|
255
|
+
invitations,
|
|
256
|
+
members,
|
|
257
|
+
resolvedLabels.invitedUser,
|
|
258
|
+
resolvedLabels.unknownName
|
|
259
|
+
]);
|
|
260
|
+
const onUpdateMemberRole = useCallback((memberId, role) => {
|
|
261
|
+
if (!canManageOrganization || !activeOrganizationId) return;
|
|
262
|
+
updateRoleMutation.mutate({
|
|
263
|
+
memberId,
|
|
264
|
+
role,
|
|
265
|
+
organizationId: activeOrganizationId
|
|
266
|
+
});
|
|
267
|
+
}, [
|
|
268
|
+
canManageOrganization,
|
|
269
|
+
activeOrganizationId,
|
|
270
|
+
updateRoleMutation
|
|
271
|
+
]);
|
|
272
|
+
const onRemoveMember = useCallback((memberId) => {
|
|
273
|
+
if (!canManageOrganization || !activeOrganizationId) return;
|
|
274
|
+
removeMemberMutation.mutate({
|
|
275
|
+
memberId,
|
|
276
|
+
organizationId: activeOrganizationId
|
|
277
|
+
});
|
|
278
|
+
}, [
|
|
279
|
+
canManageOrganization,
|
|
280
|
+
activeOrganizationId,
|
|
281
|
+
removeMemberMutation
|
|
282
|
+
]);
|
|
283
|
+
const onCreateInvitation = useCallback(() => {
|
|
284
|
+
if (!canManageOrganization || !activeOrganizationId) return;
|
|
285
|
+
if (!inviteEmail.trim()) {
|
|
286
|
+
toast.error(resolvedLabels.emailRequired);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
createInvitationMutation.mutate({
|
|
290
|
+
email: inviteEmail,
|
|
291
|
+
role: inviteRole,
|
|
292
|
+
organizationId: activeOrganizationId
|
|
293
|
+
});
|
|
294
|
+
}, [
|
|
295
|
+
canManageOrganization,
|
|
296
|
+
activeOrganizationId,
|
|
297
|
+
inviteEmail,
|
|
298
|
+
inviteRole,
|
|
299
|
+
resolvedLabels.emailRequired,
|
|
300
|
+
createInvitationMutation
|
|
301
|
+
]);
|
|
302
|
+
const onCancelInvitation = useCallback((invitationId) => {
|
|
303
|
+
if (!canManageOrganization) return;
|
|
304
|
+
cancelInvitationMutation.mutate({ invitationId });
|
|
305
|
+
}, [canManageOrganization, cancelInvitationMutation]);
|
|
306
|
+
const invitationLinkBase = useMemo(() => {
|
|
307
|
+
const invitationPath = invitationAcceptPath ?? "/organization/accept-invitation";
|
|
308
|
+
if (/^https?:\/\//i.test(invitationPath)) return `${invitationPath}?id=`;
|
|
309
|
+
return typeof window === "undefined" ? `${invitationPath}?id=` : `${window.location.origin}${invitationPath}?id=`;
|
|
310
|
+
}, [invitationAcceptPath]);
|
|
311
|
+
const onCopyInvitationLink = async (invitationId) => {
|
|
312
|
+
try {
|
|
313
|
+
await navigator.clipboard.writeText(`${invitationLinkBase}${invitationId}`);
|
|
314
|
+
toast.success(resolvedLabels.inviteLinkCopied);
|
|
315
|
+
} catch {
|
|
316
|
+
toast.error(resolvedLabels.copyInviteLinkError);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const getRoleLabel = (role) => resolvedRoleLabels[role] ?? resolvedLabels.roleUnknown;
|
|
320
|
+
if (!activeOrganizationId) return /* @__PURE__ */ jsx(OrganizationStateCard, {
|
|
321
|
+
title: resolvedLabels.membersTitle,
|
|
322
|
+
message: resolvedLabels.membersNoActive
|
|
323
|
+
});
|
|
324
|
+
if (!canManageOrganization) return /* @__PURE__ */ jsx(OrganizationStateCard, {
|
|
325
|
+
title: resolvedLabels.membersTitle,
|
|
326
|
+
message: resolvedLabels.membersManageOnly
|
|
327
|
+
});
|
|
328
|
+
if (organizationQuery.isLoading || membersQuery.isLoading || invitationsQuery.isLoading) return /* @__PURE__ */ jsx("div", {
|
|
329
|
+
className: "p-6 flex justify-center",
|
|
330
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
331
|
+
});
|
|
332
|
+
return /* @__PURE__ */ jsx("div", {
|
|
333
|
+
className: "p-6 space-y-6",
|
|
334
|
+
children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, {
|
|
335
|
+
className: "flex items-center justify-between",
|
|
336
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
337
|
+
className: "flex items-center gap-2",
|
|
338
|
+
children: [/* @__PURE__ */ jsx(Users, { className: "h-4 w-4" }), /* @__PURE__ */ jsxs("div", {
|
|
339
|
+
className: "flex flex-col",
|
|
340
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
341
|
+
className: "text-lg font-semibold",
|
|
342
|
+
children: resolvedLabels.membersTitle
|
|
343
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
344
|
+
className: "text-sm text-default-500",
|
|
345
|
+
children: resolvedLabels.membersDescription(organizationQuery.data?.name ?? resolvedLabels.defaultOrganizationName)
|
|
346
|
+
})]
|
|
347
|
+
})]
|
|
348
|
+
}), /* @__PURE__ */ jsx(Chip, {
|
|
349
|
+
variant: "flat",
|
|
350
|
+
color: "primary",
|
|
351
|
+
children: getRoleLabel(activeOrganizationRole || "member")
|
|
352
|
+
})]
|
|
353
|
+
}), /* @__PURE__ */ jsxs(CardBody, {
|
|
354
|
+
className: "space-y-4",
|
|
355
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
356
|
+
className: "grid gap-3 md:grid-cols-[1fr_160px_auto]",
|
|
357
|
+
children: [
|
|
358
|
+
/* @__PURE__ */ jsx(Input, {
|
|
359
|
+
type: "email",
|
|
360
|
+
label: resolvedLabels.emailLabel,
|
|
361
|
+
value: inviteEmail,
|
|
362
|
+
onValueChange: setInviteEmail,
|
|
363
|
+
placeholder: resolvedLabels.emailPlaceholder
|
|
364
|
+
}),
|
|
365
|
+
/* @__PURE__ */ jsx(Select, {
|
|
366
|
+
label: resolvedLabels.roleLabel,
|
|
367
|
+
selectedKeys: [inviteRole],
|
|
368
|
+
disallowEmptySelection: true,
|
|
369
|
+
onSelectionChange: (keys) => {
|
|
370
|
+
const role = Array.from(keys)[0];
|
|
371
|
+
if (role && isOrganizationRole(role) && resolvedAssignableRoles.includes(role)) setInviteRole(role);
|
|
372
|
+
},
|
|
373
|
+
children: resolvedAssignableRoles.map((role) => /* @__PURE__ */ jsx(SelectItem, { children: getRoleLabel(role) }, role))
|
|
374
|
+
}),
|
|
375
|
+
/* @__PURE__ */ jsx(Button, {
|
|
376
|
+
color: "primary",
|
|
377
|
+
startContent: /* @__PURE__ */ jsx(UserPlus, { className: "h-4 w-4" }),
|
|
378
|
+
onPress: onCreateInvitation,
|
|
379
|
+
isLoading: createInvitationMutation.isPending,
|
|
380
|
+
children: resolvedLabels.inviteButton
|
|
381
|
+
})
|
|
382
|
+
]
|
|
383
|
+
}), /* @__PURE__ */ jsxs(Table, {
|
|
384
|
+
"aria-label": resolvedLabels.tableTitle,
|
|
385
|
+
children: [/* @__PURE__ */ jsxs(TableHeader, { children: [
|
|
386
|
+
/* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnName }),
|
|
387
|
+
/* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnEmail }),
|
|
388
|
+
/* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnRole }),
|
|
389
|
+
/* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnStatus }),
|
|
390
|
+
/* @__PURE__ */ jsx(TableColumn, {
|
|
391
|
+
className: "text-right",
|
|
392
|
+
children: resolvedLabels.columnActions
|
|
393
|
+
})
|
|
394
|
+
] }), /* @__PURE__ */ jsx(TableBody, {
|
|
395
|
+
emptyContent: resolvedLabels.tableEmpty,
|
|
396
|
+
children: rows.map((row) => /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
397
|
+
/* @__PURE__ */ jsx(TableCell, { children: row.displayName }),
|
|
398
|
+
/* @__PURE__ */ jsx(TableCell, { children: row.email }),
|
|
399
|
+
/* @__PURE__ */ jsx(TableCell, { children: row.kind === "member" ? /* @__PURE__ */ jsx(Select, {
|
|
400
|
+
size: "sm",
|
|
401
|
+
selectedKeys: [row.role],
|
|
402
|
+
disallowEmptySelection: true,
|
|
403
|
+
isDisabled: updatingMemberId === row.memberId,
|
|
404
|
+
"aria-label": resolvedLabels.roleFor(row.displayName),
|
|
405
|
+
onSelectionChange: (keys) => {
|
|
406
|
+
const role = Array.from(keys)[0];
|
|
407
|
+
if (role && role !== row.role && isOrganizationRole(role) && resolvedAssignableRoles.includes(role)) onUpdateMemberRole(row.memberId, role);
|
|
408
|
+
},
|
|
409
|
+
children: resolvedAssignableRoles.map((role) => /* @__PURE__ */ jsx(SelectItem, { children: getRoleLabel(role) }, role))
|
|
410
|
+
}) : getRoleLabel(row.role) }),
|
|
411
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Chip, {
|
|
412
|
+
size: "sm",
|
|
413
|
+
variant: "flat",
|
|
414
|
+
color: row.status === "active" ? "success" : "warning",
|
|
415
|
+
children: row.status === "active" ? resolvedLabels.statusActive : resolvedLabels.statusInvited
|
|
416
|
+
}) }),
|
|
417
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
418
|
+
className: "text-right",
|
|
419
|
+
children: row.kind === "member" ? /* @__PURE__ */ jsx(Button, {
|
|
420
|
+
size: "sm",
|
|
421
|
+
color: "danger",
|
|
422
|
+
variant: "light",
|
|
423
|
+
isIconOnly: true,
|
|
424
|
+
onPress: () => void onRemoveMember(row.memberId),
|
|
425
|
+
isDisabled: removingMemberId === row.memberId,
|
|
426
|
+
"aria-label": resolvedLabels.removeMember,
|
|
427
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
428
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
429
|
+
className: "flex justify-end gap-2",
|
|
430
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
431
|
+
size: "sm",
|
|
432
|
+
variant: "light",
|
|
433
|
+
isIconOnly: true,
|
|
434
|
+
onPress: () => void onCopyInvitationLink(row.invitationId),
|
|
435
|
+
"aria-label": resolvedLabels.copyInviteLink,
|
|
436
|
+
children: /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
|
|
437
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
438
|
+
size: "sm",
|
|
439
|
+
color: "danger",
|
|
440
|
+
variant: "light",
|
|
441
|
+
isIconOnly: true,
|
|
442
|
+
onPress: () => void onCancelInvitation(row.invitationId),
|
|
443
|
+
isDisabled: cancelingInvitationId === row.invitationId,
|
|
444
|
+
"aria-label": resolvedLabels.cancelInvitation,
|
|
445
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
446
|
+
})]
|
|
447
|
+
})
|
|
448
|
+
})
|
|
449
|
+
] }, row.id))
|
|
450
|
+
})]
|
|
451
|
+
})]
|
|
452
|
+
})] })
|
|
453
|
+
});
|
|
359
454
|
}
|
|
455
|
+
//#endregion
|
|
456
|
+
export { OrganizationMembersRoute };
|
|
457
|
+
|
|
458
|
+
//# sourceMappingURL=OrganizationMembersRoute.js.map
|