@urbackend/react 0.1.1 → 0.2.0

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 CHANGED
@@ -410,9 +410,93 @@ var Toast = ({ message, type, onClose, isDark = false }) => {
410
410
 
411
411
  // src/components/UrAuth.tsx
412
412
  var import_jsx_runtime4 = require("react/jsx-runtime");
413
+ var defaultLabels = {
414
+ loginTab: "Login",
415
+ signupTab: "Sign Up",
416
+ loginTitle: "Welcome back",
417
+ signupTitle: "Create your account",
418
+ forgotTitle: "Reset Password",
419
+ resetTitle: "Enter Reset Code",
420
+ loginButton: "Log In",
421
+ signupButton: "Create Account",
422
+ forgotButton: "Send Reset Code",
423
+ resetButton: "Reset Password",
424
+ emailLabel: "Email address",
425
+ emailPlaceholder: "Enter your email address",
426
+ passwordLabel: "Password",
427
+ passwordPlaceholder: "Enter your password",
428
+ nameLabel: "Full Name",
429
+ namePlaceholder: "Enter your name",
430
+ otpLabel: "6-digit OTP Code",
431
+ otpPlaceholder: "Enter reset code",
432
+ forgotPasswordLink: "Forgot password?",
433
+ socialDivider: "OR",
434
+ googleButton: "Continue with Google",
435
+ githubButton: "Continue with GitHub",
436
+ footerSigninPrompt: "Don't have an account yet?",
437
+ footerSignupPrompt: "Already have an account?",
438
+ footerForgotPrompt: "Remember your password?",
439
+ noAuthMethods: "No authentication methods are enabled for this screen.",
440
+ forgotSubtitle: "Welcome back",
441
+ resetSubtitle: "Enter the code sent to {email}"
442
+ };
443
+ var defaultThemeColors = {
444
+ light: {
445
+ background: "#ffffff",
446
+ surface: "#ffffff",
447
+ text: "#0f172a",
448
+ textMuted: "#64748b",
449
+ border: "#e2e8f0",
450
+ inputBackground: "#ffffff",
451
+ primary: "#111111",
452
+ primaryText: "#ffffff",
453
+ footerBackground: "#f8fafc",
454
+ dividerText: "#94a3b8",
455
+ socialButtonBackground: "#ffffff"
456
+ },
457
+ dark: {
458
+ background: "#1a1a1a",
459
+ surface: "#1a1a1a",
460
+ text: "#ffffff",
461
+ textMuted: "#a1a1aa",
462
+ border: "#333333",
463
+ inputBackground: "#2a2a2a",
464
+ primary: "#ffffff",
465
+ primaryText: "#111111",
466
+ footerBackground: "#222222",
467
+ dividerText: "#94a3b8",
468
+ socialButtonBackground: "#2a2a2a"
469
+ }
470
+ };
471
+ var adjustColor = (color, percent) => {
472
+ try {
473
+ if (color.startsWith("#")) {
474
+ let hex = color.replace("#", "");
475
+ if (hex.length === 3) {
476
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
477
+ }
478
+ let r = parseInt(hex.substring(0, 2), 16);
479
+ let g = parseInt(hex.substring(2, 4), 16);
480
+ let b = parseInt(hex.substring(4, 6), 16);
481
+ r = Math.min(255, Math.max(0, r + percent));
482
+ g = Math.min(255, Math.max(0, g + percent));
483
+ b = Math.min(255, Math.max(0, b + percent));
484
+ const rr = r.toString(16).padStart(2, "0");
485
+ const gg = g.toString(16).padStart(2, "0");
486
+ const bb = b.toString(16).padStart(2, "0");
487
+ return `#${rr}${gg}${bb}`;
488
+ }
489
+ } catch (e) {
490
+ }
491
+ return color;
492
+ };
413
493
  var UrAuth = ({
414
494
  providers = ["google", "github"],
495
+ enableEmailPassword = true,
415
496
  theme = "light",
497
+ colors,
498
+ branding,
499
+ labels,
416
500
  onSuccess
417
501
  }) => {
418
502
  const { login, signUp, socialLogin, requestPasswordReset, resetPassword, isLoading, error, clearError } = useAuth();
@@ -422,11 +506,48 @@ var UrAuth = ({
422
506
  const [otp, setOtp] = (0, import_react5.useState)("");
423
507
  const [name, setName] = (0, import_react5.useState)("");
424
508
  const [toast, setToast] = (0, import_react5.useState)(null);
509
+ const text = {
510
+ ...defaultLabels,
511
+ ...labels,
512
+ loginTab: labels?.signInTab ?? labels?.loginTab ?? defaultLabels.loginTab,
513
+ loginTitle: labels?.signInTitle ?? labels?.loginTitle ?? defaultLabels.loginTitle,
514
+ loginButton: labels?.signInButton ?? labels?.loginButton ?? defaultLabels.loginButton,
515
+ signupTab: labels?.signUpTab ?? labels?.signupTab ?? defaultLabels.signupTab,
516
+ signupTitle: labels?.signUpTitle ?? labels?.signupTitle ?? defaultLabels.signupTitle,
517
+ signupButton: labels?.signUpButton ?? labels?.signupButton ?? defaultLabels.signupButton
518
+ };
519
+ const themeColors = { ...defaultThemeColors[theme], ...colors };
520
+ const primaryColor = branding?.primaryColor || themeColors.primary;
521
+ const secondStopColor = adjustColor(primaryColor, -15);
522
+ let isGoogleEnabled = true;
523
+ let isGithubEnabled = true;
524
+ let isEmailPasswordEnabled = enableEmailPassword;
525
+ if (providers) {
526
+ if (Array.isArray(providers)) {
527
+ isGoogleEnabled = providers.includes("google");
528
+ isGithubEnabled = providers.includes("github");
529
+ } else if (typeof providers === "object") {
530
+ isGoogleEnabled = !!providers.google;
531
+ isGithubEnabled = !!providers.github;
532
+ isEmailPasswordEnabled = providers.emailPassword !== void 0 ? providers.emailPassword : enableEmailPassword;
533
+ }
534
+ }
535
+ const hasPasswordAuth = isEmailPasswordEnabled;
536
+ const hasSocialAuth = isGoogleEnabled || isGithubEnabled;
537
+ const brandName = branding?.brandName || branding?.appName || branding?.title || "urBackend";
538
+ const headerTitle = branding?.title || brandName;
539
+ const headerSubtitle = branding?.subtitle || (mode === "signin" ? text.loginTitle : mode === "signup" ? text.signupTitle : mode === "forgot" ? text.forgotTitle : text.resetTitle);
540
+ const showSwitcher = hasPasswordAuth;
425
541
  (0, import_react5.useEffect)(() => {
426
542
  if (error) {
427
543
  setToast({ message: error, type: "error" });
428
544
  }
429
545
  }, [error]);
546
+ (0, import_react5.useEffect)(() => {
547
+ if (!hasPasswordAuth && mode !== "signin") {
548
+ setMode("signin");
549
+ }
550
+ }, [hasPasswordAuth, mode]);
430
551
  const handleSubmit = async (e) => {
431
552
  e.preventDefault();
432
553
  try {
@@ -453,28 +574,58 @@ var UrAuth = ({
453
574
  } catch (err) {
454
575
  }
455
576
  };
456
- const isDark = theme === "dark";
457
- const bg = isDark ? "#1a1a1a" : "#ffffff";
458
- const text = isDark ? "#ffffff" : "#0f172a";
459
- const textMuted = isDark ? "#a1a1aa" : "#64748b";
460
- const border = isDark ? "#333" : "#e2e8f0";
461
- const inputBg = isDark ? "#2a2a2a" : "#ffffff";
462
577
  const styles = {
463
578
  wrapper: {
464
579
  width: "100%",
465
580
  maxWidth: "420px",
466
581
  margin: "0 auto",
467
582
  borderRadius: "0",
468
- background: bg,
469
- boxShadow: isDark ? "0 20px 40px rgba(0,0,0,0.5)" : "0 20px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.05)",
470
- border: `1px solid ${border}`,
583
+ background: themeColors.background,
584
+ boxShadow: theme === "dark" ? "0 20px 40px rgba(0,0,0,0.5)" : "0 20px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.05)",
585
+ border: `1px solid ${themeColors.border}`,
471
586
  overflow: "hidden",
472
587
  fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
473
- color: text
588
+ color: themeColors.text
474
589
  },
475
590
  body: {
476
591
  padding: "32px 32px 24px 32px"
477
592
  },
593
+ header: {
594
+ textAlign: "center",
595
+ marginBottom: "28px"
596
+ },
597
+ brandRow: {
598
+ display: "flex",
599
+ justifyContent: "center",
600
+ alignItems: "center",
601
+ gap: "12px",
602
+ marginBottom: "10px"
603
+ },
604
+ brandLogo: {
605
+ width: "44px",
606
+ height: "44px",
607
+ borderRadius: "12px",
608
+ display: "inline-flex",
609
+ alignItems: "center",
610
+ justifyContent: "center",
611
+ background: theme === "dark" ? "#2a2a2a" : "#f1f5f9",
612
+ color: themeColors.text,
613
+ overflow: "hidden"
614
+ },
615
+ brandTitle: {
616
+ margin: 0,
617
+ fontSize: "26px",
618
+ lineHeight: 1.1,
619
+ fontWeight: 800,
620
+ color: themeColors.text
621
+ },
622
+ brandSubtitle: {
623
+ margin: "0 auto",
624
+ maxWidth: "320px",
625
+ fontSize: "14px",
626
+ lineHeight: 1.5,
627
+ color: themeColors.textMuted
628
+ },
478
629
  switcherContainer: {
479
630
  display: "flex",
480
631
  alignItems: "center",
@@ -483,7 +634,7 @@ var UrAuth = ({
483
634
  },
484
635
  switcher: {
485
636
  display: "inline-flex",
486
- background: isDark ? "#2a2a2a" : "#f1f5f9",
637
+ background: theme === "dark" ? "#2a2a2a" : "#f1f5f9",
487
638
  padding: "4px",
488
639
  borderRadius: "0"
489
640
  },
@@ -496,9 +647,9 @@ var UrAuth = ({
496
647
  fontSize: "13px",
497
648
  fontWeight: 600,
498
649
  cursor: "pointer",
499
- color: active ? text : textMuted,
500
- background: active ? isDark ? "#444" : "#ffffff" : "transparent",
501
- boxShadow: active ? isDark ? "0 2px 4px rgba(0,0,0,0.2)" : "0 2px 8px rgba(0,0,0,0.05)" : "none",
650
+ color: active ? themeColors.text : themeColors.textMuted,
651
+ background: active ? theme === "dark" ? "#444444" : "#ffffff" : "transparent",
652
+ boxShadow: active ? theme === "dark" ? "0 2px 4px rgba(0,0,0,0.2)" : "0 2px 8px rgba(0,0,0,0.05)" : "none",
502
653
  border: "none",
503
654
  transition: "all 0.2s ease"
504
655
  }),
@@ -514,12 +665,12 @@ var UrAuth = ({
514
665
  label: {
515
666
  fontSize: "13px",
516
667
  fontWeight: 600,
517
- color: isDark ? "#ddd" : "#334155"
668
+ color: theme === "dark" ? "#dddddd" : "#334155"
518
669
  },
519
670
  forgotLink: {
520
671
  fontSize: "12px",
521
672
  fontWeight: 600,
522
- color: text,
673
+ color: themeColors.text,
523
674
  cursor: "pointer",
524
675
  textDecoration: "none",
525
676
  background: "none",
@@ -530,9 +681,9 @@ var UrAuth = ({
530
681
  width: "100%",
531
682
  padding: "12px 16px",
532
683
  borderRadius: "0",
533
- border: `1px solid ${border}`,
534
- background: inputBg,
535
- color: text,
684
+ border: `1px solid ${themeColors.border}`,
685
+ background: themeColors.inputBackground,
686
+ color: themeColors.text,
536
687
  fontSize: "14px",
537
688
  boxSizing: "border-box",
538
689
  outline: "none",
@@ -542,8 +693,8 @@ var UrAuth = ({
542
693
  width: "100%",
543
694
  padding: "14px",
544
695
  borderRadius: "0",
545
- background: "linear-gradient(180deg, #2a2a2a 0%, #111111 100%)",
546
- color: "#ffffff",
696
+ background: `linear-gradient(180deg, ${primaryColor} 0%, ${secondStopColor} 100%)`,
697
+ color: themeColors.primaryText,
547
698
  fontSize: "15px",
548
699
  fontWeight: 600,
549
700
  border: "none",
@@ -556,7 +707,7 @@ var UrAuth = ({
556
707
  display: "flex",
557
708
  alignItems: "center",
558
709
  margin: "24px 0",
559
- color: "#94a3b8",
710
+ color: themeColors.dividerText,
560
711
  fontSize: "11px",
561
712
  fontWeight: 600,
562
713
  letterSpacing: "1px"
@@ -564,7 +715,7 @@ var UrAuth = ({
564
715
  dividerLine: {
565
716
  flex: 1,
566
717
  height: "1px",
567
- background: border
718
+ background: themeColors.border
568
719
  },
569
720
  dividerText: {
570
721
  padding: "0 12px"
@@ -573,9 +724,9 @@ var UrAuth = ({
573
724
  width: "100%",
574
725
  padding: "12px",
575
726
  borderRadius: "0",
576
- border: `1px solid ${border}`,
577
- background: isDark ? "#2a2a2a" : "#ffffff",
578
- color: text,
727
+ border: `1px solid ${themeColors.border}`,
728
+ background: themeColors.socialButtonBackground,
729
+ color: themeColors.text,
579
730
  fontSize: "14px",
580
731
  fontWeight: 600,
581
732
  display: "flex",
@@ -584,19 +735,19 @@ var UrAuth = ({
584
735
  gap: "10px",
585
736
  marginBottom: "12px",
586
737
  cursor: "pointer",
587
- boxShadow: isDark ? "none" : "0 1px 2px rgba(0,0,0,0.02)",
738
+ boxShadow: theme === "dark" ? "none" : "0 1px 2px rgba(0,0,0,0.02)",
588
739
  transition: "background 0.2s ease"
589
740
  },
590
741
  footer: {
591
- background: isDark ? "#222" : "#f8fafc",
742
+ background: themeColors.footerBackground,
592
743
  padding: "24px",
593
744
  textAlign: "center",
594
- borderTop: `1px solid ${border}`,
745
+ borderTop: `1px solid ${themeColors.border}`,
595
746
  fontSize: "13px",
596
- color: textMuted
747
+ color: themeColors.textMuted
597
748
  },
598
749
  footerLink: {
599
- color: text,
750
+ color: themeColors.text,
600
751
  fontWeight: 600,
601
752
  textDecoration: "underline",
602
753
  cursor: "pointer",
@@ -612,14 +763,37 @@ var UrAuth = ({
612
763
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z", fill: "#FBBC05" }),
613
764
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", fill: "#EA4335" })
614
765
  ] });
615
- const GithubIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: isDark ? "#fff" : "#000", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" }) });
766
+ const GithubIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: theme === "dark" ? "#fff" : "#000", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" }) });
767
+ const renderSocialButtons = () => {
768
+ if (!hasSocialAuth) {
769
+ return null;
770
+ }
771
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
772
+ hasPasswordAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.divider, children: [
773
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.dividerLine }),
774
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles.dividerText, children: text.socialDivider }),
775
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.dividerLine })
776
+ ] }),
777
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
778
+ isGoogleEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { style: styles.socialBtn, onClick: () => socialLogin("google"), type: "button", children: [
779
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GoogleIcon, {}),
780
+ text.googleButton
781
+ ] }),
782
+ isGithubEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { style: styles.socialBtn, onClick: () => socialLogin("github"), type: "button", children: [
783
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GithubIcon, {}),
784
+ text.githubButton
785
+ ] })
786
+ ] })
787
+ ] });
788
+ };
789
+ const footerPrompt = mode === "signin" ? text.footerSigninPrompt : mode === "signup" ? text.footerSignupPrompt : text.footerForgotPrompt;
616
790
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.wrapper, children: [
617
791
  toast && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
618
792
  Toast,
619
793
  {
620
794
  message: toast.message,
621
795
  type: toast.type,
622
- isDark,
796
+ isDark: theme === "dark",
623
797
  onClose: () => {
624
798
  setToast(null);
625
799
  if (toast.type === "error") clearError();
@@ -627,7 +801,12 @@ var UrAuth = ({
627
801
  }
628
802
  ),
629
803
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.body, children: [
630
- (mode === "signin" || mode === "signup") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.switcherContainer, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.switcher, children: [
804
+ (branding?.logo || branding?.brandName || branding?.appName || branding?.title || branding?.subtitle || headerTitle || headerSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.header, children: [
805
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.brandRow, children: branding?.logo ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.brandLogo, children: typeof branding.logo === "string" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: branding.logo, alt: brandName, style: { width: "100%", height: "100%", objectFit: "contain" } }) : branding.logo }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.brandLogo, "aria-hidden": "true", children: brandName.slice(0, 1).toUpperCase() }) }),
806
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { style: styles.brandTitle, children: headerTitle }),
807
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles.brandSubtitle, children: headerSubtitle })
808
+ ] }),
809
+ showSwitcher && (mode === "signin" || mode === "signup") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.switcherContainer, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.switcher, children: [
631
810
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
632
811
  "button",
633
812
  {
@@ -643,7 +822,7 @@ var UrAuth = ({
643
822
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "10 17 15 12 10 7" }),
644
823
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" })
645
824
  ] }),
