nucleus-core-ts 0.8.6 → 0.8.8
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/client.js +1 -1
- package/dist/dist/index.d.ts +475 -12
- package/dist/fe/components/AbstractAnimatedBackground/index.js +437 -0
- package/dist/fe/components/AuthorizationPage/components/AuthorizationPage.js +841 -0
- package/dist/fe/components/AuthorizationPage/components/ClaimList.js +100 -0
- package/dist/fe/components/AuthorizationPage/components/RoleClaimEditor.js +232 -0
- package/dist/fe/components/AuthorizationPage/components/RoleList.js +115 -0
- package/dist/fe/components/AuthorizationPage/index.js +6 -0
- package/dist/fe/components/AuthorizationPage/store/index.js +117 -0
- package/dist/fe/components/AuthorizationPage/theme/index.js +137 -0
- package/dist/fe/components/AuthorizationPage/types/index.js +1 -0
- package/dist/fe/components/Button/components/Button.js +158 -0
- package/dist/fe/components/Button/components/ButtonSpinner.js +52 -0
- package/dist/fe/components/Button/index.js +3 -0
- package/dist/fe/components/Button/theme/index.js +186 -0
- package/dist/fe/components/Button/types/index.js +1 -0
- package/dist/fe/components/Button/utils/cn.js +5 -0
- package/dist/fe/components/Captcha/components/Captcha.js +311 -0
- package/dist/fe/components/Captcha/index.js +2 -0
- package/dist/fe/components/Captcha/theme.js +52 -0
- package/dist/fe/components/Captcha/types.js +1 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordForm.js +242 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordHeader.js +39 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordPage.js +60 -0
- package/dist/fe/components/ChangePasswordPage/index.js +5 -0
- package/dist/fe/components/ChangePasswordPage/store/index.js +44 -0
- package/dist/fe/components/ChangePasswordPage/theme/index.js +87 -0
- package/dist/fe/components/ChangePasswordPage/types/index.js +1 -0
- package/dist/fe/components/Checkbox/components/Checkbox.js +115 -0
- package/dist/fe/components/Checkbox/components/CheckboxIcon.js +119 -0
- package/dist/fe/components/Checkbox/components/SwitchTrack.js +178 -0
- package/dist/fe/components/Checkbox/index.js +4 -0
- package/dist/fe/components/Checkbox/theme/index.js +221 -0
- package/dist/fe/components/Checkbox/types/index.js +1 -0
- package/dist/fe/components/Checkbox/utils/cn.js +5 -0
- package/dist/fe/components/DataTable/DataTable.js +225 -0
- package/dist/fe/components/DataTable/components/ActionCell.js +26 -0
- package/dist/fe/components/DataTable/components/DataCell.js +76 -0
- package/dist/fe/components/DataTable/components/EditableCell.js +221 -0
- package/dist/fe/components/DataTable/components/EmptyState.js +29 -0
- package/dist/fe/components/DataTable/components/HeaderCell.js +64 -0
- package/dist/fe/components/DataTable/components/InfiniteScrollTrigger.js +66 -0
- package/dist/fe/components/DataTable/components/LoadingSpinner.js +19 -0
- package/dist/fe/components/DataTable/components/ResizeHandle.js +41 -0
- package/dist/fe/components/DataTable/components/SelectionCell.js +105 -0
- package/dist/fe/components/DataTable/components/SkeletonRow.js +56 -0
- package/dist/fe/components/DataTable/components/SkeletonTable.js +83 -0
- package/dist/fe/components/DataTable/components/SortIcon.js +39 -0
- package/dist/fe/components/DataTable/components/TableHeader.js +49 -0
- package/dist/fe/components/DataTable/components/TableRow.js +118 -0
- package/dist/fe/components/DataTable/components/index.js +14 -0
- package/dist/fe/components/DataTable/hooks/index.js +2 -0
- package/dist/fe/components/DataTable/hooks/useAutoFitColumn.js +23 -0
- package/dist/fe/components/DataTable/hooks/useResizeColumn.js +122 -0
- package/dist/fe/components/DataTable/index.js +3 -0
- package/dist/fe/components/DataTable/store/index.js +97 -0
- package/dist/fe/components/DataTable/theme/index.js +144 -0
- package/dist/fe/components/DataTable/types/index.js +1 -0
- package/dist/fe/components/DataTable/utils/cn.js +5 -0
- package/dist/fe/components/DatePicker/components/CalendarGrid.js +95 -0
- package/dist/fe/components/DatePicker/components/CalendarHeader.js +152 -0
- package/dist/fe/components/DatePicker/components/DatePicker.js +381 -0
- package/dist/fe/components/DatePicker/components/MonthYearSelector.js +93 -0
- package/dist/fe/components/DatePicker/index.js +7 -0
- package/dist/fe/components/DatePicker/locales/index.js +1113 -0
- package/dist/fe/components/DatePicker/theme/index.js +315 -0
- package/dist/fe/components/DatePicker/types/index.js +1 -0
- package/dist/fe/components/DatePicker/utils/cn.js +5 -0
- package/dist/fe/components/DatePicker/utils/date.js +132 -0
- package/dist/fe/components/DevicesPage/components/DeviceCard.js +251 -0
- package/dist/fe/components/DevicesPage/components/DevicesHeader.js +42 -0
- package/dist/fe/components/DevicesPage/components/DevicesPage.js +450 -0
- package/dist/fe/components/DevicesPage/index.js +5 -0
- package/dist/fe/components/DevicesPage/store/index.js +55 -0
- package/dist/fe/components/DevicesPage/theme/index.js +131 -0
- package/dist/fe/components/DevicesPage/types/index.js +1 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.js +214 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordHeader.js +42 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.js +59 -0
- package/dist/fe/components/ForgotPasswordPage/index.js +5 -0
- package/dist/fe/components/ForgotPasswordPage/store/index.js +28 -0
- package/dist/fe/components/ForgotPasswordPage/theme/index.js +87 -0
- package/dist/fe/components/ForgotPasswordPage/types/index.js +1 -0
- package/dist/fe/components/FormBuilder/components/FormBuilder.js +156 -0
- package/dist/fe/components/FormBuilder/components/FormField.js +218 -0
- package/dist/fe/components/FormBuilder/hooks/useFormBuilder.js +152 -0
- package/dist/fe/components/FormBuilder/index.js +4 -0
- package/dist/fe/components/FormBuilder/theme/index.js +134 -0
- package/dist/fe/components/FormBuilder/types/index.js +1 -0
- package/dist/fe/components/FormBuilder/utils/cn.js +5 -0
- package/dist/fe/components/FormBuilder/utils/fieldMapping.js +216 -0
- package/dist/fe/components/FormBuilder/utils/validation.js +78 -0
- package/dist/fe/components/LoginPage/components/LoginForm.js +214 -0
- package/dist/fe/components/LoginPage/components/LoginHeader.js +24 -0
- package/dist/fe/components/LoginPage/components/LoginPage.js +138 -0
- package/dist/fe/components/LoginPage/index.js +5 -0
- package/dist/fe/components/LoginPage/store/index.js +59 -0
- package/dist/fe/components/LoginPage/theme/index.js +98 -0
- package/dist/fe/components/LoginPage/types/index.js +1 -0
- package/dist/fe/components/MagicLinkVerifyPage/components/MagicLinkVerifyPage.js +200 -0
- package/dist/fe/components/MagicLinkVerifyPage/index.js +3 -0
- package/dist/fe/components/MagicLinkVerifyPage/store.js +20 -0
- package/dist/fe/components/MagicLinkVerifyPage/theme.js +36 -0
- package/dist/fe/components/MagicLinkVerifyPage/types.js +1 -0
- package/dist/fe/components/NucleusEntityShowcase.js +1409 -0
- package/dist/fe/components/NucleusTextInput/components/FloatingLabel.js +56 -0
- package/dist/fe/components/NucleusTextInput/components/InputIcons.js +258 -0
- package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.js +321 -0
- package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.js +104 -0
- package/dist/fe/components/NucleusTextInput/components/TypewriterText.js +56 -0
- package/dist/fe/components/NucleusTextInput/index.js +7 -0
- package/dist/fe/components/NucleusTextInput/theme/index.js +121 -0
- package/dist/fe/components/NucleusTextInput/types/index.js +1 -0
- package/dist/fe/components/NucleusTextInput/utils/cn.js +5 -0
- package/dist/fe/components/NucleusTextInput/utils/format.js +62 -0
- package/dist/fe/components/NucleusTextInput/utils/validation.js +191 -0
- package/dist/fe/components/ProfilePage/components/AddressCard.js +196 -0
- package/dist/fe/components/ProfilePage/components/PhoneCard.js +206 -0
- package/dist/fe/components/ProfilePage/components/ProfileHeader.js +150 -0
- package/dist/fe/components/ProfilePage/components/ProfilePage.js +1336 -0
- package/dist/fe/components/ProfilePage/index.js +6 -0
- package/dist/fe/components/ProfilePage/store/index.js +115 -0
- package/dist/fe/components/ProfilePage/theme/index.js +168 -0
- package/dist/fe/components/ProfilePage/types/index.js +1 -0
- package/dist/fe/components/RangePicker/components/RangePicker.js +338 -0
- package/dist/fe/components/RangePicker/components/RangeThumb.js +68 -0
- package/dist/fe/components/RangePicker/components/RangeTooltip.js +45 -0
- package/dist/fe/components/RangePicker/components/RangeTrack.js +32 -0
- package/dist/fe/components/RangePicker/index.js +5 -0
- package/dist/fe/components/RangePicker/theme/index.js +88 -0
- package/dist/fe/components/RangePicker/types/index.js +1 -0
- package/dist/fe/components/RangePicker/utils/cn.js +3 -0
- package/dist/fe/components/RegisterPage/components/PasswordStrengthIndicator.js +107 -0
- package/dist/fe/components/RegisterPage/components/RegisterForm.js +322 -0
- package/dist/fe/components/RegisterPage/components/RegisterHeader.js +23 -0
- package/dist/fe/components/RegisterPage/components/RegisterPage.js +85 -0
- package/dist/fe/components/RegisterPage/index.js +6 -0
- package/dist/fe/components/RegisterPage/store/index.js +106 -0
- package/dist/fe/components/RegisterPage/theme/index.js +128 -0
- package/dist/fe/components/RegisterPage/types/index.js +1 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.js +347 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordHeader.js +42 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.js +61 -0
- package/dist/fe/components/ResetPasswordPage/index.js +5 -0
- package/dist/fe/components/ResetPasswordPage/store/index.js +36 -0
- package/dist/fe/components/ResetPasswordPage/theme/index.js +99 -0
- package/dist/fe/components/ResetPasswordPage/types/index.js +1 -0
- package/dist/fe/components/SearchBox/components/SearchBox.js +271 -0
- package/dist/fe/components/SearchBox/components/SearchBoxDropdown.js +87 -0
- package/dist/fe/components/SearchBox/index.js +5 -0
- package/dist/fe/components/SearchBox/theme/index.js +184 -0
- package/dist/fe/components/SearchBox/types/index.js +1 -0
- package/dist/fe/components/SearchBox/utils/cn.js +5 -0
- package/dist/fe/components/SearchBox/utils/debounce.js +22 -0
- package/dist/fe/components/SearchBox/utils/sanitize.js +48 -0
- package/dist/fe/components/SelectBox/components/SelectBox.js +364 -0
- package/dist/fe/components/SelectBox/components/SelectDropdown.js +92 -0
- package/dist/fe/components/SelectBox/components/SelectOptionItem.js +43 -0
- package/dist/fe/components/SelectBox/components/SelectTrigger.js +22 -0
- package/dist/fe/components/SelectBox/index.js +5 -0
- package/dist/fe/components/SelectBox/theme/index.js +98 -0
- package/dist/fe/components/SelectBox/types/index.js +1 -0
- package/dist/fe/components/SelectBox/utils/cn.js +3 -0
- package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.js +107 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +142 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordHeader.js +23 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +263 -0
- package/dist/fe/components/SetPasswordPage/index.js +7 -0
- package/dist/fe/components/SetPasswordPage/store/index.js +79 -0
- package/dist/fe/components/SetPasswordPage/theme/index.js +98 -0
- package/dist/fe/components/SetPasswordPage/types/index.js +12 -0
- package/dist/fe/components/UsersPage/components/InviteUserModal.js +262 -0
- package/dist/fe/components/UsersPage/components/Pagination.js +147 -0
- package/dist/fe/components/UsersPage/components/RoleAssignmentModal.js +186 -0
- package/dist/fe/components/UsersPage/components/StatsCards.js +124 -0
- package/dist/fe/components/UsersPage/components/UserDetailDrawer.js +444 -0
- package/dist/fe/components/UsersPage/components/UserFilters.js +142 -0
- package/dist/fe/components/UsersPage/components/UserListItem.js +125 -0
- package/dist/fe/components/UsersPage/components/UserListSkeleton.js +40 -0
- package/dist/fe/components/UsersPage/components/UsersPage.js +556 -0
- package/dist/fe/components/UsersPage/index.js +10 -0
- package/dist/fe/components/UsersPage/store/index.js +151 -0
- package/dist/fe/components/UsersPage/theme/index.js +231 -0
- package/dist/fe/components/UsersPage/types/index.js +1 -0
- package/dist/fe/components/VerifyEmailPage/components/VerifyEmailPage.js +290 -0
- package/dist/fe/components/VerifyEmailPage/index.js +3 -0
- package/dist/fe/components/VerifyEmailPage/store/index.js +45 -0
- package/dist/fe/components/VerifyEmailPage/theme/index.js +52 -0
- package/dist/fe/components/VerifyEmailPage/types/index.js +1 -0
- package/dist/fe/hooks/useNucleusEntity.js +247 -0
- package/dist/fe/index.js +28 -110
- package/dist/fe/types/index.js +1 -0
- package/dist/fe/utils/cn.js +5 -0
- package/dist/fe/utils/columnUtils.js +189 -0
- package/dist/fe/utils/endpointKeys.js +44 -0
- package/dist/index.js +1 -1
- package/dist/nucleus.config.d.ts +3 -0
- package/dist/src/Client/Proxy/httpProxy.js +1 -0
- package/dist/src/Client/Proxy/index.js +1 -1
- package/dist/src/Client/Proxy/server.js +1 -0
- package/dist/src/Client/Proxy/types.js +1 -0
- package/dist/src/Client/Proxy/utils.js +1 -0
- package/dist/src/Client/Proxy/wsProxy.js +1 -0
- package/package.json +1 -1
- package/scripts/build.ts +78 -8
- package/dist/dist/index-0yyw12k6.d.ts +0 -8
- package/dist/dist/index-tv67j5qd.d.ts +0 -488
- package/dist/index-0yyw12k6.js +0 -1
- package/dist/index-tv67j5qd.js +0 -1
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "../../../utils/cn";
|
|
5
|
+
import { Button } from "../../Button";
|
|
6
|
+
import { RoleAssignmentModal } from "./RoleAssignmentModal";
|
|
7
|
+
export function UserDetailDrawer({ theme, user, roles, allUserRoles, isOpen, actionLoading, onClose, onVerifyEmail, onLockAccount, onUnlockAccount, onResetPassword, onSendMagicLink, onResendInvite, onAssignRole, onRemoveRole, hasPasswordReset = false, hasMagicLink = false, hasInvite = false }) {
|
|
8
|
+
const drawerRef = useRef(null);
|
|
9
|
+
const [isRoleModalOpen, setIsRoleModalOpen] = useState(false);
|
|
10
|
+
useEffect(()=>{
|
|
11
|
+
const handleEscape = (e)=>{
|
|
12
|
+
if (e.key === "Escape" && isOpen) {
|
|
13
|
+
onClose();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
document.addEventListener("keydown", handleEscape);
|
|
17
|
+
return ()=>document.removeEventListener("keydown", handleEscape);
|
|
18
|
+
}, [
|
|
19
|
+
isOpen,
|
|
20
|
+
onClose
|
|
21
|
+
]);
|
|
22
|
+
useEffect(()=>{
|
|
23
|
+
if (isOpen) {
|
|
24
|
+
document.body.style.overflow = "hidden";
|
|
25
|
+
} else {
|
|
26
|
+
document.body.style.overflow = "";
|
|
27
|
+
}
|
|
28
|
+
return ()=>{
|
|
29
|
+
document.body.style.overflow = "";
|
|
30
|
+
};
|
|
31
|
+
}, [
|
|
32
|
+
isOpen
|
|
33
|
+
]);
|
|
34
|
+
if (!user || !isOpen) return null;
|
|
35
|
+
const formatDate = (date)=>{
|
|
36
|
+
if (!date) return "Never";
|
|
37
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
38
|
+
return d.toLocaleDateString("en-US", {
|
|
39
|
+
year: "numeric",
|
|
40
|
+
month: "short",
|
|
41
|
+
day: "numeric",
|
|
42
|
+
hour: "2-digit",
|
|
43
|
+
minute: "2-digit"
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const getUserDisplayName = ()=>{
|
|
47
|
+
if (user.profile?.firstName || user.profile?.lastName) {
|
|
48
|
+
return `${user.profile.firstName || ""} ${user.profile.lastName || ""}`.trim();
|
|
49
|
+
}
|
|
50
|
+
return user.email.split("@")[0];
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ _jsx("div", {
|
|
55
|
+
className: cn(theme.detailPanel.overlay),
|
|
56
|
+
onClick: onClose,
|
|
57
|
+
"aria-hidden": "true"
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
60
|
+
ref: drawerRef,
|
|
61
|
+
className: cn(theme.detailPanel.wrapper.base, "lg:relative", theme.detailPanel.wrapper.mobile, "sm:rounded-t-2xl md:rounded-none", "md:fixed md:inset-y-0 md:right-0 md:w-[400px] md:rounded-l-2xl", "lg:static lg:w-full lg:rounded-xl"),
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
64
|
+
className: cn(theme.detailPanel.header.wrapper),
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
69
|
+
className: cn(theme.detailPanel.header.title),
|
|
70
|
+
children: getUserDisplayName()
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ _jsx("p", {
|
|
73
|
+
className: "text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",
|
|
74
|
+
children: user.email
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
79
|
+
variant: "ghost",
|
|
80
|
+
size: "sm",
|
|
81
|
+
onClick: onClose,
|
|
82
|
+
"aria-label": "Close panel",
|
|
83
|
+
iconOnly: true,
|
|
84
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
85
|
+
className: "w-5 h-5",
|
|
86
|
+
fill: "none",
|
|
87
|
+
stroke: "currentColor",
|
|
88
|
+
viewBox: "0 0 24 24",
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
91
|
+
strokeLinecap: "round",
|
|
92
|
+
strokeLinejoin: "round",
|
|
93
|
+
strokeWidth: 2,
|
|
94
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
101
|
+
className: cn(theme.detailPanel.content.wrapper),
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ _jsxs("section", {
|
|
104
|
+
className: cn(theme.detailPanel.content.section.wrapper),
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
107
|
+
className: cn(theme.detailPanel.content.section.title),
|
|
108
|
+
children: "Account Status"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
111
|
+
className: cn(theme.detailPanel.content.section.content),
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
114
|
+
className: cn(theme.detailPanel.content.row.wrapper),
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ _jsx("span", {
|
|
117
|
+
className: cn(theme.detailPanel.content.row.label),
|
|
118
|
+
children: "Status"
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ _jsx("span", {
|
|
121
|
+
className: cn("text-sm font-medium", user.isLocked ? "text-red-600 dark:text-red-400" : user.verifiedAt ? "text-emerald-600 dark:text-emerald-400" : "text-amber-600 dark:text-amber-400"),
|
|
122
|
+
children: user.isLocked ? "Locked" : user.verifiedAt ? "Active" : "Unverified"
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
127
|
+
className: cn(theme.detailPanel.content.row.wrapper),
|
|
128
|
+
children: [
|
|
129
|
+
/*#__PURE__*/ _jsx("span", {
|
|
130
|
+
className: cn(theme.detailPanel.content.row.label),
|
|
131
|
+
children: "Last Login"
|
|
132
|
+
}),
|
|
133
|
+
/*#__PURE__*/ _jsx("span", {
|
|
134
|
+
className: cn(theme.detailPanel.content.row.value),
|
|
135
|
+
children: formatDate(user.lastLoginAt)
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
140
|
+
className: cn(theme.detailPanel.content.row.wrapper),
|
|
141
|
+
children: [
|
|
142
|
+
/*#__PURE__*/ _jsx("span", {
|
|
143
|
+
className: cn(theme.detailPanel.content.row.label),
|
|
144
|
+
children: "Login Count"
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ _jsx("span", {
|
|
147
|
+
className: cn(theme.detailPanel.content.row.value),
|
|
148
|
+
children: user.loginCount || 0
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
}),
|
|
152
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
153
|
+
className: cn(theme.detailPanel.content.row.wrapper),
|
|
154
|
+
children: [
|
|
155
|
+
/*#__PURE__*/ _jsx("span", {
|
|
156
|
+
className: cn(theme.detailPanel.content.row.label),
|
|
157
|
+
children: "Created"
|
|
158
|
+
}),
|
|
159
|
+
/*#__PURE__*/ _jsx("span", {
|
|
160
|
+
className: cn(theme.detailPanel.content.row.value),
|
|
161
|
+
children: formatDate(user.createdAt)
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
}),
|
|
165
|
+
user.isLocked && user.lockedUntil && /*#__PURE__*/ _jsxs("div", {
|
|
166
|
+
className: cn(theme.detailPanel.content.row.wrapper),
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ _jsx("span", {
|
|
169
|
+
className: cn(theme.detailPanel.content.row.label),
|
|
170
|
+
children: "Locked Until"
|
|
171
|
+
}),
|
|
172
|
+
/*#__PURE__*/ _jsx("span", {
|
|
173
|
+
className: cn(theme.detailPanel.content.row.value),
|
|
174
|
+
children: formatDate(user.lockedUntil)
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
}),
|
|
182
|
+
user.profile && /*#__PURE__*/ _jsxs("section", {
|
|
183
|
+
className: cn(theme.detailPanel.content.section.wrapper),
|
|
184
|
+
children: [
|
|
185
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
186
|
+
className: cn(theme.detailPanel.content.section.title),
|
|
187
|
+
children: "Profile"
|
|
188
|
+
}),
|
|
189
|
+
/*#__PURE__*/ _jsx("div", {
|
|
190
|
+
className: cn(theme.detailPanel.content.section.content),
|
|
191
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
192
|
+
className: cn(theme.detailPanel.content.row.wrapper),
|
|
193
|
+
children: [
|
|
194
|
+
/*#__PURE__*/ _jsx("span", {
|
|
195
|
+
className: cn(theme.detailPanel.content.row.label),
|
|
196
|
+
children: "Name"
|
|
197
|
+
}),
|
|
198
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
199
|
+
className: cn(theme.detailPanel.content.row.value),
|
|
200
|
+
children: [
|
|
201
|
+
user.profile.firstName,
|
|
202
|
+
" ",
|
|
203
|
+
user.profile.lastName
|
|
204
|
+
]
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
}),
|
|
211
|
+
user.addresses && user.addresses.length > 0 && /*#__PURE__*/ _jsxs("section", {
|
|
212
|
+
className: cn(theme.detailPanel.content.section.wrapper),
|
|
213
|
+
children: [
|
|
214
|
+
/*#__PURE__*/ _jsxs("h3", {
|
|
215
|
+
className: cn(theme.detailPanel.content.section.title),
|
|
216
|
+
children: [
|
|
217
|
+
"Addresses (",
|
|
218
|
+
user.addresses.length,
|
|
219
|
+
")"
|
|
220
|
+
]
|
|
221
|
+
}),
|
|
222
|
+
/*#__PURE__*/ _jsx("div", {
|
|
223
|
+
className: "space-y-2",
|
|
224
|
+
children: user.addresses.map((addr)=>/*#__PURE__*/ _jsxs("div", {
|
|
225
|
+
className: cn(theme.detailPanel.content.section.content),
|
|
226
|
+
children: [
|
|
227
|
+
/*#__PURE__*/ _jsx("div", {
|
|
228
|
+
className: "text-sm font-medium text-zinc-900 dark:text-zinc-100",
|
|
229
|
+
children: addr.name || "Address"
|
|
230
|
+
}),
|
|
231
|
+
/*#__PURE__*/ _jsx("div", {
|
|
232
|
+
className: "text-sm text-zinc-500 dark:text-zinc-400",
|
|
233
|
+
children: [
|
|
234
|
+
addr.street,
|
|
235
|
+
addr.city,
|
|
236
|
+
addr.state,
|
|
237
|
+
addr.zip,
|
|
238
|
+
addr.country
|
|
239
|
+
].filter(Boolean).join(", ")
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
}, addr.id))
|
|
243
|
+
})
|
|
244
|
+
]
|
|
245
|
+
}),
|
|
246
|
+
user.phones && user.phones.length > 0 && /*#__PURE__*/ _jsxs("section", {
|
|
247
|
+
className: cn(theme.detailPanel.content.section.wrapper),
|
|
248
|
+
children: [
|
|
249
|
+
/*#__PURE__*/ _jsxs("h3", {
|
|
250
|
+
className: cn(theme.detailPanel.content.section.title),
|
|
251
|
+
children: [
|
|
252
|
+
"Phones (",
|
|
253
|
+
user.phones.length,
|
|
254
|
+
")"
|
|
255
|
+
]
|
|
256
|
+
}),
|
|
257
|
+
/*#__PURE__*/ _jsx("div", {
|
|
258
|
+
className: "space-y-2",
|
|
259
|
+
children: user.phones.map((phone)=>/*#__PURE__*/ _jsxs("div", {
|
|
260
|
+
className: cn(theme.detailPanel.content.section.content, "flex justify-between items-center"),
|
|
261
|
+
children: [
|
|
262
|
+
/*#__PURE__*/ _jsx("span", {
|
|
263
|
+
className: "text-sm text-zinc-500 dark:text-zinc-400",
|
|
264
|
+
children: phone.name || phone.type || "Phone"
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
267
|
+
className: "text-sm font-medium text-zinc-900 dark:text-zinc-100",
|
|
268
|
+
children: [
|
|
269
|
+
phone.countryCode,
|
|
270
|
+
" ",
|
|
271
|
+
phone.number
|
|
272
|
+
]
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
}, phone.id))
|
|
276
|
+
})
|
|
277
|
+
]
|
|
278
|
+
}),
|
|
279
|
+
user.files && user.files.length > 0 && /*#__PURE__*/ _jsxs("section", {
|
|
280
|
+
className: cn(theme.detailPanel.content.section.wrapper),
|
|
281
|
+
children: [
|
|
282
|
+
/*#__PURE__*/ _jsxs("h3", {
|
|
283
|
+
className: cn(theme.detailPanel.content.section.title),
|
|
284
|
+
children: [
|
|
285
|
+
"Files (",
|
|
286
|
+
user.files.length,
|
|
287
|
+
")"
|
|
288
|
+
]
|
|
289
|
+
}),
|
|
290
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
291
|
+
className: "space-y-2",
|
|
292
|
+
children: [
|
|
293
|
+
user.files.slice(0, 5).map((file)=>/*#__PURE__*/ _jsx("div", {
|
|
294
|
+
className: cn(theme.detailPanel.content.section.content, "flex justify-between items-center"),
|
|
295
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
296
|
+
className: "min-w-0 flex-1",
|
|
297
|
+
children: [
|
|
298
|
+
/*#__PURE__*/ _jsx("div", {
|
|
299
|
+
className: "text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",
|
|
300
|
+
children: file.originalName || file.name
|
|
301
|
+
}),
|
|
302
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
303
|
+
className: "text-xs text-zinc-500",
|
|
304
|
+
children: [
|
|
305
|
+
file.mimeType,
|
|
306
|
+
" • ",
|
|
307
|
+
Math.round((file.size || 0) / 1024),
|
|
308
|
+
"KB"
|
|
309
|
+
]
|
|
310
|
+
})
|
|
311
|
+
]
|
|
312
|
+
})
|
|
313
|
+
}, file.id)),
|
|
314
|
+
user.files.length > 5 && /*#__PURE__*/ _jsxs("div", {
|
|
315
|
+
className: "text-xs text-zinc-500 dark:text-zinc-400 text-center py-1",
|
|
316
|
+
children: [
|
|
317
|
+
"+",
|
|
318
|
+
user.files.length - 5,
|
|
319
|
+
" more files"
|
|
320
|
+
]
|
|
321
|
+
})
|
|
322
|
+
]
|
|
323
|
+
})
|
|
324
|
+
]
|
|
325
|
+
}),
|
|
326
|
+
/*#__PURE__*/ _jsxs("section", {
|
|
327
|
+
className: cn(theme.detailPanel.content.section.wrapper),
|
|
328
|
+
children: [
|
|
329
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
330
|
+
className: "flex items-center justify-between mb-3",
|
|
331
|
+
children: [
|
|
332
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
333
|
+
className: cn(theme.detailPanel.content.section.title, "mb-0"),
|
|
334
|
+
children: "Roles"
|
|
335
|
+
}),
|
|
336
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
337
|
+
variant: "ghost",
|
|
338
|
+
size: "xs",
|
|
339
|
+
onClick: ()=>setIsRoleModalOpen(true),
|
|
340
|
+
className: "text-blue-600 hover:text-blue-700 dark:text-blue-400",
|
|
341
|
+
children: "Manage"
|
|
342
|
+
})
|
|
343
|
+
]
|
|
344
|
+
}),
|
|
345
|
+
/*#__PURE__*/ _jsx("div", {
|
|
346
|
+
className: "flex flex-wrap gap-2",
|
|
347
|
+
children: user.userRoles && user.userRoles.length > 0 ? user.userRoles.map((ur)=>{
|
|
348
|
+
const role = roles.find((r)=>r.id === ur.roleId);
|
|
349
|
+
const isTempId = ur.id.startsWith("temp-");
|
|
350
|
+
return /*#__PURE__*/ _jsxs("span", {
|
|
351
|
+
className: cn("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium", isTempId ? "bg-zinc-100 dark:bg-zinc-800 text-zinc-500" : "bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"),
|
|
352
|
+
children: [
|
|
353
|
+
role?.name || "...",
|
|
354
|
+
role?.name === "godmin" && /*#__PURE__*/ _jsx("svg", {
|
|
355
|
+
className: "w-3 h-3 text-amber-500",
|
|
356
|
+
fill: "currentColor",
|
|
357
|
+
viewBox: "0 0 20 20",
|
|
358
|
+
"aria-hidden": "true",
|
|
359
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
360
|
+
fillRule: "evenodd",
|
|
361
|
+
d: "M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zM12 2a1 1 0 01.967.744L14.146 7.2 17.5 9.134a1 1 0 010 1.732l-3.354 1.935-1.18 4.455a1 1 0 01-1.933 0L9.854 12.8 6.5 10.866a1 1 0 010-1.732l3.354-1.935 1.18-4.455A1 1 0 0112 2z",
|
|
362
|
+
clipRule: "evenodd"
|
|
363
|
+
})
|
|
364
|
+
})
|
|
365
|
+
]
|
|
366
|
+
}, ur.id);
|
|
367
|
+
}) : /*#__PURE__*/ _jsx("span", {
|
|
368
|
+
className: "text-sm text-zinc-500 dark:text-zinc-400",
|
|
369
|
+
children: "No roles assigned"
|
|
370
|
+
})
|
|
371
|
+
})
|
|
372
|
+
]
|
|
373
|
+
}),
|
|
374
|
+
/*#__PURE__*/ _jsx(RoleAssignmentModal, {
|
|
375
|
+
isOpen: isRoleModalOpen,
|
|
376
|
+
roles: roles,
|
|
377
|
+
userRoles: allUserRoles,
|
|
378
|
+
userId: user.id,
|
|
379
|
+
onClose: ()=>setIsRoleModalOpen(false),
|
|
380
|
+
onAssignRole: onAssignRole,
|
|
381
|
+
onRemoveRole: onRemoveRole
|
|
382
|
+
})
|
|
383
|
+
]
|
|
384
|
+
}),
|
|
385
|
+
/*#__PURE__*/ _jsx("div", {
|
|
386
|
+
className: cn(theme.detailPanel.actions.wrapper),
|
|
387
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
388
|
+
className: "grid grid-cols-2 gap-2",
|
|
389
|
+
children: [
|
|
390
|
+
!user.verifiedAt && /*#__PURE__*/ _jsx(Button, {
|
|
391
|
+
variant: "success",
|
|
392
|
+
size: "sm",
|
|
393
|
+
onClick: ()=>onVerifyEmail(user.id),
|
|
394
|
+
loading: actionLoading === `verify-${user.id}`,
|
|
395
|
+
fullWidth: true,
|
|
396
|
+
children: "Verify Email"
|
|
397
|
+
}),
|
|
398
|
+
user.isLocked ? /*#__PURE__*/ _jsx(Button, {
|
|
399
|
+
variant: "primary",
|
|
400
|
+
size: "sm",
|
|
401
|
+
onClick: ()=>onUnlockAccount(user.id),
|
|
402
|
+
loading: actionLoading === `unlock-${user.id}`,
|
|
403
|
+
fullWidth: true,
|
|
404
|
+
children: "Unlock Account"
|
|
405
|
+
}) : /*#__PURE__*/ _jsx(Button, {
|
|
406
|
+
variant: "danger",
|
|
407
|
+
size: "sm",
|
|
408
|
+
onClick: ()=>onLockAccount(user.id),
|
|
409
|
+
loading: actionLoading === `lock-${user.id}`,
|
|
410
|
+
fullWidth: true,
|
|
411
|
+
children: "Lock Account"
|
|
412
|
+
}),
|
|
413
|
+
hasPasswordReset && /*#__PURE__*/ _jsx(Button, {
|
|
414
|
+
variant: "warning",
|
|
415
|
+
size: "sm",
|
|
416
|
+
onClick: ()=>onResetPassword(user.email),
|
|
417
|
+
loading: actionLoading === `reset-${user.email}`,
|
|
418
|
+
fullWidth: true,
|
|
419
|
+
children: "Reset Password"
|
|
420
|
+
}),
|
|
421
|
+
hasMagicLink && /*#__PURE__*/ _jsx(Button, {
|
|
422
|
+
variant: "secondary",
|
|
423
|
+
size: "sm",
|
|
424
|
+
onClick: ()=>onSendMagicLink(user.email),
|
|
425
|
+
loading: actionLoading === `magic-${user.email}`,
|
|
426
|
+
fullWidth: true,
|
|
427
|
+
children: "Send Magic Link"
|
|
428
|
+
}),
|
|
429
|
+
hasInvite && !user.verifiedAt && !user.lastLoginAt && /*#__PURE__*/ _jsx(Button, {
|
|
430
|
+
variant: "primary",
|
|
431
|
+
size: "sm",
|
|
432
|
+
onClick: ()=>onResendInvite(user.email),
|
|
433
|
+
loading: actionLoading === `invite-${user.email}`,
|
|
434
|
+
fullWidth: true,
|
|
435
|
+
children: "Resend Invite"
|
|
436
|
+
})
|
|
437
|
+
]
|
|
438
|
+
})
|
|
439
|
+
})
|
|
440
|
+
]
|
|
441
|
+
})
|
|
442
|
+
]
|
|
443
|
+
});
|
|
444
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../utils/cn";
|
|
4
|
+
import { Button } from "../../Button";
|
|
5
|
+
import { NucleusTextInput } from "../../NucleusTextInput";
|
|
6
|
+
import { SelectBox } from "../../SelectBox";
|
|
7
|
+
export function UserFilters({ theme, searchQuery, statusFilter, roleFilter, roles, totalCount, filteredCount, onSearchChange, onStatusChange, onRoleChange, onRefresh, isLoading }) {
|
|
8
|
+
const statusOptions = [
|
|
9
|
+
{
|
|
10
|
+
value: "all",
|
|
11
|
+
label: "All Status"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: "active",
|
|
15
|
+
label: "Active"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "locked",
|
|
19
|
+
label: "Locked"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "unverified",
|
|
23
|
+
label: "Unverified"
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
const roleOptions = [
|
|
27
|
+
{
|
|
28
|
+
value: "all",
|
|
29
|
+
label: "All Roles"
|
|
30
|
+
},
|
|
31
|
+
...roles.map((role)=>({
|
|
32
|
+
value: role.id,
|
|
33
|
+
label: role.name
|
|
34
|
+
}))
|
|
35
|
+
];
|
|
36
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
37
|
+
className: cn(theme.filters.wrapper),
|
|
38
|
+
children: [
|
|
39
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
40
|
+
className: "flex flex-col sm:flex-row gap-3",
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ _jsx("div", {
|
|
43
|
+
className: "flex-1",
|
|
44
|
+
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
45
|
+
type: "text",
|
|
46
|
+
value: searchQuery,
|
|
47
|
+
onChange: (val)=>onSearchChange(val),
|
|
48
|
+
placeholder: "Search by name or email...",
|
|
49
|
+
size: "md",
|
|
50
|
+
leftIcon: /*#__PURE__*/ _jsx("svg", {
|
|
51
|
+
className: "w-4 h-4",
|
|
52
|
+
fill: "none",
|
|
53
|
+
stroke: "currentColor",
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round",
|
|
59
|
+
strokeWidth: 2,
|
|
60
|
+
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
66
|
+
className: "flex flex-wrap gap-2",
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ _jsx(SelectBox, {
|
|
69
|
+
options: statusOptions,
|
|
70
|
+
value: statusFilter,
|
|
71
|
+
onChange: (val)=>{
|
|
72
|
+
if (val) onStatusChange(val);
|
|
73
|
+
},
|
|
74
|
+
placeholder: "Status",
|
|
75
|
+
size: "md",
|
|
76
|
+
className: "min-w-[140px]"
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ _jsx(SelectBox, {
|
|
79
|
+
options: roleOptions,
|
|
80
|
+
value: roleFilter,
|
|
81
|
+
onChange: (val)=>{
|
|
82
|
+
if (val) onRoleChange(val);
|
|
83
|
+
},
|
|
84
|
+
placeholder: "Role",
|
|
85
|
+
size: "md",
|
|
86
|
+
searchable: roles.length > 5,
|
|
87
|
+
className: "min-w-[140px]"
|
|
88
|
+
}),
|
|
89
|
+
onRefresh && /*#__PURE__*/ _jsx(Button, {
|
|
90
|
+
variant: "outline",
|
|
91
|
+
size: "md",
|
|
92
|
+
onClick: onRefresh,
|
|
93
|
+
loading: isLoading,
|
|
94
|
+
leftIcon: /*#__PURE__*/ _jsx("svg", {
|
|
95
|
+
className: "w-4 h-4",
|
|
96
|
+
fill: "none",
|
|
97
|
+
stroke: "currentColor",
|
|
98
|
+
viewBox: "0 0 24 24",
|
|
99
|
+
"aria-hidden": "true",
|
|
100
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
101
|
+
strokeLinecap: "round",
|
|
102
|
+
strokeLinejoin: "round",
|
|
103
|
+
strokeWidth: 2,
|
|
104
|
+
d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
|
105
|
+
})
|
|
106
|
+
}),
|
|
107
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
108
|
+
className: "hidden sm:inline",
|
|
109
|
+
children: "Refresh"
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
117
|
+
className: "flex items-center justify-between text-xs text-zinc-500 dark:text-zinc-400",
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
120
|
+
children: [
|
|
121
|
+
"Showing ",
|
|
122
|
+
filteredCount,
|
|
123
|
+
" of ",
|
|
124
|
+
totalCount,
|
|
125
|
+
" users"
|
|
126
|
+
]
|
|
127
|
+
}),
|
|
128
|
+
(statusFilter !== "all" || roleFilter !== "all" || searchQuery) && /*#__PURE__*/ _jsx(Button, {
|
|
129
|
+
variant: "ghost",
|
|
130
|
+
size: "sm",
|
|
131
|
+
onClick: ()=>{
|
|
132
|
+
onSearchChange("");
|
|
133
|
+
onStatusChange("all");
|
|
134
|
+
onRoleChange("all");
|
|
135
|
+
},
|
|
136
|
+
children: "Clear filters"
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
}
|