nucleus-core-ts 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +1 -1
- package/dist/fe/components/AbstractAnimatedBackground/index.js +437 -0
- package/dist/fe/components/AuthorizationPage/components/AuthorizationPage.js +841 -0
- package/dist/fe/components/AuthorizationPage/components/ClaimList.js +100 -0
- package/dist/fe/components/AuthorizationPage/components/RoleClaimEditor.js +232 -0
- package/dist/fe/components/AuthorizationPage/components/RoleList.js +115 -0
- package/dist/fe/components/AuthorizationPage/index.js +6 -0
- package/dist/fe/components/AuthorizationPage/store/index.js +117 -0
- package/dist/fe/components/AuthorizationPage/theme/index.js +137 -0
- package/dist/fe/components/AuthorizationPage/types/index.js +1 -0
- package/dist/fe/components/Button/components/Button.js +158 -0
- package/dist/fe/components/Button/components/ButtonSpinner.js +52 -0
- package/dist/fe/components/Button/index.js +3 -0
- package/dist/fe/components/Button/theme/index.js +186 -0
- package/dist/fe/components/Button/types/index.js +1 -0
- package/dist/fe/components/Button/utils/cn.js +5 -0
- package/dist/fe/components/Captcha/components/Captcha.js +311 -0
- package/dist/fe/components/Captcha/index.js +2 -0
- package/dist/fe/components/Captcha/theme.js +52 -0
- package/dist/fe/components/Captcha/types.js +1 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordForm.js +242 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordHeader.js +39 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordPage.js +60 -0
- package/dist/fe/components/ChangePasswordPage/index.js +5 -0
- package/dist/fe/components/ChangePasswordPage/store/index.js +44 -0
- package/dist/fe/components/ChangePasswordPage/theme/index.js +87 -0
- package/dist/fe/components/ChangePasswordPage/types/index.js +1 -0
- package/dist/fe/components/Checkbox/components/Checkbox.js +115 -0
- package/dist/fe/components/Checkbox/components/CheckboxIcon.js +119 -0
- package/dist/fe/components/Checkbox/components/SwitchTrack.js +178 -0
- package/dist/fe/components/Checkbox/index.js +4 -0
- package/dist/fe/components/Checkbox/theme/index.js +221 -0
- package/dist/fe/components/Checkbox/types/index.js +1 -0
- package/dist/fe/components/Checkbox/utils/cn.js +5 -0
- package/dist/fe/components/DataTable/DataTable.js +225 -0
- package/dist/fe/components/DataTable/components/ActionCell.js +26 -0
- package/dist/fe/components/DataTable/components/DataCell.js +76 -0
- package/dist/fe/components/DataTable/components/EditableCell.js +221 -0
- package/dist/fe/components/DataTable/components/EmptyState.js +29 -0
- package/dist/fe/components/DataTable/components/HeaderCell.js +64 -0
- package/dist/fe/components/DataTable/components/InfiniteScrollTrigger.js +66 -0
- package/dist/fe/components/DataTable/components/LoadingSpinner.js +19 -0
- package/dist/fe/components/DataTable/components/ResizeHandle.js +41 -0
- package/dist/fe/components/DataTable/components/SelectionCell.js +105 -0
- package/dist/fe/components/DataTable/components/SkeletonRow.js +56 -0
- package/dist/fe/components/DataTable/components/SkeletonTable.js +83 -0
- package/dist/fe/components/DataTable/components/SortIcon.js +39 -0
- package/dist/fe/components/DataTable/components/TableHeader.js +49 -0
- package/dist/fe/components/DataTable/components/TableRow.js +118 -0
- package/dist/fe/components/DataTable/components/index.js +14 -0
- package/dist/fe/components/DataTable/hooks/index.js +2 -0
- package/dist/fe/components/DataTable/hooks/useAutoFitColumn.js +23 -0
- package/dist/fe/components/DataTable/hooks/useResizeColumn.js +122 -0
- package/dist/fe/components/DataTable/index.js +3 -0
- package/dist/fe/components/DataTable/store/index.js +97 -0
- package/dist/fe/components/DataTable/theme/index.js +144 -0
- package/dist/fe/components/DataTable/types/index.js +1 -0
- package/dist/fe/components/DataTable/utils/cn.js +5 -0
- package/dist/fe/components/DatePicker/components/CalendarGrid.js +95 -0
- package/dist/fe/components/DatePicker/components/CalendarHeader.js +152 -0
- package/dist/fe/components/DatePicker/components/DatePicker.js +381 -0
- package/dist/fe/components/DatePicker/components/MonthYearSelector.js +93 -0
- package/dist/fe/components/DatePicker/index.js +7 -0
- package/dist/fe/components/DatePicker/locales/index.js +1113 -0
- package/dist/fe/components/DatePicker/theme/index.js +315 -0
- package/dist/fe/components/DatePicker/types/index.js +1 -0
- package/dist/fe/components/DatePicker/utils/cn.js +5 -0
- package/dist/fe/components/DatePicker/utils/date.js +132 -0
- package/dist/fe/components/DevicesPage/components/DeviceCard.js +251 -0
- package/dist/fe/components/DevicesPage/components/DevicesHeader.js +42 -0
- package/dist/fe/components/DevicesPage/components/DevicesPage.js +450 -0
- package/dist/fe/components/DevicesPage/index.js +5 -0
- package/dist/fe/components/DevicesPage/store/index.js +55 -0
- package/dist/fe/components/DevicesPage/theme/index.js +131 -0
- package/dist/fe/components/DevicesPage/types/index.js +1 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.js +214 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordHeader.js +42 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.js +59 -0
- package/dist/fe/components/ForgotPasswordPage/index.js +5 -0
- package/dist/fe/components/ForgotPasswordPage/store/index.js +28 -0
- package/dist/fe/components/ForgotPasswordPage/theme/index.js +87 -0
- package/dist/fe/components/ForgotPasswordPage/types/index.js +1 -0
- package/dist/fe/components/FormBuilder/components/FormBuilder.js +156 -0
- package/dist/fe/components/FormBuilder/components/FormField.js +218 -0
- package/dist/fe/components/FormBuilder/hooks/useFormBuilder.js +152 -0
- package/dist/fe/components/FormBuilder/index.js +4 -0
- package/dist/fe/components/FormBuilder/theme/index.js +134 -0
- package/dist/fe/components/FormBuilder/types/index.js +1 -0
- package/dist/fe/components/FormBuilder/utils/cn.js +5 -0
- package/dist/fe/components/FormBuilder/utils/fieldMapping.js +216 -0
- package/dist/fe/components/FormBuilder/utils/validation.js +78 -0
- package/dist/fe/components/LoginPage/components/LoginForm.js +214 -0
- package/dist/fe/components/LoginPage/components/LoginHeader.js +24 -0
- package/dist/fe/components/LoginPage/components/LoginPage.js +138 -0
- package/dist/fe/components/LoginPage/index.js +5 -0
- package/dist/fe/components/LoginPage/store/index.js +59 -0
- package/dist/fe/components/LoginPage/theme/index.js +98 -0
- package/dist/fe/components/LoginPage/types/index.js +1 -0
- package/dist/fe/components/MagicLinkVerifyPage/components/MagicLinkVerifyPage.js +200 -0
- package/dist/fe/components/MagicLinkVerifyPage/index.js +3 -0
- package/dist/fe/components/MagicLinkVerifyPage/store.js +20 -0
- package/dist/fe/components/MagicLinkVerifyPage/theme.js +36 -0
- package/dist/fe/components/MagicLinkVerifyPage/types.js +1 -0
- package/dist/fe/components/NucleusEntityShowcase.js +1409 -0
- package/dist/fe/components/NucleusTextInput/components/FloatingLabel.js +56 -0
- package/dist/fe/components/NucleusTextInput/components/InputIcons.js +258 -0
- package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.js +321 -0
- package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.js +104 -0
- package/dist/fe/components/NucleusTextInput/components/TypewriterText.js +56 -0
- package/dist/fe/components/NucleusTextInput/index.js +7 -0
- package/dist/fe/components/NucleusTextInput/theme/index.js +121 -0
- package/dist/fe/components/NucleusTextInput/types/index.js +1 -0
- package/dist/fe/components/NucleusTextInput/utils/cn.js +5 -0
- package/dist/fe/components/NucleusTextInput/utils/format.js +62 -0
- package/dist/fe/components/NucleusTextInput/utils/validation.js +191 -0
- package/dist/fe/components/ProfilePage/components/AddressCard.js +196 -0
- package/dist/fe/components/ProfilePage/components/PhoneCard.js +206 -0
- package/dist/fe/components/ProfilePage/components/ProfileHeader.js +150 -0
- package/dist/fe/components/ProfilePage/components/ProfilePage.js +1336 -0
- package/dist/fe/components/ProfilePage/index.js +6 -0
- package/dist/fe/components/ProfilePage/store/index.js +115 -0
- package/dist/fe/components/ProfilePage/theme/index.js +168 -0
- package/dist/fe/components/ProfilePage/types/index.js +1 -0
- package/dist/fe/components/RangePicker/components/RangePicker.js +338 -0
- package/dist/fe/components/RangePicker/components/RangeThumb.js +68 -0
- package/dist/fe/components/RangePicker/components/RangeTooltip.js +45 -0
- package/dist/fe/components/RangePicker/components/RangeTrack.js +32 -0
- package/dist/fe/components/RangePicker/index.js +5 -0
- package/dist/fe/components/RangePicker/theme/index.js +88 -0
- package/dist/fe/components/RangePicker/types/index.js +1 -0
- package/dist/fe/components/RangePicker/utils/cn.js +3 -0
- package/dist/fe/components/RegisterPage/components/PasswordStrengthIndicator.js +107 -0
- package/dist/fe/components/RegisterPage/components/RegisterForm.js +322 -0
- package/dist/fe/components/RegisterPage/components/RegisterHeader.js +23 -0
- package/dist/fe/components/RegisterPage/components/RegisterPage.js +85 -0
- package/dist/fe/components/RegisterPage/index.js +6 -0
- package/dist/fe/components/RegisterPage/store/index.js +106 -0
- package/dist/fe/components/RegisterPage/theme/index.js +128 -0
- package/dist/fe/components/RegisterPage/types/index.js +1 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.js +347 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordHeader.js +42 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.js +61 -0
- package/dist/fe/components/ResetPasswordPage/index.js +5 -0
- package/dist/fe/components/ResetPasswordPage/store/index.js +36 -0
- package/dist/fe/components/ResetPasswordPage/theme/index.js +99 -0
- package/dist/fe/components/ResetPasswordPage/types/index.js +1 -0
- package/dist/fe/components/SearchBox/components/SearchBox.js +271 -0
- package/dist/fe/components/SearchBox/components/SearchBoxDropdown.js +87 -0
- package/dist/fe/components/SearchBox/index.js +5 -0
- package/dist/fe/components/SearchBox/theme/index.js +184 -0
- package/dist/fe/components/SearchBox/types/index.js +1 -0
- package/dist/fe/components/SearchBox/utils/cn.js +5 -0
- package/dist/fe/components/SearchBox/utils/debounce.js +22 -0
- package/dist/fe/components/SearchBox/utils/sanitize.js +48 -0
- package/dist/fe/components/SelectBox/components/SelectBox.js +364 -0
- package/dist/fe/components/SelectBox/components/SelectDropdown.js +92 -0
- package/dist/fe/components/SelectBox/components/SelectOptionItem.js +43 -0
- package/dist/fe/components/SelectBox/components/SelectTrigger.js +22 -0
- package/dist/fe/components/SelectBox/index.js +5 -0
- package/dist/fe/components/SelectBox/theme/index.js +98 -0
- package/dist/fe/components/SelectBox/types/index.js +1 -0
- package/dist/fe/components/SelectBox/utils/cn.js +3 -0
- package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.js +107 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.js +142 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordHeader.js +23 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.js +263 -0
- package/dist/fe/components/SetPasswordPage/index.js +7 -0
- package/dist/fe/components/SetPasswordPage/store/index.js +79 -0
- package/dist/fe/components/SetPasswordPage/theme/index.js +98 -0
- package/dist/fe/components/SetPasswordPage/types/index.js +12 -0
- package/dist/fe/components/UsersPage/components/InviteUserModal.js +262 -0
- package/dist/fe/components/UsersPage/components/Pagination.js +147 -0
- package/dist/fe/components/UsersPage/components/RoleAssignmentModal.js +186 -0
- package/dist/fe/components/UsersPage/components/StatsCards.js +124 -0
- package/dist/fe/components/UsersPage/components/UserDetailDrawer.js +444 -0
- package/dist/fe/components/UsersPage/components/UserFilters.js +142 -0
- package/dist/fe/components/UsersPage/components/UserListItem.js +125 -0
- package/dist/fe/components/UsersPage/components/UserListSkeleton.js +40 -0
- package/dist/fe/components/UsersPage/components/UsersPage.js +556 -0
- package/dist/fe/components/UsersPage/index.js +10 -0
- package/dist/fe/components/UsersPage/store/index.js +151 -0
- package/dist/fe/components/UsersPage/theme/index.js +231 -0
- package/dist/fe/components/UsersPage/types/index.js +1 -0
- package/dist/fe/components/VerifyEmailPage/components/VerifyEmailPage.js +290 -0
- package/dist/fe/components/VerifyEmailPage/index.js +3 -0
- package/dist/fe/components/VerifyEmailPage/store/index.js +45 -0
- package/dist/fe/components/VerifyEmailPage/theme/index.js +52 -0
- package/dist/fe/components/VerifyEmailPage/types/index.js +1 -0
- package/dist/fe/hooks/useNucleusEntity.js +247 -0
- package/dist/fe/index.js +28 -157
- package/dist/fe/types/index.js +1 -0
- package/dist/fe/utils/cn.js +5 -0
- package/dist/fe/utils/columnUtils.js +189 -0
- package/dist/fe/utils/endpointKeys.js +44 -0
- package/dist/index.js +1 -1
- package/dist/src/Client/Proxy/httpProxy.js +1 -0
- package/dist/src/Client/Proxy/index.js +1 -1
- package/dist/src/Client/Proxy/server.js +1 -0
- package/dist/src/Client/Proxy/types.js +1 -0
- package/dist/src/Client/Proxy/utils.js +1 -0
- package/dist/src/Client/Proxy/wsProxy.js +1 -0
- package/package.json +1 -1
- package/scripts/build.ts +32 -16
|
@@ -0,0 +1,347 @@
|
|
|
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 { useMemo, useRef } from "react";
|
|
6
|
+
import { cn } from "../../../utils/cn";
|
|
7
|
+
import { Button } from "../../Button";
|
|
8
|
+
import { NucleusTextInput } from "../../NucleusTextInput";
|
|
9
|
+
import { DEFAULT_PASSWORD_POLICY } from "../../SetPasswordPage/types";
|
|
10
|
+
import { useResetPasswordStore } from "../store";
|
|
11
|
+
import { resetPasswordPageTheme } from "../theme";
|
|
12
|
+
gsap.registerPlugin(useGSAP);
|
|
13
|
+
function ArrowLeftIcon({ className }) {
|
|
14
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
15
|
+
className: cn("w-4 h-4", className),
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round",
|
|
23
|
+
strokeWidth: 2,
|
|
24
|
+
d: "M10 19l-7-7m0 0l7-7m-7 7h18"
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function CheckCircleIcon({ className }) {
|
|
29
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
30
|
+
className: cn("w-8 h-8 text-green-600 dark:text-green-400", className),
|
|
31
|
+
fill: "none",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
36
|
+
strokeLinecap: "round",
|
|
37
|
+
strokeLinejoin: "round",
|
|
38
|
+
strokeWidth: 2,
|
|
39
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function CheckIcon({ className }) {
|
|
44
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
45
|
+
className: cn("w-3 h-3", className),
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "currentColor",
|
|
48
|
+
viewBox: "0 0 24 24",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
51
|
+
strokeLinecap: "round",
|
|
52
|
+
strokeLinejoin: "round",
|
|
53
|
+
strokeWidth: 2,
|
|
54
|
+
d: "M5 13l4 4L19 7"
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function XIcon({ className }) {
|
|
59
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
60
|
+
className: cn("w-3 h-3", className),
|
|
61
|
+
fill: "none",
|
|
62
|
+
stroke: "currentColor",
|
|
63
|
+
viewBox: "0 0 24 24",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
66
|
+
strokeLinecap: "round",
|
|
67
|
+
strokeLinejoin: "round",
|
|
68
|
+
strokeWidth: 2,
|
|
69
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export function ResetPasswordForm({ token, resetPasswordAction, onBackToLogin, backToLoginHref, passwordPolicy = {} }) {
|
|
74
|
+
const theme = resetPasswordPageTheme;
|
|
75
|
+
const formRef = useRef(null);
|
|
76
|
+
const successRef = useRef(null);
|
|
77
|
+
const store = useResetPasswordStore();
|
|
78
|
+
const policy = {
|
|
79
|
+
...DEFAULT_PASSWORD_POLICY,
|
|
80
|
+
...passwordPolicy
|
|
81
|
+
};
|
|
82
|
+
const passwordRequirements = useMemo(()=>{
|
|
83
|
+
const reqs = [
|
|
84
|
+
{
|
|
85
|
+
key: "length",
|
|
86
|
+
label: `At least ${policy.minLength} characters`,
|
|
87
|
+
test: (p)=>p.length >= policy.minLength
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
if (policy.requireUppercase) {
|
|
91
|
+
reqs.push({
|
|
92
|
+
key: "uppercase",
|
|
93
|
+
label: "One uppercase letter",
|
|
94
|
+
test: (p)=>/[A-Z]/.test(p)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (policy.requireLowercase) {
|
|
98
|
+
reqs.push({
|
|
99
|
+
key: "lowercase",
|
|
100
|
+
label: "One lowercase letter",
|
|
101
|
+
test: (p)=>/[a-z]/.test(p)
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (policy.requireNumber) {
|
|
105
|
+
reqs.push({
|
|
106
|
+
key: "number",
|
|
107
|
+
label: "One number",
|
|
108
|
+
test: (p)=>/\d/.test(p)
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (policy.requireSpecialChar) {
|
|
112
|
+
reqs.push({
|
|
113
|
+
key: "special",
|
|
114
|
+
label: "One special character",
|
|
115
|
+
test: (p)=>{
|
|
116
|
+
const escapedChars = policy.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
117
|
+
return new RegExp(`[${escapedChars}]`).test(p);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return reqs;
|
|
122
|
+
}, [
|
|
123
|
+
policy.minLength,
|
|
124
|
+
policy.requireUppercase,
|
|
125
|
+
policy.requireLowercase,
|
|
126
|
+
policy.requireNumber,
|
|
127
|
+
policy.requireSpecialChar,
|
|
128
|
+
policy.specialChars
|
|
129
|
+
]);
|
|
130
|
+
const { contextSafe } = useGSAP({
|
|
131
|
+
scope: formRef
|
|
132
|
+
});
|
|
133
|
+
const isLoading = resetPasswordAction.state.isPending;
|
|
134
|
+
const handleSubmit = contextSafe((e)=>{
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
if (!store.newPassword || !store.confirmPassword) {
|
|
137
|
+
store.setError("Please fill in all fields");
|
|
138
|
+
shakeForm();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (store.newPassword !== store.confirmPassword) {
|
|
142
|
+
store.setError("Passwords do not match");
|
|
143
|
+
shakeForm();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const allRequirementsMet = passwordRequirements.every((req)=>req.test(store.newPassword));
|
|
147
|
+
if (!allRequirementsMet) {
|
|
148
|
+
store.setError("Password does not meet all requirements");
|
|
149
|
+
shakeForm();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
store.setError(null);
|
|
153
|
+
resetPasswordAction.start({
|
|
154
|
+
payload: {
|
|
155
|
+
token,
|
|
156
|
+
newPassword: store.newPassword,
|
|
157
|
+
confirmPassword: store.confirmPassword
|
|
158
|
+
},
|
|
159
|
+
onAfterHandle: ()=>{
|
|
160
|
+
store.setStep("success");
|
|
161
|
+
},
|
|
162
|
+
onErrorHandle: (err)=>{
|
|
163
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to reset password. Please try again.";
|
|
164
|
+
store.setError(errorMessage);
|
|
165
|
+
shakeForm();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
const shakeForm = contextSafe(()=>{
|
|
170
|
+
if (!formRef.current) return;
|
|
171
|
+
gsap.fromTo(formRef.current, {
|
|
172
|
+
x: -10
|
|
173
|
+
}, {
|
|
174
|
+
x: 10,
|
|
175
|
+
duration: 0.08,
|
|
176
|
+
repeat: 5,
|
|
177
|
+
yoyo: true,
|
|
178
|
+
ease: "power2.inOut",
|
|
179
|
+
onComplete: ()=>{
|
|
180
|
+
gsap.set(formRef.current, {
|
|
181
|
+
x: 0
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
useGSAP(()=>{
|
|
187
|
+
if (store.step === "success" && successRef.current) {
|
|
188
|
+
gsap.fromTo(successRef.current, {
|
|
189
|
+
opacity: 0,
|
|
190
|
+
scale: 0.9
|
|
191
|
+
}, {
|
|
192
|
+
opacity: 1,
|
|
193
|
+
scale: 1,
|
|
194
|
+
duration: 0.4,
|
|
195
|
+
ease: "back.out(1.7)"
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
dependencies: [
|
|
200
|
+
store.step
|
|
201
|
+
]
|
|
202
|
+
});
|
|
203
|
+
const handleBackToLoginClick = ()=>{
|
|
204
|
+
if (onBackToLogin) {
|
|
205
|
+
onBackToLogin();
|
|
206
|
+
} else if (backToLoginHref) {
|
|
207
|
+
window.location.href = backToLoginHref;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
if (store.step === "success") {
|
|
211
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
212
|
+
ref: successRef,
|
|
213
|
+
className: theme.success.container,
|
|
214
|
+
children: [
|
|
215
|
+
/*#__PURE__*/ _jsx("div", {
|
|
216
|
+
className: theme.success.iconWrapper,
|
|
217
|
+
children: /*#__PURE__*/ _jsx(CheckCircleIcon, {})
|
|
218
|
+
}),
|
|
219
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
220
|
+
className: theme.success.title,
|
|
221
|
+
children: "Password Reset Successful"
|
|
222
|
+
}),
|
|
223
|
+
/*#__PURE__*/ _jsx("p", {
|
|
224
|
+
className: theme.success.message,
|
|
225
|
+
children: "Your password has been successfully reset. You can now log in with your new password."
|
|
226
|
+
}),
|
|
227
|
+
/*#__PURE__*/ _jsx("div", {
|
|
228
|
+
className: theme.links.container,
|
|
229
|
+
children: /*#__PURE__*/ _jsxs("button", {
|
|
230
|
+
type: "button",
|
|
231
|
+
onClick: handleBackToLoginClick,
|
|
232
|
+
className: theme.links.backToLogin,
|
|
233
|
+
children: [
|
|
234
|
+
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
235
|
+
"Back to login"
|
|
236
|
+
]
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return /*#__PURE__*/ _jsxs("form", {
|
|
243
|
+
ref: formRef,
|
|
244
|
+
onSubmit: handleSubmit,
|
|
245
|
+
className: theme.form.container,
|
|
246
|
+
noValidate: true,
|
|
247
|
+
children: [
|
|
248
|
+
store.error && /*#__PURE__*/ _jsx("div", {
|
|
249
|
+
className: theme.error.container,
|
|
250
|
+
role: "alert",
|
|
251
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
252
|
+
className: theme.error.text,
|
|
253
|
+
children: store.error
|
|
254
|
+
})
|
|
255
|
+
}),
|
|
256
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
257
|
+
className: theme.form.spacing,
|
|
258
|
+
children: [
|
|
259
|
+
/*#__PURE__*/ _jsx("div", {
|
|
260
|
+
className: theme.input.wrapper,
|
|
261
|
+
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
262
|
+
type: "password",
|
|
263
|
+
label: "New Password",
|
|
264
|
+
placeholder: "••••••••",
|
|
265
|
+
value: store.newPassword,
|
|
266
|
+
onChange: store.setNewPassword,
|
|
267
|
+
disabled: isLoading,
|
|
268
|
+
enableValidation: false,
|
|
269
|
+
isNewPassword: true,
|
|
270
|
+
showPasswordStrength: policy.showStrengthIndicator,
|
|
271
|
+
maxInputLength: policy.maxLength,
|
|
272
|
+
fullWidth: true,
|
|
273
|
+
showTypeIcon: false,
|
|
274
|
+
wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
|
|
275
|
+
inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
|
|
276
|
+
})
|
|
277
|
+
}),
|
|
278
|
+
/*#__PURE__*/ _jsx("div", {
|
|
279
|
+
className: theme.input.wrapper,
|
|
280
|
+
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
281
|
+
type: "password",
|
|
282
|
+
label: "Confirm Password",
|
|
283
|
+
placeholder: "••••••••",
|
|
284
|
+
value: store.confirmPassword,
|
|
285
|
+
onChange: store.setConfirmPassword,
|
|
286
|
+
disabled: isLoading,
|
|
287
|
+
enableValidation: false,
|
|
288
|
+
isNewPassword: true,
|
|
289
|
+
confirmValue: store.newPassword,
|
|
290
|
+
fullWidth: true,
|
|
291
|
+
showTypeIcon: false,
|
|
292
|
+
wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
|
|
293
|
+
inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
store.newPassword && /*#__PURE__*/ _jsxs("div", {
|
|
297
|
+
className: theme.requirements.container,
|
|
298
|
+
children: [
|
|
299
|
+
/*#__PURE__*/ _jsx("p", {
|
|
300
|
+
className: theme.requirements.title,
|
|
301
|
+
children: "Password requirements:"
|
|
302
|
+
}),
|
|
303
|
+
/*#__PURE__*/ _jsx("ul", {
|
|
304
|
+
className: theme.requirements.list,
|
|
305
|
+
children: passwordRequirements.map((req)=>{
|
|
306
|
+
const isValid = req.test(store.newPassword);
|
|
307
|
+
return /*#__PURE__*/ _jsxs("li", {
|
|
308
|
+
className: cn(theme.requirements.item, isValid ? theme.requirements.itemValid : theme.requirements.itemInvalid),
|
|
309
|
+
children: [
|
|
310
|
+
isValid ? /*#__PURE__*/ _jsx(CheckIcon, {}) : /*#__PURE__*/ _jsx(XIcon, {}),
|
|
311
|
+
req.label
|
|
312
|
+
]
|
|
313
|
+
}, req.key);
|
|
314
|
+
})
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
}),
|
|
318
|
+
/*#__PURE__*/ _jsx("div", {
|
|
319
|
+
className: theme.button.wrapper,
|
|
320
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
321
|
+
type: "submit",
|
|
322
|
+
variant: "nucleus",
|
|
323
|
+
size: "lg",
|
|
324
|
+
fullWidth: true,
|
|
325
|
+
loading: isLoading,
|
|
326
|
+
disabled: isLoading,
|
|
327
|
+
children: "Reset Password"
|
|
328
|
+
})
|
|
329
|
+
}),
|
|
330
|
+
/*#__PURE__*/ _jsx("div", {
|
|
331
|
+
className: theme.links.container,
|
|
332
|
+
children: /*#__PURE__*/ _jsxs("button", {
|
|
333
|
+
type: "button",
|
|
334
|
+
onClick: handleBackToLoginClick,
|
|
335
|
+
className: theme.links.backToLogin,
|
|
336
|
+
disabled: isLoading,
|
|
337
|
+
children: [
|
|
338
|
+
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
339
|
+
"Back to login"
|
|
340
|
+
]
|
|
341
|
+
})
|
|
342
|
+
})
|
|
343
|
+
]
|
|
344
|
+
})
|
|
345
|
+
]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../utils/cn";
|
|
4
|
+
import { resetPasswordPageTheme } from "../theme";
|
|
5
|
+
function LockIcon({ className }) {
|
|
6
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
7
|
+
className: cn("w-8 h-8 text-blue-600 dark:text-blue-400", className),
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
"aria-hidden": "true",
|
|
12
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
strokeWidth: 2,
|
|
16
|
+
d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function ResetPasswordHeader({ logo, title, subtitle }) {
|
|
21
|
+
const theme = resetPasswordPageTheme;
|
|
22
|
+
return /*#__PURE__*/ _jsxs("header", {
|
|
23
|
+
className: theme.header.container,
|
|
24
|
+
children: [
|
|
25
|
+
logo ? /*#__PURE__*/ _jsx("div", {
|
|
26
|
+
className: theme.header.logoWrapper,
|
|
27
|
+
children: logo
|
|
28
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
29
|
+
className: theme.header.iconWrapper,
|
|
30
|
+
children: /*#__PURE__*/ _jsx(LockIcon, {})
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
33
|
+
className: theme.header.title,
|
|
34
|
+
children: title
|
|
35
|
+
}),
|
|
36
|
+
/*#__PURE__*/ _jsx("p", {
|
|
37
|
+
className: theme.header.subtitle,
|
|
38
|
+
children: subtitle
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { AbstractAnimatedBackground } from "../../AbstractAnimatedBackground";
|
|
8
|
+
import { resetPasswordPageTheme } from "../theme";
|
|
9
|
+
import { ResetPasswordForm } from "./ResetPasswordForm";
|
|
10
|
+
import { ResetPasswordHeader } from "./ResetPasswordHeader";
|
|
11
|
+
gsap.registerPlugin(useGSAP);
|
|
12
|
+
export function ResetPasswordPage({ logo, title = "Reset Password", subtitle = "Enter your new password below.", token, resetPasswordAction, onBackToLogin, backToLoginHref, showBackground = true, className, passwordPolicy }) {
|
|
13
|
+
const theme = resetPasswordPageTheme;
|
|
14
|
+
const containerRef = useRef(null);
|
|
15
|
+
const cardRef = useRef(null);
|
|
16
|
+
useGSAP(()=>{
|
|
17
|
+
if (!cardRef.current) return;
|
|
18
|
+
gsap.fromTo(cardRef.current, {
|
|
19
|
+
opacity: 0,
|
|
20
|
+
y: 30,
|
|
21
|
+
scale: 0.95
|
|
22
|
+
}, {
|
|
23
|
+
opacity: 1,
|
|
24
|
+
y: 0,
|
|
25
|
+
scale: 1,
|
|
26
|
+
duration: 0.6,
|
|
27
|
+
ease: "power3.out"
|
|
28
|
+
});
|
|
29
|
+
}, {
|
|
30
|
+
scope: containerRef
|
|
31
|
+
});
|
|
32
|
+
return /*#__PURE__*/ _jsxs("main", {
|
|
33
|
+
ref: containerRef,
|
|
34
|
+
className: cn(theme.container.base, className),
|
|
35
|
+
"aria-label": "Reset password page",
|
|
36
|
+
children: [
|
|
37
|
+
showBackground && /*#__PURE__*/ _jsx(AbstractAnimatedBackground, {}),
|
|
38
|
+
/*#__PURE__*/ _jsx("div", {
|
|
39
|
+
className: theme.container.wrapper,
|
|
40
|
+
children: /*#__PURE__*/ _jsxs("article", {
|
|
41
|
+
ref: cardRef,
|
|
42
|
+
className: cn(theme.card.base, theme.card.padding, theme.card.background, theme.card.border, theme.card.shadow, theme.card.rounded),
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ _jsx(ResetPasswordHeader, {
|
|
45
|
+
logo: logo,
|
|
46
|
+
title: title,
|
|
47
|
+
subtitle: subtitle
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ _jsx(ResetPasswordForm, {
|
|
50
|
+
token: token,
|
|
51
|
+
resetPasswordAction: resetPasswordAction,
|
|
52
|
+
onBackToLogin: onBackToLogin,
|
|
53
|
+
backToLoginHref: backToLoginHref,
|
|
54
|
+
passwordPolicy: passwordPolicy
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ResetPasswordForm } from "./components/ResetPasswordForm";
|
|
2
|
+
export { ResetPasswordHeader } from "./components/ResetPasswordHeader";
|
|
3
|
+
export { ResetPasswordPage } from "./components/ResetPasswordPage";
|
|
4
|
+
export { useResetPasswordStore } from "./store";
|
|
5
|
+
export { extendResetPasswordPageTheme, resetPasswordPageTheme } from "./theme";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { batch, createStore } from "h-state";
|
|
3
|
+
const initialState = {
|
|
4
|
+
newPassword: "",
|
|
5
|
+
confirmPassword: "",
|
|
6
|
+
step: "form",
|
|
7
|
+
error: null
|
|
8
|
+
};
|
|
9
|
+
export const { useStore: useResetPasswordStore } = createStore(initialState, {
|
|
10
|
+
setNewPassword: (store)=>(password)=>{
|
|
11
|
+
store.newPassword = password;
|
|
12
|
+
if (store.error) {
|
|
13
|
+
store.error = null;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
setConfirmPassword: (store)=>(password)=>{
|
|
17
|
+
store.confirmPassword = password;
|
|
18
|
+
if (store.error) {
|
|
19
|
+
store.error = null;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
setStep: (store)=>(step)=>{
|
|
23
|
+
store.step = step;
|
|
24
|
+
},
|
|
25
|
+
setError: (store)=>(error)=>{
|
|
26
|
+
store.error = error;
|
|
27
|
+
},
|
|
28
|
+
reset: (store)=>()=>{
|
|
29
|
+
batch(()=>{
|
|
30
|
+
store.newPassword = "";
|
|
31
|
+
store.confirmPassword = "";
|
|
32
|
+
store.step = "form";
|
|
33
|
+
store.error = null;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export const resetPasswordPageTheme = {
|
|
2
|
+
container: {
|
|
3
|
+
base: "relative min-h-screen w-full flex items-center justify-center",
|
|
4
|
+
wrapper: "relative z-10 w-full max-w-md px-4 sm:px-0"
|
|
5
|
+
},
|
|
6
|
+
card: {
|
|
7
|
+
base: "w-full",
|
|
8
|
+
padding: "p-6 sm:p-8",
|
|
9
|
+
background: "bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",
|
|
10
|
+
border: "border border-white/20 dark:border-zinc-800/50",
|
|
11
|
+
shadow: "shadow-2xl shadow-black/10 dark:shadow-black/30",
|
|
12
|
+
rounded: "rounded-2xl sm:rounded-3xl"
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
container: "flex flex-col items-center mb-8",
|
|
16
|
+
logoWrapper: "mb-4",
|
|
17
|
+
iconWrapper: "mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",
|
|
18
|
+
title: "text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",
|
|
19
|
+
subtitle: "mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"
|
|
20
|
+
},
|
|
21
|
+
form: {
|
|
22
|
+
container: "w-full",
|
|
23
|
+
spacing: "space-y-4"
|
|
24
|
+
},
|
|
25
|
+
input: {
|
|
26
|
+
wrapper: "w-full"
|
|
27
|
+
},
|
|
28
|
+
button: {
|
|
29
|
+
wrapper: "mt-6"
|
|
30
|
+
},
|
|
31
|
+
links: {
|
|
32
|
+
container: "mt-6 text-center",
|
|
33
|
+
backToLogin: "text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer inline-flex items-center gap-1"
|
|
34
|
+
},
|
|
35
|
+
error: {
|
|
36
|
+
container: "mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",
|
|
37
|
+
text: "text-sm text-red-600 dark:text-red-400 text-center"
|
|
38
|
+
},
|
|
39
|
+
success: {
|
|
40
|
+
container: "flex flex-col items-center text-center",
|
|
41
|
+
iconWrapper: "mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",
|
|
42
|
+
title: "text-xl font-semibold text-zinc-900 dark:text-white mb-2",
|
|
43
|
+
message: "text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"
|
|
44
|
+
},
|
|
45
|
+
requirements: {
|
|
46
|
+
container: "mt-3 p-3 rounded-lg bg-zinc-50 dark:bg-zinc-800/50",
|
|
47
|
+
title: "text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-2",
|
|
48
|
+
list: "space-y-1",
|
|
49
|
+
item: "text-xs flex items-center gap-2",
|
|
50
|
+
itemValid: "text-green-600 dark:text-green-400",
|
|
51
|
+
itemInvalid: "text-zinc-400 dark:text-zinc-500"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export function extendResetPasswordPageTheme(overrides) {
|
|
55
|
+
return {
|
|
56
|
+
...resetPasswordPageTheme,
|
|
57
|
+
...overrides,
|
|
58
|
+
container: {
|
|
59
|
+
...resetPasswordPageTheme.container,
|
|
60
|
+
...overrides.container
|
|
61
|
+
},
|
|
62
|
+
card: {
|
|
63
|
+
...resetPasswordPageTheme.card,
|
|
64
|
+
...overrides.card
|
|
65
|
+
},
|
|
66
|
+
header: {
|
|
67
|
+
...resetPasswordPageTheme.header,
|
|
68
|
+
...overrides.header
|
|
69
|
+
},
|
|
70
|
+
form: {
|
|
71
|
+
...resetPasswordPageTheme.form,
|
|
72
|
+
...overrides.form
|
|
73
|
+
},
|
|
74
|
+
input: {
|
|
75
|
+
...resetPasswordPageTheme.input,
|
|
76
|
+
...overrides.input
|
|
77
|
+
},
|
|
78
|
+
button: {
|
|
79
|
+
...resetPasswordPageTheme.button,
|
|
80
|
+
...overrides.button
|
|
81
|
+
},
|
|
82
|
+
links: {
|
|
83
|
+
...resetPasswordPageTheme.links,
|
|
84
|
+
...overrides.links
|
|
85
|
+
},
|
|
86
|
+
error: {
|
|
87
|
+
...resetPasswordPageTheme.error,
|
|
88
|
+
...overrides.error
|
|
89
|
+
},
|
|
90
|
+
success: {
|
|
91
|
+
...resetPasswordPageTheme.success,
|
|
92
|
+
...overrides.success
|
|
93
|
+
},
|
|
94
|
+
requirements: {
|
|
95
|
+
...resetPasswordPageTheme.requirements,
|
|
96
|
+
...overrides.requirements
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|