646
- "Login"
825
+ text.loginTab
647
826
  ]
648
827
  }
649
828
  ),
@@ -663,24 +842,25 @@ var UrAuth = ({
663
842
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "19", y1: "8", x2: "19", y2: "14" }),
664
843
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "22", y1: "11", x2: "16", y2: "11" })
665
844
  ] }),
666
- "Sign Up"
845
+ text.signupTab
667
846
  ]
668
847
  }
669
848
  )
670
849
  ] }) }),
671
850
  (mode === "forgot" || mode === "reset") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
672
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 700, color: text }, children: mode === "forgot" ? "Reset Password" : "Enter Reset Code" }),
673
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: 0, fontSize: "14px", color: textMuted }, children: mode === "forgot" ? "Enter your email and we'll send a code" : `Enter the code sent to ${email}` })
851
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 700, color: themeColors.text }, children: mode === "forgot" ? text.forgotTitle : text.resetTitle }),
852
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: 0, fontSize: "14px", color: themeColors.textMuted }, children: mode === "forgot" ? text.forgotSubtitle : text.resetSubtitle.replace("{email}", email) })
674
853
  ] }),
675
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { onSubmit: handleSubmit, children: [
854
+ !hasPasswordAuth && !hasSocialAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { textAlign: "center", color: themeColors.textMuted, fontSize: "14px", lineHeight: 1.5 }, children: text.noAuthMethods }),
855
+ hasPasswordAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { onSubmit: handleSubmit, children: [
676
856
  mode === "signup" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.field, children: [
677
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.labelRow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: "Full Name" }) }),
857
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.labelRow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: text.nameLabel }) }),
678
858
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
679
859
  "input",
