@rqdhw3n/react-auth-flow 1.0.3 → 1.0.4

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.js CHANGED
@@ -405,11 +405,36 @@ function useAuth() {
405
405
  }
406
406
  return context;
407
407
  }
408
+ function cn(...classes) {
409
+ return classes.filter(Boolean).join(" ");
410
+ }
411
+ const DEFAULT_CLASSES$4 = {
412
+ form: "space-y-5",
413
+ field: "space-y-2",
414
+ label: "block text-sm font-medium text-slate-700",
415
+ input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
416
+ button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
417
+ error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
418
+ title: "text-2xl font-bold text-slate-900",
419
+ subtitle: "mt-1 text-sm text-slate-500"
420
+ };
408
421
  const LoginForm = ({
409
- className = "",
422
+ className,
423
+ formClassName,
424
+ fieldClassName,
425
+ labelClassName,
426
+ inputClassName,
427
+ buttonClassName,
428
+ errorClassName,
429
+ titleClassName,
430
+ subtitleClassName,
410
431
  labels = {},
411
432
  placeholders = {},
412
433
  submitButtonText = "Login",
434
+ loadingText = "Signing in...",
435
+ title,
436
+ subtitle,
437
+ showTitle = !!title,
413
438
  onSuccess,
414
439
  onError
415
440
  }) => {
@@ -439,71 +464,106 @@ const LoginForm = ({
439
464
  });
440
465
  }
441
466
  };
442
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
443
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
444
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
445
- /* @__PURE__ */ jsxRuntime.jsx(
446
- "input",
447
- {
448
- id: "email",
449
- type: "email",
450
- value: email,
451
- onChange: (e) => setEmail(e.target.value),
452
- placeholder: placeholders.email || "your@email.com",
453
- disabled: isLoading,
454
- className: "auth-form-input",
455
- required: true
456
- }
457
- )
467
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
468
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
469
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES$4.title, titleClassName), children: title }),
470
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES$4.subtitle, subtitleClassName), children: subtitle })
458
471
  ] }),
459
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
460
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: "auth-form-label", children: labels.password || "Password" }),
472
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$4.form, formClassName), children: [
473
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$4.field, fieldClassName), children: [
474
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$4.label, labelClassName), children: labels.email || "Email" }),
475
+ /* @__PURE__ */ jsxRuntime.jsx(
476
+ "input",
477
+ {
478
+ id: "email",
479
+ type: "email",
480
+ value: email,
481
+ onChange: (e) => setEmail(e.target.value),
482
+ placeholder: placeholders.email || "your@email.com",
483
+ disabled: isLoading,
484
+ className: cn(DEFAULT_CLASSES$4.input, inputClassName),
485
+ required: true
486
+ }
487
+ )
488
+ ] }),
489
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$4.field, fieldClassName), children: [
490
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$4.label, labelClassName), children: labels.password || "Password" }),
491
+ /* @__PURE__ */ jsxRuntime.jsx(
492
+ "input",
493
+ {
494
+ id: "password",
495
+ type: "password",
496
+ value: password,
497
+ onChange: (e) => setPassword(e.target.value),
498
+ placeholder: placeholders.password || "••••••••",
499
+ disabled: isLoading,
500
+ className: cn(DEFAULT_CLASSES$4.input, inputClassName),
501
+ required: true
502
+ }
503
+ )
504
+ ] }),
505
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
506
+ /* @__PURE__ */ jsxRuntime.jsx(
507
+ "input",
508
+ {
509
+ id: "rememberMe",
510
+ type: "checkbox",
511
+ checked: rememberMe,
512
+ onChange: (e) => setRememberMe(e.target.checked),
513
+ disabled: isLoading,
514
+ className: "h-4 w-4 rounded border-slate-300"
515
+ }
516
+ ),
517
+ /* @__PURE__ */ jsxRuntime.jsx(
518
+ "label",
519
+ {
520
+ htmlFor: "rememberMe",
521
+ className: "ml-2 text-sm text-slate-700",
522
+ children: labels.rememberMe || "Remember me"
523
+ }
524
+ )
525
+ ] }),
526
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES$4.error, errorClassName), children: error }),
461
527
  /* @__PURE__ */ jsxRuntime.jsx(
462
- "input",
528
+ "button",
463
529
  {
464
- id: "password",
465
- type: "password",
466
- value: password,
467
- onChange: (e) => setPassword(e.target.value),
468
- placeholder: placeholders.password || "••••••••",
530
+ type: "submit",
469
531
  disabled: isLoading,
470
- className: "auth-form-input",
471
- required: true
532
+ className: cn(DEFAULT_CLASSES$4.button, buttonClassName),
533
+ children: isLoading ? loadingText : submitButtonText
472
534
  }
473
535
  )
