@rqdhw3n/react-auth-flow 1.0.4 → 1.0.5

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.es.js CHANGED
@@ -1,6 +1,14 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React, { createContext, useReducer, useCallback, useEffect, useContext, useState } from "react";
3
3
  import { Navigate } from "react-router-dom";
4
+ const authStyles = ".rq-auth-container,\n.rq-auth-container * {\n box-sizing: border-box;\n}\n\n.rq-auth-container {\n --rq-auth-primary: #2563eb;\n --rq-auth-primary-hover: #1d4ed8;\n --rq-auth-primary-soft: rgba(37, 99, 235, 0.16);\n --rq-auth-border: #dbe4f0;\n --rq-auth-border-strong: #c7d4e5;\n --rq-auth-text: #0f172a;\n --rq-auth-muted: #64748b;\n --rq-auth-surface: #ffffff;\n --rq-auth-surface-alt: #f8fbff;\n --rq-auth-disabled: #eef2f7;\n --rq-auth-error: #b91c1c;\n --rq-auth-error-border: #fecaca;\n --rq-auth-error-bg: #fef2f2;\n --rq-auth-success: #047857;\n --rq-auth-success-border: #a7f3d0;\n --rq-auth-success-bg: #ecfdf5;\n width: min(100%, 28rem);\n margin: 0 auto;\n padding: clamp(1.25rem, 3vw, 2rem);\n border: 1px solid var(--rq-auth-border);\n border-radius: 1.5rem;\n background:\n radial-gradient(circle at top, rgba(96, 165, 250, 0.14), transparent 34%),\n linear-gradient(180deg, var(--rq-auth-surface) 0%, var(--rq-auth-surface-alt) 100%);\n box-shadow:\n 0 24px 48px rgba(15, 23, 42, 0.08),\n 0 8px 20px rgba(15, 23, 42, 0.05);\n color: var(--rq-auth-text);\n}\n\n.rq-auth-header {\n margin-bottom: 1.5rem;\n}\n\n.rq-auth-title {\n margin: 0;\n font-size: clamp(1.625rem, 4vw, 2rem);\n font-weight: 700;\n line-height: 1.15;\n letter-spacing: -0.02em;\n color: var(--rq-auth-text);\n}\n\n.rq-auth-subtitle {\n margin: 0.5rem 0 0;\n font-size: 0.95rem;\n line-height: 1.6;\n color: var(--rq-auth-muted);\n}\n\n.rq-auth-form {\n display: grid;\n gap: 1rem;\n}\n\n.rq-auth-field {\n display: grid;\n gap: 0.5rem;\n}\n\n.rq-auth-label {\n font-size: 0.94rem;\n font-weight: 600;\n line-height: 1.4;\n color: var(--rq-auth-text);\n}\n\n.rq-auth-input {\n width: 100%;\n min-width: 0;\n padding: 0.9rem 1rem;\n border: 1px solid var(--rq-auth-border);\n border-radius: 0.95rem;\n background: rgba(255, 255, 255, 0.92);\n color: var(--rq-auth-text);\n font: inherit;\n line-height: 1.5;\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease,\n background-color 0.2s ease,\n transform 0.2s ease;\n box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);\n}\n\n.rq-auth-input::placeholder {\n color: #94a3b8;\n}\n\n.rq-auth-input:hover {\n border-color: var(--rq-auth-border-strong);\n}\n\n.rq-auth-input:focus {\n border-color: var(--rq-auth-primary);\n box-shadow:\n 0 0 0 4px var(--rq-auth-primary-soft),\n inset 0 1px 2px rgba(15, 23, 42, 0.03);\n}\n\n.rq-auth-input:disabled {\n cursor: not-allowed;\n background: var(--rq-auth-disabled);\n color: #94a3b8;\n}\n\n.rq-auth-checkbox {\n display: flex;\n align-items: flex-start;\n gap: 0.75rem;\n font-size: 0.94rem;\n line-height: 1.5;\n color: var(--rq-auth-muted);\n}\n\n.rq-auth-checkbox-input {\n width: 1.05rem;\n height: 1.05rem;\n margin: 0.2rem 0 0;\n border-radius: 0.35rem;\n accent-color: var(--rq-auth-primary);\n flex: 0 0 auto;\n}\n\n.rq-auth-checkbox-input:disabled {\n cursor: not-allowed;\n}\n\n.rq-auth-checkbox-label {\n color: var(--rq-auth-muted);\n}\n\n.rq-auth-button {\n width: 100%;\n border: 0;\n border-radius: 0.95rem;\n padding: 0.95rem 1.15rem;\n background: linear-gradient(180deg, #3b82f6 0%, var(--rq-auth-primary) 100%);\n color: #ffffff;\n font: inherit;\n font-size: 0.98rem;\n font-weight: 600;\n line-height: 1.2;\n cursor: pointer;\n transition:\n background 0.2s ease,\n box-shadow 0.2s ease,\n transform 0.2s ease,\n opacity 0.2s ease;\n box-shadow:\n 0 14px 28px rgba(37, 99, 235, 0.22),\n inset 0 1px 0 rgba(255, 255, 255, 0.18);\n}\n\n.rq-auth-button:hover:not(:disabled) {\n background: linear-gradient(180deg, #2563eb 0%, var(--rq-auth-primary-hover) 100%);\n transform: translateY(-1px);\n}\n\n.rq-auth-button:focus-visible {\n outline: none;\n box-shadow:\n 0 0 0 4px var(--rq-auth-primary-soft),\n 0 14px 28px rgba(37, 99, 235, 0.22);\n}\n\n.rq-auth-button:disabled {\n cursor: not-allowed;\n opacity: 0.68;\n transform: none;\n box-shadow: none;\n}\n\n.rq-auth-button-content {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.625rem;\n}\n\n.rq-auth-button-spinner {\n width: 1rem;\n height: 1rem;\n border: 2px solid rgba(255, 255, 255, 0.4);\n border-top-color: #ffffff;\n border-radius: 999px;\n animation: rq-auth-spin 0.75s linear infinite;\n}\n\n.rq-auth-error,\n.rq-auth-success,\n.auth-loading,\n.auth-forbidden {\n padding: 0.95rem 1rem;\n border-radius: 1rem;\n border: 1px solid transparent;\n font-size: 0.94rem;\n line-height: 1.55;\n}\n\n.rq-auth-error {\n border-color: var(--rq-auth-error-border);\n background: var(--rq-auth-error-bg);\n color: var(--rq-auth-error);\n}\n\n.rq-auth-success {\n border-color: var(--rq-auth-success-border);\n background: var(--rq-auth-success-bg);\n color: var(--rq-auth-success);\n}\n\n.auth-loading {\n border-color: var(--rq-auth-border);\n background: var(--rq-auth-surface-alt);\n color: var(--rq-auth-muted);\n}\n\n.auth-forbidden {\n border-color: var(--rq-auth-error-border);\n background: var(--rq-auth-error-bg);\n color: var(--rq-auth-error);\n}\n\n@keyframes rq-auth-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@media (max-width: 640px) {\n .rq-auth-container {\n width: 100%;\n padding: 1.125rem;\n border-radius: 1.25rem;\n }\n\n .rq-auth-form {\n gap: 0.9rem;\n }\n\n .rq-auth-input,\n .rq-auth-button {\n padding-inline: 0.95rem;\n }\n}\n";
5
+ const STYLE_ELEMENT_ID = "rq-auth-flow-styles";
6
+ if (typeof document !== "undefined" && !document.getElementById(STYLE_ELEMENT_ID)) {
7
+ const styleElement = document.createElement("style");
8
+ styleElement.id = STYLE_ELEMENT_ID;
9
+ styleElement.textContent = authStyles;
10
+ document.head.appendChild(styleElement);
11
+ }
4
12
  const AuthContext = createContext(
5
13
  void 0
6
14
  );