680
860
  {
681
861
  style: styles.input,
682
862
  type: "text",
683
- placeholder: "Enter your name",
863
+ placeholder: text.namePlaceholder,
684
864
  value: name,
685
865
  onChange: (e) => setName(e.target.value),
686
866
  required: true
@@ -688,13 +868,13 @@ var UrAuth = ({
688
868
  )
689
869
  ] }),
690
870
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.field, children: [
691
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.labelRow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: "Email address" }) }),
871
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.labelRow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: text.emailLabel }) }),
692
872
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
693
873
  "input",
694
874
  {
695
875
  style: styles.input,
696
876
  type: "email",
697
- placeholder: "Enter your email address",
877
+ placeholder: text.emailPlaceholder,
698
878
  value: email,
699
879
  onChange: (e) => setEmail(e.target.value),
700
880
  required: true,
@@ -702,40 +882,40 @@ var UrAuth = ({
702
882
  }
703
883
  )
704
884
  ] }),
705
- mode === "reset" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.field, children: [
706
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.labelRow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: "6-digit OTP Code" }) }),
707
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
708
- "input",
709
- {
710
- style: styles.input,
711
- type: "text",
712
- placeholder: "Enter reset code",
713
- value: otp,
714
- onChange: (e) => setOtp(e.target.value),
715
- required: true
716
- }
717
- )
718
- ] }),
719
885
  (mode === "signin" || mode === "signup" || mode === "reset") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.field, children: [
720
886
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.labelRow, children: [
721
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: mode === "reset" ? "New Password" : "Password" }),
887
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: mode === "reset" ? text.passwordLabel : text.passwordLabel }),
722
888
  mode === "signin" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", style: styles.forgotLink, onClick: () => {
