@kendevelops/auth-flow-kit 0.0.1

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/index.js ADDED
@@ -0,0 +1,795 @@
1
+ // src/AuthContext.tsx
2
+ import {
3
+ createContext,
4
+ useContext,
5
+ useEffect,
6
+ useMemo,
7
+ useState
8
+ } from "react";
9
+
10
+ // src/http.ts
11
+ function makeURL(baseURL, path) {
12
+ return `${baseURL.replace(/\/$/, "")}${path.startsWith("/") ? path : `/${path}`}`;
13
+ }
14
+ function getStoredAccessToken() {
15
+ try {
16
+ return localStorage.getItem("afk_access_token");
17
+ } catch {
18
+ return null;
19
+ }
20
+ }
21
+ function setStoredAccessToken(token) {
22
+ try {
23
+ if (token) localStorage.setItem("afk_access_token", token);
24
+ else localStorage.removeItem("afk_access_token");
25
+ } catch {
26
+ }
27
+ }
28
+ async function httpJSON(url, opts = {}, withAuth = false) {
29
+ const headers = {
30
+ "Content-Type": "application/json"
31
+ };
32
+ if (withAuth) {
33
+ const tok = getStoredAccessToken();
34
+ if (tok) headers["Authorization"] = `Bearer ${tok}`;
35
+ }
36
+ const res = await fetch(url, {
37
+ ...opts,
38
+ headers: { ...headers, ...opts.headers || {} }
39
+ });
40
+ if (!res.ok) {
41
+ const text = await res.text().catch(() => "");
42
+ throw new Error(text || `HTTP ${res.status}`);
43
+ }
44
+ return res.json();
45
+ }
46
+ async function tryRefreshToken(baseURL, endpoints) {
47
+ if (!endpoints.refresh) return null;
48
+ const refreshToken = localStorage.getItem("afk_refresh_token");
49
+ if (!refreshToken) return null;
50
+ try {
51
+ const url = makeURL(baseURL, endpoints.refresh);
52
+ const next = await httpJSON(url, {
53
+ method: "POST",
54
+ body: JSON.stringify({ refreshToken })
55
+ });
56
+ setStoredAccessToken(next.accessToken);
57
+ return next.accessToken;
58
+ } catch {
59
+ return null;
60
+ }
61
+ }
62
+
63
+ // src/AuthContext.tsx
64
+ import { jsx } from "react/jsx-runtime";
65
+ var AuthContext = createContext(void 0);
66
+ function useAuth() {
67
+ const ctx = useContext(AuthContext);
68
+ if (!ctx) throw new Error("useAuth must be used inside AuthProvider");
69
+ return ctx;
70
+ }
71
+ function AuthProvider({
72
+ config,
73
+ children
74
+ }) {
75
+ const { baseURL, endpoints, onLoginSuccess, onLogout } = config;
76
+ const [user, setUser] = useState(null);
77
+ const [loading, setLoading] = useState(true);
78
+ const getToken = () => getStoredAccessToken();
79
+ useEffect(() => {
80
+ const init = async () => {
81
+ setLoading(true);
82
+ const token = getStoredAccessToken();
83
+ if (!token) {
84
+ setUser(null);
85
+ setLoading(false);
86
+ return;
87
+ }
88
+ try {
89
+ const meURL = makeURL(baseURL, endpoints.me);
90
+ const profile = await httpJSON(meURL, {}, true);
91
+ setUser(profile);
92
+ } catch (err) {
93
+ const refreshed = await tryRefreshToken(baseURL, endpoints);
94
+ if (refreshed) {
95
+ try {
96
+ const meURL = makeURL(baseURL, endpoints.me);
97
+ const profile = await httpJSON(meURL, {}, true);
98
+ setUser(profile);
99
+ } catch {
100
+ setStoredAccessToken(null);
101
+ localStorage.removeItem("afk_refresh_token");
102
+ setUser(null);
103
+ }
104
+ } else {
105
+ setStoredAccessToken(null);
106
+ localStorage.removeItem("afk_refresh_token");
107
+ setUser(null);
108
+ }
109
+ } finally {
110
+ setLoading(false);
111
+ }
112
+ };
113
+ void init();
114
+ }, []);
115
+ const login = async (email, password) => {
116
+ const url = makeURL(baseURL, endpoints.login);
117
+ const res = await httpJSON(url, {
118
+ method: "POST",
119
+ body: JSON.stringify({ email, password })
120
+ });
121
+ setStoredAccessToken(res.accessToken);
122
+ if (res.refreshToken)
123
+ localStorage.setItem("afk_refresh_token", res.refreshToken);
124
+ setUser(res.user);
125
+ if (onLoginSuccess) onLoginSuccess();
126
+ };
127
+ const signup = async (payload) => {
128
+ const url = makeURL(baseURL, endpoints.signup);
129
+ const res = await httpJSON(url, {
130
+ method: "POST",
131
+ body: JSON.stringify(payload)
132
+ });
133
+ setStoredAccessToken(res.accessToken);
134
+ if (res.refreshToken)
135
+ localStorage.setItem("afk_refresh_token", res.refreshToken);
136
+ setUser(res.user);
137
+ if (onLoginSuccess) onLoginSuccess();
138
+ };
139
+ const logout = () => {
140
+ setStoredAccessToken(null);
141
+ localStorage.removeItem("afk_refresh_token");
142
+ setUser(null);
143
+ if (onLogout) onLogout();
144
+ };
145
+ const value = useMemo(
146
+ () => ({ user, loading, login, signup, logout, getToken }),
147
+ [user, loading]
148
+ );
149
+ return /* @__PURE__ */ jsx(AuthContext.Provider, { value, children });
150
+ }
151
+
152
+ // src/Protected.tsx
153
+ import { useEffect as useEffect2 } from "react";
154
+ import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
155
+ function Protected({ children }) {
156
+ const { user, loading } = useAuth();
157
+ useEffect2(() => {
158
+ if (!loading && !user) {
159
+ window.location.href = "/login";
160
+ }
161
+ }, [loading, user]);
162
+ if (loading) return /* @__PURE__ */ jsx2("div", { children: "Loading..." });
163
+ if (!user) return null;
164
+ return /* @__PURE__ */ jsx2(Fragment, { children });
165
+ }
166
+
167
+ // src/screens/LoginScreen.tsx
168
+ import { useState as useState3 } from "react";
169
+
170
+ // src/screens/PasswordResetScreen.tsx
171
+ import { useState as useState2 } from "react";
172
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
173
+ function PasswordResetScreen() {
174
+ const { getToken } = useAuth();
175
+ const [email, setEmail] = useState2("");
176
+ const [sent, setSent] = useState2(false);
177
+ const [error, setError] = useState2(null);
178
+ const requestReset = async (e) => {
179
+ e.preventDefault();
180
+ setError(null);
181
+ try {
182
+ const baseURL = window.__AFK_BASE__ || "";
183
+ const url = makeURL(baseURL, "/auth/forgot");
184
+ await httpJSON(url, {
185
+ method: "POST",
186
+ body: JSON.stringify({ email })
187
+ });
188
+ setSent(true);
189
+ } catch (err) {
190
+ setError(err?.message || "Failed to request reset");
191
+ }
192
+ };
193
+ return /* @__PURE__ */ jsxs(
194
+ "form",
195
+ {
196
+ onSubmit: requestReset,
197
+ style: {
198
+ maxWidth: 400,
199
+ margin: "60px auto",
200
+ padding: 32,
201
+ borderRadius: 20,
202
+ fontFamily: "Inter, sans-serif",
203
+ // GLASS EFFECT
204
+ background: "rgba(255, 255, 255, 0.25)",
205
+ backdropFilter: "blur(14px)",
206
+ WebkitBackdropFilter: "blur(14px)",
207
+ boxShadow: "0 20px 40px rgba(0,0,0,0.15)",
208
+ border: "1px solid rgba(255,255,255,0.4)",
209
+ animation: "fadeIn 0.25s ease"
210
+ },
211
+ children: [
212
+ /* @__PURE__ */ jsx3(
213
+ "h2",
214
+ {
215
+ style: {
216
+ marginBottom: 30,
217
+ color: "#060f22",
218
+ fontWeight: 700,
219
+ fontSize: 30,
220
+ textAlign: "center",
221
+ letterSpacing: "-0.5px"
222
+ },
223
+ children: "Reset Password \u{1F511}"
224
+ }
225
+ ),
226
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative", marginBottom: 26 }, children: [
227
+ /* @__PURE__ */ jsx3(
228
+ "label",
229
+ {
230
+ style: {
231
+ position: "absolute",
232
+ top: sent ? "-18px" : "-10px",
233
+ left: "14px",
234
+ background: "rgba(255,255,255,0.85)",
235
+ padding: "0 6px",
236
+ fontSize: 13,
237
+ color: "#444",
238
+ borderRadius: 6
239
+ },
240
+ children: "Email"
241
+ }
242
+ ),
243
+ /* @__PURE__ */ jsx3(
244
+ "input",
245
+ {
246
+ value: email,
247
+ onChange: (e) => setEmail(e.target.value),
248
+ type: "email",
249
+ placeholder: "you@example.com",
250
+ style: {
251
+ width: "90%",
252
+ padding: "14px 16px",
253
+ borderRadius: 12,
254
+ border: "1px solid #d2d2d2",
255
+ fontSize: 15,
256
+ outline: "none",
257
+ transition: "0.25s",
258
+ background: "rgba(255,255,255,0.85)"
259
+ },
260
+ onFocus: (e) => {
261
+ e.currentTarget.style.border = "1px solid #4b4bff";
262
+ e.currentTarget.style.boxShadow = "0 0 0 3px rgba(75,75,255,0.25)";
263
+ },
264
+ onBlur: (e) => {
265
+ e.currentTarget.style.border = "1px solid #d2d2d2";
266
+ e.currentTarget.style.boxShadow = "0 0 0 transparent";
267
+ }
268
+ }
269
+ )
270
+ ] }),
271
+ /* @__PURE__ */ jsx3(
272
+ "button",
273
+ {
274
+ type: "submit",
275
+ style: {
276
+ width: "100%",
277
+ padding: "14px 20px",
278
+ borderRadius: 12,
279
+ // PREMIUM GRADIENT
280
+ background: sent ? "linear-gradient(90deg, #7aff9d, #34c759)" : "linear-gradient(90deg, #5353aaff, #060f22ff)",
281
+ color: "white",
282
+ border: "none",
283
+ fontSize: 16,
284
+ fontWeight: 700,
285
+ letterSpacing: "0.3px",
286
+ cursor: "pointer",
287
+ transition: "0.3s",
288
+ boxShadow: "0 8px 20px rgba(75,75,255,0.25)"
289
+ },
290
+ children: sent ? "Link Sent \u2714" : "Send reset link"
291
+ }
292
+ ),
293
+ sent && /* @__PURE__ */ jsx3(
294
+ "p",
295
+ {
296
+ style: {
297
+ marginTop: 20,
298
+ color: "#2ecc71",
299
+ textAlign: "center",
300
+ fontSize: 15,
301
+ fontWeight: 600
302
+ },
303
+ children: "Check your email for reset instructions."
304
+ }
305
+ ),
306
+ error && /* @__PURE__ */ jsx3(
307
+ "p",
308
+ {
309
+ style: {
310
+ marginTop: 20,
311
+ color: "crimson",
312
+ textAlign: "center",
313
+ fontSize: 14,
314
+ fontWeight: 500
315
+ },
316
+ children: error
317
+ }
318
+ )
319
+ ]
320
+ }
321
+ );
322
+ }
323
+
324
+ // src/screens/LoginScreen.tsx
325
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
326
+ function LoginScreen() {
327
+ const { login } = useAuth();
328
+ const [email, setEmail] = useState3("");
329
+ const [password, setPassword] = useState3("");
330
+ const [submitting, setSubmitting] = useState3(false);
331
+ const [error, setError] = useState3(null);
332
+ const [showReset, setShowReset] = useState3(false);
333
+ if (showReset) {
334
+ return /* @__PURE__ */ jsxs2("div", { style: { animation: "fade .2s" }, children: [
335
+ /* @__PURE__ */ jsx4(PasswordResetScreen, {}),
336
+ /* @__PURE__ */ jsx4(
337
+ "p",
338
+ {
339
+ onClick: () => setShowReset(false),
340
+ style: {
341
+ marginTop: 16,
342
+ textAlign: "center",
343
+ fontSize: 14,
344
+ color: "#4b4bff",
345
+ cursor: "pointer",
346
+ textDecoration: "underline"
347
+ },
348
+ children: "Back to login"
349
+ }
350
+ )
351
+ ] });
352
+ }
353
+ const onSubmit = async (e) => {
354
+ e.preventDefault();
355
+ setSubmitting(true);
356
+ setError(null);
357
+ const trimmedEmail = email.trim();
358
+ const trimmedPassword = password.trim();
359
+ if (!trimmedEmail || !trimmedPassword) {
360
+ setError("Email and password cannot be empty.");
361
+ setSubmitting(false);
362
+ return;
363
+ }
364
+ try {
365
+ await login(trimmedEmail, trimmedPassword);
366
+ } catch (err) {
367
+ setError(err?.message || "Login failed");
368
+ } finally {
369
+ setSubmitting(false);
370
+ }
371
+ };
372
+ return /* @__PURE__ */ jsxs2(
373
+ "form",
374
+ {
375
+ onSubmit,
376
+ style: {
377
+ maxWidth: 400,
378
+ margin: "60px auto",
379
+ padding: 32,
380
+ borderRadius: 20,
381
+ fontFamily: "Inter, sans-serif",
382
+ // GLASS EFFECT
383
+ background: "rgba(255, 255, 255, 0.25)",
384
+ backdropFilter: "blur(14px)",
385
+ WebkitBackdropFilter: "blur(14px)",
386
+ boxShadow: "0 20px 40px rgba(0,0,0,0.15)",
387
+ border: "1px solid rgba(255,255,255,0.4)",
388
+ animation: "fadeIn 0.3s ease"
389
+ },
390
+ children: [
391
+ /* @__PURE__ */ jsx4(
392
+ "h2",
393
+ {
394
+ style: {
395
+ marginBottom: 30,
396
+ color: "#060f22",
397
+ fontWeight: 700,
398
+ fontSize: 30,
399
+ textAlign: "center",
400
+ letterSpacing: "-0.5px"
401
+ },
402
+ children: "Welcome Back \u{1F44B}"
403
+ }
404
+ ),
405
+ /* @__PURE__ */ jsxs2("div", { style: { position: "relative", marginBottom: 26 }, children: [
406
+ /* @__PURE__ */ jsx4(
407
+ "label",
408
+ {
409
+ style: {
410
+ position: "absolute",
411
+ top: "-10px",
412
+ left: "14px",
413
+ background: "rgba(255,255,255,0.8)",
414
+ padding: "0 6px",
415
+ fontSize: 13,
416
+ color: "#444",
417
+ borderRadius: 6
418
+ },
419
+ children: "Email"
420
+ }
421
+ ),
422
+ /* @__PURE__ */ jsx4(
423
+ "input",
424
+ {
425
+ value: email,
426
+ onChange: (e) => setEmail(e.target.value),
427
+ type: "email",
428
+ placeholder: "you@example.com",
429
+ style: {
430
+ width: "80%",
431
+ padding: "14px 16px",
432
+ borderRadius: 12,
433
+ border: "1px solid #d2d2d2",
434
+ fontSize: 15,
435
+ outline: "none",
436
+ transition: "0.25s",
437
+ background: "rgba(255,255,255,0.85)"
438
+ },
439
+ onFocus: (e) => {
440
+ e.currentTarget.style.border = "1px solid #4b4bff";
441
+ e.currentTarget.style.boxShadow = "0 0 0 3px rgba(75,75,255,0.25)";
442
+ },
443
+ onBlur: (e) => {
444
+ e.currentTarget.style.border = "1px solid #d2d2d2";
445
+ e.currentTarget.style.boxShadow = "0 0 0 transparent";
446
+ }
447
+ }
448
+ )
449
+ ] }),
450
+ /* @__PURE__ */ jsxs2("div", { style: { position: "relative", marginBottom: 10 }, children: [
451
+ /* @__PURE__ */ jsx4(
452
+ "label",
453
+ {
454
+ style: {
455
+ position: "absolute",
456
+ top: "-10px",
457
+ left: "14px",
458
+ background: "rgba(255,255,255,0.8)",
459
+ padding: "0 6px",
460
+ fontSize: 13,
461
+ color: "#444",
462
+ borderRadius: 6
463
+ },
464
+ children: "Password"
465
+ }
466
+ ),
467
+ /* @__PURE__ */ jsx4(
468
+ "input",
469
+ {
470
+ value: password,
471
+ onChange: (e) => setPassword(e.target.value),
472
+ type: "password",
473
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
474
+ style: {
475
+ width: "80%",
476
+ padding: "14px 16px",
477
+ borderRadius: 12,
478
+ border: "1px solid #d2d2d2",
479
+ fontSize: 15,
480
+ outline: "none",
481
+ transition: "0.25s",
482
+ background: "rgba(255,255,255,0.85)"
483
+ },
484
+ onFocus: (e) => {
485
+ e.currentTarget.style.border = "1px solid #4b4bff";
486
+ e.currentTarget.style.boxShadow = "0 0 0 3px rgba(75,75,255,0.25)";
487
+ },
488
+ onBlur: (e) => {
489
+ e.currentTarget.style.border = "1px solid #d2d2d2";
490
+ e.currentTarget.style.boxShadow = "0 0 0 transparent";
491
+ }
492
+ }
493
+ )
494
+ ] }),
495
+ /* @__PURE__ */ jsx4(
496
+ "p",
497
+ {
498
+ onClick: () => setShowReset(true),
499
+ style: {
500
+ textAlign: "right",
501
+ fontSize: 13,
502
+ color: "#4b4bff",
503
+ cursor: "pointer",
504
+ marginBottom: 24
505
+ },
506
+ children: "Forgot password?"
507
+ }
508
+ ),
509
+ /* @__PURE__ */ jsx4(
510
+ "button",
511
+ {
512
+ disabled: submitting,
513
+ type: "submit",
514
+ style: {
515
+ width: "100%",
516
+ padding: "14px 20px",
517
+ borderRadius: 12,
518
+ // 🔥 GRADIENT BUTTON
519
+ background: submitting ? "linear-gradient(90deg, #b2bdfd, #8da0ff)" : "linear-gradient(90deg, #5353aaff, #060f22ff)",
520
+ color: "white",
521
+ border: "none",
522
+ fontSize: 16,
523
+ fontWeight: 700,
524
+ letterSpacing: "0.3px",
525
+ cursor: "pointer",
526
+ transition: "0.25s",
527
+ boxShadow: "0 8px 20px rgba(75,75,255,0.25)"
528
+ },
529
+ children: submitting ? "Signing in..." : "Sign in"
530
+ }
531
+ ),
532
+ error && /* @__PURE__ */ jsx4(
533
+ "p",
534
+ {
535
+ style: {
536
+ marginTop: 18,
537
+ color: "crimson",
538
+ textAlign: "center",
539
+ fontSize: 14,
540
+ fontWeight: 500
541
+ },
542
+ children: error
543
+ }
544
+ )
545
+ ]
546
+ }
547
+ );
548
+ }
549
+
550
+ // src/screens/SignupScreen.tsx
551
+ import { useState as useState4 } from "react";
552
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
553
+ function SignupScreen() {
554
+ const { signup } = useAuth();
555
+ const [name, setName] = useState4("");
556
+ const [email, setEmail] = useState4("");
557
+ const [password, setPassword] = useState4("");
558
+ const [submitting, setSubmitting] = useState4(false);
559
+ const [error, setError] = useState4(null);
560
+ const onSubmit = async (e) => {
561
+ e.preventDefault();
562
+ setSubmitting(true);
563
+ setError(null);
564
+ const trimmedEmail = email.trim();
565
+ const trimmedPassword = password.trim();
566
+ const trimmedName = name.trim();
567
+ if (!trimmedEmail || !trimmedPassword || !trimmedName) {
568
+ setError("Email and password cannot be empty.");
569
+ setSubmitting(false);
570
+ return;
571
+ }
572
+ try {
573
+ await signup({ name, email, password });
574
+ } catch (err) {
575
+ setError(err?.message || "Signup failed");
576
+ } finally {
577
+ setSubmitting(false);
578
+ }
579
+ };
580
+ return /* @__PURE__ */ jsxs3(
581
+ "form",
582
+ {
583
+ onSubmit,
584
+ style: {
585
+ maxWidth: 400,
586
+ margin: "60px auto",
587
+ padding: 32,
588
+ borderRadius: 20,
589
+ fontFamily: "Inter, sans-serif",
590
+ // GLASS EFFECT
591
+ background: "rgba(255, 255, 255, 0.25)",
592
+ backdropFilter: "blur(14px)",
593
+ WebkitBackdropFilter: "blur(14px)",
594
+ boxShadow: "0 20px 40px rgba(0,0,0,0.15)",
595
+ border: "1px solid rgba(255,255,255,0.4)",
596
+ animation: "fadeIn 0.3s ease"
597
+ },
598
+ children: [
599
+ /* @__PURE__ */ jsx5(
600
+ "h2",
601
+ {
602
+ style: {
603
+ marginBottom: 30,
604
+ color: "#060f22",
605
+ fontWeight: 700,
606
+ fontSize: 30,
607
+ textAlign: "center",
608
+ letterSpacing: "-0.5px"
609
+ },
610
+ children: "Create Account \u2728"
611
+ }
612
+ ),
613
+ /* @__PURE__ */ jsxs3("div", { style: { position: "relative", marginBottom: 26 }, children: [
614
+ /* @__PURE__ */ jsx5(
615
+ "label",
616
+ {
617
+ style: {
618
+ position: "absolute",
619
+ top: "-10px",
620
+ left: "14px",
621
+ background: "rgba(255,255,255,0.85)",
622
+ padding: "0 6px",
623
+ fontSize: 13,
624
+ color: "#444",
625
+ borderRadius: 6
626
+ },
627
+ children: "Name"
628
+ }
629
+ ),
630
+ /* @__PURE__ */ jsx5(
631
+ "input",
632
+ {
633
+ value: name,
634
+ onChange: (e) => setName(e.target.value),
635
+ placeholder: "Your name",
636
+ style: {
637
+ width: "80%",
638
+ padding: "14px 16px",
639
+ borderRadius: 12,
640
+ border: "1px solid #d2d2d2",
641
+ fontSize: 15,
642
+ outline: "none",
643
+ transition: "0.25s",
644
+ background: "rgba(255,255,255,0.85)"
645
+ },
646
+ onFocus: (e) => {
647
+ e.currentTarget.style.border = "1px solid #4b4bff";
648
+ e.currentTarget.style.boxShadow = "0 0 0 3px rgba(75,75,255,0.25)";
649
+ },
650
+ onBlur: (e) => {
651
+ e.currentTarget.style.border = "1px solid #d2d2d2";
652
+ e.currentTarget.style.boxShadow = "0 0 0 transparent";
653
+ }
654
+ }
655
+ )
656
+ ] }),
657
+ /* @__PURE__ */ jsxs3("div", { style: { position: "relative", marginBottom: 26 }, children: [
658
+ /* @__PURE__ */ jsx5(
659
+ "label",
660
+ {
661
+ style: {
662
+ position: "absolute",
663
+ top: "-10px",
664
+ left: "14px",
665
+ background: "rgba(255,255,255,0.85)",
666
+ padding: "0 6px",
667
+ fontSize: 13,
668
+ color: "#444",
669
+ borderRadius: 6
670
+ },
671
+ children: "Email"
672
+ }
673
+ ),
674
+ /* @__PURE__ */ jsx5(
675
+ "input",
676
+ {
677
+ value: email,
678
+ onChange: (e) => setEmail(e.target.value),
679
+ type: "email",
680
+ placeholder: "you@example.com",
681
+ style: {
682
+ width: "80%",
683
+ padding: "14px 16px",
684
+ borderRadius: 12,
685
+ border: "1px solid #d2d2d2",
686
+ fontSize: 15,
687
+ outline: "none",
688
+ transition: "0.25s",
689
+ background: "rgba(255,255,255,0.85)"
690
+ },
691
+ onFocus: (e) => {
692
+ e.currentTarget.style.border = "1px solid #4b4bff";
693
+ e.currentTarget.style.boxShadow = "0 0 0 3px rgba(75,75,255,0.25)";
694
+ },
695
+ onBlur: (e) => {
696
+ e.currentTarget.style.border = "1px solid #d2d2d2";
697
+ e.currentTarget.style.boxShadow = "0 0 0 transparent";
698
+ }
699
+ }
700
+ )
701
+ ] }),
702
+ /* @__PURE__ */ jsxs3("div", { style: { position: "relative", marginBottom: 26 }, children: [
703
+ /* @__PURE__ */ jsx5(
704
+ "label",
705
+ {
706
+ style: {
707
+ position: "absolute",
708
+ top: "-10px",
709
+ left: "14px",
710
+ background: "rgba(255,255,255,0.85)",
711
+ padding: "0 6px",
712
+ fontSize: 13,
713
+ color: "#444",
714
+ borderRadius: 6
715
+ },
716
+ children: "Password"
717
+ }
718
+ ),
719
+ /* @__PURE__ */ jsx5(
720
+ "input",
721
+ {
722
+ value: password,
723
+ onChange: (e) => setPassword(e.target.value),
724
+ type: "password",
725
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
726
+ style: {
727
+ width: "80%",
728
+ padding: "14px 16px",
729
+ borderRadius: 12,
730
+ border: "1px solid #d2d2d2",
731
+ fontSize: 15,
732
+ outline: "none",
733
+ transition: "0.25s",
734
+ background: "rgba(255,255,255,0.85)"
735
+ },
736
+ onFocus: (e) => {
737
+ e.currentTarget.style.border = "1px solid #4b4bff";
738
+ e.currentTarget.style.boxShadow = "0 0 0 3px rgba(75,75,255,0.25)";
739
+ },
740
+ onBlur: (e) => {
741
+ e.currentTarget.style.border = "1px solid #d2d2d2";
742
+ e.currentTarget.style.boxShadow = "0 0 0 transparent";
743
+ }
744
+ }
745
+ )
746
+ ] }),
747
+ /* @__PURE__ */ jsx5(
748
+ "button",
749
+ {
750
+ disabled: submitting,
751
+ type: "submit",
752
+ style: {
753
+ width: "100%",
754
+ padding: "14px 20px",
755
+ borderRadius: 12,
756
+ // SAME GRADIENT AS LOGIN
757
+ background: submitting ? "linear-gradient(90deg, #b2bdfd, #8da0ff)" : "linear-gradient(90deg, #5353aaff, #060f22ff)",
758
+ color: "white",
759
+ border: "none",
760
+ fontSize: 16,
761
+ fontWeight: 700,
762
+ letterSpacing: "0.3px",
763
+ cursor: "pointer",
764
+ transition: "0.25s",
765
+ boxShadow: "0 8px 20px rgba(75,75,255,0.25)"
766
+ },
767
+ children: submitting ? "Creating..." : "Create account"
768
+ }
769
+ ),
770
+ error && /* @__PURE__ */ jsx5(
771
+ "p",
772
+ {
773
+ style: {
774
+ marginTop: 18,
775
+ color: "crimson",
776
+ textAlign: "center",
777
+ fontSize: 14,
778
+ fontWeight: 500
779
+ },
780
+ children: error
781
+ }
782
+ )
783
+ ]
784
+ }
785
+ );
786
+ }
787
+ export {
788
+ AuthProvider,
789
+ LoginScreen,
790
+ PasswordResetScreen,
791
+ Protected,
792
+ SignupScreen,
793
+ useAuth
794
+ };
795
+ //# sourceMappingURL=index.js.map