@@ -406,15 +414,23 @@ function useAuth() {
406
414
  function cn(...classes) {
407
415
  return classes.filter(Boolean).join(" ");
408
416
  }
409
- const DEFAULT_CLASSES$4 = {
410
- form: "space-y-5",
411
- field: "space-y-2",
412
- label: "block text-sm font-medium text-slate-700",
413
- 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",
414
- 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",
415
- error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
416
- title: "text-2xl font-bold text-slate-900",
417
- subtitle: "mt-1 text-sm text-slate-500"
417
+ const AUTH_FORM_CLASSES = {
418
+ container: "rq-auth-container",
419
+ header: "rq-auth-header",
420
+ form: "rq-auth-form",
421
+ field: "rq-auth-field",
422
+ label: "rq-auth-label",
423
+ input: "rq-auth-input",
424
+ button: "rq-auth-button",
425
+ buttonContent: "rq-auth-button-content",
426
+ buttonSpinner: "rq-auth-button-spinner",
427
+ error: "rq-auth-error",
428
+ success: "rq-auth-success",
429
+ title: "rq-auth-title",
430
+ subtitle: "rq-auth-subtitle",
431
+ checkbox: "rq-auth-checkbox",
432
+ checkboxInput: "rq-auth-checkbox-input",
433
+ checkboxLabel: "rq-auth-checkbox-label"
418
434
  };
419
435
  const LoginForm = ({
420
436
  className,
@@ -462,89 +478,93 @@ const LoginForm = ({
462
478
  });
463
479
  }
464
480
  };
465
- return /* @__PURE__ */ jsxs("div", { className, children: [
466
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
467
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$4.title, titleClassName), children: title }),
468
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$4.subtitle, subtitleClassName), children: subtitle })
481
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
482
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
483
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
484
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
469
485
  ] }),