723
889
  setMode("forgot");
724
890
  clearError();
725
- }, children: "Forgot password?" })
891
+ }, children: text.forgotPasswordLink })
726
892
  ] }),
727
893
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
728
894
  "input",
729
895
  {
730
896
  style: styles.input,
731
897
  type: "password",
732
- placeholder: mode === "reset" ? "Enter new password" : "Enter your password",
898
+ placeholder: text.passwordPlaceholder,
733
899
  value: password,
734
900
  onChange: (e) => setPassword(e.target.value),
735
901
  required: true
736
902
  }
737
903
  )
738
904
  ] }),
905
+ mode === "reset" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.field, children: [
906
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.labelRow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: text.otpLabel }) }),
907
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
908
+ "input",
909
+ {
910
+ style: styles.input,
911
+ type: "text",
912
+ placeholder: text.otpPlaceholder,
913
+ value: otp,
914
+ onChange: (e) => setOtp(e.target.value),
915
+ required: true
916
+ }
917
+ )
918
+ ] }),
739
919
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
740
920
  "button",
741
921
  {
@@ -745,30 +925,14 @@ var UrAuth = ({
745
925
  onMouseDown: (e) => e.currentTarget.style.transform = "scale(0.98)",
746
926
  onMouseUp: (e) => e.currentTarget.style.transform = "scale(1)",
747
927
  onMouseLeave: (e) => e.currentTarget.style.transform = "scale(1)",
748
- children: isLoading ? "Processing..." : mode === "signin" ? "Log In" : mode === "signup" ? "Create Account" : mode === "forgot" ? "Send Reset Code" : "Reset Password"
928
+ children: isLoading ? "Processing..." : mode === "signin" ? text.loginButton : mode === "signup" ? text.signupButton : mode === "forgot" ? text.forgotButton : text.resetButton
749
929
  }
750
930
  )
751
931
  ] }),
