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,98 @@
|
|
|
1
|
+
export const setPasswordPageTheme = {
|
|
2
|
+
container: {
|
|
3
|
+
base: "min-h-screen flex items-center justify-center bg-gradient-to-br from-zinc-50 via-zinc-100 to-zinc-200 dark:from-zinc-900 dark:via-zinc-900 dark:to-zinc-800 px-4 sm:px-6 lg:px-8",
|
|
4
|
+
wrapper: "w-full max-w-md relative z-10"
|
|
5
|
+
},
|
|
6
|
+
card: {
|
|
7
|
+
base: "relative overflow-hidden",
|
|
8
|
+
padding: "p-6 sm:p-8 lg:p-10",
|
|
9
|
+
background: "bg-white dark:bg-zinc-800",
|
|
10
|
+
border: "border border-zinc-200 dark:border-zinc-700",
|
|
11
|
+
shadow: "shadow-xl",
|
|
12
|
+
rounded: "rounded-2xl"
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
wrapper: "text-center mb-6 sm:mb-8",
|
|
16
|
+
logo: "mx-auto mb-4 sm:mb-6",
|
|
17
|
+
title: "text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-2 sm:mb-3",
|
|
18
|
+
subtitle: "text-sm sm:text-base text-zinc-600 dark:text-zinc-400"
|
|
19
|
+
},
|
|
20
|
+
form: {
|
|
21
|
+
wrapper: "space-y-4 sm:space-y-5",
|
|
22
|
+
inputGroup: "space-y-1",
|
|
23
|
+
label: "block text-sm font-medium text-zinc-700 dark:text-zinc-300",
|
|
24
|
+
input: "w-full px-3 sm:px-4 py-2 sm:py-3 border border-zinc-300 dark:border-zinc-600 rounded-xl bg-white dark:bg-zinc-700 text-zinc-900 dark:text-white placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200",
|
|
25
|
+
error: "text-sm text-red-500 dark:text-red-400 mt-1",
|
|
26
|
+
submitButton: "w-full py-2.5 sm:py-3 px-4 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",
|
|
27
|
+
backLink: "w-full mt-3 sm:mt-4 text-center",
|
|
28
|
+
backLinkText: "text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer"
|
|
29
|
+
},
|
|
30
|
+
alert: {
|
|
31
|
+
error: "mb-4 p-3 sm:p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl text-red-600 dark:text-red-400 text-sm",
|
|
32
|
+
success: "text-center"
|
|
33
|
+
},
|
|
34
|
+
states: {
|
|
35
|
+
verifying: {
|
|
36
|
+
wrapper: "text-center py-8",
|
|
37
|
+
iconWrapper: "mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mb-6",
|
|
38
|
+
spinner: "animate-spin rounded-full h-8 w-8 sm:h-10 sm:w-10 border-3 border-blue-600 border-t-transparent",
|
|
39
|
+
title: "text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white mb-3",
|
|
40
|
+
subtitle: "text-zinc-600 dark:text-zinc-400 text-sm sm:text-base"
|
|
41
|
+
},
|
|
42
|
+
error: {
|
|
43
|
+
iconWrapper: "mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center mb-6",
|
|
44
|
+
icon: "w-8 h-8 sm:w-10 sm:h-10 text-red-500 dark:text-red-400",
|
|
45
|
+
title: "text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",
|
|
46
|
+
subtitle: "text-zinc-600 dark:text-zinc-400 mb-2 text-sm sm:text-base",
|
|
47
|
+
errorMessage: "text-red-500 dark:text-red-400 text-sm mb-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 rounded-lg",
|
|
48
|
+
helpText: "text-zinc-500 dark:text-zinc-500 text-sm mb-8",
|
|
49
|
+
buttonPrimary: "w-full py-3 px-4 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",
|
|
50
|
+
buttonSecondary: "w-full py-3 px-4 bg-zinc-100 dark:bg-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-600 text-zinc-700 dark:text-zinc-300 font-medium rounded-xl transition-colors duration-200"
|
|
51
|
+
},
|
|
52
|
+
success: {
|
|
53
|
+
iconWrapper: "mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6",
|
|
54
|
+
icon: "w-8 h-8 sm:w-10 sm:h-10 text-green-500 dark:text-green-400",
|
|
55
|
+
title: "text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",
|
|
56
|
+
subtitle: "text-zinc-600 dark:text-zinc-400 text-sm sm:text-base mb-6",
|
|
57
|
+
redirectSpinner: "animate-spin rounded-full h-4 w-4 border-2 border-zinc-400 border-t-transparent",
|
|
58
|
+
redirectText: "text-zinc-500 dark:text-zinc-400 text-sm"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
footer: "text-center text-zinc-500 dark:text-zinc-500 text-xs mt-6",
|
|
62
|
+
layout: {
|
|
63
|
+
textCenter: "text-center",
|
|
64
|
+
buttonGroup: "space-y-3",
|
|
65
|
+
redirectWrapper: "flex items-center justify-center gap-2"
|
|
66
|
+
},
|
|
67
|
+
passwordStrength: {
|
|
68
|
+
container: "mt-3 space-y-3",
|
|
69
|
+
bar: {
|
|
70
|
+
wrapper: "flex gap-1",
|
|
71
|
+
segment: "h-1 flex-1 rounded-full transition-colors duration-200",
|
|
72
|
+
inactive: "bg-zinc-200 dark:bg-zinc-700",
|
|
73
|
+
active: {
|
|
74
|
+
weak: "bg-red-500",
|
|
75
|
+
fair: "bg-orange-500",
|
|
76
|
+
good: "bg-yellow-500",
|
|
77
|
+
strong: "bg-green-500",
|
|
78
|
+
veryStrong: "bg-emerald-500"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
requirements: {
|
|
82
|
+
container: "space-y-1",
|
|
83
|
+
item: "flex items-center gap-2 text-xs transition-colors duration-200",
|
|
84
|
+
met: "text-green-600 dark:text-green-400",
|
|
85
|
+
unmet: "text-zinc-400 dark:text-zinc-500",
|
|
86
|
+
icon: {
|
|
87
|
+
met: "text-green-600 dark:text-green-400",
|
|
88
|
+
unmet: "text-zinc-400 dark:text-zinc-500"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export function extendSetPasswordPageTheme(overrides) {
|
|
94
|
+
return {
|
|
95
|
+
...setPasswordPageTheme,
|
|
96
|
+
...overrides
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const DEFAULT_PASSWORD_POLICY = {
|
|
2
|
+
minLength: 8,
|
|
3
|
+
maxLength: 128,
|
|
4
|
+
requireUppercase: true,
|
|
5
|
+
requireLowercase: true,
|
|
6
|
+
requireNumber: true,
|
|
7
|
+
requireSpecialChar: false,
|
|
8
|
+
specialChars: "!@#$%^&*()_+-=[]{}|;:,.<>?",
|
|
9
|
+
preventCommonPasswords: true,
|
|
10
|
+
preventUserInfoInPassword: true,
|
|
11
|
+
showStrengthIndicator: true
|
|
12
|
+
};
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useGSAP } from "@gsap/react";
|
|
4
|
+
import gsap from "gsap";
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { cn } from "../../../utils/cn";
|
|
7
|
+
import { Button } from "../../Button";
|
|
8
|
+
import { NucleusTextInput } from "../../NucleusTextInput";
|
|
9
|
+
gsap.registerPlugin(useGSAP);
|
|
10
|
+
export function InviteUserModal({ theme, isOpen, isLoading, onClose, onInvite }) {
|
|
11
|
+
const [email, setEmail] = useState("");
|
|
12
|
+
const [error, setError] = useState("");
|
|
13
|
+
const overlayRef = useRef(null);
|
|
14
|
+
const modalRef = useRef(null);
|
|
15
|
+
useGSAP(()=>{
|
|
16
|
+
if (!overlayRef.current || !modalRef.current) return;
|
|
17
|
+
if (isOpen) {
|
|
18
|
+
gsap.fromTo(overlayRef.current, {
|
|
19
|
+
opacity: 0
|
|
20
|
+
}, {
|
|
21
|
+
opacity: 1,
|
|
22
|
+
duration: 0.2,
|
|
23
|
+
ease: "power2.out"
|
|
24
|
+
});
|
|
25
|
+
gsap.fromTo(modalRef.current, {
|
|
26
|
+
opacity: 0,
|
|
27
|
+
scale: 0.95,
|
|
28
|
+
y: 20
|
|
29
|
+
}, {
|
|
30
|
+
opacity: 1,
|
|
31
|
+
scale: 1,
|
|
32
|
+
y: 0,
|
|
33
|
+
duration: 0.3,
|
|
34
|
+
ease: "back.out(1.7)"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
dependencies: [
|
|
39
|
+
isOpen
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
useEffect(()=>{
|
|
43
|
+
if (isOpen) {
|
|
44
|
+
setEmail("");
|
|
45
|
+
setError("");
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
isOpen
|
|
49
|
+
]);
|
|
50
|
+
useEffect(()=>{
|
|
51
|
+
const handleEscape = (e)=>{
|
|
52
|
+
if (e.key === "Escape" && isOpen && !isLoading) {
|
|
53
|
+
onClose();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
document.addEventListener("keydown", handleEscape);
|
|
57
|
+
return ()=>document.removeEventListener("keydown", handleEscape);
|
|
58
|
+
}, [
|
|
59
|
+
isOpen,
|
|
60
|
+
isLoading,
|
|
61
|
+
onClose
|
|
62
|
+
]);
|
|
63
|
+
const validateEmail = (email)=>{
|
|
64
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
65
|
+
return emailRegex.test(email);
|
|
66
|
+
};
|
|
67
|
+
const handleSubmit = ()=>{
|
|
68
|
+
if (!email.trim()) {
|
|
69
|
+
setError("Email is required");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!validateEmail(email)) {
|
|
73
|
+
setError("Please enter a valid email address");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
setError("");
|
|
77
|
+
onInvite(email.trim());
|
|
78
|
+
};
|
|
79
|
+
const handleKeyDown = (e)=>{
|
|
80
|
+
if (e.key === "Enter" && !isLoading) {
|
|
81
|
+
handleSubmit();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
if (!isOpen) return null;
|
|
85
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
86
|
+
children: [
|
|
87
|
+
/*#__PURE__*/ _jsx("div", {
|
|
88
|
+
ref: overlayRef,
|
|
89
|
+
className: cn(theme.modal.overlay),
|
|
90
|
+
onClick: ()=>!isLoading && onClose(),
|
|
91
|
+
"aria-hidden": "true"
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ _jsx("div", {
|
|
94
|
+
className: "fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
95
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
96
|
+
ref: modalRef,
|
|
97
|
+
className: cn(theme.modal.wrapper),
|
|
98
|
+
role: "dialog",
|
|
99
|
+
"aria-modal": "true",
|
|
100
|
+
"aria-labelledby": "invite-modal-title",
|
|
101
|
+
children: [
|
|
102
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
103
|
+
className: cn(theme.modal.header.wrapper),
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
106
|
+
className: "flex items-center gap-3",
|
|
107
|
+
children: [
|
|
108
|
+
/*#__PURE__*/ _jsx("div", {
|
|
109
|
+
className: cn(theme.modal.header.icon),
|
|
110
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
111
|
+
className: "w-5 h-5",
|
|
112
|
+
fill: "none",
|
|
113
|
+
stroke: "currentColor",
|
|
114
|
+
viewBox: "0 0 24 24",
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
117
|
+
strokeLinecap: "round",
|
|
118
|
+
strokeLinejoin: "round",
|
|
119
|
+
strokeWidth: 2,
|
|
120
|
+
d: "M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
125
|
+
children: [
|
|
126
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
127
|
+
id: "invite-modal-title",
|
|
128
|
+
className: cn(theme.modal.header.title),
|
|
129
|
+
children: "Invite User"
|
|
130
|
+
}),
|
|
131
|
+
/*#__PURE__*/ _jsx("p", {
|
|
132
|
+
className: cn(theme.modal.header.subtitle),
|
|
133
|
+
children: "Send an invitation email to add a new user"
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
140
|
+
variant: "ghost",
|
|
141
|
+
size: "sm",
|
|
142
|
+
onClick: onClose,
|
|
143
|
+
disabled: isLoading,
|
|
144
|
+
"aria-label": "Close modal",
|
|
145
|
+
iconOnly: true,
|
|
146
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
147
|
+
className: "w-5 h-5",
|
|
148
|
+
fill: "none",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
viewBox: "0 0 24 24",
|
|
151
|
+
"aria-hidden": "true",
|
|
152
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
153
|
+
strokeLinecap: "round",
|
|
154
|
+
strokeLinejoin: "round",
|
|
155
|
+
strokeWidth: 2,
|
|
156
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ _jsx("div", {
|
|
163
|
+
className: cn(theme.modal.content),
|
|
164
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
165
|
+
className: "space-y-4",
|
|
166
|
+
children: [
|
|
167
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
168
|
+
children: [
|
|
169
|
+
/*#__PURE__*/ _jsx("label", {
|
|
170
|
+
htmlFor: "invite-email",
|
|
171
|
+
className: "block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",
|
|
172
|
+
children: "Email Address"
|
|
173
|
+
}),
|
|
174
|
+
/*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
175
|
+
id: "invite-email",
|
|
176
|
+
type: "email",
|
|
177
|
+
value: email,
|
|
178
|
+
onChange: setEmail,
|
|
179
|
+
onKeyDown: handleKeyDown,
|
|
180
|
+
placeholder: "colleague@company.com",
|
|
181
|
+
size: "md",
|
|
182
|
+
disabled: isLoading,
|
|
183
|
+
errorMessage: error || undefined,
|
|
184
|
+
leftIcon: /*#__PURE__*/ _jsx("svg", {
|
|
185
|
+
className: "w-4 h-4",
|
|
186
|
+
fill: "none",
|
|
187
|
+
stroke: "currentColor",
|
|
188
|
+
viewBox: "0 0 24 24",
|
|
189
|
+
"aria-hidden": "true",
|
|
190
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
191
|
+
strokeLinecap: "round",
|
|
192
|
+
strokeLinejoin: "round",
|
|
193
|
+
strokeWidth: 2,
|
|
194
|
+
d: "M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
}),
|
|
200
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
201
|
+
className: cn(theme.modal.infoBox),
|
|
202
|
+
children: [
|
|
203
|
+
/*#__PURE__*/ _jsx("svg", {
|
|
204
|
+
className: "w-4 h-4 text-blue-500 flex-shrink-0 mt-0.5",
|
|
205
|
+
fill: "none",
|
|
206
|
+
stroke: "currentColor",
|
|
207
|
+
viewBox: "0 0 24 24",
|
|
208
|
+
"aria-hidden": "true",
|
|
209
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
210
|
+
strokeLinecap: "round",
|
|
211
|
+
strokeLinejoin: "round",
|
|
212
|
+
strokeWidth: 2,
|
|
213
|
+
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
214
|
+
})
|
|
215
|
+
}),
|
|
216
|
+
/*#__PURE__*/ _jsx("p", {
|
|
217
|
+
className: "text-sm text-zinc-600 dark:text-zinc-400",
|
|
218
|
+
children: "The user will receive an email with a secure link to set their password and complete registration."
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
})
|
|
224
|
+
}),
|
|
225
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
226
|
+
className: cn(theme.modal.footer),
|
|
227
|
+
children: [
|
|
228
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
229
|
+
variant: "outline",
|
|
230
|
+
size: "md",
|
|
231
|
+
onClick: onClose,
|
|
232
|
+
disabled: isLoading,
|
|
233
|
+
children: "Cancel"
|
|
234
|
+
}),
|
|
235
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
236
|
+
variant: "primary",
|
|
237
|
+
size: "md",
|
|
238
|
+
onClick: handleSubmit,
|
|
239
|
+
loading: isLoading,
|
|
240
|
+
leftIcon: /*#__PURE__*/ _jsx("svg", {
|
|
241
|
+
className: "w-4 h-4",
|
|
242
|
+
fill: "none",
|
|
243
|
+
stroke: "currentColor",
|
|
244
|
+
viewBox: "0 0 24 24",
|
|
245
|
+
"aria-hidden": "true",
|
|
246
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
247
|
+
strokeLinecap: "round",
|
|
248
|
+
strokeLinejoin: "round",
|
|
249
|
+
strokeWidth: 2,
|
|
250
|
+
d: "M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
|
|
251
|
+
})
|
|
252
|
+
}),
|
|
253
|
+
children: "Send Invitation"
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
})
|
|
257
|
+
]
|
|
258
|
+
})
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
});
|
|
262
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
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 { SelectBox } from "../../SelectBox";
|
|
6
|
+
export function Pagination({ theme, currentPage, totalPages, totalItems, pageSize, pageSizeOptions = [
|
|
7
|
+
10,
|
|
8
|
+
25,
|
|
9
|
+
50,
|
|
10
|
+
100
|
|
11
|
+
], onPageChange, onPageSizeChange }) {
|
|
12
|
+
const startItem = (currentPage - 1) * pageSize + 1;
|
|
13
|
+
const endItem = Math.min(currentPage * pageSize, totalItems);
|
|
14
|
+
const pageSizeSelectOptions = pageSizeOptions.map((size)=>({
|
|
15
|
+
value: String(size),
|
|
16
|
+
label: `${size} / page`
|
|
17
|
+
}));
|
|
18
|
+
const getVisiblePages = ()=>{
|
|
19
|
+
const pages = [];
|
|
20
|
+
const maxVisible = 5;
|
|
21
|
+
if (totalPages <= maxVisible) {
|
|
22
|
+
for(let i = 1; i <= totalPages; i++){
|
|
23
|
+
pages.push(i);
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
pages.push(1);
|
|
27
|
+
if (currentPage > 3) {
|
|
28
|
+
pages.push("ellipsis");
|
|
29
|
+
}
|
|
30
|
+
const start = Math.max(2, currentPage - 1);
|
|
31
|
+
const end = Math.min(totalPages - 1, currentPage + 1);
|
|
32
|
+
for(let i = start; i <= end; i++){
|
|
33
|
+
pages.push(i);
|
|
34
|
+
}
|
|
35
|
+
if (currentPage < totalPages - 2) {
|
|
36
|
+
pages.push("ellipsis");
|
|
37
|
+
}
|
|
38
|
+
if (totalPages > 1) {
|
|
39
|
+
pages.push(totalPages);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return pages;
|
|
43
|
+
};
|
|
44
|
+
if (totalItems === 0) return null;
|
|
45
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
46
|
+
className: cn(theme.pagination.wrapper),
|
|
47
|
+
children: [
|
|
48
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
49
|
+
className: cn(theme.pagination.info),
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
52
|
+
className: "hidden sm:inline",
|
|
53
|
+
children: [
|
|
54
|
+
"Showing ",
|
|
55
|
+
startItem,
|
|
56
|
+
"-",
|
|
57
|
+
endItem,
|
|
58
|
+
" of ",
|
|
59
|
+
totalItems,
|
|
60
|
+
" users"
|
|
61
|
+
]
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
64
|
+
className: "sm:hidden",
|
|
65
|
+
children: [
|
|
66
|
+
startItem,
|
|
67
|
+
"-",
|
|
68
|
+
endItem,
|
|
69
|
+
" / ",
|
|
70
|
+
totalItems
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
76
|
+
className: "flex items-center gap-3",
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ _jsx(SelectBox, {
|
|
79
|
+
options: pageSizeSelectOptions,
|
|
80
|
+
value: String(pageSize),
|
|
81
|
+
onChange: (val)=>{
|
|
82
|
+
if (val) onPageSizeChange(Number(val));
|
|
83
|
+
},
|
|
84
|
+
size: "sm",
|
|
85
|
+
className: "min-w-[100px]"
|
|
86
|
+
}),
|
|
87
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
88
|
+
className: cn(theme.pagination.controls.wrapper),
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
91
|
+
variant: "ghost",
|
|
92
|
+
size: "sm",
|
|
93
|
+
onClick: ()=>onPageChange(currentPage - 1),
|
|
94
|
+
disabled: currentPage === 1,
|
|
95
|
+
"aria-label": "Previous page",
|
|
96
|
+
iconOnly: true,
|
|
97
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
98
|
+
className: "w-4 h-4",
|
|
99
|
+
fill: "none",
|
|
100
|
+
stroke: "currentColor",
|
|
101
|
+
viewBox: "0 0 24 24",
|
|
102
|
+
"aria-hidden": "true",
|
|
103
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
104
|
+
strokeLinecap: "round",
|
|
105
|
+
strokeLinejoin: "round",
|
|
106
|
+
strokeWidth: 2,
|
|
107
|
+
d: "M15 19l-7-7 7-7"
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
}),
|
|
111
|
+
getVisiblePages().map((page, idx)=>page === "ellipsis" ? /*#__PURE__*/ _jsx("span", {
|
|
112
|
+
className: "px-2 text-zinc-400 dark:text-zinc-600",
|
|
113
|
+
children: "..."
|
|
114
|
+
}, `ellipsis-${idx}`) : /*#__PURE__*/ _jsx(Button, {
|
|
115
|
+
variant: page === currentPage ? "primary" : "ghost",
|
|
116
|
+
size: "sm",
|
|
117
|
+
onClick: ()=>onPageChange(page),
|
|
118
|
+
children: page
|
|
119
|
+
}, page)),
|
|
120
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
121
|
+
variant: "ghost",
|
|
122
|
+
size: "sm",
|
|
123
|
+
onClick: ()=>onPageChange(currentPage + 1),
|
|
124
|
+
disabled: currentPage === totalPages,
|
|
125
|
+
"aria-label": "Next page",
|
|
126
|
+
iconOnly: true,
|
|
127
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
128
|
+
className: "w-4 h-4",
|
|
129
|
+
fill: "none",
|
|
130
|
+
stroke: "currentColor",
|
|
131
|
+
viewBox: "0 0 24 24",
|
|
132
|
+
"aria-hidden": "true",
|
|
133
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
134
|
+
strokeLinecap: "round",
|
|
135
|
+
strokeLinejoin: "round",
|
|
136
|
+
strokeWidth: 2,
|
|
137
|
+
d: "M9 5l7 7-7 7"
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
}
|