474
- ] }),
475
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group auth-form-checkbox", children: [
476
- /* @__PURE__ */ jsxRuntime.jsx(
477
- "input",
478
- {
479
- id: "rememberMe",
480
- type: "checkbox",
481
- checked: rememberMe,
482
- onChange: (e) => setRememberMe(e.target.checked),
483
- disabled: isLoading,
484
- className: "auth-form-input"
485
- }
486
- ),
487
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "rememberMe", className: "auth-form-label", children: labels.rememberMe || "Remember me" })
488
- ] }),
489
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
490
- /* @__PURE__ */ jsxRuntime.jsx(
491
- "button",
492
- {
493
- type: "submit",
494
- disabled: isLoading,
495
- className: "auth-form-button auth-form-button-primary",
496
- children: isLoading ? "Loading..." : submitButtonText
497
- }
498
- )
536
+ ] })
499
537
  ] });
500
538
  };
501
539
  LoginForm.displayName = "LoginForm";
540
+ const DEFAULT_CLASSES$3 = {
541
+ form: "space-y-5",
542
+ field: "space-y-2",
543
+ label: "block text-sm font-medium text-slate-700",
544
+ input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
545
+ button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
546
+ error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
547
+ title: "text-2xl font-bold text-slate-900",
548
+ subtitle: "mt-1 text-sm text-slate-500"
549
+ };
502
550
  const RegisterForm = ({
503
- className = "",
551
+ className,
552
+ formClassName,
553
+ fieldClassName,
554
+ labelClassName,
555
+ inputClassName,
556
+ buttonClassName,
557
+ errorClassName,
558
+ titleClassName,
559
+ subtitleClassName,
504
560
  labels = {},
505
561
  placeholders = {},
506
562
  submitButtonText = "Register",
563
+ loadingText = "Creating account...",
564
+ title,
565
+ subtitle,
566
+ showTitle = !!title,
507
567
  onSuccess,
508
568
  onError
509
569
  }) => {
@@ -547,89 +607,119 @@ const RegisterForm = ({
547
607
  });
548
608
  }
549
609
  };
550
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
551
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
552
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "name", className: "auth-form-label", children: labels.name || "Full Name" }),
553
- /* @__PURE__ */ jsxRuntime.jsx(
554
- "input",
555
- {
556
- id: "name",
557
- type: "text",
558
- value: name,
559
- onChange: (e) => setName(e.target.value),
560
- placeholder: placeholders.name || "John Doe",
561
- disabled: isLoading,
562
- className: "auth-form-input",
563
- required: true
564
- }
565
- )
566
- ] }),
567
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
568
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
569
- /* @__PURE__ */ jsxRuntime.jsx(
570
- "input",
571
- {
572
- id: "email",
573
- type: "email",
574
- value: email,
575
- onChange: (e) => setEmail(e.target.value),
576
- placeholder: placeholders.email || "your@email.com",
577
- disabled: isLoading,
578
- className: "auth-form-input",
579
- required: true
580
- }
581
- )
582
- ] }),
583
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
584
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: "auth-form-label", children: labels.password || "Password" }),
585
- /* @__PURE__ */ jsxRuntime.jsx(
586
- "input",
587
- {
588
- id: "password",
589
- type: "password",
590
- value: password,
591
- onChange: (e) => setPassword(e.target.value),
592
- placeholder: placeholders.password || "••••••••",
593
- disabled: isLoading,
594
- className: "auth-form-input",
595
- required: true
596
- }
597
- )
610
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
611
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
612
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES$3.title, titleClassName), children: title }),
613
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES$3.subtitle, subtitleClassName), children: subtitle })
598
614
  ] }),
