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,214 @@
|
|
|
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 { Button } from "../../Button";
|
|
8
|
+
import { NucleusTextInput } from "../../NucleusTextInput";
|
|
9
|
+
import { useForgotPasswordStore } from "../store";
|
|
10
|
+
import { forgotPasswordPageTheme } from "../theme";
|
|
11
|
+
gsap.registerPlugin(useGSAP);
|
|
12
|
+
function ArrowLeftIcon({ className }) {
|
|
13
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
14
|
+
className: cn("w-4 h-4", className),
|
|
15
|
+
fill: "none",
|
|
16
|
+
stroke: "currentColor",
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
20
|
+
strokeLinecap: "round",
|
|
21
|
+
strokeLinejoin: "round",
|
|
22
|
+
strokeWidth: 2,
|
|
23
|
+
d: "M10 19l-7-7m0 0l7-7m-7 7h18"
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function CheckCircleIcon({ className }) {
|
|
28
|
+
return /*#__PURE__*/ _jsx("svg", {
|
|
29
|
+
className: cn("w-8 h-8 text-green-600 dark:text-green-400", className),
|
|
30
|
+
fill: "none",
|
|
31
|
+
stroke: "currentColor",
|
|
32
|
+
viewBox: "0 0 24 24",
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
35
|
+
strokeLinecap: "round",
|
|
36
|
+
strokeLinejoin: "round",
|
|
37
|
+
strokeWidth: 2,
|
|
38
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function ForgotPasswordForm({ forgotPasswordAction, onBackToLogin, backToLoginHref }) {
|
|
43
|
+
const theme = forgotPasswordPageTheme;
|
|
44
|
+
const formRef = useRef(null);
|
|
45
|
+
const successRef = useRef(null);
|
|
46
|
+
const store = useForgotPasswordStore();
|
|
47
|
+
const { contextSafe } = useGSAP({
|
|
48
|
+
scope: formRef
|
|
49
|
+
});
|
|
50
|
+
const isLoading = forgotPasswordAction.state.isPending;
|
|
51
|
+
const handleSubmit = contextSafe((e)=>{
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
if (!store.email) {
|
|
54
|
+
store.setError("Please enter your email address");
|
|
55
|
+
shakeForm();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
store.setError(null);
|
|
59
|
+
forgotPasswordAction.start({
|
|
60
|
+
payload: {
|
|
61
|
+
email: store.email
|
|
62
|
+
},
|
|
63
|
+
onAfterHandle: ()=>{
|
|
64
|
+
store.setStep("success");
|
|
65
|
+
},
|
|
66
|
+
onErrorHandle: (err)=>{
|
|
67
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to send reset email. Please try again.";
|
|
68
|
+
store.setError(errorMessage);
|
|
69
|
+
shakeForm();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
const shakeForm = contextSafe(()=>{
|
|
74
|
+
if (!formRef.current) return;
|
|
75
|
+
gsap.fromTo(formRef.current, {
|
|
76
|
+
x: -10
|
|
77
|
+
}, {
|
|
78
|
+
x: 10,
|
|
79
|
+
duration: 0.08,
|
|
80
|
+
repeat: 5,
|
|
81
|
+
yoyo: true,
|
|
82
|
+
ease: "power2.inOut",
|
|
83
|
+
onComplete: ()=>{
|
|
84
|
+
gsap.set(formRef.current, {
|
|
85
|
+
x: 0
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
useGSAP(()=>{
|
|
91
|
+
if (store.step === "success" && successRef.current) {
|
|
92
|
+
gsap.fromTo(successRef.current, {
|
|
93
|
+
opacity: 0,
|
|
94
|
+
scale: 0.9
|
|
95
|
+
}, {
|
|
96
|
+
opacity: 1,
|
|
97
|
+
scale: 1,
|
|
98
|
+
duration: 0.4,
|
|
99
|
+
ease: "back.out(1.7)"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
dependencies: [
|
|
104
|
+
store.step
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
const handleBackToLoginClick = ()=>{
|
|
108
|
+
if (onBackToLogin) {
|
|
109
|
+
onBackToLogin();
|
|
110
|
+
} else if (backToLoginHref) {
|
|
111
|
+
window.location.href = backToLoginHref;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
if (store.step === "success") {
|
|
115
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
116
|
+
ref: successRef,
|
|
117
|
+
className: theme.success.container,
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ _jsx("div", {
|
|
120
|
+
className: theme.success.iconWrapper,
|
|
121
|
+
children: /*#__PURE__*/ _jsx(CheckCircleIcon, {})
|
|
122
|
+
}),
|
|
123
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
124
|
+
className: theme.success.title,
|
|
125
|
+
children: "Check your email"
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
128
|
+
className: theme.success.message,
|
|
129
|
+
children: [
|
|
130
|
+
"We've sent a password reset link to ",
|
|
131
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
132
|
+
children: store.email
|
|
133
|
+
}),
|
|
134
|
+
". Please check your inbox and follow the instructions."
|
|
135
|
+
]
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ _jsx("div", {
|
|
138
|
+
className: theme.links.container,
|
|
139
|
+
children: /*#__PURE__*/ _jsxs("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
onClick: handleBackToLoginClick,
|
|
142
|
+
className: theme.links.backToLogin,
|
|
143
|
+
children: [
|
|
144
|
+
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
145
|
+
"Back to login"
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return /*#__PURE__*/ _jsxs("form", {
|
|
153
|
+
ref: formRef,
|
|
154
|
+
onSubmit: handleSubmit,
|
|
155
|
+
className: theme.form.container,
|
|
156
|
+
noValidate: true,
|
|
157
|
+
children: [
|
|
158
|
+
store.error && /*#__PURE__*/ _jsx("div", {
|
|
159
|
+
className: theme.error.container,
|
|
160
|
+
role: "alert",
|
|
161
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
162
|
+
className: theme.error.text,
|
|
163
|
+
children: store.error
|
|
164
|
+
})
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
167
|
+
className: theme.form.spacing,
|
|
168
|
+
children: [
|
|
169
|
+
/*#__PURE__*/ _jsx("div", {
|
|
170
|
+
className: theme.input.wrapper,
|
|
171
|
+
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
172
|
+
type: "email",
|
|
173
|
+
label: "Email",
|
|
174
|
+
placeholder: "you@example.com",
|
|
175
|
+
value: store.email,
|
|
176
|
+
onChange: store.setEmail,
|
|
177
|
+
disabled: isLoading,
|
|
178
|
+
enableValidation: false,
|
|
179
|
+
fullWidth: true,
|
|
180
|
+
showTypeIcon: false,
|
|
181
|
+
wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
|
|
182
|
+
inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
|
|
183
|
+
})
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ _jsx("div", {
|
|
186
|
+
className: theme.button.wrapper,
|
|
187
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
188
|
+
type: "submit",
|
|
189
|
+
variant: "nucleus",
|
|
190
|
+
size: "lg",
|
|
191
|
+
fullWidth: true,
|
|
192
|
+
loading: isLoading,
|
|
193
|
+
disabled: isLoading,
|
|
194
|
+
children: "Send Reset Link"
|
|
195
|
+
})
|
|
196
|
+
}),
|
|
197
|
+
/*#__PURE__*/ _jsx("div", {
|
|
198
|
+
className: theme.links.container,
|
|
199
|
+
children: /*#__PURE__*/ _jsxs("button", {
|
|
200
|
+
type: "button",
|
|
201
|
+
onClick: handleBackToLoginClick,
|
|
202
|
+
className: theme.links.backToLogin,
|
|
203
|
+
disabled: isLoading,
|
|
204
|
+
children: [
|
|
205
|
+
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
206
|
+
"Back to login"
|
|
207
|
+
]
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
@@ -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 { forgotPasswordPageTheme } from "../theme";
|
|
5
|
+
function KeyIcon({ 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: "M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function ForgotPasswordHeader({ logo, title, subtitle }) {
|
|
21
|
+
const theme = forgotPasswordPageTheme;
|
|
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(KeyIcon, {})
|
|
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,59 @@
|
|
|
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 { forgotPasswordPageTheme } from "../theme";
|
|
9
|
+
import { ForgotPasswordForm } from "./ForgotPasswordForm";
|
|
10
|
+
import { ForgotPasswordHeader } from "./ForgotPasswordHeader";
|
|
11
|
+
gsap.registerPlugin(useGSAP);
|
|
12
|
+
export function ForgotPasswordPage({ logo, title = "Forgot Password?", subtitle = "No worries, we'll send you reset instructions.", forgotPasswordAction, onBackToLogin, backToLoginHref, showBackground = true, className }) {
|
|
13
|
+
const theme = forgotPasswordPageTheme;
|
|
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": "Forgot 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(ForgotPasswordHeader, {
|
|
45
|
+
logo: logo,
|
|
46
|
+
title: title,
|
|
47
|
+
subtitle: subtitle
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ _jsx(ForgotPasswordForm, {
|
|
50
|
+
forgotPasswordAction: forgotPasswordAction,
|
|
51
|
+
onBackToLogin: onBackToLogin,
|
|
52
|
+
backToLoginHref: backToLoginHref
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ForgotPasswordForm } from "./components/ForgotPasswordForm";
|
|
2
|
+
export { ForgotPasswordHeader } from "./components/ForgotPasswordHeader";
|
|
3
|
+
export { ForgotPasswordPage } from "./components/ForgotPasswordPage";
|
|
4
|
+
export { useForgotPasswordStore } from "./store";
|
|
5
|
+
export { extendForgotPasswordPageTheme, forgotPasswordPageTheme } from "./theme";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { batch, createStore } from "h-state";
|
|
3
|
+
const initialState = {
|
|
4
|
+
email: "",
|
|
5
|
+
step: "request",
|
|
6
|
+
error: null
|
|
7
|
+
};
|
|
8
|
+
export const { useStore: useForgotPasswordStore } = createStore(initialState, {
|
|
9
|
+
setEmail: (store)=>(email)=>{
|
|
10
|
+
store.email = email;
|
|
11
|
+
if (store.error) {
|
|
12
|
+
store.error = null;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setStep: (store)=>(step)=>{
|
|
16
|
+
store.step = step;
|
|
17
|
+
},
|
|
18
|
+
setError: (store)=>(error)=>{
|
|
19
|
+
store.error = error;
|
|
20
|
+
},
|
|
21
|
+
reset: (store)=>()=>{
|
|
22
|
+
batch(()=>{
|
|
23
|
+
store.email = "";
|
|
24
|
+
store.step = "request";
|
|
25
|
+
store.error = null;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export const forgotPasswordPageTheme = {
|
|
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
|
+
};
|
|
46
|
+
export function extendForgotPasswordPageTheme(overrides) {
|
|
47
|
+
return {
|
|
48
|
+
...forgotPasswordPageTheme,
|
|
49
|
+
...overrides,
|
|
50
|
+
container: {
|
|
51
|
+
...forgotPasswordPageTheme.container,
|
|
52
|
+
...overrides.container
|
|
53
|
+
},
|
|
54
|
+
card: {
|
|
55
|
+
...forgotPasswordPageTheme.card,
|
|
56
|
+
...overrides.card
|
|
57
|
+
},
|
|
58
|
+
header: {
|
|
59
|
+
...forgotPasswordPageTheme.header,
|
|
60
|
+
...overrides.header
|
|
61
|
+
},
|
|
62
|
+
form: {
|
|
63
|
+
...forgotPasswordPageTheme.form,
|
|
64
|
+
...overrides.form
|
|
65
|
+
},
|
|
66
|
+
input: {
|
|
67
|
+
...forgotPasswordPageTheme.input,
|
|
68
|
+
...overrides.input
|
|
69
|
+
},
|
|
70
|
+
button: {
|
|
71
|
+
...forgotPasswordPageTheme.button,
|
|
72
|
+
...overrides.button
|
|
73
|
+
},
|
|
74
|
+
links: {
|
|
75
|
+
...forgotPasswordPageTheme.links,
|
|
76
|
+
...overrides.links
|
|
77
|
+
},
|
|
78
|
+
error: {
|
|
79
|
+
...forgotPasswordPageTheme.error,
|
|
80
|
+
...overrides.error
|
|
81
|
+
},
|
|
82
|
+
success: {
|
|
83
|
+
...forgotPasswordPageTheme.success,
|
|
84
|
+
...overrides.success
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,156 @@
|
|
|
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 { Button } from "../../Button";
|
|
7
|
+
import { useFormBuilder } from "../hooks/useFormBuilder";
|
|
8
|
+
import { formBuilderTheme } from "../theme";
|
|
9
|
+
import { cn } from "../utils/cn";
|
|
10
|
+
import { formatLabel, shouldExcludeField } from "../utils/fieldMapping";
|
|
11
|
+
import { FormField } from "./FormField";
|
|
12
|
+
gsap.registerPlugin(useGSAP);
|
|
13
|
+
export function FormBuilder({ columns, mode, initialValues, onSubmit, onCancel, fieldConfigs, excludeFields = [], includeFields, layout = "vertical", size = "md", columns_grid = 1, gap = "md", submitText, cancelText = "Cancel", loading = false, disabled = false, showRequiredIndicator: _showRequiredIndicator = true, locale = "en-US", className, formClassName, fieldsClassName, actionsClassName, renderHeader, renderFooter, renderField }) {
|
|
14
|
+
const theme = formBuilderTheme;
|
|
15
|
+
const formRef = useRef(null);
|
|
16
|
+
const fieldsRef = useRef(null);
|
|
17
|
+
const { state, reset, submit, getFieldProps } = useFormBuilder({
|
|
18
|
+
columns,
|
|
19
|
+
initialValues,
|
|
20
|
+
fieldConfigs,
|
|
21
|
+
onSubmit
|
|
22
|
+
});
|
|
23
|
+
const defaultSubmitText = mode === "add" ? "Create" : "Update";
|
|
24
|
+
useGSAP(()=>{
|
|
25
|
+
if (fieldsRef.current) {
|
|
26
|
+
const fields = fieldsRef.current.querySelectorAll("[data-form-field]");
|
|
27
|
+
gsap.fromTo(fields, {
|
|
28
|
+
opacity: 0,
|
|
29
|
+
y: 10
|
|
30
|
+
}, {
|
|
31
|
+
opacity: 1,
|
|
32
|
+
y: 0,
|
|
33
|
+
duration: theme.animation.field.enter.duration,
|
|
34
|
+
ease: theme.animation.field.enter.ease,
|
|
35
|
+
stagger: theme.animation.field.enter.stagger
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, [
|
|
39
|
+
columns
|
|
40
|
+
]);
|
|
41
|
+
const getVisibleColumns = ()=>{
|
|
42
|
+
return columns.filter((column)=>{
|
|
43
|
+
if (shouldExcludeField(column)) return false;
|
|
44
|
+
const fieldName = column.name;
|
|
45
|
+
if (excludeFields.includes(fieldName)) return false;
|
|
46
|
+
if (includeFields && !includeFields.includes(fieldName)) return false;
|
|
47
|
+
const config = fieldConfigs?.[fieldName];
|
|
48
|
+
if (config?.hidden) return false;
|
|
49
|
+
if (config?.showWhen && !config.showWhen(state.values)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const getSortedColumns = ()=>{
|
|
56
|
+
const visible = getVisibleColumns();
|
|
57
|
+
return visible.sort((a, b)=>{
|
|
58
|
+
const configA = fieldConfigs?.[a.name];
|
|
59
|
+
const configB = fieldConfigs?.[b.name];
|
|
60
|
+
const orderA = configA?.order ?? 999;
|
|
61
|
+
const orderB = configB?.order ?? 999;
|
|
62
|
+
return orderA - orderB;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const handleSubmit = (e)=>{
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
submit();
|
|
68
|
+
};
|
|
69
|
+
const visibleColumns = getSortedColumns();
|
|
70
|
+
const isSubmitting = state.isSubmitting || loading;
|
|
71
|
+
const isFormDisabled = disabled || isSubmitting;
|
|
72
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
73
|
+
className: cn(theme.container.base, className),
|
|
74
|
+
children: [
|
|
75
|
+
renderHeader?.(),
|
|
76
|
+
/*#__PURE__*/ _jsxs("form", {
|
|
77
|
+
ref: formRef,
|
|
78
|
+
onSubmit: handleSubmit,
|
|
79
|
+
className: cn(theme.form.base, theme.form.layout[layout], formClassName),
|
|
80
|
+
noValidate: true,
|
|
81
|
+
children: [
|
|
82
|
+
/*#__PURE__*/ _jsx("div", {
|
|
83
|
+
ref: fieldsRef,
|
|
84
|
+
className: cn(theme.fields.base, theme.fields.columns[columns_grid], theme.fields.gap[gap], fieldsClassName),
|
|
85
|
+
children: visibleColumns.map((column)=>{
|
|
86
|
+
const fieldName = column.name;
|
|
87
|
+
const config = fieldConfigs?.[fieldName];
|
|
88
|
+
const fieldProps = getFieldProps(fieldName);
|
|
89
|
+
const mergedConfig = {
|
|
90
|
+
name: column.name,
|
|
91
|
+
label: config?.label ?? formatLabel(column.name),
|
|
92
|
+
placeholder: config?.placeholder,
|
|
93
|
+
helperText: config?.helperText,
|
|
94
|
+
required: config?.required ?? column.notNull ?? false,
|
|
95
|
+
disabled: config?.disabled ?? isFormDisabled,
|
|
96
|
+
readOnly: config?.readOnly,
|
|
97
|
+
hidden: config?.hidden,
|
|
98
|
+
order: config?.order,
|
|
99
|
+
span: config?.span ?? 12,
|
|
100
|
+
options: config?.options,
|
|
101
|
+
defaultValue: config?.defaultValue
|
|
102
|
+
};
|
|
103
|
+
const defaultRender = ()=>/*#__PURE__*/ _jsx("div", {
|
|
104
|
+
"data-form-field": true,
|
|
105
|
+
children: /*#__PURE__*/ _jsx(FormField, {
|
|
106
|
+
column: column,
|
|
107
|
+
config: mergedConfig,
|
|
108
|
+
value: fieldProps.value,
|
|
109
|
+
onChange: fieldProps.onChange,
|
|
110
|
+
error: fieldProps.error,
|
|
111
|
+
size: size,
|
|
112
|
+
locale: locale,
|
|
113
|
+
disabled: isFormDisabled
|
|
114
|
+
})
|
|
115
|
+
}, column.name);
|
|
116
|
+
if (renderField) {
|
|
117
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
118
|
+
"data-form-field": true,
|
|
119
|
+
children: renderField(column, mergedConfig, defaultRender)
|
|
120
|
+
}, column.name);
|
|
121
|
+
}
|
|
122
|
+
return defaultRender();
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
renderFooter ? renderFooter({
|
|
126
|
+
isSubmitting,
|
|
127
|
+
isValid: Object.keys(state.errors).length === 0,
|
|
128
|
+
isDirty: state.isDirty,
|
|
129
|
+
reset,
|
|
130
|
+
submit
|
|
131
|
+
}) : /*#__PURE__*/ _jsxs("div", {
|
|
132
|
+
className: cn(theme.actions.base, theme.actions.gap[gap], theme.actions.alignment.right, actionsClassName),
|
|
133
|
+
children: [
|
|
134
|
+
onCancel && /*#__PURE__*/ _jsx(Button, {
|
|
135
|
+
type: "button",
|
|
136
|
+
variant: "ghost",
|
|
137
|
+
size: size,
|
|
138
|
+
onClick: onCancel,
|
|
139
|
+
disabled: isSubmitting,
|
|
140
|
+
children: cancelText
|
|
141
|
+
}),
|
|
142
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
143
|
+
type: "submit",
|
|
144
|
+
variant: "primary",
|
|
145
|
+
size: size,
|
|
146
|
+
loading: isSubmitting,
|
|
147
|
+
disabled: isFormDisabled,
|
|
148
|
+
children: submitText ?? defaultSubmitText
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
}
|