470
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$4.form, formClassName), children: [
471
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$4.field, fieldClassName), children: [
472
- /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$4.label, labelClassName), children: labels.email || "Email" }),
473
- /* @__PURE__ */ jsx(
474
- "input",
475
- {
476
- id: "email",
477
- type: "email",
478
- value: email,
479
- onChange: (e) => setEmail(e.target.value),
480
- placeholder: placeholders.email || "your@email.com",
481
- disabled: isLoading,
482
- className: cn(DEFAULT_CLASSES$4.input, inputClassName),
483
- required: true
484
- }
485
- )
486
- ] }),
487
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$4.field, fieldClassName), children: [
488
- /* @__PURE__ */ jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$4.label, labelClassName), children: labels.password || "Password" }),
489
- /* @__PURE__ */ jsx(
490
- "input",
491
- {
492
- id: "password",
493
- type: "password",
494
- value: password,
495
- onChange: (e) => setPassword(e.target.value),
496
- placeholder: placeholders.password || "••••••••",
497
- disabled: isLoading,
498
- className: cn(DEFAULT_CLASSES$4.input, inputClassName),
499
- required: true
500
- }
501
- )
502
- ] }),
503
- /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
504
- /* @__PURE__ */ jsx(
505
- "input",
506
- {
507
- id: "rememberMe",
508
- type: "checkbox",
509
- checked: rememberMe,
510
- onChange: (e) => setRememberMe(e.target.checked),
511
- disabled: isLoading,
512
- className: "h-4 w-4 rounded border-slate-300"
513
- }
514
- ),
515
- /* @__PURE__ */ jsx(
516
- "label",
517
- {
518
- htmlFor: "rememberMe",
519
- className: "ml-2 text-sm text-slate-700",
520
- children: labels.rememberMe || "Remember me"
521
- }
522
- )
523
- ] }),
524
- error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$4.error, errorClassName), children: error }),
525
- /* @__PURE__ */ jsx(
526
- "button",
527
- {
528
- type: "submit",
529
- disabled: isLoading,
530
- className: cn(DEFAULT_CLASSES$4.button, buttonClassName),
531
- children: isLoading ? loadingText : submitButtonText
532
- }
533
- )
534
- ] })
486
+ /* @__PURE__ */ jsxs(
487
+ "form",
488
+ {
489
+ onSubmit: handleSubmit,
490
+ className: cn(AUTH_FORM_CLASSES.form, formClassName),
491
+ "aria-busy": isLoading,
492
+ children: [
493
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
494
+ /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(AUTH_FORM_CLASSES.label, labelClassName), children: labels.email || "Email" }),
495
+ /* @__PURE__ */ jsx(
496
+ "input",
497
+ {
498
+ id: "email",
499
+ type: "email",
500
+ value: email,
501
+ onChange: (e) => setEmail(e.target.value),
502
+ placeholder: placeholders.email || "your@email.com",
503
+ disabled: isLoading,
504
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
505
+ autoComplete: "username",
506
+ required: true
507
+ }
508
+ )
509
+ ] }),
510
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
511
+ /* @__PURE__ */ jsx(
512
+ "label",
513
+ {
514
+ htmlFor: "password",
515
+ className: cn(AUTH_FORM_CLASSES.label, labelClassName),
516
+ children: labels.password || "Password"
517
+ }
518
+ ),
519
+ /* @__PURE__ */ jsx(
520
+ "input",
521
+ {
522
+ id: "password",
523
+ type: "password",
524
+ value: password,
525
+ onChange: (e) => setPassword(e.target.value),
526
+ placeholder: placeholders.password || "Enter your password",
527
+ disabled: isLoading,
528
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
529
+ autoComplete: "current-password",
530
+ required: true
531
+ }
532
+ )
533
+ ] }),
534
+ /* @__PURE__ */ jsxs("label", { htmlFor: "rememberMe", className: AUTH_FORM_CLASSES.checkbox, children: [
535
+ /* @__PURE__ */ jsx(
536
+ "input",
537
+ {
538
+ id: "rememberMe",
539
+ type: "checkbox",
540
+ checked: rememberMe,
541
+ onChange: (e) => setRememberMe(e.target.checked),
542
+ disabled: isLoading,
543
+ className: AUTH_FORM_CLASSES.checkboxInput
544
+ }
545
+ ),
546
+ /* @__PURE__ */ jsx("span", { className: AUTH_FORM_CLASSES.checkboxLabel, children: labels.rememberMe || "Remember me" })
547
+ ] }),
548
+ error && /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.error, errorClassName), role: "alert", children: error }),
549
+ /* @__PURE__ */ jsx(
550
+ "button",
551
+ {
552
+ type: "submit",
553
+ disabled: isLoading,
554
+ className: cn(AUTH_FORM_CLASSES.button, buttonClassName),
555
+ "aria-busy": isLoading,
556
+ children: isLoading ? /* @__PURE__ */ jsxs("span", { className: AUTH_FORM_CLASSES.buttonContent, children: [
557
+ /* @__PURE__ */ jsx("span", { className: AUTH_FORM_CLASSES.buttonSpinner, "aria-hidden": "true" }),
558
+ loadingText
559
+ ] }) : submitButtonText
560
+ }
561
+ )
562
+ ]
563
+ }
564
+ )
535
565
  ] });
536
566
  };
