@urbackend/react 0.1.1 → 0.2.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 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,49 @@ 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 || colors?.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 brandingLogo = branding?.logo ?? branding?.logoUrl;
540
+ const headerSubtitle = branding?.subtitle || (mode === "signin" ? text.loginTitle : mode === "signup" ? text.signupTitle : mode === "forgot" ? text.forgotTitle : text.resetTitle);
541
+ const showSwitcher = hasPasswordAuth;
425
542
  (0, import_react5.useEffect)(() => {
426
543
  if (error) {
427
544
  setToast({ message: error, type: "error" });
428
545
  }
429
546
  }, [error]);
547
+ (0, import_react5.useEffect)(() => {
548
+ if (!hasPasswordAuth && mode !== "signin") {
549
+ setMode("signin");
550
+ }
551
+ }, [hasPasswordAuth, mode]);
430
552
  const handleSubmit = async (e) => {
431
553
  e.preventDefault();
432
554
  try {
@@ -453,28 +575,58 @@ var UrAuth = ({
453
575
  } catch (err) {
454
576
  }
455
577
  };
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
578
  const styles = {
463
579
  wrapper: {
464
580
  width: "100%",
465
581
  maxWidth: "420px",
466
582
  margin: "0 auto",
467
583
  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}`,
584
+ background: themeColors.background,
585
+ 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)",
586
+ border: `1px solid ${themeColors.border}`,
471
587
  overflow: "hidden",
472
588
  fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
473
- color: text
589
+ color: themeColors.text
474
590
  },
475
591
  body: {
476
592
  padding: "32px 32px 24px 32px"
477
593
  },
594
+ header: {
595
+ textAlign: "center",
596
+ marginBottom: "28px"
597
+ },
598
+ brandRow: {
599
+ display: "flex",
600
+ justifyContent: "center",
601
+ alignItems: "center",
602
+ gap: "12px",
603
+ marginBottom: "10px"
604
+ },
605
+ brandLogo: {
606
+ width: "44px",
607
+ height: "44px",
608
+ borderRadius: "12px",
609
+ display: "inline-flex",
610
+ alignItems: "center",
611
+ justifyContent: "center",
612
+ background: theme === "dark" ? "#2a2a2a" : "#f1f5f9",
613
+ color: themeColors.text,
614
+ overflow: "hidden"
615
+ },
616
+ brandTitle: {
617
+ margin: 0,
618
+ fontSize: "26px",
619
+ lineHeight: 1.1,
620
+ fontWeight: 800,
621
+ color: themeColors.text
622
+ },
623
+ brandSubtitle: {
624
+ margin: "0 auto",
625
+ maxWidth: "320px",
626
+ fontSize: "14px",
627
+ lineHeight: 1.5,
628
+ color: themeColors.textMuted
629
+ },
478
630
  switcherContainer: {
479
631
  display: "flex",
480
632
  alignItems: "center",
@@ -483,7 +635,7 @@ var UrAuth = ({
483
635
  },
484
636
  switcher: {
485
637
  display: "inline-flex",
486
- background: isDark ? "#2a2a2a" : "#f1f5f9",
638
+ background: theme === "dark" ? "#2a2a2a" : "#f1f5f9",
487
639
  padding: "4px",
488
640
  borderRadius: "0"
489
641
  },
@@ -496,9 +648,9 @@ var UrAuth = ({
496
648
  fontSize: "13px",
497
649
  fontWeight: 600,
498
650
  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",
651
+ color: active ? themeColors.text : themeColors.textMuted,
652
+ background: active ? theme === "dark" ? "#444444" : "#ffffff" : "transparent",
653
+ boxShadow: active ? theme === "dark" ? "0 2px 4px rgba(0,0,0,0.2)" : "0 2px 8px rgba(0,0,0,0.05)" : "none",
502
654
  border: "none",
503
655
  transition: "all 0.2s ease"
504
656
  }),
@@ -514,12 +666,12 @@ var UrAuth = ({
514
666
  label: {
515
667
  fontSize: "13px",
516
668
  fontWeight: 600,
517
- color: isDark ? "#ddd" : "#334155"
669
+ color: theme === "dark" ? "#dddddd" : "#334155"
518
670
  },
519
671
  forgotLink: {
520
672
  fontSize: "12px",
521
673
  fontWeight: 600,
522
- color: text,
674
+ color: themeColors.text,
523
675
  cursor: "pointer",
524
676
  textDecoration: "none",
525
677
  background: "none",
@@ -530,9 +682,9 @@ var UrAuth = ({
530
682
  width: "100%",
531
683
  padding: "12px 16px",
532
684
  borderRadius: "0",
533
- border: `1px solid ${border}`,
534
- background: inputBg,
535
- color: text,
685
+ border: `1px solid ${themeColors.border}`,
686
+ background: themeColors.inputBackground,
687
+ color: themeColors.text,
536
688
  fontSize: "14px",
537
689
  boxSizing: "border-box",
538
690
  outline: "none",
@@ -542,8 +694,8 @@ var UrAuth = ({
542
694
  width: "100%",
543
695
  padding: "14px",
544
696
  borderRadius: "0",
545
- background: "linear-gradient(180deg, #2a2a2a 0%, #111111 100%)",
546
- color: "#ffffff",
697
+ background: `linear-gradient(180deg, ${primaryColor} 0%, ${secondStopColor} 100%)`,
698
+ color: themeColors.primaryText,
547
699
  fontSize: "15px",
548
700
  fontWeight: 600,
549
701
  border: "none",
@@ -556,7 +708,7 @@ var UrAuth = ({
556
708
  display: "flex",
557
709
  alignItems: "center",
558
710
  margin: "24px 0",
559
- color: "#94a3b8",
711
+ color: themeColors.dividerText,
560
712
  fontSize: "11px",
561
713
  fontWeight: 600,
562
714
  letterSpacing: "1px"
@@ -564,7 +716,7 @@ var UrAuth = ({
564
716
  dividerLine: {
565
717
  flex: 1,
566
718
  height: "1px",
567
- background: border
719
+ background: themeColors.border
568
720
  },
569
721
  dividerText: {
570
722
  padding: "0 12px"
@@ -573,9 +725,9 @@ var UrAuth = ({
573
725
  width: "100%",
574
726
  padding: "12px",
575
727
  borderRadius: "0",
576
- border: `1px solid ${border}`,
577
- background: isDark ? "#2a2a2a" : "#ffffff",
578
- color: text,
728
+ border: `1px solid ${themeColors.border}`,
729
+ background: themeColors.socialButtonBackground,
730
+ color: themeColors.text,
579
731
  fontSize: "14px",
580
732
  fontWeight: 600,
581
733
  display: "flex",
@@ -584,19 +736,19 @@ var UrAuth = ({
584
736
  gap: "10px",
585
737
  marginBottom: "12px",
586
738
  cursor: "pointer",
587
- boxShadow: isDark ? "none" : "0 1px 2px rgba(0,0,0,0.02)",
739
+ boxShadow: theme === "dark" ? "none" : "0 1px 2px rgba(0,0,0,0.02)",
588
740
  transition: "background 0.2s ease"
589
741
  },
590
742
  footer: {
591
- background: isDark ? "#222" : "#f8fafc",
743
+ background: themeColors.footerBackground,
592
744
  padding: "24px",
593
745
  textAlign: "center",
594
- borderTop: `1px solid ${border}`,
746
+ borderTop: `1px solid ${themeColors.border}`,
595
747
  fontSize: "13px",
596
- color: textMuted
748
+ color: themeColors.textMuted
597
749
  },
598
750
  footerLink: {
599
- color: text,
751
+ color: themeColors.text,
600
752
  fontWeight: 600,
601
753
  textDecoration: "underline",
602
754
  cursor: "pointer",
@@ -612,14 +764,37 @@ var UrAuth = ({
612
764
  /* @__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
765
  /* @__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
766
  ] });
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" }) });
767
+ 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" }) });
768
+ const renderSocialButtons = () => {
769
+ if (!hasSocialAuth) {
770
+ return null;
771
+ }
772
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
773
+ hasPasswordAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.divider, children: [
774
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.dividerLine }),
775
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles.dividerText, children: text.socialDivider }),
776
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.dividerLine })
777
+ ] }),
778
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
779
+ isGoogleEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { style: styles.socialBtn, onClick: () => socialLogin("google"), type: "button", children: [
780
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GoogleIcon, {}),
781
+ text.googleButton
782
+ ] }),
783
+ isGithubEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { style: styles.socialBtn, onClick: () => socialLogin("github"), type: "button", children: [
784
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GithubIcon, {}),
785
+ text.githubButton
786
+ ] })
787
+ ] })
788
+ ] });
789
+ };
790
+ const footerPrompt = mode === "signin" ? text.footerSigninPrompt : mode === "signup" ? text.footerSignupPrompt : text.footerForgotPrompt;
616
791
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.wrapper, children: [
617
792
  toast && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
618
793
  Toast,
619
794
  {
620
795
  message: toast.message,
621
796
  type: toast.type,
622
- isDark,
797
+ isDark: theme === "dark",
623
798
  onClose: () => {
624
799
  setToast(null);
625
800
  if (toast.type === "error") clearError();
@@ -627,7 +802,12 @@ var UrAuth = ({
627
802
  }
628
803
  ),
629
804
  /* @__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: [
805
+ (brandingLogo || branding?.brandName || branding?.appName || branding?.title || branding?.subtitle || headerTitle || headerSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.header, children: [
806
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.brandRow, children: brandingLogo ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.brandLogo, children: typeof brandingLogo === "string" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: brandingLogo, alt: brandName, style: { width: "100%", height: "100%", objectFit: "contain" } }) : brandingLogo }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.brandLogo, "aria-hidden": "true", children: brandName.slice(0, 1).toUpperCase() }) }),
807
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { style: styles.brandTitle, children: headerTitle }),
808
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles.brandSubtitle, children: headerSubtitle })
809
+ ] }),
810
+ 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
811
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
632
812
  "button",
633
813
  {
@@ -643,7 +823,7 @@ var UrAuth = ({
643
823
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "10 17 15 12 10 7" }),
644
824
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" })
645
825
  ] }),
646
- "Login"
826
+ text.loginTab
647
827
  ]
648
828
  }
649
829
  ),
@@ -663,24 +843,25 @@ var UrAuth = ({
663
843
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "19", y1: "8", x2: "19", y2: "14" }),
664
844
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "22", y1: "11", x2: "16", y2: "11" })
665
845
  ] }),
666
- "Sign Up"
846
+ text.signupTab
667
847
  ]
668
848
  }
669
849
  )
670
850
  ] }) }),
671
851
  (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}` })
852
+ /* @__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 }),
853
+ /* @__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
854
  ] }),
675
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { onSubmit: handleSubmit, children: [
855
+ !hasPasswordAuth && !hasSocialAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { textAlign: "center", color: themeColors.textMuted, fontSize: "14px", lineHeight: 1.5 }, children: text.noAuthMethods }),
856
+ hasPasswordAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { onSubmit: handleSubmit, children: [
676
857
  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" }) }),
858
+ /* @__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
859
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
679
860
  "input",
680
861
  {
681
862
  style: styles.input,
682
863
  type: "text",
683
- placeholder: "Enter your name",
864
+ placeholder: text.namePlaceholder,
684
865
  value: name,
685
866
  onChange: (e) => setName(e.target.value),
686
867
  required: true
@@ -688,13 +869,13 @@ var UrAuth = ({
688
869
  )
689
870
  ] }),
690
871
  /* @__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" }) }),
872
+ /* @__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
873
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
693
874
  "input",
694
875
  {
695
876
  style: styles.input,
696
877
  type: "email",
697
- placeholder: "Enter your email address",
878
+ placeholder: text.emailPlaceholder,
698
879
  value: email,
699
880
  onChange: (e) => setEmail(e.target.value),
700
881
  required: true,
@@ -702,40 +883,40 @@ var UrAuth = ({
702
883
  }
703
884
  )
704
885
  ] }),
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
886
  (mode === "signin" || mode === "signup" || mode === "reset") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.field, children: [
720
887
  /* @__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" }),
888
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: mode === "reset" ? text.passwordLabel : text.passwordLabel }),
722
889
  mode === "signin" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", style: styles.forgotLink, onClick: () => {
723
890
  setMode("forgot");
724
891
  clearError();
725
- }, children: "Forgot password?" })
892
+ }, children: text.forgotPasswordLink })
726
893
  ] }),
727
894
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
728
895
  "input",
729
896
  {
730
897
  style: styles.input,
731
898
  type: "password",
732
- placeholder: mode === "reset" ? "Enter new password" : "Enter your password",
899
+ placeholder: text.passwordPlaceholder,
733
900
  value: password,
734
901
  onChange: (e) => setPassword(e.target.value),
735
902
  required: true
736
903
  }
737
904
  )
738
905
  ] }),
906
+ mode === "reset" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.field, children: [
907
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles.labelRow, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: styles.label, children: text.otpLabel }) }),
908
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
909
+ "input",
910
+ {
911
+ style: styles.input,
912
+ type: "text",
913
+ placeholder: text.otpPlaceholder,
914
+ value: otp,
915
+ onChange: (e) => setOtp(e.target.value),
916
+ required: true
917
+ }
918
+ )
919
+ ] }),
739
920
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
740
921
  "button",
741
922
  {
@@ -745,30 +926,14 @@ var UrAuth = ({
745
926
  onMouseDown: (e) => e.currentTarget.style.transform = "scale(0.98)",
746
927
  onMouseUp: (e) => e.currentTarget.style.transform = "scale(1)",
747
928
  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"
929
+ children: isLoading ? "Processing..." : mode === "signin" ? text.loginButton : mode === "signup" ? text.signupButton : mode === "forgot" ? text.forgotButton : text.resetButton
749
930
  }
750
931
  )
751
932
  ] }),
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
- ] })
933
+ (mode === "signin" || mode === "signup") && renderSocialButtons()
769
934
  ] }),
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?",
935
+ hasPasswordAuth && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles.footer, children: [
936
+ footerPrompt,
772
937
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
773
938
  "button",
774
939
  {
@@ -778,7 +943,7 @@ var UrAuth = ({
778
943
  setMode(mode === "signin" ? "signup" : "signin");
779
944
  clearError();
780
945
  },
781
- children: mode === "signin" ? "Sign up" : "Log in"
946
+ children: mode === "signin" ? text.signupTab : text.loginTab
782
947
  }
783
948
  )
784
949
  ] })