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