537
567
  LoginForm.displayName = "LoginForm";
538
- const DEFAULT_CLASSES$3 = {
539
- form: "space-y-5",
540
- field: "space-y-2",
541
- label: "block text-sm font-medium text-slate-700",
542
- 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",
543
- 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",
544
- error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
545
- title: "text-2xl font-bold text-slate-900",
546
- subtitle: "mt-1 text-sm text-slate-500"
547
- };
548
568
  const RegisterForm = ({
549
569
  className,
550
570
  formClassName,
@@ -605,101 +625,120 @@ const RegisterForm = ({
605
625
  });
606
626
  }
607
627
  };
608
- return /* @__PURE__ */ jsxs("div", { className, children: [
609
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
610
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$3.title, titleClassName), children: title }),
611
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$3.subtitle, subtitleClassName), children: subtitle })
628
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
629
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
630
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
631
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
612
632
  ] }),
613
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$3.form, formClassName), children: [
614
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
615
- /* @__PURE__ */ jsx("label", { htmlFor: "name", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.name || "Full Name" }),
616
- /* @__PURE__ */ jsx(
617
- "input",
618
- {
619
- id: "name",
620
- type: "text",
621
- value: name,
622
- onChange: (e) => setName(e.target.value),
623
- placeholder: placeholders.name || "John Doe",
624
- disabled: isLoading,
625
- className: cn(DEFAULT_CLASSES$3.input, inputClassName),
626
- required: true
627
- }
628
- )
629
- ] }),
630
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
631
- /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.email || "Email" }),
632
- /* @__PURE__ */ jsx(
633
- "input",
634
- {
635
- id: "email",
636
- type: "email",
637
- value: email,
638
- onChange: (e) => setEmail(e.target.value),
639
- placeholder: placeholders.email || "your@email.com",
640
- disabled: isLoading,
641
- className: cn(DEFAULT_CLASSES$3.input, inputClassName),
642
- required: true
643
- }
644
- )
645
- ] }),
646
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
647
- /* @__PURE__ */ jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.password || "Password" }),
648
- /* @__PURE__ */ jsx(
649
- "input",
650
- {
651
- id: "password",
652
- type: "password",
653
- value: password,
654
- onChange: (e) => setPassword(e.target.value),
655
- placeholder: placeholders.password || "••••••••",
656
- disabled: isLoading,
657
- className: cn(DEFAULT_CLASSES$3.input, inputClassName),
658
- required: true
659
- }
660
- )
661
- ] }),
662
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$3.field, fieldClassName), children: [
663
- /* @__PURE__ */ jsx("label", { htmlFor: "confirmPassword", className: cn(DEFAULT_CLASSES$3.label, labelClassName), children: labels.confirmPassword || "Confirm Password" }),
664
- /* @__PURE__ */ jsx(
665
- "input",
666
- {
667
- id: "confirmPassword",
668
- type: "password",
669
- value: confirmPassword,
670
- onChange: (e) => setConfirmPassword(e.target.value),
671
- placeholder: placeholders.confirmPassword || "••••••••",
672
- disabled: isLoading,
673
- className: cn(DEFAULT_CLASSES$3.input, inputClassName),
674
- required: true
675
- }
676
- )
677
- ] }),
678
- error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$3.error, errorClassName), children: error }),
679
- /* @__PURE__ */ jsx(
680
- "button",
681
- {
682
- type: "submit",
683
- disabled: isLoading,
684
- className: cn(DEFAULT_CLASSES$3.button, buttonClassName),
685
- children: isLoading ? loadingText : submitButtonText
686
- }
687
- )
688
- ] })
633
+ /* @__PURE__ */ jsxs(
634
+ "form",
635
+ {
636
+ onSubmit: handleSubmit,
637
+ className: cn(AUTH_FORM_CLASSES.form, formClassName),
638
+ "aria-busy": isLoading,
639
+ children: [
640
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
641
+ /* @__PURE__ */ jsx("label", { htmlFor: "name", className: cn(AUTH_FORM_CLASSES.label, labelClassName), children: labels.name || "Full Name" }),
642
+ /* @__PURE__ */ jsx(
643
+ "input",
644
+ {
645
+ id: "name",
646
+ type: "text",
647
+ value: name,
648
+ onChange: (e) => setName(e.target.value),
649
+ placeholder: placeholders.name || "John Doe",
650
+ disabled: isLoading,
651
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
652
+ autoComplete: "name",
653
+ required: true
654
+ }
655
+ )
656
+ ] }),
657
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
658
+ /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(AUTH_FORM_CLASSES.label, labelClassName), children: labels.email || "Email" }),
659
+ /* @__PURE__ */ jsx(
660
+ "input",
661
+ {
662
+ id: "email",
663
+ type: "email",
664
+ value: email,
665
+ onChange: (e) => setEmail(e.target.value),
666
+ placeholder: placeholders.email || "your@email.com",
667
+ disabled: isLoading,
668
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
669
+ autoComplete: "email",
670
+ required: true
671
+ }
672
+ )
673
+ ] }),
674
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
675
+ /* @__PURE__ */ jsx(
676
+ "label",
677
+ {
678
+ htmlFor: "password",
679
+ className: cn(AUTH_FORM_CLASSES.label, labelClassName),
680
+ children: labels.password || "Password"
681
+ }
682
+ ),
683
+ /* @__PURE__ */ jsx(
684
+ "input",
685
+ {
686
+ id: "password",
687
+ type: "password",
688
+ value: password,
689
+ onChange: (e) => setPassword(e.target.value),
690
+ placeholder: placeholders.password || "Create a password",
691
+ disabled: isLoading,
692
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
693
+ autoComplete: "new-password",
694
+ required: true
695
+ }
696
+ )
697
+ ] }),
698
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
699
+ /* @__PURE__ */ jsx(
700
+ "label",
701
+ {
702
+ htmlFor: "confirmPassword",
703
+ className: cn(AUTH_FORM_CLASSES.label, labelClassName),
704
+ children: labels.confirmPassword || "Confirm Password"
705
+ }
706
+ ),
707
+ /* @__PURE__ */ jsx(
708
+ "input",
709
+ {
710
+ id: "confirmPassword",
711
+ type: "password",
712
+ value: confirmPassword,
713
+ onChange: (e) => setConfirmPassword(e.target.value),
714
+ placeholder: placeholders.confirmPassword || "Confirm your password",
715
+ disabled: isLoading,
716
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
717
+ autoComplete: "new-password",
718
+ required: true
719
+ }
720
+ )
721
+ ] }),
722
+ error && /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.error, errorClassName), role: "alert", children: error }),
723
+ /* @__PURE__ */ jsx(
724
+ "button",
725
+ {
726
+ type: "submit",
727
+ disabled: isLoading,
728
+ className: cn(AUTH_FORM_CLASSES.button, buttonClassName),
729
+ "aria-busy": isLoading,
730
+ children: isLoading ? /* @__PURE__ */ jsxs("span", { className: AUTH_FORM_CLASSES.buttonContent, children: [
731
+ /* @__PURE__ */ jsx("span", { className: AUTH_FORM_CLASSES.buttonSpinner, "aria-hidden": "true" }),
732
+ loadingText
733
+ ] }) : submitButtonText
734
+ }
735
+ )
736
+ ]
737
+ }
738
+ )
689
739
  ] });
