nucleus-core-ts 0.8.7 → 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/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 -157
- 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/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 +32 -16
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { cn } from "../../../utils/cn";
|
|
6
|
+
export function RoleAssignmentModal({ isOpen, roles, userRoles, userId, onClose, onAssignRole, onRemoveRole }) {
|
|
7
|
+
const modalRef = useRef(null);
|
|
8
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
9
|
+
const [mounted, setMounted] = useState(false);
|
|
10
|
+
useEffect(()=>{
|
|
11
|
+
setMounted(true);
|
|
12
|
+
}, []);
|
|
13
|
+
useEffect(()=>{
|
|
14
|
+
const handleEscape = (e)=>{
|
|
15
|
+
if (e.key === "Escape" && isOpen) {
|
|
16
|
+
onClose();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
document.addEventListener("keydown", handleEscape);
|
|
20
|
+
return ()=>document.removeEventListener("keydown", handleEscape);
|
|
21
|
+
}, [
|
|
22
|
+
isOpen,
|
|
23
|
+
onClose
|
|
24
|
+
]);
|
|
25
|
+
useEffect(()=>{
|
|
26
|
+
if (isOpen) {
|
|
27
|
+
document.body.style.overflow = "hidden";
|
|
28
|
+
setSearchQuery("");
|
|
29
|
+
} else {
|
|
30
|
+
document.body.style.overflow = "";
|
|
31
|
+
}
|
|
32
|
+
return ()=>{
|
|
33
|
+
document.body.style.overflow = "";
|
|
34
|
+
};
|
|
35
|
+
}, [
|
|
36
|
+
isOpen
|
|
37
|
+
]);
|
|
38
|
+
if (!isOpen || !mounted) return null;
|
|
39
|
+
const assignedRoleIds = userRoles.filter((ur)=>ur.userId === userId).map((ur)=>ur.roleId);
|
|
40
|
+
const filteredRoles = roles.filter((role)=>role.name.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
41
|
+
const handleToggleRole = (role)=>{
|
|
42
|
+
const isAssigned = assignedRoleIds.includes(role.id);
|
|
43
|
+
if (isAssigned) {
|
|
44
|
+
const userRole = userRoles.find((ur)=>ur.userId === userId && ur.roleId === role.id);
|
|
45
|
+
if (userRole && !userRole.id.startsWith("temp-") && role.name !== "godmin") {
|
|
46
|
+
onRemoveRole(userRole.id);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
onAssignRole(userId, role.id);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const isRoleDisabled = (role)=>{
|
|
53
|
+
if (role.name === "godmin") return true;
|
|
54
|
+
const userRole = userRoles.find((ur)=>ur.userId === userId && ur.roleId === role.id);
|
|
55
|
+
return userRole?.id.startsWith("temp-") || false;
|
|
56
|
+
};
|
|
57
|
+
const modalContent = /*#__PURE__*/ _jsxs("div", {
|
|
58
|
+
className: "fixed inset-0 flex items-center justify-center p-4",
|
|
59
|
+
style: {
|
|
60
|
+
zIndex: 99999
|
|
61
|
+
},
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ _jsx("div", {
|
|
64
|
+
className: "fixed inset-0 bg-black/60",
|
|
65
|
+
onClick: onClose,
|
|
66
|
+
"aria-hidden": "true"
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
69
|
+
ref: modalRef,
|
|
70
|
+
className: "relative bg-white dark:bg-zinc-900 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col border border-zinc-200 dark:border-zinc-700",
|
|
71
|
+
children: [
|
|
72
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
73
|
+
className: "flex items-center justify-between px-5 py-4 border-b border-zinc-200 dark:border-zinc-700",
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
76
|
+
className: "text-base font-semibold text-zinc-900 dark:text-white",
|
|
77
|
+
children: "Manage Roles"
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ _jsx("button", {
|
|
80
|
+
type: "button",
|
|
81
|
+
onClick: onClose,
|
|
82
|
+
className: "p-1 rounded-md text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors",
|
|
83
|
+
"aria-label": "Close",
|
|
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__*/ _jsx("div", {
|
|
101
|
+
className: "px-5 py-3 border-b border-zinc-200 dark:border-zinc-700",
|
|
102
|
+
children: /*#__PURE__*/ _jsx("input", {
|
|
103
|
+
type: "text",
|
|
104
|
+
placeholder: "Search roles...",
|
|
105
|
+
value: searchQuery,
|
|
106
|
+
onChange: (e)=>setSearchQuery(e.target.value),
|
|
107
|
+
className: "w-full px-3 py-2 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg outline-none focus:ring-2 focus:ring-blue-500/50 text-zinc-900 dark:text-white placeholder:text-zinc-400"
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ _jsx("div", {
|
|
111
|
+
className: "flex-1 overflow-y-auto px-3 py-2 min-h-[200px]",
|
|
112
|
+
children: filteredRoles.length === 0 ? /*#__PURE__*/ _jsx("div", {
|
|
113
|
+
className: "text-center py-8 text-zinc-500 dark:text-zinc-400 text-sm",
|
|
114
|
+
children: "No roles found"
|
|
115
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
116
|
+
className: "space-y-1",
|
|
117
|
+
children: filteredRoles.map((role)=>{
|
|
118
|
+
const isAssigned = assignedRoleIds.includes(role.id);
|
|
119
|
+
const disabled = isRoleDisabled(role);
|
|
120
|
+
return /*#__PURE__*/ _jsxs("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
onClick: ()=>!disabled && handleToggleRole(role),
|
|
123
|
+
disabled: disabled,
|
|
124
|
+
className: cn("w-full flex items-start gap-3 px-3 py-3 rounded-lg text-left transition-colors", disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-zinc-50 dark:hover:bg-zinc-800/50 cursor-pointer", isAssigned && !disabled && "bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30"),
|
|
125
|
+
children: [
|
|
126
|
+
/*#__PURE__*/ _jsx("div", {
|
|
127
|
+
className: cn("w-5 h-5 mt-0.5 rounded border-2 flex items-center justify-center flex-shrink-0 transition-colors", isAssigned ? "bg-blue-600 border-blue-600" : "border-zinc-300 dark:border-zinc-600"),
|
|
128
|
+
children: isAssigned && /*#__PURE__*/ _jsx("svg", {
|
|
129
|
+
className: "w-3 h-3 text-white",
|
|
130
|
+
fill: "none",
|
|
131
|
+
stroke: "currentColor",
|
|
132
|
+
viewBox: "0 0 24 24",
|
|
133
|
+
"aria-hidden": "true",
|
|
134
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
135
|
+
strokeLinecap: "round",
|
|
136
|
+
strokeLinejoin: "round",
|
|
137
|
+
strokeWidth: 3,
|
|
138
|
+
d: "M5 13l4 4L19 7"
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
143
|
+
className: "flex-1 min-w-0",
|
|
144
|
+
children: [
|
|
145
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
146
|
+
className: "flex items-center gap-2",
|
|
147
|
+
children: [
|
|
148
|
+
/*#__PURE__*/ _jsx("span", {
|
|
149
|
+
className: "font-medium text-sm text-zinc-900 dark:text-white",
|
|
150
|
+
children: role.name
|
|
151
|
+
}),
|
|
152
|
+
role.name === "godmin" && /*#__PURE__*/ _jsx("span", {
|
|
153
|
+
className: "text-[10px] px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 font-medium",
|
|
154
|
+
children: "Protected"
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}),
|
|
158
|
+
role.description && /*#__PURE__*/ _jsx("p", {
|
|
159
|
+
className: "text-xs text-zinc-500 dark:text-zinc-400 mt-0.5 line-clamp-2",
|
|
160
|
+
children: role.description
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
}, role.id);
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
}),
|
|
169
|
+
/*#__PURE__*/ _jsx("div", {
|
|
170
|
+
className: "px-5 py-3 border-t border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50 rounded-b-xl",
|
|
171
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
172
|
+
className: "text-xs text-zinc-500 dark:text-zinc-400",
|
|
173
|
+
children: [
|
|
174
|
+
assignedRoleIds.length,
|
|
175
|
+
" role",
|
|
176
|
+
assignedRoleIds.length !== 1 ? "s" : "",
|
|
177
|
+
" assigned"
|
|
178
|
+
]
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
});
|
|
185
|
+
return /*#__PURE__*/ createPortal(modalContent, document.body);
|
|
186
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useGSAP } from "@gsap/react";
|
|
4
|
+
import gsap from "gsap";
|
|
5
|
+
import { useRef } from "react";
|
|
6
|
+
import { cn } from "../../../utils/cn";
|
|
7
|
+
gsap.registerPlugin(useGSAP);
|
|
8
|
+
export function StatsCards({ theme, totalUsers, verifiedUsers, lockedUsers, unverifiedUsers }) {
|
|
9
|
+
const containerRef = useRef(null);
|
|
10
|
+
useGSAP(()=>{
|
|
11
|
+
if (!containerRef.current) return;
|
|
12
|
+
const cards = containerRef.current.querySelectorAll("[data-stat-card]");
|
|
13
|
+
gsap.fromTo(cards, {
|
|
14
|
+
opacity: 0,
|
|
15
|
+
y: 20,
|
|
16
|
+
scale: 0.95
|
|
17
|
+
}, {
|
|
18
|
+
opacity: 1,
|
|
19
|
+
y: 0,
|
|
20
|
+
scale: 1,
|
|
21
|
+
duration: 0.4,
|
|
22
|
+
stagger: 0.08,
|
|
23
|
+
ease: "back.out(1.7)"
|
|
24
|
+
});
|
|
25
|
+
}, {
|
|
26
|
+
scope: containerRef
|
|
27
|
+
});
|
|
28
|
+
const stats = [
|
|
29
|
+
{
|
|
30
|
+
label: "Total Users",
|
|
31
|
+
value: totalUsers,
|
|
32
|
+
iconColor: "primary",
|
|
33
|
+
icon: /*#__PURE__*/ _jsx("svg", {
|
|
34
|
+
className: "w-4 h-4 sm:w-5 sm:h-5",
|
|
35
|
+
fill: "none",
|
|
36
|
+
stroke: "currentColor",
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
40
|
+
strokeLinecap: "round",
|
|
41
|
+
strokeLinejoin: "round",
|
|
42
|
+
strokeWidth: 2,
|
|
43
|
+
d: "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Verified",
|
|
49
|
+
value: verifiedUsers,
|
|
50
|
+
iconColor: "success",
|
|
51
|
+
icon: /*#__PURE__*/ _jsx("svg", {
|
|
52
|
+
className: "w-4 h-4 sm:w-5 sm:h-5",
|
|
53
|
+
fill: "none",
|
|
54
|
+
stroke: "currentColor",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
58
|
+
strokeLinecap: "round",
|
|
59
|
+
strokeLinejoin: "round",
|
|
60
|
+
strokeWidth: 2,
|
|
61
|
+
d: "M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: "Unverified",
|
|
67
|
+
value: unverifiedUsers,
|
|
68
|
+
iconColor: "warning",
|
|
69
|
+
icon: /*#__PURE__*/ _jsx("svg", {
|
|
70
|
+
className: "w-4 h-4 sm:w-5 sm:h-5",
|
|
71
|
+
fill: "none",
|
|
72
|
+
stroke: "currentColor",
|
|
73
|
+
viewBox: "0 0 24 24",
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
76
|
+
strokeLinecap: "round",
|
|
77
|
+
strokeLinejoin: "round",
|
|
78
|
+
strokeWidth: 2,
|
|
79
|
+
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "Locked",
|
|
85
|
+
value: lockedUsers,
|
|
86
|
+
iconColor: "danger",
|
|
87
|
+
icon: /*#__PURE__*/ _jsx("svg", {
|
|
88
|
+
className: "w-4 h-4 sm:w-5 sm:h-5",
|
|
89
|
+
fill: "none",
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
viewBox: "0 0 24 24",
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
94
|
+
strokeLinecap: "round",
|
|
95
|
+
strokeLinejoin: "round",
|
|
96
|
+
strokeWidth: 2,
|
|
97
|
+
d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
103
|
+
ref: containerRef,
|
|
104
|
+
className: cn(theme.stats.wrapper),
|
|
105
|
+
children: stats.map((stat)=>/*#__PURE__*/ _jsxs("div", {
|
|
106
|
+
"data-stat-card": true,
|
|
107
|
+
className: cn(theme.stats.card.base),
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ _jsx("div", {
|
|
110
|
+
className: cn(theme.stats.card.icon.wrapper, theme.stats.card.icon[stat.iconColor]),
|
|
111
|
+
children: stat.icon
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ _jsx("div", {
|
|
114
|
+
className: cn(theme.stats.card.value),
|
|
115
|
+
children: stat.value
|
|
116
|
+
}),
|
|
117
|
+
/*#__PURE__*/ _jsx("div", {
|
|
118
|
+
className: cn(theme.stats.card.label),
|
|
119
|
+
children: stat.label
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}, stat.label))
|
|
123
|
+
});
|
|
124
|
+
}
|