599
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
600
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "confirmPassword", className: "auth-form-label", children: labels.confirmPassword || "Confirm Password" }),
615
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$3.form, formClassName), children: [
616
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
617
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "name", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.name || "Full Name" }),
618
+ /* @__PURE__ */ jsxRuntime.jsx(
619
+ "input",
620
+ {
621
+ id: "name",
622
+ type: "text",
623
+ value: name,
624
+ onChange: (e) => setName(e.target.value),
625
+ placeholder: placeholders.name || "John Doe",
626
+ disabled: isLoading,
627
+ className: cn(DEFAULT_CLASSES$3.input, inputClassName),
628
+ required: true
629
+ }
630
+ )
631
+ ] }),
632
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
633
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.email || "Email" }),
634
+ /* @__PURE__ */ jsxRuntime.jsx(
635
+ "input",
636
+ {
637
+ id: "email",
638
+ type: "email",
639
+ value: email,
640
+ onChange: (e) => setEmail(e.target.value),
641
+ placeholder: placeholders.email || "your@email.com",
642
+ disabled: isLoading,
643
+ className: cn(DEFAULT_CLASSES$3.input, inputClassName),
644
+ required: true
645
+ }
646
+ )
647
+ ] }),
648
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
649
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.password || "Password" }),
650
+ /* @__PURE__ */ jsxRuntime.jsx(
651
+ "input",
652
+ {
653
+ id: "password",
654
+ type: "password",
655
+ value: password,
656
+ onChange: (e) => setPassword(e.target.value),
657
+ placeholder: placeholders.password || "••••••••",
658
+ disabled: isLoading,
659
+ className: cn(DEFAULT_CLASSES$3.input, inputClassName),
660
+ required: true
661
+ }
662
+ )
663
+ ] }),
664
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
665
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "confirmPassword", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.confirmPassword || "Confirm Password" }),
666
+ /* @__PURE__ */ jsxRuntime.jsx(
667
+ "input",
668
+ {
669
+ id: "confirmPassword",
670
+ type: "password",
671
+ value: confirmPassword,
672
+ onChange: (e) => setConfirmPassword(e.target.value),
673
+ placeholder: placeholders.confirmPassword || "••••••••",
674
+ disabled: isLoading,
675
+ className: cn(DEFAULT_CLASSES$3.input, inputClassName),
676
+ required: true
677
+ }
678
+ )
679
+ ] }),
680
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES$3.error, errorClassName), children: error }),
601
681
  /* @__PURE__ */ jsxRuntime.jsx(
602
- "input",
682
+ "button",
603
683
  {
604
- id: "confirmPassword",
605
- type: "password",
606
- value: confirmPassword,
607
- onChange: (e) => setConfirmPassword(e.target.value),
608
- placeholder: placeholders.confirmPassword || "••••••••",
684
+ type: "submit",
609
685
  disabled: isLoading,
610
- className: "auth-form-input",
611
- required: true
686
+ className: cn(DEFAULT_CLASSES$3.button, buttonClassName),
687
+ children: isLoading ? loadingText : submitButtonText
612
688
  }
613
689
  )
614
- ] }),
615
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
616
- /* @__PURE__ */ jsxRuntime.jsx(
617
- "button",
618
- {
619
- type: "submit",
620
- disabled: isLoading,
621
- className: "auth-form-button auth-form-button-primary",
622
- children: isLoading ? "Loading..." : submitButtonText
623
- }
624
- )
690
+ ] })
625
691
  ] });
626
692
  };
627
693
  RegisterForm.displayName = "RegisterForm";
