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,251 @@
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
+ import { devicesPageTheme } from "../theme";
8
+ gsap.registerPlugin(useGSAP);
9
+ function getDeviceIcon(deviceType) {
10
+ const iconClass = "w-5 h-5";
11
+ switch(deviceType?.toLowerCase()){
12
+ case "mobile":
13
+ return /*#__PURE__*/ _jsxs("svg", {
14
+ className: iconClass,
15
+ fill: "none",
16
+ viewBox: "0 0 24 24",
17
+ stroke: "currentColor",
18
+ "aria-label": "Mobile device",
19
+ children: [
20
+ /*#__PURE__*/ _jsx("title", {
21
+ children: "Mobile device"
22
+ }),
23
+ /*#__PURE__*/ _jsx("path", {
24
+ strokeLinecap: "round",
25
+ strokeLinejoin: "round",
26
+ strokeWidth: 1.5,
27
+ d: "M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"
28
+ })
29
+ ]
30
+ });
31
+ case "tablet":
32
+ return /*#__PURE__*/ _jsxs("svg", {
33
+ className: iconClass,
34
+ fill: "none",
35
+ viewBox: "0 0 24 24",
36
+ stroke: "currentColor",
37
+ "aria-label": "Tablet device",
38
+ children: [
39
+ /*#__PURE__*/ _jsx("title", {
40
+ children: "Tablet device"
41
+ }),
42
+ /*#__PURE__*/ _jsx("path", {
43
+ strokeLinecap: "round",
44
+ strokeLinejoin: "round",
45
+ strokeWidth: 1.5,
46
+ d: "M12 18h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"
47
+ })
48
+ ]
49
+ });
50
+ default:
51
+ return /*#__PURE__*/ _jsxs("svg", {
52
+ className: iconClass,
53
+ fill: "none",
54
+ viewBox: "0 0 24 24",
55
+ stroke: "currentColor",
56
+ "aria-label": "Desktop device",
57
+ children: [
58
+ /*#__PURE__*/ _jsx("title", {
59
+ children: "Desktop device"
60
+ }),
61
+ /*#__PURE__*/ _jsx("path", {
62
+ strokeLinecap: "round",
63
+ strokeLinejoin: "round",
64
+ strokeWidth: 1.5,
65
+ d: "M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
66
+ })
67
+ ]
68
+ });
69
+ }
70
+ }
71
+ function getTrustScoreColor(score) {
72
+ if (!score) return "bg-zinc-400";
73
+ if (score >= 80) return "bg-green-500";
74
+ if (score >= 60) return "bg-yellow-500";
75
+ if (score >= 40) return "bg-orange-500";
76
+ return "bg-red-500";
77
+ }
78
+ function formatDate(dateString) {
79
+ if (!dateString) return "Unknown";
80
+ const date = new Date(dateString);
81
+ return date.toLocaleDateString(undefined, {
82
+ year: "numeric",
83
+ month: "short",
84
+ day: "numeric",
85
+ hour: "2-digit",
86
+ minute: "2-digit"
87
+ });
88
+ }
89
+ export function DeviceCard({ device, isCurrent = false, onRevoke, isRevoking = false }) {
90
+ const theme = devicesPageTheme;
91
+ const cardRef = useRef(null);
92
+ useGSAP(()=>{
93
+ if (!cardRef.current) return;
94
+ gsap.fromTo(cardRef.current, {
95
+ opacity: 0,
96
+ y: 20
97
+ }, {
98
+ opacity: 1,
99
+ y: 0,
100
+ duration: 0.4,
101
+ ease: "power2.out"
102
+ });
103
+ }, {
104
+ scope: cardRef
105
+ });
106
+ const deviceName = device.deviceName || `${device.browserName || "Unknown"} on ${device.osName || "Unknown"}`;
107
+ return /*#__PURE__*/ _jsxs("article", {
108
+ ref: cardRef,
109
+ className: cn(theme.deviceCard.base, theme.deviceCard.padding, isCurrent ? theme.deviceCard.backgroundCurrent : theme.deviceCard.background, isCurrent ? theme.deviceCard.borderCurrent : theme.deviceCard.border, theme.deviceCard.shadow, theme.deviceCard.rounded, !isCurrent && theme.deviceCard.hover),
110
+ children: [
111
+ /*#__PURE__*/ _jsxs("header", {
112
+ className: theme.deviceCard.header.container,
113
+ children: [
114
+ /*#__PURE__*/ _jsx("div", {
115
+ className: cn(theme.deviceCard.header.icon, isCurrent && theme.deviceCard.header.iconCurrent),
116
+ children: getDeviceIcon(device.deviceType)
117
+ }),
118
+ /*#__PURE__*/ _jsxs("div", {
119
+ className: theme.deviceCard.header.info,
120
+ children: [
121
+ /*#__PURE__*/ _jsx("h3", {
122
+ className: theme.deviceCard.header.deviceName,
123
+ children: deviceName
124
+ }),
125
+ /*#__PURE__*/ _jsxs("p", {
126
+ className: theme.deviceCard.header.deviceType,
127
+ children: [
128
+ device.deviceType || "Desktop",
129
+ " • ",
130
+ device.browserName,
131
+ " ",
132
+ device.browserVersion
133
+ ]
134
+ })
135
+ ]
136
+ })
137
+ ]
138
+ }),
139
+ /*#__PURE__*/ _jsxs("dl", {
140
+ className: theme.deviceCard.details.container,
141
+ children: [
142
+ /*#__PURE__*/ _jsxs("div", {
143
+ className: theme.deviceCard.details.row,
144
+ children: [
145
+ /*#__PURE__*/ _jsx("dt", {
146
+ className: theme.deviceCard.details.label,
147
+ children: "IP Address"
148
+ }),
149
+ /*#__PURE__*/ _jsx("dd", {
150
+ className: theme.deviceCard.details.value,
151
+ children: device.ipAddress || "Unknown"
152
+ })
153
+ ]
154
+ }),
155
+ device.locationCity && /*#__PURE__*/ _jsxs("div", {
156
+ className: theme.deviceCard.details.row,
157
+ children: [
158
+ /*#__PURE__*/ _jsx("dt", {
159
+ className: theme.deviceCard.details.label,
160
+ children: "Location"
161
+ }),
162
+ /*#__PURE__*/ _jsxs("dd", {
163
+ className: theme.deviceCard.details.value,
164
+ children: [
165
+ device.locationCity,
166
+ device.locationCountry ? `, ${device.locationCountry}` : ""
167
+ ]
168
+ })
169
+ ]
170
+ }),
171
+ /*#__PURE__*/ _jsxs("div", {
172
+ className: theme.deviceCard.details.row,
173
+ children: [
174
+ /*#__PURE__*/ _jsx("dt", {
175
+ className: theme.deviceCard.details.label,
176
+ children: "Last Active"
177
+ }),
178
+ /*#__PURE__*/ _jsx("dd", {
179
+ className: theme.deviceCard.details.value,
180
+ children: formatDate(device.lastActivityAt)
181
+ })
182
+ ]
183
+ }),
184
+ /*#__PURE__*/ _jsxs("div", {
185
+ className: theme.deviceCard.details.row,
186
+ children: [
187
+ /*#__PURE__*/ _jsx("dt", {
188
+ className: theme.deviceCard.details.label,
189
+ children: "First Seen"
190
+ }),
191
+ /*#__PURE__*/ _jsx("dd", {
192
+ className: theme.deviceCard.details.value,
193
+ children: formatDate(device.createdAt)
194
+ })
195
+ ]
196
+ })
197
+ ]
198
+ }),
199
+ device.trustScore !== undefined && /*#__PURE__*/ _jsxs("div", {
200
+ className: theme.deviceCard.trustScore.container,
201
+ children: [
202
+ /*#__PURE__*/ _jsx("div", {
203
+ className: theme.deviceCard.trustScore.bar,
204
+ children: /*#__PURE__*/ _jsx("div", {
205
+ className: cn(theme.deviceCard.trustScore.barFill, getTrustScoreColor(device.trustScore)),
206
+ style: {
207
+ width: `${device.trustScore}%`
208
+ }
209
+ })
210
+ }),
211
+ /*#__PURE__*/ _jsxs("p", {
212
+ className: theme.deviceCard.trustScore.label,
213
+ children: [
214
+ "Trust Score: ",
215
+ device.trustScore,
216
+ "%"
217
+ ]
218
+ })
219
+ ]
220
+ }),
221
+ /*#__PURE__*/ _jsxs("footer", {
222
+ className: theme.deviceCard.footer.container,
223
+ children: [
224
+ isCurrent ? /*#__PURE__*/ _jsxs("span", {
225
+ className: theme.deviceCard.footer.currentBadge,
226
+ children: [
227
+ /*#__PURE__*/ _jsx("svg", {
228
+ className: "w-3 h-3 mr-1",
229
+ fill: "currentColor",
230
+ viewBox: "0 0 20 20",
231
+ children: /*#__PURE__*/ _jsx("path", {
232
+ fillRule: "evenodd",
233
+ d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
234
+ clipRule: "evenodd"
235
+ })
236
+ }),
237
+ "Current Device"
238
+ ]
239
+ }) : /*#__PURE__*/ _jsx("span", {}),
240
+ onRevoke && !isCurrent && /*#__PURE__*/ _jsx("button", {
241
+ type: "button",
242
+ onClick: ()=>onRevoke(device.id),
243
+ disabled: isRevoking,
244
+ className: cn(theme.deviceCard.footer.revokeButton, isRevoking && "opacity-50 cursor-not-allowed"),
245
+ children: isRevoking ? "Revoking..." : "Revoke Access"
246
+ })
247
+ ]
248
+ })
249
+ ]
250
+ });
251
+ }
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button } from "../../Button";
4
+ import { devicesPageTheme } from "../theme";
5
+ export function DevicesHeader({ title = "Active Devices", subtitle = "Manage devices that have access to your account", totalDevices = 0, onRevokeAll, isRevokingAll = false, allowRevokeAll = true }) {
6
+ const theme = devicesPageTheme;
7
+ return /*#__PURE__*/ _jsxs("header", {
8
+ className: theme.header.container,
9
+ children: [
10
+ /*#__PURE__*/ _jsxs("div", {
11
+ className: theme.header.titleWrapper,
12
+ children: [
13
+ /*#__PURE__*/ _jsxs("h1", {
14
+ className: theme.header.title,
15
+ children: [
16
+ title,
17
+ totalDevices > 0 && /*#__PURE__*/ _jsx("span", {
18
+ className: theme.header.badge,
19
+ children: totalDevices
20
+ })
21
+ ]
22
+ }),
23
+ /*#__PURE__*/ _jsx("p", {
24
+ className: theme.header.subtitle,
25
+ children: subtitle
26
+ })
27
+ ]
28
+ }),
29
+ allowRevokeAll && totalDevices > 1 && onRevokeAll && /*#__PURE__*/ _jsx("div", {
30
+ className: theme.header.actions,
31
+ children: /*#__PURE__*/ _jsx(Button, {
32
+ variant: "outline",
33
+ size: "sm",
34
+ onClick: onRevokeAll,
35
+ disabled: isRevokingAll,
36
+ className: "text-red-600 border-red-200 hover:bg-red-50 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/20",
37
+ children: isRevokingAll ? "Revoking..." : "Revoke All Other Devices"
38
+ })
39
+ })
40
+ ]
41
+ });
42
+ }