690
740
  };
691
741
  RegisterForm.displayName = "RegisterForm";
692
- const DEFAULT_CLASSES$2 = {
693
- form: "space-y-5",
694
- field: "space-y-2",
695
- label: "block text-sm font-medium text-slate-700",
696
- 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",
697
- 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",
698
- error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
699
- success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
700
- title: "text-2xl font-bold text-slate-900",
701
- subtitle: "mt-1 text-sm text-slate-500"
702
- };
703
742
  const ForgotPasswordForm = ({
704
743
  className,
705
744
  formClassName,
@@ -754,61 +793,63 @@ const ForgotPasswordForm = ({
754
793
  }
755
794
  };
756
795
  if (successMessage) {
757
- return /* @__PURE__ */ jsxs("div", { className, children: [
758
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
759
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$2.title, titleClassName), children: title }),
760
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$2.subtitle, subtitleClassName), children: subtitle })
796
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
797
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
798
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
799
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
761
800
  ] }),
762
- /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$2.success, successClassName), children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
801
+ /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.success, successClassName), role: "status", children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
763
802
  ] });
764
803
  }
765
- return /* @__PURE__ */ jsxs("div", { className, children: [
766
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
767
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$2.title, titleClassName), children: title }),
768
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$2.subtitle, subtitleClassName), children: subtitle })
804
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
805
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
806
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
807
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
769
808
  ] }),
770
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$2.form, formClassName), children: [
771
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$2.field, fieldClassName), children: [
772
- /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES$2.label, labelClassName), children: labels.email || "Email" }),
773
- /* @__PURE__ */ jsx(
774
- "input",
775
- {
776
- id: "email",
777
- type: "email",
778
- value: email,
779
- onChange: (e) => setEmail(e.target.value),
780
- placeholder: placeholders.email || "your@email.com",
781
- disabled: isLoading,
782
- className: cn(DEFAULT_CLASSES$2.input, inputClassName),
783
- required: true
784
- }
785
- )
786
- ] }),
787
- error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$2.error, errorClassName), children: error }),
788
- /* @__PURE__ */ jsx(
789
- "button",
790
- {
791
- type: "submit",
792
- disabled: isLoading,
793
- className: cn(DEFAULT_CLASSES$2.button, buttonClassName),
794
- children: isLoading ? loadingText : submitButtonText
795
- }
796
- )
797
- ] })
809
+ /* @__PURE__ */ jsxs(
810
+ "form",
811
+ {
812
+ onSubmit: handleSubmit,
813
+ className: cn(AUTH_FORM_CLASSES.form, formClassName),
814
+ "aria-busy": isLoading,
815
+ children: [
816
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
817
+ /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(AUTH_FORM_CLASSES.label, labelClassName), children: labels.email || "Email" }),
818
+ /* @__PURE__ */ jsx(
819
+ "input",
820
+ {
821
+ id: "email",
822
+ type: "email",
823
+ value: email,
824
+ onChange: (e) => setEmail(e.target.value),
825
+ placeholder: placeholders.email || "your@email.com",
826
+ disabled: isLoading,
827
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
828
+ autoComplete: "email",
829
+ required: true
830
+ }
831
+ )
832
+ ] }),
833
+ error && /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.error, errorClassName), role: "alert", children: error }),
834
+ /* @__PURE__ */ jsx(
835
+ "button",
836
+ {
837
+ type: "submit",
838
+ disabled: isLoading,
839
+ className: cn(AUTH_FORM_CLASSES.button, buttonClassName),
840
+ "aria-busy": isLoading,
841
+ children: isLoading ? /* @__PURE__ */ jsxs("span", { className: AUTH_FORM_CLASSES.buttonContent, children: [
842
+ /* @__PURE__ */ jsx("span", { className: AUTH_FORM_CLASSES.buttonSpinner, "aria-hidden": "true" }),
843
+ loadingText
844
+ ] }) : submitButtonText
845
+ }
846
+ )
847
+ ]
848
+ }
849
+ )
798
850
  ] });
