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,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { registerPageTheme } from "../theme";
|
|
4
|
+
export function RegisterHeader({ logo, title = "Create Account", subtitle = "Sign up to get started" }) {
|
|
5
|
+
const theme = registerPageTheme;
|
|
6
|
+
return /*#__PURE__*/ _jsxs("header", {
|
|
7
|
+
className: theme.header.container,
|
|
8
|
+
children: [
|
|
9
|
+
logo && /*#__PURE__*/ _jsx("div", {
|
|
10
|
+
className: theme.header.logoWrapper,
|
|
11
|
+
children: logo
|
|
12
|
+
}),
|
|
13
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
14
|
+
className: theme.header.title,
|
|
15
|
+
children: title
|
|
16
|
+
}),
|
|
17
|
+
subtitle && /*#__PURE__*/ _jsx("p", {
|
|
18
|
+
className: theme.header.subtitle,
|
|
19
|
+
children: subtitle
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { registerPageTheme } from "../theme";
|
|
9
|
+
import { RegisterForm } from "./RegisterForm";
|
|
10
|
+
import { RegisterHeader } from "./RegisterHeader";
|
|
11
|
+
gsap.registerPlugin(useGSAP);
|
|
12
|
+
export function RegisterPage({ variant: _variant = "default", logo, title = "Create Account", subtitle = "Sign up to get started with your account", showFirstName: showFirstNameProp, showLastName: showLastNameProp, showTerms = true, showSignIn = true, termsHref: termsHrefProp, privacyHref: privacyHrefProp, signInHref, registerAction, onTermsClick, onPrivacyClick, onSignIn, onSuccess, showBackground = true, className, passwordMinLength: passwordMinLengthProp, requireUppercase: requireUppercaseProp, requireLowercase: requireLowercaseProp, requireNumber: requireNumberProp, requireSpecialChar: requireSpecialCharProp, config }) {
|
|
13
|
+
// Resolve values from config or props (config takes precedence)
|
|
14
|
+
const showFirstName = config?.register?.showFirstName ?? showFirstNameProp ?? false;
|
|
15
|
+
const showLastName = config?.register?.showLastName ?? showLastNameProp ?? false;
|
|
16
|
+
const termsHref = config?.register?.termsUrl ?? termsHrefProp;
|
|
17
|
+
const privacyHref = config?.register?.privacyUrl ?? privacyHrefProp;
|
|
18
|
+
const passwordMinLength = config?.passwordPolicy?.minLength ?? passwordMinLengthProp ?? 8;
|
|
19
|
+
const requireUppercase = config?.passwordPolicy?.requireUppercase ?? requireUppercaseProp ?? true;
|
|
20
|
+
const requireLowercase = config?.passwordPolicy?.requireLowercase ?? requireLowercaseProp ?? true;
|
|
21
|
+
const requireNumber = config?.passwordPolicy?.requireNumber ?? requireNumberProp ?? true;
|
|
22
|
+
const requireSpecialChar = config?.passwordPolicy?.requireSpecialChar ?? requireSpecialCharProp ?? false;
|
|
23
|
+
const createProfileOnRegister = config?.register?.createProfileOnRegister ?? (showFirstName || showLastName);
|
|
24
|
+
const theme = registerPageTheme;
|
|
25
|
+
const containerRef = useRef(null);
|
|
26
|
+
const cardRef = useRef(null);
|
|
27
|
+
useGSAP(()=>{
|
|
28
|
+
if (!cardRef.current) return;
|
|
29
|
+
gsap.fromTo(cardRef.current, {
|
|
30
|
+
opacity: 0,
|
|
31
|
+
y: 30,
|
|
32
|
+
scale: 0.95
|
|
33
|
+
}, {
|
|
34
|
+
opacity: 1,
|
|
35
|
+
y: 0,
|
|
36
|
+
scale: 1,
|
|
37
|
+
duration: 0.6,
|
|
38
|
+
ease: "power3.out"
|
|
39
|
+
});
|
|
40
|
+
}, {
|
|
41
|
+
scope: containerRef
|
|
42
|
+
});
|
|
43
|
+
return /*#__PURE__*/ _jsxs("main", {
|
|
44
|
+
ref: containerRef,
|
|
45
|
+
className: cn(theme.container.base, className),
|
|
46
|
+
"aria-label": "Registration page",
|
|
47
|
+
children: [
|
|
48
|
+
showBackground && /*#__PURE__*/ _jsx(AbstractAnimatedBackground, {}),
|
|
49
|
+
/*#__PURE__*/ _jsx("div", {
|
|
50
|
+
className: theme.container.wrapper,
|
|
51
|
+
children: /*#__PURE__*/ _jsxs("article", {
|
|
52
|
+
ref: cardRef,
|
|
53
|
+
className: cn(theme.card.base, theme.card.padding, theme.card.background, theme.card.border, theme.card.shadow, theme.card.rounded),
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ _jsx(RegisterHeader, {
|
|
56
|
+
logo: logo,
|
|
57
|
+
title: title,
|
|
58
|
+
subtitle: subtitle
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ _jsx(RegisterForm, {
|
|
61
|
+
registerAction: registerAction,
|
|
62
|
+
showFirstName: showFirstName,
|
|
63
|
+
showLastName: showLastName,
|
|
64
|
+
showTerms: showTerms,
|
|
65
|
+
showSignIn: showSignIn,
|
|
66
|
+
termsHref: termsHref,
|
|
67
|
+
privacyHref: privacyHref,
|
|
68
|
+
signInHref: signInHref,
|
|
69
|
+
onTermsClick: onTermsClick,
|
|
70
|
+
onPrivacyClick: onPrivacyClick,
|
|
71
|
+
onSignIn: onSignIn,
|
|
72
|
+
onSuccess: onSuccess,
|
|
73
|
+
passwordMinLength: passwordMinLength,
|
|
74
|
+
requireUppercase: requireUppercase,
|
|
75
|
+
requireLowercase: requireLowercase,
|
|
76
|
+
requireNumber: requireNumber,
|
|
77
|
+
requireSpecialChar: requireSpecialChar,
|
|
78
|
+
createProfileOnRegister: createProfileOnRegister
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { PasswordStrengthIndicator } from "./components/PasswordStrengthIndicator";
|
|
2
|
+
export { RegisterForm } from "./components/RegisterForm";
|
|
3
|
+
export { RegisterHeader } from "./components/RegisterHeader";
|
|
4
|
+
export { RegisterPage } from "./components/RegisterPage";
|
|
5
|
+
export { useRegisterStore } from "./store";
|
|
6
|
+
export { extendRegisterPageTheme, registerPageTheme } from "./theme";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { batch, createStore } from "h-state";
|
|
3
|
+
const calculatePasswordStrength = (password, minLength = 8)=>{
|
|
4
|
+
const hasMinLength = password.length >= minLength;
|
|
5
|
+
const hasUppercase = /[A-Z]/.test(password);
|
|
6
|
+
const hasLowercase = /[a-z]/.test(password);
|
|
7
|
+
const hasNumber = /[0-9]/.test(password);
|
|
8
|
+
const hasSpecialChar = /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password);
|
|
9
|
+
let score = 0;
|
|
10
|
+
if (hasMinLength) score += 1;
|
|
11
|
+
if (hasUppercase) score += 1;
|
|
12
|
+
if (hasLowercase) score += 1;
|
|
13
|
+
if (hasNumber) score += 1;
|
|
14
|
+
if (hasSpecialChar) score += 1;
|
|
15
|
+
return {
|
|
16
|
+
score,
|
|
17
|
+
hasMinLength,
|
|
18
|
+
hasUppercase,
|
|
19
|
+
hasLowercase,
|
|
20
|
+
hasNumber,
|
|
21
|
+
hasSpecialChar
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const initialState = {
|
|
25
|
+
email: "",
|
|
26
|
+
password: "",
|
|
27
|
+
confirmPassword: "",
|
|
28
|
+
firstName: "",
|
|
29
|
+
lastName: "",
|
|
30
|
+
acceptTerms: false,
|
|
31
|
+
isLoading: false,
|
|
32
|
+
error: null,
|
|
33
|
+
passwordStrength: {
|
|
34
|
+
score: 0,
|
|
35
|
+
hasMinLength: false,
|
|
36
|
+
hasUppercase: false,
|
|
37
|
+
hasLowercase: false,
|
|
38
|
+
hasNumber: false,
|
|
39
|
+
hasSpecialChar: false
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export const { useStore: useRegisterStore } = createStore(initialState, {
|
|
43
|
+
setEmail: (store)=>(email)=>{
|
|
44
|
+
store.email = email;
|
|
45
|
+
if (store.error) {
|
|
46
|
+
store.error = null;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
setPassword: (store)=>(password, minLength = 8)=>{
|
|
50
|
+
store.password = password;
|
|
51
|
+
store.passwordStrength = calculatePasswordStrength(password, minLength);
|
|
52
|
+
if (store.error) {
|
|
53
|
+
store.error = null;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
setConfirmPassword: (store)=>(confirmPassword)=>{
|
|
57
|
+
store.confirmPassword = confirmPassword;
|
|
58
|
+
if (store.error) {
|
|
59
|
+
store.error = null;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
setFirstName: (store)=>(firstName)=>{
|
|
63
|
+
store.firstName = firstName;
|
|
64
|
+
if (store.error) {
|
|
65
|
+
store.error = null;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
setLastName: (store)=>(lastName)=>{
|
|
69
|
+
store.lastName = lastName;
|
|
70
|
+
if (store.error) {
|
|
71
|
+
store.error = null;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
setAcceptTerms: (store)=>(value)=>{
|
|
75
|
+
store.acceptTerms = value;
|
|
76
|
+
if (store.error) {
|
|
77
|
+
store.error = null;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
setLoading: (store)=>(value)=>{
|
|
81
|
+
store.isLoading = value;
|
|
82
|
+
},
|
|
83
|
+
setError: (store)=>(error)=>{
|
|
84
|
+
store.error = error;
|
|
85
|
+
},
|
|
86
|
+
reset: (store)=>()=>{
|
|
87
|
+
batch(()=>{
|
|
88
|
+
store.email = "";
|
|
89
|
+
store.password = "";
|
|
90
|
+
store.confirmPassword = "";
|
|
91
|
+
store.firstName = "";
|
|
92
|
+
store.lastName = "";
|
|
93
|
+
store.acceptTerms = false;
|
|
94
|
+
store.isLoading = false;
|
|
95
|
+
store.error = null;
|
|
96
|
+
store.passwordStrength = {
|
|
97
|
+
score: 0,
|
|
98
|
+
hasMinLength: false,
|
|
99
|
+
hasUppercase: false,
|
|
100
|
+
hasLowercase: false,
|
|
101
|
+
hasNumber: false,
|
|
102
|
+
hasSpecialChar: false
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export const registerPageTheme = {
|
|
2
|
+
container: {
|
|
3
|
+
base: "relative min-h-screen w-full flex items-center justify-center py-8 sm:py-12",
|
|
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
|
+
title: "text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",
|
|
18
|
+
subtitle: "mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center"
|
|
19
|
+
},
|
|
20
|
+
form: {
|
|
21
|
+
container: "w-full",
|
|
22
|
+
spacing: "space-y-4",
|
|
23
|
+
row: "grid grid-cols-1 sm:grid-cols-2 gap-4"
|
|
24
|
+
},
|
|
25
|
+
input: {
|
|
26
|
+
wrapper: "w-full"
|
|
27
|
+
},
|
|
28
|
+
checkbox: {
|
|
29
|
+
wrapper: "flex items-start",
|
|
30
|
+
label: "ml-2 text-sm text-zinc-600 dark:text-zinc-400 select-none cursor-pointer leading-tight"
|
|
31
|
+
},
|
|
32
|
+
links: {
|
|
33
|
+
container: "flex items-center justify-between mt-1",
|
|
34
|
+
terms: "text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors cursor-pointer",
|
|
35
|
+
signIn: {
|
|
36
|
+
wrapper: "mt-6 text-center",
|
|
37
|
+
text: "text-sm text-zinc-600 dark:text-zinc-400",
|
|
38
|
+
link: "text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
button: {
|
|
42
|
+
wrapper: "mt-6"
|
|
43
|
+
},
|
|
44
|
+
error: {
|
|
45
|
+
container: "mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",
|
|
46
|
+
text: "text-sm text-red-600 dark:text-red-400 text-center"
|
|
47
|
+
},
|
|
48
|
+
passwordStrength: {
|
|
49
|
+
container: "mt-2",
|
|
50
|
+
bar: {
|
|
51
|
+
wrapper: "flex gap-1",
|
|
52
|
+
segment: "h-1 flex-1 rounded-full transition-colors duration-300",
|
|
53
|
+
active: {
|
|
54
|
+
weak: "bg-red-500",
|
|
55
|
+
fair: "bg-orange-500",
|
|
56
|
+
good: "bg-yellow-500",
|
|
57
|
+
strong: "bg-lime-500",
|
|
58
|
+
veryStrong: "bg-green-500"
|
|
59
|
+
},
|
|
60
|
+
inactive: "bg-zinc-200 dark:bg-zinc-700"
|
|
61
|
+
},
|
|
62
|
+
requirements: {
|
|
63
|
+
container: "mt-3 space-y-1",
|
|
64
|
+
item: "flex items-center gap-2 text-xs transition-colors duration-200",
|
|
65
|
+
met: "text-green-600 dark:text-green-400",
|
|
66
|
+
unmet: "text-zinc-400 dark:text-zinc-500",
|
|
67
|
+
icon: {
|
|
68
|
+
met: "text-green-500",
|
|
69
|
+
unmet: "text-zinc-300 dark:text-zinc-600"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
divider: {
|
|
74
|
+
container: "relative my-6",
|
|
75
|
+
line: "absolute inset-0 flex items-center",
|
|
76
|
+
text: "relative flex justify-center text-sm"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export function extendRegisterPageTheme(overrides) {
|
|
80
|
+
return {
|
|
81
|
+
...registerPageTheme,
|
|
82
|
+
...overrides,
|
|
83
|
+
container: {
|
|
84
|
+
...registerPageTheme.container,
|
|
85
|
+
...overrides.container
|
|
86
|
+
},
|
|
87
|
+
card: {
|
|
88
|
+
...registerPageTheme.card,
|
|
89
|
+
...overrides.card
|
|
90
|
+
},
|
|
91
|
+
header: {
|
|
92
|
+
...registerPageTheme.header,
|
|
93
|
+
...overrides.header
|
|
94
|
+
},
|
|
95
|
+
form: {
|
|
96
|
+
...registerPageTheme.form,
|
|
97
|
+
...overrides.form
|
|
98
|
+
},
|
|
99
|
+
input: {
|
|
100
|
+
...registerPageTheme.input,
|
|
101
|
+
...overrides.input
|
|
102
|
+
},
|
|
103
|
+
checkbox: {
|
|
104
|
+
...registerPageTheme.checkbox,
|
|
105
|
+
...overrides.checkbox
|
|
106
|
+
},
|
|
107
|
+
links: {
|
|
108
|
+
...registerPageTheme.links,
|
|
109
|
+
...overrides.links
|
|
110
|
+
},
|
|
111
|
+
button: {
|
|
112
|
+
...registerPageTheme.button,
|
|
113
|
+
...overrides.button
|
|
114
|
+
},
|
|
115
|
+
error: {
|
|
116
|
+
...registerPageTheme.error,
|
|
117
|
+
...overrides.error
|
|
118
|
+
},
|
|
119
|
+
passwordStrength: {
|
|
120
|
+
...registerPageTheme.passwordStrength,
|
|
121
|
+
...overrides.passwordStrength
|
|
122
|
+
},
|
|
123
|
+
divider: {
|
|
124
|
+
...registerPageTheme.divider,
|
|
125
|
+
...overrides.divider
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|