694
+ const DEFAULT_CLASSES$2 = {
695
+ form: "space-y-5",
696
+ field: "space-y-2",
697
+ label: "block text-sm font-medium text-slate-700",
698
+ input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
699
+ button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
700
+ error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
701
+ success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
702
+ title: "text-2xl font-bold text-slate-900",
703
+ subtitle: "mt-1 text-sm text-slate-500"
704
+ };
628
705
  const ForgotPasswordForm = ({
629
- className = "",
706
+ className,
707
+ formClassName,
708
+ fieldClassName,
709
+ labelClassName,
710
+ inputClassName,
711
+ buttonClassName,
712
+ errorClassName,
713
+ successClassName,
714
+ titleClassName,
715
+ subtitleClassName,
630
716
  labels = {},
631
717
  placeholders = {},
632
718
  submitButtonText = "Send Reset Link",
719
+ loadingText = "Sending...",
720
+ title,
721
+ subtitle,
722
+ showTitle = !!title,
633
723
  onSuccess,
634
724
  onError
635
725
  }) => {
@@ -666,44 +756,80 @@ const ForgotPasswordForm = ({
666
756
  }
667
757
  };
668
758
  if (successMessage) {
669
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `auth-form-success ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "auth-form-success-message", children: successMessage }) });
759
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
760
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
761
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES$2.title, titleClassName), children: title }),
762
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES$2.subtitle, subtitleClassName), children: subtitle })
763
+ ] }),
764
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES$2.success, successClassName), children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: successMessage }) })
765
+ ] });
670
766
  }
671
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
672
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
673
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
767
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
768
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
769
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES$2.title, titleClassName), children: title }),
770
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES$2.subtitle, subtitleClassName), children: subtitle })
771
+ ] }),
772
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$2.form, formClassName), children: [
773
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$2.field, fieldClassName), children: [
774
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$2.label, labelClassName), children: labels.email || "Email" }),
775
+ /* @__PURE__ */ jsxRuntime.jsx(
776
+ "input",
777
+ {
778
+ id: "email",
779
+ type: "email",
780
+ value: email,
781
+ onChange: (e) => setEmail(e.target.value),
782
+ placeholder: placeholders.email || "your@email.com",
783
+ disabled: isLoading,
784
+ className: cn(DEFAULT_CLASSES$2.input, inputClassName),
785
+ required: true
786
+ }
787
+ )
788
+ ] }),
789
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES$2.error, errorClassName), children: error }),
674
790
  /* @__PURE__ */ jsxRuntime.jsx(
675
- "input",
791
+ "button",
676
792
  {
677
- id: "email",
678
- type: "email",
679
- value: email,
680
- onChange: (e) => setEmail(e.target.value),
681
- placeholder: placeholders.email || "your@email.com",
793
+ type: "submit",
682
794
  disabled: isLoading,
683
- className: "auth-form-input",
684
- required: true
795
+ className: cn(DEFAULT_CLASSES$2.button, buttonClassName),
796
+ children: isLoading ? loadingText : submitButtonText
685
797
  }
686
798
  )
687
- ] }),
688
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
689
- /* @__PURE__ */ jsxRuntime.jsx(
690
- "button",
691
- {
692
- type: "submit",
693
- disabled: isLoading,
694
- className: "auth-form-button auth-form-button-primary",
695
- children: isLoading ? "Loading..." : submitButtonText
696
- }
697
- )
799
+ ] })
698
800
  ] });
699
801
  };
700
802
  ForgotPasswordForm.displayName = "ForgotPasswordForm";
803
+ const DEFAULT_CLASSES$1 = {
804
+ form: "space-y-5",
805
+ field: "space-y-2",
806
+ label: "block text-sm font-medium text-slate-700",
807
+ input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
808
+ button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
809
+ error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
810
+ success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
811
+ title: "text-2xl font-bold text-slate-900",
812
+ subtitle: "mt-1 text-sm text-slate-500"
813
+ };
701
814
  const ResetPasswordForm = ({
702
815
  token,
703
- className = "",
816
+ className,
817
+ formClassName,
818
+ fieldClassName,
819
+ labelClassName,
820
+ inputClassName,
821
+ buttonClassName,
822
+ errorClassName,
823
+ successClassName,
824
+ titleClassName,
825
+ subtitleClassName,
704
826
  labels = {},
705
827
  placeholders = {},
706
828
  submitButtonText = "Reset Password",
829
+ loadingText = "Updating...",
830
+ title,
831
+ subtitle,
832
+ showTitle = !!title,
707
833
  onSuccess,
708
834
  onError
709
835
  }) => {
@@ -750,61 +876,97 @@ const ResetPasswordForm = ({
750
876
  }
751
877
  };
752
878
  if (successMessage) {
753
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `auth-form-success ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "auth-form-success-message", children: successMessage }) });
879
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
880
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
881
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES$1.title, titleClassName), children: title }),
882
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES$1.subtitle, subtitleClassName), children: subtitle })
883
+ ] }),
884
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES$1.success, successClassName), children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: successMessage }) })
885
+ ] });
754
886
  }
755
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
756
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
757
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: "auth-form-label", children: labels.password || "New Password" }),
758
- /* @__PURE__ */ jsxRuntime.jsx(
759
- "input",
760
- {
761
- id: "password",
762
- type: "password",
763
- value: password,
764
- onChange: (e) => setPassword(e.target.value),
765
- placeholder: placeholders.password || "••••••••",
766
- disabled: isLoading,
767
- className: "auth-form-input",
768
- required: true
769
- }
770
- )
887
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
888
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
889
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES$1.title, titleClassName), children: title }),
890
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES$1.subtitle, subtitleClassName), children: subtitle })
771
891
  ] }),
