nucleus-core-ts 0.8.7 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/dist/client.js +1 -1
  2. package/dist/fe/components/AbstractAnimatedBackground/index.js +437 -0
  3. package/dist/fe/components/AuthorizationPage/components/AuthorizationPage.js +841 -0
  4. package/dist/fe/components/AuthorizationPage/components/ClaimList.js +100 -0
  5. package/dist/fe/components/AuthorizationPage/components/RoleClaimEditor.js +232 -0
  6. package/dist/fe/components/AuthorizationPage/components/RoleList.js +115 -0
  7. package/dist/fe/components/AuthorizationPage/index.js +6 -0
  8. package/dist/fe/components/AuthorizationPage/store/index.js +117 -0
  9. package/dist/fe/components/AuthorizationPage/theme/index.js +137 -0
  10. package/dist/fe/components/AuthorizationPage/types/index.js +1 -0
  11. package/dist/fe/components/Button/components/Button.js +158 -0
  12. package/dist/fe/components/Button/components/ButtonSpinner.js +52 -0
  13. package/dist/fe/components/Button/index.js +3 -0
  14. package/dist/fe/components/Button/theme/index.js +186 -0
  15. package/dist/fe/components/Button/types/index.js +1 -0
  16. package/dist/fe/components/Button/utils/cn.js +5 -0
  17. package/dist/fe/components/Captcha/components/Captcha.js +311 -0
  18. package/dist/fe/components/Captcha/index.js +2 -0
  19. package/dist/fe/components/Captcha/theme.js +52 -0
  20. package/dist/fe/components/Captcha/types.js +1 -0
  21. package/dist/fe/components/ChangePasswordPage/components/ChangePasswordForm.js +242 -0
  22. package/dist/fe/components/ChangePasswordPage/components/ChangePasswordHeader.js +39 -0
  23. package/dist/fe/components/ChangePasswordPage/components/ChangePasswordPage.js +60 -0
  24. package/dist/fe/components/ChangePasswordPage/index.js +5 -0
  25. package/dist/fe/components/ChangePasswordPage/store/index.js +44 -0
  26. package/dist/fe/components/ChangePasswordPage/theme/index.js +87 -0
  27. package/dist/fe/components/ChangePasswordPage/types/index.js +1 -0
  28. package/dist/fe/components/Checkbox/components/Checkbox.js +115 -0
  29. package/dist/fe/components/Checkbox/components/CheckboxIcon.js +119 -0
  30. package/dist/fe/components/Checkbox/components/SwitchTrack.js +178 -0
  31. package/dist/fe/components/Checkbox/index.js +4 -0
  32. package/dist/fe/components/Checkbox/theme/index.js +221 -0
  33. package/dist/fe/components/Checkbox/types/index.js +1 -0
  34. package/dist/fe/components/Checkbox/utils/cn.js +5 -0
  35. package/dist/fe/components/DataTable/DataTable.js +225 -0
  36. package/dist/fe/components/DataTable/components/ActionCell.js +26 -0
  37. package/dist/fe/components/DataTable/components/DataCell.js +76 -0
  38. package/dist/fe/components/DataTable/components/EditableCell.js +221 -0
  39. package/dist/fe/components/DataTable/components/EmptyState.js +29 -0
  40. package/dist/fe/components/DataTable/components/HeaderCell.js +64 -0
  41. package/dist/fe/components/DataTable/components/InfiniteScrollTrigger.js +66 -0
  42. package/dist/fe/components/DataTable/components/LoadingSpinner.js +19 -0
  43. package/dist/fe/components/DataTable/components/ResizeHandle.js +41 -0
  44. package/dist/fe/components/DataTable/components/SelectionCell.js +105 -0
  45. package/dist/fe/components/DataTable/components/SkeletonRow.js +56 -0
  46. package/dist/fe/components/DataTable/components/SkeletonTable.js +83 -0
  47. package/dist/fe/components/DataTable/components/SortIcon.js +39 -0
  48. package/dist/fe/components/DataTable/components/TableHeader.js +49 -0
  49. package/dist/fe/components/DataTable/components/TableRow.js +118 -0
  50. package/dist/fe/components/DataTable/components/index.js +14 -0
  51. package/dist/fe/components/DataTable/hooks/index.js +2 -0
  52. package/dist/fe/components/DataTable/hooks/useAutoFitColumn.js +23 -0
  53. package/dist/fe/components/DataTable/hooks/useResizeColumn.js +122 -0
  54. package/dist/fe/components/DataTable/index.js +3 -0
  55. package/dist/fe/components/DataTable/store/index.js +97 -0
  56. package/dist/fe/components/DataTable/theme/index.js +144 -0
  57. package/dist/fe/components/DataTable/types/index.js +1 -0
  58. package/dist/fe/components/DataTable/utils/cn.js +5 -0
  59. package/dist/fe/components/DatePicker/components/CalendarGrid.js +95 -0
  60. package/dist/fe/components/DatePicker/components/CalendarHeader.js +152 -0
  61. package/dist/fe/components/DatePicker/components/DatePicker.js +381 -0
  62. package/dist/fe/components/DatePicker/components/MonthYearSelector.js +93 -0
  63. package/dist/fe/components/DatePicker/index.js +7 -0
  64. package/dist/fe/components/DatePicker/locales/index.js +1113 -0
  65. package/dist/fe/components/DatePicker/theme/index.js +315 -0
  66. package/dist/fe/components/DatePicker/types/index.js +1 -0
  67. package/dist/fe/components/DatePicker/utils/cn.js +5 -0
  68. package/dist/fe/components/DatePicker/utils/date.js +132 -0
  69. package/dist/fe/components/DevicesPage/components/DeviceCard.js +251 -0
  70. package/dist/fe/components/DevicesPage/components/DevicesHeader.js +42 -0
  71. package/dist/fe/components/DevicesPage/components/DevicesPage.js +450 -0
  72. package/dist/fe/components/DevicesPage/index.js +5 -0
  73. package/dist/fe/components/DevicesPage/store/index.js +55 -0
  74. package/dist/fe/components/DevicesPage/theme/index.js +131 -0
  75. package/dist/fe/components/DevicesPage/types/index.js +1 -0
  76. package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.js +214 -0
  77. package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordHeader.js +42 -0
  78. package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.js +59 -0
  79. package/dist/fe/components/ForgotPasswordPage/index.js +5 -0
  80. package/dist/fe/components/ForgotPasswordPage/store/index.js +28 -0
  81. package/dist/fe/components/ForgotPasswordPage/theme/index.js +87 -0
  82. package/dist/fe/components/ForgotPasswordPage/types/index.js +1 -0
  83. package/dist/fe/components/FormBuilder/components/FormBuilder.js +156 -0
  84. package/dist/fe/components/FormBuilder/components/FormField.js +218 -0
  85. package/dist/fe/components/FormBuilder/hooks/useFormBuilder.js +152 -0
  86. package/dist/fe/components/FormBuilder/index.js +4 -0
  87. package/dist/fe/components/FormBuilder/theme/index.js +134 -0
  88. package/dist/fe/components/FormBuilder/types/index.js +1 -0
  89. package/dist/fe/components/FormBuilder/utils/cn.js +5 -0
  90. package/dist/fe/components/FormBuilder/utils/fieldMapping.js +216 -0
  91. package/dist/fe/components/FormBuilder/utils/validation.js +78 -0
  92. package/dist/fe/components/LoginPage/components/LoginForm.js +214 -0
  93. package/dist/fe/components/LoginPage/components/LoginHeader.js +24 -0
  94. package/dist/fe/components/LoginPage/components/LoginPage.js +138 -0
  95. package/dist/fe/components/LoginPage/index.js +5 -0
  96. package/dist/fe/components/LoginPage/store/index.js +59 -0
  97. package/dist/fe/components/LoginPage/theme/index.js +98 -0
  98. package/dist/fe/components/LoginPage/types/index.js +1 -0
  99. package/dist/fe/components/MagicLinkVerifyPage/components/MagicLinkVerifyPage.js +200 -0
  100. package/dist/fe/components/MagicLinkVerifyPage/index.js +3 -0
  101. package/dist/fe/components/MagicLinkVerifyPage/store.js +20 -0
  102. package/dist/fe/components/MagicLinkVerifyPage/theme.js +36 -0
  103. package/dist/fe/components/MagicLinkVerifyPage/types.js +1 -0
  104. package/dist/fe/components/NucleusEntityShowcase.js +1409 -0
  105. package/dist/fe/components/NucleusTextInput/components/FloatingLabel.js +56 -0
  106. package/dist/fe/components/NucleusTextInput/components/InputIcons.js +258 -0
  107. package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.js +321 -0
  108. package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.js +104 -0
  109. package/dist/fe/components/NucleusTextInput/components/TypewriterText.js +56 -0
  110. package/dist/fe/components/NucleusTextInput/index.js +7 -0
  111. package/dist/fe/components/NucleusTextInput/theme/index.js +121 -0
  112. package/dist/fe/components/NucleusTextInput/types/index.js +1 -0
  113. package/dist/fe/components/NucleusTextInput/utils/cn.js +5 -0
  114. package/dist/fe/components/NucleusTextInput/utils/format.js +62 -0
  115. package/dist/fe/components/NucleusTextInput/utils/validation.js +191 -0
  116. package/dist/fe/components/ProfilePage/components/AddressCard.js +196 -0
  117. package/dist/fe/components/ProfilePage/components/PhoneCard.js +206 -0
  118. package/dist/fe/components/ProfilePage/components/ProfileHeader.js +150 -0
  119. package/dist/fe/components/ProfilePage/components/ProfilePage.js +1336 -0
  120. package/dist/fe/components/ProfilePage/index.js +6 -0
  121. package/dist/fe/components/ProfilePage/store/index.js +115 -0
  122. package/dist/fe/components/ProfilePage/theme/index.js +168 -0
  123. package/dist/fe/components/ProfilePage/types/index.js +1 -0
  124. package/dist/fe/components/RangePicker/components/RangePicker.js +338 -0
  125. package/dist/fe/components/RangePicker/components/RangeThumb.js +68 -0
  126. package/dist/fe/components/RangePicker/components/RangeTooltip.js +45 -0
  127. package/dist/fe/components/RangePicker/components/RangeTrack.js +32 -0
  128. package/dist/fe/components/RangePicker/index.js +5 -0
  129. package/dist/fe/components/RangePicker/theme/index.js +88 -0
  130. package/dist/fe/components/RangePicker/types/index.js +1 -0
  131. package/dist/fe/components/RangePicker/utils/cn.js +3 -0
  132. package/dist/fe/components/RegisterPage/components/PasswordStrengthIndicator.js +107 -0
  133. package/dist/fe/components/RegisterPage/components/RegisterForm.js +322 -0
  134. package/dist/fe/components/RegisterPage/components/RegisterHeader.js +23 -0
  135. package/dist/fe/components/RegisterPage/components/RegisterPage.js +85 -0
  136. package/dist/fe/components/RegisterPage/index.js +6 -0
  137. package/dist/fe/components/RegisterPage/store/index.js +106 -0
  138. package/dist/fe/components/RegisterPage/theme/index.js +128 -0
  139. package/dist/fe/components/RegisterPage/types/index.js +1 -0
  140. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.js +347 -0
  141. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordHeader.js +42 -0
  142. package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.js +61 -0
  143. package/dist/fe/components/ResetPasswordPage/index.js +5 -0
  144. package/dist/fe/components/ResetPasswordPage/store/index.js +36 -0
  145. package/dist/fe/components/ResetPasswordPage/theme/index.js +99 -0
  146. package/dist/fe/components/ResetPasswordPage/types/index.js +1 -0
  147. package/dist/fe/components/SearchBox/components/SearchBox.js +271 -0
  148. package/dist/fe/components/SearchBox/components/SearchBoxDropdown.js +87 -0
  149. package/dist/fe/components/SearchBox/index.js +5 -0
  150. package/dist/fe/components/SearchBox/theme/index.js +184 -0
  151. package/dist/fe/components/SearchBox/types/index.js +1 -0
  152. package/dist/fe/components/SearchBox/utils/cn.js +5 -0
  153. package/dist/fe/components/SearchBox/utils/debounce.js +22 -0
  154. package/dist/fe/components/SearchBox/utils/sanitize.js +48 -0
  155. package/dist/fe/components/SelectBox/components/SelectBox.js +364 -0
  156. package/dist/fe/components/SelectBox/components/SelectDropdown.js +92 -0
  157. package/dist/fe/components/SelectBox/components/SelectOptionItem.js +43 -0
  158. package/dist/fe/components/SelectBox/components/SelectTrigger.js +22 -0
  159. package/dist/fe/components/SelectBox/index.js +5 -0
  160. package/dist/fe/components/SelectBox/theme/index.js +98 -0
  161. package/dist/fe/components/SelectBox/types/index.js +1 -0
  162. package/dist/fe/components/SelectBox/utils/cn.js +3 -0
  163. package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.js +107 -0
  164. package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +142 -0
  165. package/dist/fe/components/SetPasswordPage/components/SetPasswordHeader.js +23 -0
  166. package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +263 -0
  167. package/dist/fe/components/SetPasswordPage/index.js +7 -0
  168. package/dist/fe/components/SetPasswordPage/store/index.js +79 -0
  169. package/dist/fe/components/SetPasswordPage/theme/index.js +98 -0
  170. package/dist/fe/components/SetPasswordPage/types/index.js +12 -0
  171. package/dist/fe/components/UsersPage/components/InviteUserModal.js +262 -0
  172. package/dist/fe/components/UsersPage/components/Pagination.js +147 -0
  173. package/dist/fe/components/UsersPage/components/RoleAssignmentModal.js +186 -0
  174. package/dist/fe/components/UsersPage/components/StatsCards.js +124 -0
  175. package/dist/fe/components/UsersPage/components/UserDetailDrawer.js +444 -0
  176. package/dist/fe/components/UsersPage/components/UserFilters.js +142 -0
  177. package/dist/fe/components/UsersPage/components/UserListItem.js +125 -0
  178. package/dist/fe/components/UsersPage/components/UserListSkeleton.js +40 -0
  179. package/dist/fe/components/UsersPage/components/UsersPage.js +556 -0
  180. package/dist/fe/components/UsersPage/index.js +10 -0
  181. package/dist/fe/components/UsersPage/store/index.js +151 -0
  182. package/dist/fe/components/UsersPage/theme/index.js +231 -0
  183. package/dist/fe/components/UsersPage/types/index.js +1 -0
  184. package/dist/fe/components/VerifyEmailPage/components/VerifyEmailPage.js +290 -0
  185. package/dist/fe/components/VerifyEmailPage/index.js +3 -0
  186. package/dist/fe/components/VerifyEmailPage/store/index.js +45 -0
  187. package/dist/fe/components/VerifyEmailPage/theme/index.js +52 -0
  188. package/dist/fe/components/VerifyEmailPage/types/index.js +1 -0
  189. package/dist/fe/hooks/useNucleusEntity.js +247 -0
  190. package/dist/fe/index.js +28 -157
  191. package/dist/fe/types/index.js +1 -0
  192. package/dist/fe/utils/cn.js +5 -0
  193. package/dist/fe/utils/columnUtils.js +189 -0
  194. package/dist/fe/utils/endpointKeys.js +44 -0
  195. package/dist/index.js +1 -1
  196. package/dist/nucleus.config.d.ts +2 -0
  197. package/dist/src/Client/ApiCaller/client.js +1 -0
  198. package/dist/src/Client/ApiCaller/examples/usage.example.js +1 -0
  199. package/dist/src/Client/ApiCaller/generator.js +1 -0
  200. package/dist/src/Client/ApiCaller/index.js +1 -0
  201. package/dist/src/Client/ApiCaller/server.js +1 -0
  202. package/dist/src/Client/ApiCaller/system-tables.js +1 -0
  203. package/dist/src/Client/ApiCaller/types.js +1 -0
  204. package/dist/src/Client/Proxy/httpProxy.js +1 -0
  205. package/dist/src/Client/Proxy/index.js +1 -1
  206. package/dist/src/Client/Proxy/server.js +1 -0
  207. package/dist/src/Client/Proxy/types.js +1 -0
  208. package/dist/src/Client/Proxy/utils.js +1 -0
  209. package/dist/src/Client/Proxy/wsProxy.js +1 -0
  210. package/dist/src/Client/ServerFetch/index.js +1 -0
  211. package/dist/src/Client/ServerFetch/types.js +1 -0
  212. package/dist/src/Client/index.js +1 -0
  213. package/package.json +1 -1
  214. package/scripts/build.ts +41 -16
@@ -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
+ }