799
851
  };
800
852
  ForgotPasswordForm.displayName = "ForgotPasswordForm";
801
- const DEFAULT_CLASSES$1 = {
802
- form: "space-y-5",
803
- field: "space-y-2",
804
- label: "block text-sm font-medium text-slate-700",
805
- 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",
806
- 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",
807
- error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
808
- success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
809
- title: "text-2xl font-bold text-slate-900",
810
- subtitle: "mt-1 text-sm text-slate-500"
811
- };
812
853
  const ResetPasswordForm = ({
813
854
  token,
814
855
  className,
@@ -874,77 +915,94 @@ const ResetPasswordForm = ({
874
915
  }
875
916
  };
876
917
  if (successMessage) {
877
- return /* @__PURE__ */ jsxs("div", { className, children: [
878
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
879
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$1.title, titleClassName), children: title }),
880
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$1.subtitle, subtitleClassName), children: subtitle })
918
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
919
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
920
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
921
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
881
922
  ] }),
882
- /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$1.success, successClassName), children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
923
+ /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.success, successClassName), role: "status", children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
883
924
  ] });
884
925
  }
885
- return /* @__PURE__ */ jsxs("div", { className, children: [
886
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
887
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES$1.title, titleClassName), children: title }),
888
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES$1.subtitle, subtitleClassName), children: subtitle })
926
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
927
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
928
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
929
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
889
930
  ] }),
890
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES$1.form, formClassName), children: [
891
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$1.field, fieldClassName), children: [
892
- /* @__PURE__ */ jsx("label", { htmlFor: "password", className: cn(DEFAULT_CLASSES$1.label, labelClassName), children: labels.password || "New Password" }),
893
- /* @__PURE__ */ jsx(
894
- "input",
895
- {
896
- id: "password",
897
- type: "password",
898
- value: password,
899
- onChange: (e) => setPassword(e.target.value),
900
- placeholder: placeholders.password || "••••••••",
901
- disabled: isLoading,
902
- className: cn(DEFAULT_CLASSES$1.input, inputClassName),
903
- required: true
904
- }
905
- )
906
- ] }),
907
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES$1.field, fieldClassName), children: [
908
- /* @__PURE__ */ jsx("label", { htmlFor: "confirmPassword", className: cn(DEFAULT_CLASSES$1.label, labelClassName), children: labels.confirmPassword || "Confirm Password" }),
909
- /* @__PURE__ */ jsx(
910
- "input",
911
- {
912
- id: "confirmPassword",
913
- type: "password",
914
- value: confirmPassword,
915
- onChange: (e) => setConfirmPassword(e.target.value),
916
- placeholder: placeholders.confirmPassword || "••••••••",
917
- disabled: isLoading,
918
- className: cn(DEFAULT_CLASSES$1.input, inputClassName),
919
- required: true
920
- }
921
- )
922
- ] }),
923
- error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES$1.error, errorClassName), children: error }),
924
- /* @__PURE__ */ jsx(
925
- "button",
926
- {
927
- type: "submit",
928
- disabled: isLoading,
929
- className: cn(DEFAULT_CLASSES$1.button, buttonClassName),
930
- children: isLoading ? loadingText : submitButtonText
931
- }
932
- )
933
- ] })
931
+ /* @__PURE__ */ jsxs(
932
+ "form",
933
+ {
934
+ onSubmit: handleSubmit,
935
+ className: cn(AUTH_FORM_CLASSES.form, formClassName),
936
+ "aria-busy": isLoading,
937
+ children: [
938
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
939
+ /* @__PURE__ */ jsx(
940
+ "label",
941
+ {
942
+ htmlFor: "password",
943
+ className: cn(AUTH_FORM_CLASSES.label, labelClassName),
944
+ children: labels.password || "New Password"
945
+ }
946
+ ),
947
+ /* @__PURE__ */ jsx(
948
+ "input",
949
+ {
950
+ id: "password",
951
+ type: "password",
952
+ value: password,
953
+ onChange: (e) => setPassword(e.target.value),
954
+ placeholder: placeholders.password || "Enter a new password",
955
+ disabled: isLoading,
956
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
957
+ autoComplete: "new-password",
958
+ required: true
959
+ }
960
+ )
961
+ ] }),
962
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
963
+ /* @__PURE__ */ jsx(
964
+ "label",
965
+ {
966
+ htmlFor: "confirmPassword",
967
+ className: cn(AUTH_FORM_CLASSES.label, labelClassName),
968
+ children: labels.confirmPassword || "Confirm Password"
969
+ }
970
+ ),
971
+ /* @__PURE__ */ jsx(
972
+ "input",
973
+ {
974
+ id: "confirmPassword",
975
+ type: "password",
976
+ value: confirmPassword,
977
+ onChange: (e) => setConfirmPassword(e.target.value),
978
+ placeholder: placeholders.confirmPassword || "Confirm your new password",
979
+ disabled: isLoading,
980
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
981
+ autoComplete: "new-password",
982
+ required: true
983
+ }
984
+ )
985
+ ] }),
986
+ error && /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.error, errorClassName), role: "alert", children: error }),
987
+ /* @__PURE__ */ jsx(
988
+ "button",
989
+ {
990
+ type: "submit",
991
+ disabled: isLoading,
992
+ className: cn(AUTH_FORM_CLASSES.button, buttonClassName),
993
+ "aria-busy": isLoading,
994
+ children: isLoading ? /* @__PURE__ */ jsxs("span", { className: AUTH_FORM_CLASSES.buttonContent, children: [
995
+ /* @__PURE__ */ jsx("span", { className: AUTH_FORM_CLASSES.buttonSpinner, "aria-hidden": "true" }),
996
+ loadingText
997
+ ] }) : submitButtonText
998
+ }
999
+ )
1000
+ ]
1001
+ }
1002
+ )
934
1003
  ] });