772
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
773
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "confirmPassword", className: "auth-form-label", children: labels.confirmPassword || "Confirm Password" }),
892
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$1.form, formClassName), children: [
893
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$1.field, fieldClassName), children: [
894
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$1.label, labelClassName), children: labels.password || "New Password" }),
895
+ /* @__PURE__ */ jsxRuntime.jsx(
896
+ "input",
897
+ {
898
+ id: "password",
899
+ type: "password",
900
+ value: password,
901
+ onChange: (e) => setPassword(e.target.value),
902
+ placeholder: placeholders.password || "••••••••",
903
+ disabled: isLoading,
904
+ className: cn(DEFAULT_CLASSES$1.input, inputClassName),
905
+ required: true
906
+ }
907
+ )
908
+ ] }),
909
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES$1.field, fieldClassName), children: [
910
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "confirmPassword", className: cn(DEFAULT_CLASSES$1.label, labelClassName), children: labels.confirmPassword || "Confirm Password" }),
911
+ /* @__PURE__ */ jsxRuntime.jsx(
912
+ "input",
913
+ {
914
+ id: "confirmPassword",
915
+ type: "password",
916
+ value: confirmPassword,
917
+ onChange: (e) => setConfirmPassword(e.target.value),
918
+ placeholder: placeholders.confirmPassword || "••••••••",
919
+ disabled: isLoading,
920
+ className: cn(DEFAULT_CLASSES$1.input, inputClassName),
921
+ required: true
922
+ }
923
+ )
924
+ ] }),
925
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES$1.error, errorClassName), children: error }),
774
926
  /* @__PURE__ */ jsxRuntime.jsx(
775
- "input",
927
+ "button",
776
928
  {
777
- id: "confirmPassword",
778
- type: "password",
779
- value: confirmPassword,
780
- onChange: (e) => setConfirmPassword(e.target.value),
781
- placeholder: placeholders.confirmPassword || "••••••••",
929
+ type: "submit",
782
930
  disabled: isLoading,
783
- className: "auth-form-input",
784
- required: true
931
+ className: cn(DEFAULT_CLASSES$1.button, buttonClassName),
932
+ children: isLoading ? loadingText : submitButtonText
785
933
  }
786
934
  )
787
- ] }),
788
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
789
- /* @__PURE__ */ jsxRuntime.jsx(
790
- "button",
791
- {
792
- type: "submit",
793
- disabled: isLoading,
794
- className: "auth-form-button auth-form-button-primary",
795
- children: isLoading ? "Loading..." : submitButtonText
796
- }
797
- )
935
+ ] })
798
936
  ] });
799
937
  };
800
938
  ResetPasswordForm.displayName = "ResetPasswordForm";
