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,311 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useGSAP } from "@gsap/react";
|
|
4
|
+
import gsap from "gsap";
|
|
5
|
+
import { useEffect, useEffectEvent, useRef, useState } from "react";
|
|
6
|
+
import { cn } from "../../../utils/cn";
|
|
7
|
+
import { captchaTheme } from "../theme";
|
|
8
|
+
gsap.registerPlugin(useGSAP);
|
|
9
|
+
const RefreshIcon = ({ className, iconRef })=>/*#__PURE__*/ _jsxs("svg", {
|
|
10
|
+
ref: iconRef,
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
width: "16",
|
|
13
|
+
height: "16",
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
fill: "none",
|
|
16
|
+
stroke: "currentColor",
|
|
17
|
+
strokeWidth: "2",
|
|
18
|
+
strokeLinecap: "round",
|
|
19
|
+
strokeLinejoin: "round",
|
|
20
|
+
className: className,
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ _jsx("path", {
|
|
24
|
+
d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"
|
|
25
|
+
}),
|
|
26
|
+
/*#__PURE__*/ _jsx("path", {
|
|
27
|
+
d: "M3 3v5h5"
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ _jsx("path", {
|
|
30
|
+
d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsx("path", {
|
|
33
|
+
d: "M16 16h5v5"
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
export function Captcha({ generateAction, config, onChallengeLoad, onAnswerChange, disabled = false, autoGenerate = true, className, label = "Security Check", errorMessage }) {
|
|
38
|
+
const theme = captchaTheme;
|
|
39
|
+
const containerRef = useRef(null);
|
|
40
|
+
const challengeRef = useRef(null);
|
|
41
|
+
const iconRef = useRef(null);
|
|
42
|
+
const [challenge, setChallengeData] = useState(null);
|
|
43
|
+
const [answer, setAnswer] = useState("");
|
|
44
|
+
const [timeRemaining, setTimeRemaining] = useState(null);
|
|
45
|
+
const [isExpired, setIsExpired] = useState(false);
|
|
46
|
+
const [rateLimitError, setRateLimitError] = useState(null);
|
|
47
|
+
const [puzzleOrder, setPuzzleOrder] = useState([]);
|
|
48
|
+
const isLoading = generateAction.state.isPending;
|
|
49
|
+
const { contextSafe } = useGSAP({
|
|
50
|
+
scope: containerRef
|
|
51
|
+
});
|
|
52
|
+
const generateChallenge = useEffectEvent(()=>{
|
|
53
|
+
setAnswer("");
|
|
54
|
+
setIsExpired(false);
|
|
55
|
+
setRateLimitError(null);
|
|
56
|
+
setPuzzleOrder([]);
|
|
57
|
+
generateAction.start({
|
|
58
|
+
payload: {
|
|
59
|
+
type: config?.type,
|
|
60
|
+
difficulty: config?.difficulty
|
|
61
|
+
},
|
|
62
|
+
onAfterHandle: (response)=>{
|
|
63
|
+
const data = response.data;
|
|
64
|
+
if (!data || data.rateLimited) {
|
|
65
|
+
setRateLimitError(response.message ?? "Too many requests. Please try again later.");
|
|
66
|
+
setChallengeData(null);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setChallengeData(data);
|
|
70
|
+
onChallengeLoad?.(response);
|
|
71
|
+
if (challengeRef.current) {
|
|
72
|
+
gsap.fromTo(challengeRef.current, {
|
|
73
|
+
opacity: 0,
|
|
74
|
+
scale: 0.95
|
|
75
|
+
}, {
|
|
76
|
+
opacity: 1,
|
|
77
|
+
scale: 1,
|
|
78
|
+
duration: 0.3,
|
|
79
|
+
ease: "power2.out"
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
onErrorHandle: ()=>{
|
|
84
|
+
setChallengeData(null);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
const handleRefresh = contextSafe(()=>{
|
|
89
|
+
if (iconRef.current) {
|
|
90
|
+
gsap.to(iconRef.current, {
|
|
91
|
+
rotation: "+=360",
|
|
92
|
+
duration: 0.5,
|
|
93
|
+
ease: "power2.inOut"
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
generateChallenge();
|
|
97
|
+
});
|
|
98
|
+
const handleAnswerChange = (value)=>{
|
|
99
|
+
setAnswer(value);
|
|
100
|
+
if (challenge) {
|
|
101
|
+
onAnswerChange?.(challenge.challengeId, value);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const handlePuzzlePieceClick = (pieceId)=>{
|
|
105
|
+
if (disabled || isLoading || isExpired) return;
|
|
106
|
+
const newOrder = puzzleOrder.includes(pieceId) ? puzzleOrder.filter((id)=>id !== pieceId) : [
|
|
107
|
+
...puzzleOrder,
|
|
108
|
+
pieceId
|
|
109
|
+
];
|
|
110
|
+
setPuzzleOrder(newOrder);
|
|
111
|
+
const orderString = newOrder.join(",");
|
|
112
|
+
setAnswer(orderString);
|
|
113
|
+
if (challenge) {
|
|
114
|
+
onAnswerChange?.(challenge.challengeId, orderString);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const handleClearPuzzleOrder = ()=>{
|
|
118
|
+
setPuzzleOrder([]);
|
|
119
|
+
setAnswer("");
|
|
120
|
+
if (challenge) {
|
|
121
|
+
onAnswerChange?.(challenge.challengeId, "");
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
useEffect(()=>{
|
|
125
|
+
if (autoGenerate && config?.enabled !== false) {
|
|
126
|
+
generateChallenge();
|
|
127
|
+
}
|
|
128
|
+
}, [
|
|
129
|
+
autoGenerate,
|
|
130
|
+
config?.enabled
|
|
131
|
+
]);
|
|
132
|
+
useEffect(()=>{
|
|
133
|
+
if (!challenge?.expiresAt) {
|
|
134
|
+
setTimeRemaining(null);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const updateTimer = ()=>{
|
|
138
|
+
const now = Date.now();
|
|
139
|
+
const remaining = Math.max(0, Math.floor((challenge.expiresAt - now) / 1000));
|
|
140
|
+
setTimeRemaining(remaining);
|
|
141
|
+
if (remaining <= 0) {
|
|
142
|
+
setIsExpired(true);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
updateTimer();
|
|
146
|
+
const interval = setInterval(updateTimer, 1000);
|
|
147
|
+
return ()=>clearInterval(interval);
|
|
148
|
+
}, [
|
|
149
|
+
challenge?.expiresAt
|
|
150
|
+
]);
|
|
151
|
+
const formatTime = (seconds)=>{
|
|
152
|
+
const mins = Math.floor(seconds / 60);
|
|
153
|
+
const secs = seconds % 60;
|
|
154
|
+
return `${mins}:${secs.toString().padStart(2, "0")}`;
|
|
155
|
+
};
|
|
156
|
+
const getPlaceholder = ()=>{
|
|
157
|
+
if (!challenge) return "Enter answer";
|
|
158
|
+
switch(challenge.type){
|
|
159
|
+
case "math":
|
|
160
|
+
return "Enter the result";
|
|
161
|
+
case "image":
|
|
162
|
+
case "text":
|
|
163
|
+
return "Enter the text shown";
|
|
164
|
+
case "puzzle":
|
|
165
|
+
return "Enter piece order (e.g., 0,1,2,3)";
|
|
166
|
+
default:
|
|
167
|
+
return "Enter answer";
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
if (config?.enabled === false) {
|
|
171
|
+
return /*#__PURE__*/ _jsx(_Fragment, {});
|
|
172
|
+
}
|
|
173
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
174
|
+
ref: containerRef,
|
|
175
|
+
className: cn(theme.container.base, className),
|
|
176
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
177
|
+
className: theme.container.wrapper,
|
|
178
|
+
children: [
|
|
179
|
+
/*#__PURE__*/ _jsx("span", {
|
|
180
|
+
className: theme.label.base,
|
|
181
|
+
children: label
|
|
182
|
+
}),
|
|
183
|
+
/*#__PURE__*/ _jsx("div", {
|
|
184
|
+
ref: challengeRef,
|
|
185
|
+
className: theme.challenge.wrapper,
|
|
186
|
+
children: isLoading ? /*#__PURE__*/ _jsx("div", {
|
|
187
|
+
className: theme.loading.wrapper,
|
|
188
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
189
|
+
className: theme.loading.spinner
|
|
190
|
+
})
|
|
191
|
+
}) : challenge ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
192
|
+
children: [
|
|
193
|
+
challenge.type === "math" && /*#__PURE__*/ _jsx("p", {
|
|
194
|
+
className: theme.challenge.math.question,
|
|
195
|
+
children: challenge.question
|
|
196
|
+
}),
|
|
197
|
+
challenge.type === "text" && /*#__PURE__*/ _jsx("p", {
|
|
198
|
+
className: theme.challenge.text.question,
|
|
199
|
+
children: challenge.question
|
|
200
|
+
}),
|
|
201
|
+
challenge.type === "image" && challenge.imageData && /*#__PURE__*/ _jsx("div", {
|
|
202
|
+
className: theme.challenge.image.wrapper,
|
|
203
|
+
children: /*#__PURE__*/ _jsx("img", {
|
|
204
|
+
src: challenge.imageData,
|
|
205
|
+
alt: "Captcha",
|
|
206
|
+
className: theme.challenge.image.img,
|
|
207
|
+
draggable: false
|
|
208
|
+
})
|
|
209
|
+
}),
|
|
210
|
+
challenge.type === "puzzle" && challenge.puzzleData && /*#__PURE__*/ _jsxs("div", {
|
|
211
|
+
className: theme.challenge.puzzle.wrapper,
|
|
212
|
+
children: [
|
|
213
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
214
|
+
className: theme.challenge.puzzle.instruction,
|
|
215
|
+
children: [
|
|
216
|
+
"Click the pieces in the correct order (0 to",
|
|
217
|
+
" ",
|
|
218
|
+
challenge.puzzleData.pieces.length - 1,
|
|
219
|
+
")"
|
|
220
|
+
]
|
|
221
|
+
}),
|
|
222
|
+
/*#__PURE__*/ _jsx("div", {
|
|
223
|
+
className: theme.challenge.puzzle.grid,
|
|
224
|
+
children: challenge.puzzleData.pieces.map((piece)=>/*#__PURE__*/ _jsx("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
onClick: ()=>handlePuzzlePieceClick(piece.id),
|
|
227
|
+
disabled: disabled || isLoading || isExpired,
|
|
228
|
+
className: cn(theme.challenge.puzzle.piece, puzzleOrder.includes(piece.id) && theme.challenge.puzzle.pieceOrdered),
|
|
229
|
+
children: piece.id
|
|
230
|
+
}, piece.id))
|
|
231
|
+
}),
|
|
232
|
+
puzzleOrder.length > 0 && /*#__PURE__*/ _jsxs("div", {
|
|
233
|
+
className: theme.challenge.puzzle.orderDisplay,
|
|
234
|
+
children: [
|
|
235
|
+
puzzleOrder.map((id, index)=>/*#__PURE__*/ _jsx("span", {
|
|
236
|
+
className: theme.challenge.puzzle.orderBadge,
|
|
237
|
+
children: id
|
|
238
|
+
}, `order-${id}-${index}`)),
|
|
239
|
+
/*#__PURE__*/ _jsx("button", {
|
|
240
|
+
type: "button",
|
|
241
|
+
onClick: handleClearPuzzleOrder,
|
|
242
|
+
className: theme.challenge.puzzle.clearButton,
|
|
243
|
+
children: "Clear"
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
251
|
+
className: theme.loading.wrapper,
|
|
252
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
253
|
+
className: "text-sm text-zinc-500",
|
|
254
|
+
children: "Click refresh to load captcha"
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
}),
|
|
258
|
+
challenge?.type !== "puzzle" && /*#__PURE__*/ _jsxs("div", {
|
|
259
|
+
className: theme.input.wrapper,
|
|
260
|
+
children: [
|
|
261
|
+
/*#__PURE__*/ _jsx("label", {
|
|
262
|
+
htmlFor: "captcha-answer",
|
|
263
|
+
className: "sr-only",
|
|
264
|
+
children: label
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ _jsx("input", {
|
|
267
|
+
id: "captcha-answer",
|
|
268
|
+
type: "text",
|
|
269
|
+
value: answer,
|
|
270
|
+
onChange: (e)=>handleAnswerChange(e.target.value),
|
|
271
|
+
placeholder: getPlaceholder(),
|
|
272
|
+
disabled: disabled || isLoading || isExpired,
|
|
273
|
+
className: cn(theme.input.base, (errorMessage || isExpired) && theme.input.error),
|
|
274
|
+
autoComplete: "off"
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
}),
|
|
278
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
279
|
+
className: theme.actions.wrapper,
|
|
280
|
+
children: [
|
|
281
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
282
|
+
type: "button",
|
|
283
|
+
onClick: handleRefresh,
|
|
284
|
+
disabled: disabled || isLoading,
|
|
285
|
+
className: theme.actions.refresh,
|
|
286
|
+
children: [
|
|
287
|
+
/*#__PURE__*/ _jsx(RefreshIcon, {
|
|
288
|
+
iconRef: iconRef
|
|
289
|
+
}),
|
|
290
|
+
/*#__PURE__*/ _jsx("span", {
|
|
291
|
+
children: "New challenge"
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
}),
|
|
295
|
+
timeRemaining !== null && /*#__PURE__*/ _jsx("span", {
|
|
296
|
+
className: isExpired ? theme.actions.timerExpired : theme.actions.timer,
|
|
297
|
+
children: isExpired ? "Expired" : `Expires in ${formatTime(timeRemaining)}`
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
}),
|
|
301
|
+
(errorMessage || isExpired || rateLimitError) && /*#__PURE__*/ _jsx("div", {
|
|
302
|
+
className: theme.error.container,
|
|
303
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
304
|
+
className: theme.error.text,
|
|
305
|
+
children: rateLimitError ? rateLimitError : isExpired ? "Captcha expired. Please refresh." : errorMessage
|
|
306
|
+
})
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
})
|
|
310
|
+
});
|
|
311
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const captchaTheme = {
|
|
2
|
+
container: {
|
|
3
|
+
base: "w-full",
|
|
4
|
+
wrapper: "flex flex-col gap-3"
|
|
5
|
+
},
|
|
6
|
+
label: {
|
|
7
|
+
base: "text-sm font-medium text-zinc-700 dark:text-zinc-300"
|
|
8
|
+
},
|
|
9
|
+
challenge: {
|
|
10
|
+
wrapper: "relative rounded-lg border border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50 p-4",
|
|
11
|
+
math: {
|
|
12
|
+
question: "text-2xl font-bold text-center text-zinc-900 dark:text-zinc-100 font-mono tracking-wide"
|
|
13
|
+
},
|
|
14
|
+
image: {
|
|
15
|
+
wrapper: "flex justify-center",
|
|
16
|
+
img: "max-w-full h-auto rounded select-none pointer-events-none"
|
|
17
|
+
},
|
|
18
|
+
text: {
|
|
19
|
+
question: "text-2xl font-bold text-center text-zinc-900 dark:text-zinc-100 font-mono tracking-widest select-none"
|
|
20
|
+
},
|
|
21
|
+
puzzle: {
|
|
22
|
+
wrapper: "flex flex-col gap-3",
|
|
23
|
+
instruction: "text-sm text-center text-zinc-600 dark:text-zinc-400",
|
|
24
|
+
grid: "flex flex-wrap justify-center gap-2",
|
|
25
|
+
piece: "w-12 h-12 flex items-center justify-center rounded-lg border-2 border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-700 text-lg font-bold text-zinc-900 dark:text-zinc-100 cursor-pointer hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/30 transition-all duration-200 select-none",
|
|
26
|
+
pieceSelected: "border-blue-500 bg-blue-100 dark:bg-blue-900/50 ring-2 ring-blue-500",
|
|
27
|
+
pieceOrdered: "border-green-500 bg-green-50 dark:bg-green-900/30",
|
|
28
|
+
orderDisplay: "flex justify-center gap-1 mt-2",
|
|
29
|
+
orderBadge: "w-8 h-8 flex items-center justify-center rounded-md bg-blue-500 text-white text-sm font-medium",
|
|
30
|
+
clearButton: "text-xs text-red-500 hover:text-red-600 dark:hover:text-red-400 cursor-pointer"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
input: {
|
|
34
|
+
wrapper: "mt-3",
|
|
35
|
+
base: "w-full px-4 py-2.5 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200",
|
|
36
|
+
error: "border-red-500 focus:ring-red-500"
|
|
37
|
+
},
|
|
38
|
+
actions: {
|
|
39
|
+
wrapper: "flex items-center justify-between mt-2",
|
|
40
|
+
refresh: "flex items-center gap-1.5 text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
41
|
+
timer: "text-xs text-zinc-500 dark:text-zinc-400",
|
|
42
|
+
timerExpired: "text-xs text-red-500 dark:text-red-400"
|
|
43
|
+
},
|
|
44
|
+
error: {
|
|
45
|
+
container: "mt-2 p-2 rounded-md 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"
|
|
47
|
+
},
|
|
48
|
+
loading: {
|
|
49
|
+
wrapper: "flex items-center justify-center py-6",
|
|
50
|
+
spinner: "w-6 h-6 border-2 border-zinc-300 dark:border-zinc-600 border-t-blue-500 rounded-full animate-spin"
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,242 @@
|
|
|
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 { useChangePasswordStore } from "../store";
|
|
10
|
+
import { changePasswordPageTheme } 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: "M5 13l4 4L19 7"
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function ChangePasswordForm({ changePasswordAction, onSuccess, onCancel, cancelHref }) {
|
|
43
|
+
const theme = changePasswordPageTheme;
|
|
44
|
+
const formRef = useRef(null);
|
|
45
|
+
const successRef = useRef(null);
|
|
46
|
+
const store = useChangePasswordStore();
|
|
47
|
+
const { contextSafe } = useGSAP({
|
|
48
|
+
scope: formRef
|
|
49
|
+
});
|
|
50
|
+
const isLoading = changePasswordAction.state.isPending;
|
|
51
|
+
useGSAP(()=>{
|
|
52
|
+
if (store.step === "success" && successRef.current) {
|
|
53
|
+
gsap.fromTo(successRef.current, {
|
|
54
|
+
opacity: 0,
|
|
55
|
+
scale: 0.9
|
|
56
|
+
}, {
|
|
57
|
+
opacity: 1,
|
|
58
|
+
scale: 1,
|
|
59
|
+
duration: 0.4,
|
|
60
|
+
ease: "back.out(1.7)"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
dependencies: [
|
|
65
|
+
store.step
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
const shakeForm = contextSafe(()=>{
|
|
69
|
+
if (!formRef.current) return;
|
|
70
|
+
gsap.fromTo(formRef.current, {
|
|
71
|
+
x: -10
|
|
72
|
+
}, {
|
|
73
|
+
x: 10,
|
|
74
|
+
duration: 0.08,
|
|
75
|
+
repeat: 5,
|
|
76
|
+
yoyo: true,
|
|
77
|
+
ease: "power2.inOut",
|
|
78
|
+
onComplete: ()=>{
|
|
79
|
+
gsap.set(formRef.current, {
|
|
80
|
+
x: 0
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
const handleSubmit = contextSafe((e)=>{
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
if (store.newPassword !== store.confirmPassword) {
|
|
88
|
+
store.setError("New passwords do not match");
|
|
89
|
+
shakeForm();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (store.newPassword.length < 8) {
|
|
93
|
+
store.setError("Password must be at least 8 characters");
|
|
94
|
+
shakeForm();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
store.setError(null);
|
|
98
|
+
changePasswordAction.start({
|
|
99
|
+
payload: {
|
|
100
|
+
currentPassword: store.currentPassword,
|
|
101
|
+
newPassword: store.newPassword,
|
|
102
|
+
confirmPassword: store.confirmPassword
|
|
103
|
+
},
|
|
104
|
+
onAfterHandle: ()=>{
|
|
105
|
+
store.setStep("success");
|
|
106
|
+
onSuccess?.();
|
|
107
|
+
},
|
|
108
|
+
onErrorHandle: (err)=>{
|
|
109
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to change password. Please try again.";
|
|
110
|
+
store.setError(errorMessage);
|
|
111
|
+
shakeForm();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
const handleCancelClick = ()=>{
|
|
116
|
+
if (onCancel) {
|
|
117
|
+
onCancel();
|
|
118
|
+
} else if (cancelHref) {
|
|
119
|
+
window.location.href = cancelHref;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
if (store.step === "success") {
|
|
123
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
124
|
+
ref: successRef,
|
|
125
|
+
className: theme.success.container,
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ _jsx("div", {
|
|
128
|
+
className: theme.success.iconWrapper,
|
|
129
|
+
children: /*#__PURE__*/ _jsx(CheckCircleIcon, {})
|
|
130
|
+
}),
|
|
131
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
132
|
+
className: theme.success.title,
|
|
133
|
+
children: "Password Changed!"
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ _jsx("p", {
|
|
136
|
+
className: theme.success.message,
|
|
137
|
+
children: "Your password has been successfully updated. You can now use your new password to log in."
|
|
138
|
+
}),
|
|
139
|
+
(cancelHref || onCancel) && /*#__PURE__*/ _jsx("div", {
|
|
140
|
+
className: theme.links.container,
|
|
141
|
+
children: /*#__PURE__*/ _jsxs("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
onClick: handleCancelClick,
|
|
144
|
+
className: theme.links.cancel,
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
147
|
+
"Go back"
|
|
148
|
+
]
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return /*#__PURE__*/ _jsxs("form", {
|
|
155
|
+
ref: formRef,
|
|
156
|
+
onSubmit: handleSubmit,
|
|
157
|
+
className: cn(theme.form.container, theme.form.spacing),
|
|
158
|
+
noValidate: true,
|
|
159
|
+
children: [
|
|
160
|
+
store.error && /*#__PURE__*/ _jsx("div", {
|
|
161
|
+
className: theme.error.container,
|
|
162
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
163
|
+
className: theme.error.text,
|
|
164
|
+
children: store.error
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ _jsx("div", {
|
|
168
|
+
className: theme.input.wrapper,
|
|
169
|
+
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
170
|
+
label: "Current Password",
|
|
171
|
+
type: "password",
|
|
172
|
+
value: store.currentPassword,
|
|
173
|
+
onChange: (value)=>store.setCurrentPassword(value),
|
|
174
|
+
placeholder: "Enter your current password",
|
|
175
|
+
autoComplete: "current-password",
|
|
176
|
+
enableValidation: false,
|
|
177
|
+
fullWidth: true,
|
|
178
|
+
showTypeIcon: false,
|
|
179
|
+
wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
|
|
180
|
+
inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
|
|
181
|
+
})
|
|
182
|
+
}),
|
|
183
|
+
/*#__PURE__*/ _jsx("div", {
|
|
184
|
+
className: theme.input.wrapper,
|
|
185
|
+
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
186
|
+
label: "New Password",
|
|
187
|
+
type: "password",
|
|
188
|
+
value: store.newPassword,
|
|
189
|
+
onChange: (value)=>store.setNewPassword(value),
|
|
190
|
+
placeholder: "Enter your new password",
|
|
191
|
+
autoComplete: "new-password",
|
|
192
|
+
isNewPassword: true,
|
|
193
|
+
showPasswordStrength: true,
|
|
194
|
+
fullWidth: true,
|
|
195
|
+
showTypeIcon: false,
|
|
196
|
+
wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
|
|
197
|
+
inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
|
|
198
|
+
})
|
|
199
|
+
}),
|
|
200
|
+
/*#__PURE__*/ _jsx("div", {
|
|
201
|
+
className: theme.input.wrapper,
|
|
202
|
+
children: /*#__PURE__*/ _jsx(NucleusTextInput, {
|
|
203
|
+
label: "Confirm New Password",
|
|
204
|
+
type: "password",
|
|
205
|
+
value: store.confirmPassword,
|
|
206
|
+
onChange: (value)=>store.setConfirmPassword(value),
|
|
207
|
+
placeholder: "Confirm your new password",
|
|
208
|
+
autoComplete: "new-password",
|
|
209
|
+
enableValidation: false,
|
|
210
|
+
fullWidth: true,
|
|
211
|
+
showTypeIcon: false,
|
|
212
|
+
wrapperClassName: "!bg-transparent border-zinc-300 dark:border-zinc-600",
|
|
213
|
+
inputClassName: "placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"
|
|
214
|
+
})
|
|
215
|
+
}),
|
|
216
|
+
/*#__PURE__*/ _jsx("div", {
|
|
217
|
+
className: theme.button.wrapper,
|
|
218
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
219
|
+
type: "submit",
|
|
220
|
+
variant: "primary",
|
|
221
|
+
size: "lg",
|
|
222
|
+
fullWidth: true,
|
|
223
|
+
loading: changePasswordAction.state.isPending,
|
|
224
|
+
children: "Change Password"
|
|
225
|
+
})
|
|
226
|
+
}),
|
|
227
|
+
(cancelHref || onCancel) && /*#__PURE__*/ _jsx("div", {
|
|
228
|
+
className: theme.links.container,
|
|
229
|
+
children: /*#__PURE__*/ _jsxs("button", {
|
|
230
|
+
type: "button",
|
|
231
|
+
onClick: handleCancelClick,
|
|
232
|
+
className: theme.links.cancel,
|
|
233
|
+
disabled: isLoading,
|
|
234
|
+
children: [
|
|
235
|
+
/*#__PURE__*/ _jsx(ArrowLeftIcon, {}),
|
|
236
|
+
"Cancel"
|
|
237
|
+
]
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../utils/cn";
|
|
4
|
+
import { changePasswordPageTheme } from "../theme";
|
|
5
|
+
export function ChangePasswordHeader({ logo, title, subtitle }) {
|
|
6
|
+
const theme = changePasswordPageTheme;
|
|
7
|
+
return /*#__PURE__*/ _jsxs("header", {
|
|
8
|
+
className: theme.header.container,
|
|
9
|
+
children: [
|
|
10
|
+
logo ? /*#__PURE__*/ _jsx("div", {
|
|
11
|
+
className: theme.header.logoWrapper,
|
|
12
|
+
children: logo
|
|
13
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
14
|
+
className: theme.header.iconWrapper,
|
|
15
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
16
|
+
className: "w-8 h-8 text-blue-600 dark:text-blue-400",
|
|
17
|
+
fill: "none",
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
viewBox: "0 0 24 24",
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
22
|
+
strokeLinecap: "round",
|
|
23
|
+
strokeLinejoin: "round",
|
|
24
|
+
strokeWidth: 2,
|
|
25
|
+
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"
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ _jsx("h1", {
|
|
30
|
+
className: cn(theme.header.title),
|
|
31
|
+
children: title
|
|
32
|
+
}),
|
|
33
|
+
/*#__PURE__*/ _jsx("p", {
|
|
34
|
+
className: cn(theme.header.subtitle),
|
|
35
|
+
children: subtitle
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|