935
1004
  };
936
1005
  ResetPasswordForm.displayName = "ResetPasswordForm";
937
- const DEFAULT_CLASSES = {
938
- form: "space-y-5",
939
- field: "space-y-2",
940
- label: "block text-sm font-medium text-slate-700",
941
- 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",
942
- 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",
943
- error: "rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600",
944
- success: "rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-700",
945
- title: "text-2xl font-bold text-slate-900",
946
- subtitle: "mt-1 text-sm text-slate-500"
947
- };
948
1006
  const VerifyEmailForm = ({
949
1007
  token: initialToken,
950
1008
  email: initialEmail,
@@ -979,12 +1037,6 @@ const VerifyEmailForm = ({
979
1037
  const [successMessage, setSuccessMessage] = useState("");
980
1038
  const isLoading = authLoading;
981
1039
  const error = formError || authError?.message;
982
- useEffect(() => {
983
- if (token && email && !successMessage && !error) {
984
- handleSubmit({ preventDefault: () => {
985
- } });
986
- }
987
- }, [token, email]);
988
1040
  const handleSubmit = async (e) => {
989
1041
  e.preventDefault();
990
1042
  setFormError("");
@@ -1010,64 +1062,84 @@ const VerifyEmailForm = ({
1010
1062
  });
1011
1063
  }
1012
1064
  };
1065
+ useEffect(() => {
1066
+ if (token && email && !successMessage && !error) {
1067
+ void handleSubmit({ preventDefault: () => {
1068
+ } });
1069
+ }
1070
+ }, [token, email]);
1013
1071
  if (successMessage) {
1014
- return /* @__PURE__ */ jsxs("div", { className, children: [
1015
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
1016
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES.title, titleClassName), children: title }),
1017
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES.subtitle, subtitleClassName), children: subtitle })
1072
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
1073
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
1074
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
1075
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
1018
1076
  ] }),
1019
- /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES.success, successClassName), children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
1077
+ /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.success, successClassName), role: "status", children: /* @__PURE__ */ jsx("p", { children: successMessage }) })
1020
1078
  ] });
1021
1079
  }