939
+ const DEFAULT_CLASSES = {
940
+ form: "space-y-5",
941
+ field: "space-y-2",
942
+ label: "block text-sm font-medium text-slate-700",
943
+ input: "w-full rounded-xl border border-slate-300 bg-white px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-blue-500 focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:bg-slate-100",
944
+ button: "w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60",
945
+ error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
946
+ success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
947
+ title: "text-2xl font-bold text-slate-900",
948
+ subtitle: "mt-1 text-sm text-slate-500"
949
+ };
801
950
  const VerifyEmailForm = ({
802
951
  token: initialToken,
803
952
  email: initialEmail,
804
- className = "",
953
+ className,
954
+ formClassName,
955
+ fieldClassName,
956
+ labelClassName,
957
+ inputClassName,
958
+ buttonClassName,
959
+ errorClassName,
960
+ successClassName,
961
+ titleClassName,
962
+ subtitleClassName,
805
963
  labels = {},
806
964
  placeholders = {},
807
965
  submitButtonText = "Verify Email",
966
+ loadingText = "Verifying...",
967
+ title,
968
+ subtitle,
969
+ showTitle = !!title,
808
970
  onSuccess,
809
971
  onError
810
972
  }) => {
@@ -851,51 +1013,63 @@ const VerifyEmailForm = ({
851
1013
  }
852
1014
  };
853
1015
  if (successMessage) {
854
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `auth-form-success ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "auth-form-success-message", children: successMessage }) });
1016
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
1017
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
1018
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES.title, titleClassName), children: title }),
1019
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES.subtitle, subtitleClassName), children: subtitle })
1020
+ ] }),
1021
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES.success, successClassName), children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: successMessage }) })
1022
+ ] });
855
1023
  }
856
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, children: [
857
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
858
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: "auth-form-label", children: labels.email || "Email" }),
859
- /* @__PURE__ */ jsxRuntime.jsx(
860
- "input",
861
- {
862
- id: "email",
863
- type: "email",
864
- value: email,
865
- onChange: (e) => setEmail(e.target.value),
866
- placeholder: placeholders.email || "your@email.com",
867
- disabled: isLoading,
868
- className: "auth-form-input",
869
- required: true
870
- }
871
- )
1024
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
1025
+ showTitle && title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
1026
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(DEFAULT_CLASSES.title, titleClassName), children: title }),
1027
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(DEFAULT_CLASSES.subtitle, subtitleClassName), children: subtitle })
872
1028
  ] }),
873
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "auth-form-group", children: [
874
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "token", className: "auth-form-label", children: labels.token || "Verification Code" }),
1029
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES.form, formClassName), children: [
1030
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES.field, fieldClassName), children: [
1031
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES.label, labelClassName), children: labels.email || "Email" }),
1032
+ /* @__PURE__ */ jsxRuntime.jsx(
1033
+ "input",
1034
+ {
1035
+ id: "email",
1036
+ type: "email",
1037
+ value: email,
1038
+ onChange: (e) => setEmail(e.target.value),
1039
+ placeholder: placeholders.email || "your@email.com",
1040
+ disabled: isLoading,
1041
+ className: cn(DEFAULT_CLASSES.input, inputClassName),
1042
+ required: true
1043
+ }
1044
+ )
1045
+ ] }),
1046
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(DEFAULT_CLASSES.field, fieldClassName), children: [
1047
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "token", className: cn(DEFAULT_CLASSES.label, labelClassName), children: labels.token || "Verification Code" }),
1048
+ /* @__PURE__ */ jsxRuntime.jsx(
1049
+ "input",
1050
+ {
1051
+ id: "token",
1052
+ type: "text",
1053
+ value: token,
1054
+ onChange: (e) => setToken(e.target.value),
1055
+ placeholder: placeholders.token || "Enter verification code",
1056
+ disabled: isLoading,
1057
+ className: cn(DEFAULT_CLASSES.input, inputClassName),
1058
+ required: true
1059
+ }
1060
+ )
1061
+ ] }),
1062
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DEFAULT_CLASSES.error, errorClassName), children: error }),
875
1063
  /* @__PURE__ */ jsxRuntime.jsx(
876
- "input",
1064
+ "button",
877
1065
  {
878
- id: "token",
879
- type: "text",
880
- value: token,
881
- onChange: (e) => setToken(e.target.value),
882
- placeholder: placeholders.token || "Enter verification code",
1066
+ type: "submit",
883
1067
  disabled: isLoading,
884
- className: "auth-form-input",
885
- required: true
1068
+ className: cn(DEFAULT_CLASSES.button, buttonClassName),
1069
+ children: isLoading ? loadingText : submitButtonText
886
1070
  }
887
1071
  )
888
- ] }),
889
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "auth-form-error", children: error }),
890
- /* @__PURE__ */ jsxRuntime.jsx(
891
- "button",
892
- {
893
- type: "submit",
894
- disabled: isLoading,
895
- className: "auth-form-button auth-form-button-primary",
896
- children: isLoading ? "Loading..." : submitButtonText
897
- }
898
- )
1072
+ ] })
899
1073
  ] });
900
1074
  };
901
1075
  VerifyEmailForm.displayName = "VerifyEmailForm";
@@ -938,6 +1112,7 @@ exports.ProtectedRoute = ProtectedRoute;
938
1112
  exports.RegisterForm = RegisterForm;
939
1113
  exports.ResetPasswordForm = ResetPasswordForm;
940
1114
  exports.VerifyEmailForm = VerifyEmailForm;
1115
+ exports.cn = cn;
941
1116
  exports.createAuthClient = createAuthClient;
942
1117
  exports.normalizeError = normalizeError;
943
1118
  exports.useAuth = useAuth;