752
- (mode === "signin" || mode === "signup") && providers && providers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
753
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.divider, children: [
754
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.dividerLine }),
755
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles.dividerText, children: "OR" }),
756
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.dividerLine })
757
- ] }),
758
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
759
- providers.includes("google") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { style: styles.socialBtn, onClick: () => socialLogin("google"), type: "button", children: [
760
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GoogleIcon, {}),
761
- "Continue with Google"
762
- ] }),
763
- providers.includes("github") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { style: styles.socialBtn, onClick: () => socialLogin("github"), type: "button", children: [
764
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GithubIcon, {}),
765
- "Continue with GitHub"
766
- ] })
767
- ] })
768
- ] })
932
+ (mode === "signin" || mode === "signup") && renderSocialButtons()
769
933
  ] }),
770
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.footer, children: [
771
- mode === "signin" ? "Don't have an account yet?" : mode === "signup" ? "Already have an account?" : "Remember your password?",
934
+ hasPasswordAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.footer, children: [
935
+ footerPrompt,
772
936
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
773
937
  "button",
774
938
  {
@@ -778,7 +942,7 @@ var UrAuth = ({
778
942
  setMode(mode === "signin" ? "signup" : "signin");
779
943
  clearError();
780
944
  },
781
- children: mode === "signin" ? "Sign up" : "Log in"
945
+ children: mode === "signin" ? text.signupTab : text.loginTab
782
946
  }
783
947
  )
784
948
  ] })