1022
- return /* @__PURE__ */ jsxs("div", { className, children: [
1023
- showTitle && title && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
1024
- /* @__PURE__ */ jsx("h1", { className: cn(DEFAULT_CLASSES.title, titleClassName), children: title }),
1025
- subtitle && /* @__PURE__ */ jsx("p", { className: cn(DEFAULT_CLASSES.subtitle, subtitleClassName), children: subtitle })
1080
+ return /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.container, className), children: [
1081
+ showTitle && title && /* @__PURE__ */ jsxs("div", { className: AUTH_FORM_CLASSES.header, children: [
1082
+ /* @__PURE__ */ jsx("h1", { className: cn(AUTH_FORM_CLASSES.title, titleClassName), children: title }),
1083
+ subtitle && /* @__PURE__ */ jsx("p", { className: cn(AUTH_FORM_CLASSES.subtitle, subtitleClassName), children: subtitle })
1026
1084
  ] }),
1027
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: cn(DEFAULT_CLASSES.form, formClassName), children: [
1028
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES.field, fieldClassName), children: [
1029
- /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(DEFAULT_CLASSES.label, labelClassName), children: labels.email || "Email" }),
1030
- /* @__PURE__ */ jsx(
1031
- "input",
1032
- {
1033
- id: "email",
1034
- type: "email",
1035
- value: email,
1036
- onChange: (e) => setEmail(e.target.value),
1037
- placeholder: placeholders.email || "your@email.com",
1038
- disabled: isLoading,
1039
- className: cn(DEFAULT_CLASSES.input, inputClassName),
1040
- required: true
1041
- }
1042
- )
1043
- ] }),
1044
- /* @__PURE__ */ jsxs("div", { className: cn(DEFAULT_CLASSES.field, fieldClassName), children: [
1045
- /* @__PURE__ */ jsx("label", { htmlFor: "token", className: cn(DEFAULT_CLASSES.label, labelClassName), children: labels.token || "Verification Code" }),
1046
- /* @__PURE__ */ jsx(
1047
- "input",
1048
- {
1049
- id: "token",
1050
- type: "text",
1051
- value: token,
1052
- onChange: (e) => setToken(e.target.value),
1053
- placeholder: placeholders.token || "Enter verification code",
1054
- disabled: isLoading,
1055
- className: cn(DEFAULT_CLASSES.input, inputClassName),
1056
- required: true
1057
- }
1058
- )
1059
- ] }),
1060
- error && /* @__PURE__ */ jsx("div", { className: cn(DEFAULT_CLASSES.error, errorClassName), children: error }),
1061
- /* @__PURE__ */ jsx(
1062
- "button",
1063
- {
1064
- type: "submit",
1065
- disabled: isLoading,
1066
- className: cn(DEFAULT_CLASSES.button, buttonClassName),
1067
- children: isLoading ? loadingText : submitButtonText
1068
- }
1069
- )
1070
- ] })
1085
+ /* @__PURE__ */ jsxs(
1086
+ "form",
1087
+ {
1088
+ onSubmit: handleSubmit,
1089
+ className: cn(AUTH_FORM_CLASSES.form, formClassName),
1090
+ "aria-busy": isLoading,
1091
+ children: [
1092
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
1093
+ /* @__PURE__ */ jsx("label", { htmlFor: "email", className: cn(AUTH_FORM_CLASSES.label, labelClassName), children: labels.email || "Email" }),
1094
+ /* @__PURE__ */ jsx(
1095
+ "input",
1096
+ {
1097
+ id: "email",
1098
+ type: "email",
1099
+ value: email,
1100
+ onChange: (e) => setEmail(e.target.value),
1101
+ placeholder: placeholders.email || "your@email.com",
1102
+ disabled: isLoading,
1103
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
1104
+ autoComplete: "email",
1105
+ required: true
1106
+ }
1107
+ )
1108
+ ] }),
1109
+ /* @__PURE__ */ jsxs("div", { className: cn(AUTH_FORM_CLASSES.field, fieldClassName), children: [
1110
+ /* @__PURE__ */ jsx("label", { htmlFor: "token", className: cn(AUTH_FORM_CLASSES.label, labelClassName), children: labels.token || "Verification Code" }),
1111
+ /* @__PURE__ */ jsx(
1112
+ "input",
1113
+ {
1114
+ id: "token",
1115
+ type: "text",
1116
+ value: token,
1117
+ onChange: (e) => setToken(e.target.value),
1118
+ placeholder: placeholders.token || "Enter verification code",
1119
+ disabled: isLoading,
1120
+ className: cn(AUTH_FORM_CLASSES.input, inputClassName),
1121
+ autoComplete: "one-time-code",
1122
+ required: true
1123
+ }
1124
+ )
1125
+ ] }),
1126
+ error && /* @__PURE__ */ jsx("div", { className: cn(AUTH_FORM_CLASSES.error, errorClassName), role: "alert", children: error }),
1127
+ /* @__PURE__ */ jsx(
1128
+ "button",
1129
+ {
1130
+ type: "submit",
1131
+ disabled: isLoading,
1132
+ className: cn(AUTH_FORM_CLASSES.button, buttonClassName),
1133
+ "aria-busy": isLoading,
1134
+ children: isLoading ? /* @__PURE__ */ jsxs("span", { className: AUTH_FORM_CLASSES.buttonContent, children: [
1135
+ /* @__PURE__ */ jsx("span", { className: AUTH_FORM_CLASSES.buttonSpinner, "aria-hidden": "true" }),
1136
+ loadingText
1137
+ ] }) : submitButtonText
1138
+ }
1139
+ )
1140
+ ]
1141
+ }
1142
+ )
1071
1143
  ] });
1072
1144
  };
1073
1145
  VerifyEmailForm.displayName = "VerifyEmailForm";