@tempots/beatui 0.87.2 → 0.87.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/{ar-DjMvIww5.js → ar-Dn7AkNO5.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/{auth-divider-BIefTDoO.js → auth-divider-BZPM2Xd3.js} +101 -103
- package/dist/{auth-divider-V_Se6Qhe.cjs → auth-divider-Cj-xJxF_.cjs} +1 -1
- package/dist/beatui.css +23 -0
- package/dist/beatui.tailwind.css +23 -0
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +12 -12
- package/dist/{colors-BmLYKmoH.js → colors-CatA-RXf.js} +9 -9
- package/dist/{de-wChFYqM4.js → de-QYhBiWv7.js} +1 -1
- package/dist/deep-merge-BmxkFFi1.cjs +1 -0
- package/dist/{deep-merge-BRqRzEQs.js → deep-merge-D076XcC5.js} +152 -156
- package/dist/{duration-input-BDEb1Bb7.js → duration-input-6RN16H08.js} +5 -5
- package/dist/{duration-input-BtFL5Vjx.cjs → duration-input-CJU-yeKk.cjs} +1 -1
- package/dist/{editor-toolbar-group-CwCCGzEC.js → editor-toolbar-group-DRCbXeQP.js} +6 -3
- package/dist/{es-CmPF3IGl.js → es-Ba31pZAd.js} +1 -1
- package/dist/{fa-D696e75R.js → fa-DvLjl_Ha.js} +1 -1
- package/dist/{fr-B0jeX1Hx.js → fr-D64yBpAp.js} +1 -1
- package/dist/{he-SgAsIYJA.js → he-DHZGEQ7C.js} +1 -1
- package/dist/{hi-s9oiIihq.js → hi-CeAXVCvp.js} +1 -1
- package/dist/{index-CaWDj1Vg.cjs → index-BIGCKfNz.cjs} +10 -10
- package/dist/{index-DdqGL9Jk.js → index-BTITknMc.js} +701 -684
- package/dist/{index-qa82MK4Z.cjs → index-Bso_SkEn.cjs} +1 -1
- package/dist/{index-B0t-nt7i.js → index-DWDC-qRY.js} +4 -4
- package/dist/{index-D2_J_-XS.js → index-rHnH2IGb.js} +77 -77
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +1015 -1018
- package/dist/{index.esm-ChUrm4xR.js → index.esm-By0m3ki1.js} +3 -3
- package/dist/{input-container-DhUiLmXE.js → input-container-BTyCOubf.js} +1 -1
- package/dist/{it-Dc4IMciD.js → it-Im0KgKWL.js} +1 -1
- package/dist/{ja-D2t2g5xj.js → ja-lliCbC19.js} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +97 -103
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +15 -15
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +349 -351
- package/dist/{ko-BRylA5JZ.js → ko-B9W4RBBs.js} +1 -1
- package/dist/lexical/index.cjs.js +5 -12
- package/dist/lexical/index.es.js +54 -84
- package/dist/{menu-Ui4lUPHM.js → menu-CV85y3Xf.js} +1 -1
- package/dist/{modal-Dkje8L_l.js → modal-CD3DwAlD.js} +5 -5
- package/dist/{modal-Coenk8Fy.cjs → modal-jJMS0ZlW.cjs} +1 -1
- package/dist/monaco/index.es.js +1 -1
- package/dist/{nl-Dh7LUWAn.js → nl-ba5SyHsw.js} +1 -1
- package/dist/notice-9lpZ-VDn.cjs +1 -0
- package/dist/{notice-BmkckDsD.js → notice-Cc26kgiB.js} +26 -28
- package/dist/{oneof-branch-detection-Vov_e3kI.cjs → oneof-branch-detection-BsGhMslW.cjs} +6 -6
- package/dist/{oneof-branch-detection-BED_n2MT.js → oneof-branch-detection-DiAtgGQH.js} +1740 -1734
- package/dist/{pl-XEG-p1Q9.js → pl-DCiJAZWC.js} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-DYsDA2sZ.js → pt-Df5bAGWA.js} +1 -1
- package/dist/{ru-BTKBykp-.js → ru-Dg-c670Y.js} +1 -1
- package/dist/stack-4VUGISn6.cjs +1 -0
- package/dist/{stack-BJgsPJ9A.js → stack-Bm-UZosx.js} +145 -139
- package/dist/tailwind/preset.es.js +2 -2
- package/dist/tailwind/vite-plugin.es.js +1 -1
- package/dist/{text-input-BZmAB3_o.js → text-input-Cux5iiUC.js} +5 -5
- package/dist/{theme-BzpMLdvH.js → theme-kQZEeusG.js} +4 -4
- package/dist/{toolbar-Pdj-F80l.js → toolbar-DYmKrtic.js} +1 -1
- package/dist/{tr-Cp8ZCUic.js → tr-Dhpiq0u_.js} +1 -1
- package/dist/{translations-BGblCUBj.js → translations-BLlzvZgw.js} +30 -30
- package/dist/{translations-jUYta1_1.js → translations-COSDzhvR.js} +1 -1
- package/dist/types/auth-i18n/translations.d.ts +2 -2
- package/dist/types/beatui-i18n/translations.d.ts +2 -2
- package/dist/types/better-auth/components/authenticated.d.ts +2 -2
- package/dist/types/better-auth/components/better-auth-container.d.ts +1 -1
- package/dist/types/better-auth/i18n/translations.d.ts +2 -2
- package/dist/types/better-auth/provider.d.ts +2 -2
- package/dist/types/components/auth/auth-container.d.ts +1 -1
- package/dist/types/components/auth/auth-email-prop.d.ts +1 -1
- package/dist/types/components/beatui.d.ts +1 -1
- package/dist/types/components/button/button.d.ts +1 -1
- package/dist/types/components/content/native-pdf-preview.d.ts +1 -1
- package/dist/types/components/content/pdfjs-preview.d.ts +1 -1
- package/dist/types/components/data/icon.d.ts +1 -1
- package/dist/types/components/data/page-drop-zone.d.ts +1 -1
- package/dist/types/components/data/unstyled-drop-zone.d.ts +1 -1
- package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +1 -1
- package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +1 -1
- package/dist/types/components/form/control/control.d.ts +2 -2
- package/dist/types/components/form/control/ensure-control.d.ts +1 -1
- package/dist/types/components/form/control/list-control.d.ts +1 -1
- package/dist/types/components/form/controller/color-controller.d.ts +4 -4
- package/dist/types/components/form/input/appearance-selector.d.ts +2 -2
- package/dist/types/components/form/input/base64-input.d.ts +1 -1
- package/dist/types/components/form/input/base64s-input.d.ts +1 -1
- package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
- package/dist/types/components/form/input/email-input.d.ts +1 -1
- package/dist/types/components/form/input/file-input.d.ts +1 -1
- package/dist/types/components/form/input/files-input.d.ts +1 -1
- package/dist/types/components/form/input/input-options.d.ts +1 -1
- package/dist/types/components/form/input/list-input.d.ts +1 -1
- package/dist/types/components/form/input/nullable-base64-input.d.ts +1 -1
- package/dist/types/components/form/input/nullable-plain-date-input.d.ts +12 -12
- package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +12 -12
- package/dist/types/components/form/input/nullable-plain-time-input.d.ts +12 -12
- package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +12 -12
- package/dist/types/components/form/input/password-input.d.ts +1 -1
- package/dist/types/components/form/input/plain-date-input.d.ts +12 -12
- package/dist/types/components/form/input/plain-date-time-input.d.ts +12 -12
- package/dist/types/components/form/input/plain-time-input.d.ts +12 -12
- package/dist/types/components/form/input/plain-year-month-input.d.ts +12 -12
- package/dist/types/components/form/input/select-tags-input.d.ts +3 -3
- package/dist/types/components/form/use-form.d.ts +3 -3
- package/dist/types/components/i18n/locale-direction.d.ts +1 -1
- package/dist/types/components/i18n/locale-selector.d.ts +1 -1
- package/dist/types/components/i18n/locale.d.ts +1 -1
- package/dist/types/components/i18n/make-i18nprovider.d.ts +2 -2
- package/dist/types/components/layout/app-shell.d.ts +1 -1
- package/dist/types/components/lexical/code/language-selector.d.ts +1 -1
- package/dist/types/components/lexical/floating/block-handle.d.ts +1 -1
- package/dist/types/components/lexical/floating/floating-toolbar.d.ts +1 -1
- package/dist/types/components/lexical/floating/slash-command-palette.d.ts +1 -1
- package/dist/types/components/lexical/table/table-controls.d.ts +1 -1
- package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +1 -1
- package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +2 -2
- package/dist/types/components/media/pdf-page-viewer.d.ts +1 -1
- package/dist/types/components/misc/notification-provider.d.ts +2 -2
- package/dist/types/components/navigation/link/button-link.d.ts +1 -1
- package/dist/types/components/navigation/link/link.d.ts +1 -1
- package/dist/types/components/navigation/link/navigation-link.d.ts +1 -1
- package/dist/types/components/navigation/pagination.d.ts +1 -1
- package/dist/types/components/navigation/sidebar/sidebar.d.ts +2 -2
- package/dist/types/components/navigation/toolbar/toolbar.d.ts +1 -1
- package/dist/types/components/prosemirror/link-control.d.ts +1 -1
- package/dist/types/components/prosemirror/prosemirror-toolbar.d.ts +1 -1
- package/dist/types/components/prosemirror/utils.d.ts +2 -2
- package/dist/types/components/theme/theme.d.ts +2 -2
- package/dist/types/i18n/translate.d.ts +1 -1
- package/dist/types/utils/delay-signal.d.ts +1 -1
- package/dist/types/utils/use-animated-toggle.d.ts +22 -22
- package/dist/{ur-DkIYJxsF.js → ur-Lr1p8f9y.js} +1 -1
- package/dist/{use-animated-toggle-89fKlXxy.js → use-animated-toggle-C7PTmnZi.js} +7 -7
- package/dist/{use-form-BSvvERhX.js → use-form-BfzX3bwL.js} +13 -13
- package/dist/{use-form-B_mCauP0.cjs → use-form-i97PToWB.cjs} +1 -1
- package/dist/{vi-DKw6PBja.js → vi-jozfaxSj.js} +1 -1
- package/dist/widget-customization-BZqPoojo.cjs +1 -0
- package/dist/{widget-customization-DFr3ycD7.js → widget-customization-fMNSVtuP.js} +29 -29
- package/dist/{zh-CaKHseXJ.js → zh-BBYKq49d.js} +1 -1
- package/package.json +35 -31
- package/dist/deep-merge-CvN7Xvd1.cjs +0 -1
- package/dist/notice-DMK7dx9a.cjs +0 -1
- package/dist/stack-DcZ_u50f.cjs +0 -1
- package/dist/widget-customization-BASfRpF7.cjs +0 -1
package/dist/auth/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../auth-divider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../auth-divider-Cj-xJxF_.cjs");exports.AmazonLoginButton=o.AmazonLoginButton;exports.AppleLoginButton=o.AppleLoginButton;exports.AuthContainer=o.AuthContainer;exports.AuthDivider=o.AuthDivider;exports.AuthModal=o.AuthModal;exports.DiscordLoginButton=o.DiscordLoginButton;exports.EpicLoginButton=o.EpicLoginButton;exports.FacebookLoginButton=o.FacebookLoginButton;exports.GitHubLoginButton=o.GitHubLoginButton;exports.GoogleLoginButton=o.GoogleLoginButton;exports.InstagramLoginButton=o.InstagramLoginButton;exports.LinkedInLoginButton=o.LinkedInLoginButton;exports.MicrosoftLoginButton=o.MicrosoftLoginButton;exports.PasswordStrengthBar=o.PasswordStrengthBar;exports.PasswordStrengthIndicator=o.PasswordStrengthIndicator;exports.PasswordStrengthText=o.PasswordStrengthText;exports.PayPalLoginButton=o.PayPalLoginButton;exports.PinterestLoginButton=o.PinterestLoginButton;exports.PlayStationLoginButton=o.PlayStationLoginButton;exports.RedditLoginButton=o.RedditLoginButton;exports.ResetPasswordForm=o.ResetPasswordForm;exports.SignInForm=o.SignInForm;exports.SignUpForm=o.SignUpForm;exports.SnapchatLoginButton=o.SnapchatLoginButton;exports.SocialLoginButton=o.SocialLoginButton;exports.SocialLoginButtons=o.SocialLoginButtons;exports.SocialProviders=o.SocialProviders;exports.SteamLoginButton=o.SteamLoginButton;exports.TiktokLoginButton=o.TiktokLoginButton;exports.TwitchLoginButton=o.TwitchLoginButton;exports.TwitterLoginButton=o.TwitterLoginButton;exports.WeChatLoginButton=o.WeChatLoginButton;exports.WhatsAppLoginButton=o.WhatsAppLoginButton;exports.XLoginButtin=o.XLoginButtin;exports.XboxLoginButton=o.XboxLoginButton;exports.YahooLoginButton=o.YahooLoginButton;exports.authSchemas=o.authSchemas;exports.calculatePasswordStrength=o.calculatePasswordStrength;exports.createEmailSchema=o.createEmailSchema;exports.createPasswordSchema=o.createPasswordSchema;exports.createSignInSchema=o.createSignInSchema;exports.createSignUpSchema=o.createSignUpSchema;exports.createSocialLoginUrl=o.createSocialLoginUrl;exports.defaultPasswordRules=o.defaultPasswordRules;exports.defaultSignInSchema=o.defaultSignInSchema;exports.defaultSignUpSchema=o.defaultSignUpSchema;exports.emailSchema=o.emailSchema;exports.formatAuthError=o.formatAuthError;exports.formatProviderName=o.formatProviderName;exports.formatSocialLoginText=o.formatSocialLoginText;exports.generateRandomString=o.generateRandomString;exports.getProviderColor=o.getProviderColor;exports.getProviderIcon=o.getProviderIcon;exports.isBrowser=o.isBrowser;exports.isValidEmail=o.isValidEmail;exports.openSocialLoginPopup=o.openSocialLoginPopup;exports.providerInfo=o.providerInfo;exports.requestToControllerValidation=o.requestToControllerValidation;exports.resetPasswordSchema=o.resetPasswordSchema;exports.socialProviderInfo=o.socialProviderInfo;exports.useAuthEmailProp=o.useAuthEmailProp;exports.validateEmail=o.validateEmail;exports.validatePassword=o.validatePassword;
|
package/dist/auth/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as t, a as s, b as n, c as i, d as e, D as r, E as g, F as u, G as c, e as l, I as d, L, M as S, P as B, f as m, g as h, h as P, i as p, j as w, R as f, k as v, S as I, l as A, m as E, n as T, o as k, p as x, q as C, T as F, r as R, s as U, W as b, t as y, X as D, u as G, Y as M, v as V, w as W, x as X, y as q, z, B as H, C as N, H as Y, J as j, K as J, N as K, O, Q, U as Z, V as _, Z as $, _ as aa, $ as oa, a0 as ta, a1 as sa, a2 as na, a3 as ia, a4 as ea, a5 as ra, a6 as ga, a7 as ua, a8 as ca } from "../auth-divider-BZPM2Xd3.js";
|
|
2
2
|
export {
|
|
3
3
|
t as AmazonLoginButton,
|
|
4
4
|
s as AppleLoginButton,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { localStorageProp as le, prop as U, Use as q, html as l, attr as t, on as
|
|
2
|
-
import { i as te, S as T } from "./stack-
|
|
3
|
-
import { t as de, u as G, a as ne, b as A } from "./use-form-
|
|
4
|
-
import { o as H,
|
|
5
|
-
import { d as f, A as x } from "./translations-
|
|
6
|
-
import { P as O, E as j, N as X } from "./notice-
|
|
7
|
-
import { B as M } from "./input-container-
|
|
8
|
-
import { T as ge } from "./text-input-
|
|
9
|
-
import { I as fe } from "./translations-
|
|
1
|
+
import { localStorageProp as le, prop as U, Use as q, html as l, attr as t, on as z, When as _, coalesce as g, Ensure as W, computedOf as b, bind as me, ForEach as ue, Value as oe, OneOfValue as pe, Fragment as R } from "@tempots/dom";
|
|
2
|
+
import { i as te, S as T } from "./stack-Bm-UZosx.js";
|
|
3
|
+
import { t as de, u as G, a as ne, b as A } from "./use-form-BfzX3bwL.js";
|
|
4
|
+
import { o as H, b as F, s as C, M as he } from "./modal-CD3DwAlD.js";
|
|
5
|
+
import { d as f, A as x } from "./translations-COSDzhvR.js";
|
|
6
|
+
import { P as O, E as j, N as X } from "./notice-Cc26kgiB.js";
|
|
7
|
+
import { B as M } from "./input-container-BTyCOubf.js";
|
|
8
|
+
import { T as ge } from "./text-input-Cux5iiUC.js";
|
|
9
|
+
import { I as fe } from "./translations-BLlzvZgw.js";
|
|
10
10
|
import { classes as be } from "@tempots/ui";
|
|
11
11
|
const Y = {
|
|
12
12
|
google: { name: "Google", icon: "logos:google-icon", color: "#4285f4" },
|
|
@@ -329,7 +329,7 @@ function Le({
|
|
|
329
329
|
// Email/Password form
|
|
330
330
|
l.form(
|
|
331
331
|
t.class("bc-auth-form__form"),
|
|
332
|
-
|
|
332
|
+
z.submit(i),
|
|
333
333
|
T(
|
|
334
334
|
t.class("bc-auth-form__fields"),
|
|
335
335
|
W(
|
|
@@ -587,29 +587,27 @@ function Ze({
|
|
|
587
587
|
`bc-password-strength-text--${r}`,
|
|
588
588
|
u
|
|
589
589
|
].filter(Boolean).join(" "));
|
|
590
|
-
return
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
})
|
|
612
|
-
)
|
|
590
|
+
return q(
|
|
591
|
+
x,
|
|
592
|
+
(r) => l.span(
|
|
593
|
+
t.class(c),
|
|
594
|
+
b(
|
|
595
|
+
a,
|
|
596
|
+
r
|
|
597
|
+
)((u, n) => {
|
|
598
|
+
switch (u) {
|
|
599
|
+
case "weak":
|
|
600
|
+
return n.passwordStrengthWeak;
|
|
601
|
+
case "fair":
|
|
602
|
+
return n.passwordStrengthFair;
|
|
603
|
+
case "good":
|
|
604
|
+
return n.passwordStrengthGood;
|
|
605
|
+
case "strong":
|
|
606
|
+
return n.passwordStrengthStrong;
|
|
607
|
+
default:
|
|
608
|
+
return n.passwordStrengthWeak;
|
|
609
|
+
}
|
|
610
|
+
})
|
|
613
611
|
)
|
|
614
612
|
);
|
|
615
613
|
}
|
|
@@ -655,14 +653,14 @@ function ke({
|
|
|
655
653
|
}
|
|
656
654
|
}), { controller: S, submit: V } = k;
|
|
657
655
|
h.on(S.setDisabled);
|
|
658
|
-
const B = S.field("name"), P = S.field("email"),
|
|
656
|
+
const B = S.field("name"), P = S.field("email"), E = S.field("password"), D = S.field("confirmPassword"), I = S.field("acceptTerms");
|
|
659
657
|
return q(
|
|
660
658
|
x,
|
|
661
659
|
(w) => (
|
|
662
660
|
// Registration form
|
|
663
661
|
l.form(
|
|
664
662
|
t.class("bc-auth-form__form"),
|
|
665
|
-
|
|
663
|
+
z.submit(V),
|
|
666
664
|
T(
|
|
667
665
|
t.class("bc-auth-form__fields"),
|
|
668
666
|
W(
|
|
@@ -690,14 +688,14 @@ function ke({
|
|
|
690
688
|
}),
|
|
691
689
|
// Password field
|
|
692
690
|
A(O, {
|
|
693
|
-
controller:
|
|
691
|
+
controller: E,
|
|
694
692
|
label: g(o?.passwordLabel, w.$.passwordLabel)
|
|
695
693
|
}),
|
|
696
694
|
// Password strength indicator
|
|
697
695
|
_(
|
|
698
696
|
c ?? !1,
|
|
699
697
|
() => ve({
|
|
700
|
-
password:
|
|
698
|
+
password: E.signal,
|
|
701
699
|
rules: L,
|
|
702
700
|
showLabel: !0
|
|
703
701
|
})
|
|
@@ -796,7 +794,7 @@ function ye({
|
|
|
796
794
|
t.class("bc-auth-form__description"),
|
|
797
795
|
g(o?.resetPasswordDescription, m.$.resetPasswordDescription)
|
|
798
796
|
),
|
|
799
|
-
|
|
797
|
+
z.submit(u),
|
|
800
798
|
T(
|
|
801
799
|
t.class("bc-auth-form__fields"),
|
|
802
800
|
// Email field
|
|
@@ -1157,12 +1155,12 @@ function Pe({
|
|
|
1157
1155
|
}, ...V) {
|
|
1158
1156
|
const B = e != null ? oe.deriveProp(e) : U("signin");
|
|
1159
1157
|
return B.on((P) => v?.(P)), q(x, (P) => {
|
|
1160
|
-
function
|
|
1158
|
+
function E() {
|
|
1161
1159
|
const w = g(m?.hasAccountLink, P.$.hasAccountLink);
|
|
1162
1160
|
return l.button(
|
|
1163
1161
|
t.type("button"),
|
|
1164
1162
|
t.class("bc-auth-form__link"),
|
|
1165
|
-
|
|
1163
|
+
z.click(() => B.set("signin")),
|
|
1166
1164
|
w
|
|
1167
1165
|
);
|
|
1168
1166
|
}
|
|
@@ -1170,7 +1168,7 @@ function Pe({
|
|
|
1170
1168
|
return l.button(
|
|
1171
1169
|
t.type("button"),
|
|
1172
1170
|
t.class("bc-auth-form__link"),
|
|
1173
|
-
|
|
1171
|
+
z.click(() => B.set("signup")),
|
|
1174
1172
|
g(m?.noAccountLink, P.$.noAccountLink)
|
|
1175
1173
|
);
|
|
1176
1174
|
}
|
|
@@ -1178,7 +1176,7 @@ function Pe({
|
|
|
1178
1176
|
return l.button(
|
|
1179
1177
|
t.type("button"),
|
|
1180
1178
|
t.class("bc-auth-form__link"),
|
|
1181
|
-
|
|
1179
|
+
z.click(() => B.set("reset-password")),
|
|
1182
1180
|
g(m?.forgotPasswordLink, P.$.forgotPasswordLink)
|
|
1183
1181
|
);
|
|
1184
1182
|
}
|
|
@@ -1190,12 +1188,12 @@ function Pe({
|
|
|
1190
1188
|
t.class(B.map((w) => `bc-auth-container--${w}`)),
|
|
1191
1189
|
t.class("bc-auth-form"),
|
|
1192
1190
|
pe(B, {
|
|
1193
|
-
signin: () =>
|
|
1191
|
+
signin: () => R(
|
|
1194
1192
|
l.h2(
|
|
1195
1193
|
t.class("bc-auth-form__title"),
|
|
1196
1194
|
g(m?.signInTitle, P.$.signInTitle)
|
|
1197
1195
|
),
|
|
1198
|
-
o != null ?
|
|
1196
|
+
o != null ? R(
|
|
1199
1197
|
ae({
|
|
1200
1198
|
providers: o,
|
|
1201
1199
|
onSocialLogin: k
|
|
@@ -1221,12 +1219,12 @@ function Pe({
|
|
|
1221
1219
|
I()
|
|
1222
1220
|
)
|
|
1223
1221
|
),
|
|
1224
|
-
signup: () =>
|
|
1222
|
+
signup: () => R(
|
|
1225
1223
|
l.h2(
|
|
1226
1224
|
t.class("bc-auth-form__title"),
|
|
1227
1225
|
g(m?.signUpTitle, P.$.signUpTitle)
|
|
1228
1226
|
),
|
|
1229
|
-
o != null ?
|
|
1227
|
+
o != null ? R(
|
|
1230
1228
|
ae({
|
|
1231
1229
|
providers: o,
|
|
1232
1230
|
onSocialLogin: k
|
|
@@ -1249,9 +1247,9 @@ function Pe({
|
|
|
1249
1247
|
passwordRules: c,
|
|
1250
1248
|
showPasswordStrength: n
|
|
1251
1249
|
}),
|
|
1252
|
-
T(t.class("bc-auth-form__footer"),
|
|
1250
|
+
T(t.class("bc-auth-form__footer"), E())
|
|
1253
1251
|
),
|
|
1254
|
-
"reset-password": () =>
|
|
1252
|
+
"reset-password": () => R(
|
|
1255
1253
|
l.h2(
|
|
1256
1254
|
t.class("bc-auth-form__title"),
|
|
1257
1255
|
g(m?.resetPasswordTitle, P.$.resetPasswordTitle)
|
|
@@ -1265,7 +1263,7 @@ function Pe({
|
|
|
1265
1263
|
},
|
|
1266
1264
|
onResetPassword: L
|
|
1267
1265
|
}),
|
|
1268
|
-
T(t.class("bc-auth-form__footer"),
|
|
1266
|
+
T(t.class("bc-auth-form__footer"), E())
|
|
1269
1267
|
)
|
|
1270
1268
|
}),
|
|
1271
1269
|
...V
|
|
@@ -1309,67 +1307,67 @@ function se({
|
|
|
1309
1307
|
);
|
|
1310
1308
|
}
|
|
1311
1309
|
export {
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1310
|
+
Oe as $,
|
|
1311
|
+
_o as A,
|
|
1312
|
+
Q as B,
|
|
1313
|
+
Ve as C,
|
|
1316
1314
|
so as D,
|
|
1317
|
-
|
|
1315
|
+
ho as E,
|
|
1318
1316
|
eo as F,
|
|
1319
|
-
|
|
1320
|
-
|
|
1317
|
+
Ke as G,
|
|
1318
|
+
$ as H,
|
|
1321
1319
|
ro as I,
|
|
1322
|
-
|
|
1323
|
-
|
|
1320
|
+
We as J,
|
|
1321
|
+
Ge as K,
|
|
1324
1322
|
no as L,
|
|
1325
1323
|
ao as M,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1324
|
+
re as N,
|
|
1325
|
+
Fe as O,
|
|
1326
|
+
Ye as P,
|
|
1327
|
+
we as Q,
|
|
1328
|
+
lo as R,
|
|
1331
1329
|
Le as S,
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1330
|
+
io as T,
|
|
1331
|
+
Me as U,
|
|
1332
|
+
_e as V,
|
|
1333
|
+
wo as W,
|
|
1336
1334
|
oo as X,
|
|
1337
1335
|
Lo as Y,
|
|
1338
|
-
|
|
1336
|
+
Ue as Z,
|
|
1339
1337
|
Re as _,
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1338
|
+
Qe as a,
|
|
1339
|
+
Ne as a0,
|
|
1340
|
+
De as a1,
|
|
1341
|
+
Y as a2,
|
|
1342
|
+
Z as a3,
|
|
1343
|
+
ie as a4,
|
|
1344
|
+
p as a5,
|
|
1345
|
+
ce as a6,
|
|
1346
|
+
je as a7,
|
|
1347
|
+
Xe as a8,
|
|
1348
|
+
Pe as b,
|
|
1349
|
+
se as c,
|
|
1350
|
+
ko as d,
|
|
1351
|
+
Je as e,
|
|
1352
|
+
ve as f,
|
|
1353
|
+
Ze as g,
|
|
1354
|
+
vo as h,
|
|
1355
|
+
mo as i,
|
|
1356
|
+
go as j,
|
|
1357
|
+
ye as k,
|
|
1358
|
+
ke as l,
|
|
1359
|
+
co as m,
|
|
1360
|
+
d as n,
|
|
1361
|
+
Se as o,
|
|
1362
|
+
ae as p,
|
|
1363
|
+
po as q,
|
|
1364
|
+
uo as r,
|
|
1365
|
+
to as s,
|
|
1366
|
+
bo as t,
|
|
1367
|
+
fo as u,
|
|
1368
|
+
He as v,
|
|
1369
|
+
ee as w,
|
|
1370
|
+
N as x,
|
|
1371
|
+
J as y,
|
|
1372
|
+
K as z
|
|
1375
1373
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("@tempots/dom"),P=require("./stack-DcZ_u50f.cjs"),L=require("./use-form-B_mCauP0.cjs"),f=require("./modal-Coenk8Fy.cjs"),m=require("./translations-CZ0KOii3.cjs"),y=require("./notice-DMK7dx9a.cjs"),C=require("./input-container-B31Seozh.cjs"),Q=require("./text-input-w0eVcqk5.cjs"),ee=require("./translations-gVgMyNno.cjs"),te=require("@tempots/ui"),T={google:{name:"Google",icon:"logos:google-icon",color:"#4285f4"},github:{name:"GitHub",icon:"logos:github-icon",color:"#333"},apple:{name:"Apple",icon:"logos:apple",color:"#000"},facebook:{name:"Facebook",icon:"logos:facebook",color:"#1877f2"},twitter:{name:"Twitter",icon:"logos:twitter",color:"#1da1f2"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"#00a4ef"},discord:{name:"Discord",icon:"logos:discord-icon",color:"#5865f2"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"#0077b5"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"#e4405f"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"#000"},snapchat:{name:"Snapchat",icon:"logos:snapchat-icon",color:"#fffc00"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"#ff4500"},pinterest:{name:"Pinterest",icon:"logos:pinterest-icon",color:"#bd081c"},twitch:{name:"Twitch",icon:"logos:twitch",color:"#9146ff"},steam:{name:"Steam",icon:"logos:steam-icon",color:"#000"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"#313131"},playstation:{name:"PlayStation",icon:"logos:playstation-icon",color:"#003791"},xbox:{name:"Xbox",icon:"logos:xbox-icon",color:"#107c10"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"#25d366"},wechat:{name:"WeChat",icon:"logos:wechat-icon",color:"#1aad19"},amazon:{name:"Amazon",icon:"logos:amazon-icon",color:"#ff9900"},yahoo:{name:"Yahoo",icon:"logos:yahoo-icon",color:"#720e9e"},paypal:{name:"PayPal",icon:"logos:paypal",color:"#0070ba"},x:{name:"X",icon:"simple-icons:x",color:"#000"}};function G(t){return T[t]?.name||t}function oe(t){return T[t]?.icon||"mdi:account"}function ae(t){return T[t]?.color||"#666"}function ne(t,o="Continue with {provider}"){return o.replace("{provider}",G(t))}const B={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function re(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function j(t=32){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let a=0;a<t;a++)n+=o.charAt(Math.floor(Math.random()*o.length));return n}function se(t,o,n,a=[],c={}){const s={google:"https://accounts.google.com/oauth/authorize",github:"https://github.com/login/oauth/authorize",apple:"https://appleid.apple.com/auth/authorize",facebook:"https://www.facebook.com/v18.0/dialog/oauth",twitter:"https://twitter.com/i/oauth2/authorize",microsoft:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",discord:"https://discord.com/api/oauth2/authorize",linkedin:"https://www.linkedin.com/oauth/v2/authorization",instagram:"https://api.instagram.com/oauth/authorize",tiktok:"https://www.tiktok.com/v2/auth/authorize",snapchat:"https://accounts.snapchat.com/accounts/oauth2/authorize",reddit:"https://www.reddit.com/api/v1/authorize",pinterest:"https://api.pinterest.com/oauth/",twitch:"https://id.twitch.tv/oauth2/authorize",steam:"https://steamcommunity.com/oauth/authorize",epic:"https://auth.epicgames.com/authorize",playstation:"https://auth.api.sonyentertainmentnetwork.com/oauth/authorize",xbox:"https://login.live.com/oauth20_authorize.srf",whatsapp:"https://web.whatsapp.com/oauth/authorize",wechat:"https://open.weixin.qq.com/connect/qrconnect",amazon:"https://www.amazon.com/ap/oa",yahoo:"https://api.login.yahoo.com/oauth2/request_auth",paypal:"https://www.paypal.com/signin/authorize",x:"https://api.twitter.com/oauth2/authorize"},u={google:["openid","email","profile"],github:["user:email"],apple:["email","name"],facebook:["email"],twitter:["users.read"],microsoft:["openid","email","profile"],discord:["identify","email"],linkedin:["r_liteprofile","r_emailaddress"],instagram:["user_profile","user_media"],tiktok:["user.info.basic","user.external.id"],snapchat:["user.info.basic","user.external.id"],reddit:["identity","email"],pinterest:["read_public","read_relationships"],twitch:["openid","email","profile"],steam:["openid","email","profile"],epic:["openid","email","profile"],playstation:["openid","email","profile"],xbox:["openid","email","profile"],whatsapp:["openid","email","profile"],wechat:["openid","email","profile"],amazon:["openid","email","profile"],yahoo:["openid","email","profile"],paypal:["openid","email","profile"],x:["openid","email","profile"]},r=s[t];if(!r)throw new Error(`Unsupported provider: ${t}`);const l=a.length>0?a:u[t],i=j(),h=new URLSearchParams({client_id:o,redirect_uri:n,scope:l.join(" "),state:i,response_type:"code",...c});return`${r}?${h.toString()}`}function ie(t,o,n,a){const c=window.open(t,`${o}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){a?.(new Error("Failed to open popup window"));return}const s=setInterval(()=>{c.closed&&(clearInterval(s),a?.(new Error("Login cancelled")))},1e3),u=r=>{r.origin===window.location.origin&&(r.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(s),c.close(),window.removeEventListener("message",u),n?.(r.data.result)):r.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(s),c.close(),window.removeEventListener("message",u),a?.(new Error(r.data.error))))};window.addEventListener("message",u)}function ce(t){return t instanceof Error?t.message:typeof t=="string"?t:t&&typeof t=="object"&&"message"in t?String(t.message):"An unexpected error occurred"}function le(){return typeof window<"u"&&typeof document<"u"}function $({task:t,message:o,onStart:n,onEnd:a}){return async c=>{n?.();const s=await L.taskToValidation({task:t!=null?()=>t(c):async()=>null,errorMessage:o,errorPath:["root"],validation:u=>u!=null?P.i.invalid({message:u}):P.i.valid});return a?.(),s}}function E(t=B,o){const n=o??m.defaultMessages;let a=f.string();return t.minLength&&(a=a.min(t.minLength,(n.passwordMinLength??m.defaultMessages.passwordMinLength)(t.minLength))),t.requireUppercase&&(a=a.regex(/[A-Z]/,n.passwordRequireUppercase??m.defaultMessages.passwordRequireUppercase)),t.requireLowercase&&(a=a.regex(/[a-z]/,n.passwordRequireLowercase??m.defaultMessages.passwordRequireLowercase)),t.requireNumbers&&(a=a.regex(/[0-9]/,n.passwordRequireNumber??m.defaultMessages.passwordRequireNumber)),t.requireSymbols&&(a=a.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,n.passwordRequireSpecialChar??m.defaultMessages.passwordRequireSpecialChar)),t.customValidation&&(a=a.refine(c=>t.customValidation(c))),a}function A(t){const o=t??m.defaultMessages;return f.string().min(1,o.emailRequired??m.defaultMessages.emailRequired).email(o.invalidEmail??m.defaultMessages.invalidEmail)}const N=A();function M(t,o){const n=o??m.defaultMessages,a=t?E(t,o):f.string().refine(c=>c.length>0?null:n.passwordRequired??m.defaultMessages.passwordRequired);return f.object({email:A(o),password:a,rememberMe:f.boolean().default(!1)}).schema()}function z(t=B,o,n){const a=n??m.defaultMessages,c=E(t,n),s=o?.showNameField!==!1,u=o?.showConfirmPassword!==!1,r=o?.showAcceptTermsAndConditions!==!1,l={name:s?f.string().min(1,a.nameRequired??m.defaultMessages.nameRequired).optional():f.string().optional(),email:A(n),password:c,confirmPassword:u?f.string().min(1,a.confirmPasswordRequired??m.defaultMessages.confirmPasswordRequired):f.string(),acceptTerms:r?f.boolean().refine(h=>h===!0,a.acceptTermsRequired??m.defaultMessages.acceptTermsRequired):f.boolean().default(!0)},i=f.object(l);return u?i.refine(h=>h.password===h.confirmPassword?null:a.passwordsDoNotMatch??m.defaultMessages.passwordsDoNotMatch,{path:["confirmPassword"]}).schema():i.schema()}const V=f.object({email:N}).schema(),ue=M(),me=z(),de={signIn:M,signUp:z,resetPassword:()=>V};function pe(t,o){const n=o??m.defaultMessages,c=(o?A(o):N).validate(t);return c.success?null:c.errors[0]?.message||(n.invalidEmailAddress??m.defaultMessages.invalidEmailAddress)}function he(t,o=B,n){const a=n??m.defaultMessages,s=E(o,n).validate(t);return s.success?null:s.errors[0]?.message||(a.invalidPassword??m.defaultMessages.invalidPassword)}function R(t,o=B){const n={length:t.length>=(o.minLength||8),uppercase:/[A-Z]/.test(t),lowercase:/[a-z]/.test(t),numbers:/[0-9]/.test(t),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(t),custom:o.customValidation?o.customValidation(t)===null:t.length>0},a=[!0,o.requireUppercase,o.requireLowercase,o.requireNumbers,o.requireSymbols,!!o.customValidation].filter(Boolean).length,c=[n.length,o.requireUppercase?n.uppercase:null,o.requireLowercase?n.lowercase:null,o.requireNumbers?n.numbers:null,o.requireSymbols?n.symbols:null,o.customValidation?n.custom:null].filter(r=>r===!0).length,s=a>0?Math.round(c/a*100):0;let u;return s<40?u="weak":s<60?u="fair":s<80?u="good":u="strong",{strength:u,score:s,checks:n}}const D=()=>e.localStorageProp({key:"bui_auth_email",defaultValue:null});function H({onSignIn:t,passwordRules:o,labels:n,showRememberMe:a}){const c=e.prop(!1),s=D(),u=M(o),r=L.useForm({schema:u,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{c.set(!0),r.controller.disable()},onEnd:()=>{c.set(!1),r.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:l,submit:i}=r;c.on(l.setDisabled);const h=l.field("email"),w=l.field("password");return s.on(b=>{b!=null&&h.change(b)}),h.signal.on(b=>{s.value!=null&&(s.value=b)}),e.Use(m.AuthI18n,b=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(i),P.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(l.error,_=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(_))),L.Control(y.EmailInput,{controller:h,label:e.coalesce(n?.emailLabel,b.$.emailLabel)}),L.Control(y.PasswordInput,{controller:w,label:e.coalesce(n?.passwordLabel,b.$.passwordLabel)}),e.When(a??!0,()=>e.html.div(e.attr.class("bc-auth-form__remember-me"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:s.map(_=>_!=null),after:e.html.span(e.coalesce(n?.rememberMeLabel,b.$.rememberMeLabel)),onChange:_=>{_?s.value=h.signal.value??"":s.value=null}}))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:l.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(n?.signInButton,b.$.signInButton))))}function X({password:t,rules:o=B,showLabel:n=!0,className:a}){const c=e.computedOf(t)(i=>!i||i.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:R(i,o)),s=c.map(i=>i.strength),u=c.map(i=>i.score),r=c.map(i=>i.checks),l=e.computedOf(s,a)((i,h)=>["bc-password-strength",`bc-password-strength--${i}`,h].filter(Boolean).join(" "));return e.html.div(e.attr.class(l),e.html.div(e.attr.class("bc-password-strength__bar"),e.html.div(e.attr.class("bc-password-strength__fill"),e.attr.style(u.map(i=>`width: ${i}%`)))),e.When(n,()=>e.Use(m.AuthI18n,i=>e.html.div(e.attr.class("bc-password-strength__label"),e.computedOf(s,i)((h,w)=>{switch(h){case"weak":return w.passwordStrengthWeak;case"fair":return w.passwordStrengthFair;case"good":return w.passwordStrengthGood;case"strong":return w.passwordStrengthStrong;default:return w.passwordStrengthWeak}})))),e.html.div(e.attr.class("bc-password-strength__requirements"),e.When(o.minLength!==void 0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.length?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.length?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),`At least ${o.minLength} characters`))),e.When(o.requireUppercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.uppercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.uppercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),e.When(o.requireLowercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.lowercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.lowercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),e.When(o.requireNumbers===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.numbers?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.numbers?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One number"))),e.When(o.requireSymbols===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.symbols?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.symbols?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function ge({password:t,rules:o=B,className:n}){const a=e.computedOf(t)(r=>!r||r.length===0?{strength:"weak",score:0}:R(r,o)),c=a.map(r=>r.strength),s=a.map(r=>r.score),u=e.computedOf(c,n)((r,l)=>["bc-password-strength-bar",`bc-password-strength-bar--${r}`,l].filter(Boolean).join(" "));return e.html.div(e.attr.class(u),e.html.div(e.attr.class("bc-password-strength-bar__fill"),e.attr.style(s.map(r=>`width: ${r}%`))))}function fe({password:t,rules:o=B,className:n}){const a=e.computedOf(t)(s=>!s||s.length===0?"weak":R(s,o).strength),c=e.computedOf(a,n)((s,u)=>["bc-password-strength-text",`bc-password-strength-text--${s}`,u].filter(Boolean).join(" "));return e.Fragment(e.Use(m.AuthI18n,s=>e.html.span(e.attr.class(c),e.computedOf(a,s)((u,r)=>{switch(u){case"weak":return r.passwordStrengthWeak;case"fair":return r.passwordStrengthFair;case"good":return r.passwordStrengthGood;case"strong":return r.passwordStrengthStrong;default:return r.passwordStrengthWeak}}))))}function Y({passwordRules:t,labels:o,initialEmail:n,initialName:a,showPasswordStrength:c,onSignUp:s,showNameField:u,showConfirmPassword:r,showAcceptTermsAndConditions:l,termsAndConditions:i}){const h=e.prop(!1),w=t||B,b=z(w,{showNameField:u!==!1,showConfirmPassword:r!==!1,showAcceptTermsAndConditions:l!==!1}),_=L.useForm({schema:b,onSubmit:$({task:s!=null?g=>s({email:g.email,password:g.password,name:g.name,acceptTerms:g.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{h.set(!0),_.controller.disable()},onEnd:()=>{h.set(!1),_.controller.enable()}}),initialValue:{name:a??"",email:n??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:v,submit:U}=_;h.on(v.setDisabled);const q=v.field("name"),S=v.field("email"),x=v.field("password"),O=v.field("confirmPassword"),I=v.field("acceptTerms");return e.Use(m.AuthI18n,g=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(U),P.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(v.error,k=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(k))),e.When(u!==!1,()=>L.Control(Q.TextInput,{controller:q.transform(k=>k??"",k=>k===""?void 0:k),label:e.coalesce(o?.nameLabel,g.$.nameLabel)})),L.Control(y.EmailInput,{controller:S,label:e.coalesce(o?.emailLabel,g.$.emailLabel)}),L.Control(y.PasswordInput,{controller:x,label:e.coalesce(o?.passwordLabel,g.$.passwordLabel)}),e.When(c??!1,()=>X({password:x.signal,rules:w,showLabel:!0})),e.When(r??!1,()=>L.Control(y.PasswordInput,{controller:O,label:e.coalesce(o?.confirmPasswordLabel,g.$.confirmPasswordLabel)})),e.When(l??!1,()=>e.html.div(e.attr.class("bc-auth-form__terms"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:I.signal.map(k=>k??!1),onChange:k=>I.change(k)}),e.html.span(i||e.coalesce(o?.acceptTermsLabel,g.$.acceptTermsLabel))),e.When(I.errorVisible,()=>e.html.div(e.attr.class("bc-auth-form__field-error"),I.error.map(k=>k||"")))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:h,disabled:v.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.signUpButton,g.$.signUpButton))))}function Z({onResetPassword:t,labels:o={}}){const n=D(),a=e.prop(!1),c=L.useForm({schema:V,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{a.set(!0),c.controller.disable()},onEnd:()=>{a.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:s,submit:u}=c;a.on(s.setDisabled);const r=s.field("email");return n.on(l=>{l!=null&&r.change(l)}),e.Use(m.AuthI18n,l=>e.html.form(e.attr.class("bc-auth-form__form"),e.Ensure(s.error,i=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(i))),e.html.p(e.attr.class("bc-auth-form__description"),e.coalesce(o?.resetPasswordDescription,l.$.resetPasswordDescription)),e.on.submit(u),P.Stack(e.attr.class("bc-auth-form__fields"),L.Control(y.EmailInput,{controller:r,label:e.coalesce(o?.emailLabel,l.$.emailLabel)})),C.Button({loading:a,type:"submit",variant:"filled",color:"primary",disabled:s.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.resetPasswordButton,l.$.resetPasswordButton))))}function p({provider:t,onClick:o,size:n="md",name:a,icon:c,color:s,flow:u,labels:r}){const l=async()=>{if(o)try{u==="popup"?await o():await o()}catch(i){console.error(`Social login error for ${t} (${u||"redirect"} flow):`,i)}};return C.Button({type:"button",variant:"filled",size:n,color:s,onClick:l,roundedness:"full"},e.attr.class("bc-social-login-button"),e.attr.class(e.computedOf(t)(i=>`bc-social-login-button--${i}`)),e.html.span(e.attr.class("bc-social-login-button__inner"),e.html.span(e.attr.class("bc-social-login-button__icon"),ee.Icon({icon:c,size:n},e.attr.class("bc-social-login-button__icon-inner"))),e.Use(m.AuthI18n,i=>e.html.span(e.attr.class("bc-social-login-button__label"),e.bind(e.coalesce(r?.continueWithProvider,i.$.continueWithProvider))(a)))))}function J({providers:t,onProviderClick:o,size:n="md",className:a}){return P.Stack(e.attr.class("bc-social-login-buttons"),e.attr.class(a),e.ForEach(t,c=>p({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:s})=>d[s].color),name:c.map(({provider:s})=>d[s].name),icon:c.map(({provider:s})=>d[s].icon),onClick:async()=>{o&&await o(c.$.provider.value)},size:n})))}const d={google:{name:"Google",icon:"logos:google-icon",color:"red"},github:{name:"GitHub",icon:"logos:github-icon",color:"black"},apple:{name:"Apple",icon:"logos:apple",color:"stone"},facebook:{name:"Facebook",icon:"logos:facebook",color:"blue"},twitter:{name:"Twitter",icon:"logos:twitter",color:"sky"},x:{name:"X",icon:"logos:x",color:"zinc"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"amber"},discord:{name:"Discord",icon:"logos:discord-icon",color:"indigo"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"cyan"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"fuchsia"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"teal"},snapchat:{name:"Snapchat",icon:"simple-icons:snapchat",color:"yellow"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"orange"},pinterest:{name:"Pinterest",icon:"logos:pinterest",color:"rose"},twitch:{name:"Twitch",icon:"logos:twitch",color:"purple"},steam:{name:"Steam",icon:"logos:steam",color:"slate"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"neutral"},playstation:{name:"PlayStation",icon:"simple-icons:playstation",color:"violet"},xbox:{name:"Xbox",icon:"simple-icons:xbox",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"simple-icons:wechat",color:"lime"},amazon:{name:"Amazon",icon:"simple-icons:amazon",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},we=t=>p({...t,...d.google,provider:"google"}),be=t=>p({...t,...d.github,provider:"github"}),Le=t=>p({...t,...d.apple,provider:"apple"}),_e=t=>p({...t,...d.facebook,provider:"facebook"}),ke=t=>p({...t,...d.x,provider:"x"}),ve=t=>p({...t,...d.twitter,provider:"twitter"}),Se=t=>p({...t,...d.microsoft,provider:"microsoft"}),Pe=t=>p({...t,...d.discord,provider:"discord"}),ye=t=>p({...t,...d.linkedin,provider:"linkedin"}),Be=t=>p({...t,...d.instagram,provider:"instagram"}),qe=t=>p({...t,...d.tiktok,provider:"tiktok"}),Ie=t=>p({...t,...d.snapchat,provider:"snapchat"}),xe=t=>p({...t,...d.reddit,provider:"reddit"}),Ae=t=>p({...t,...d.pinterest,provider:"pinterest"}),Ce=t=>p({...t,...d.twitch,provider:"twitch"}),Te=t=>p({...t,...d.steam,provider:"steam"}),$e=t=>p({...t,...d.epic,provider:"epic"}),Ee=t=>p({...t,...d.playstation,provider:"playstation"}),Me=t=>p({...t,...d.xbox,provider:"xbox"}),ze=t=>p({...t,...d.whatsapp,provider:"whatsapp"}),Re=t=>p({...t,...d.wechat,provider:"wechat"}),Ue=t=>p({...t,...d.amazon,provider:"amazon"}),Oe=t=>p({...t,...d.yahoo,provider:"yahoo"}),We=t=>p({...t,...d.paypal,provider:"paypal"});function W({providers:t,onSocialLogin:o}){return P.Stack(J({providers:t,onProviderClick:o}))}function K({mode:t,socialProviders:o,initialName:n,initialEmail:a,passwordRules:c,showRememberMe:s,showSocialDivider:u,showPasswordStrength:r,labels:l,onSignIn:i,onSignUp:h,onResetPassword:w,onModeChange:b,onSocialLogin:_,showContainer:v},...U){const q=t!=null?e.Value.deriveProp(t):e.prop("signin");return q.on(S=>b?.(S)),e.Use(m.AuthI18n,S=>{function x(){const g=e.coalesce(l?.hasAccountLink,S.$.hasAccountLink);return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>q.set("signin")),g)}function O(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>q.set("signup")),e.coalesce(l?.noAccountLink,S.$.noAccountLink))}function I(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>q.set("reset-password")),e.coalesce(l?.forgotPasswordLink,S.$.forgotPasswordLink))}return e.html.div(te.classes({"bc-auth-container":!0,"bc-auth-container--styled":e.Value.map(v??!0,g=>g)}),e.attr.class(q.map(g=>`bc-auth-container--${g}`)),e.attr.class("bc-auth-form"),e.OneOfValue(q,{signin:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signInTitle,S.$.signInTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,H({onSignIn:i,showRememberMe:s,passwordRules:c,labels:{emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,rememberMeLabel:l?.rememberMeLabel,signInButton:l?.signInButton,forgotPasswordLink:l?.forgotPasswordLink,noAccountLink:l?.noAccountLink}}),P.Stack(e.attr.class("bc-auth-form__footer"),O(),I())),signup:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signUpTitle,S.$.signUpTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,Y({labels:{nameLabel:l?.nameLabel,emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,confirmPasswordLabel:l?.confirmPasswordLabel,acceptTermsLabel:l?.acceptTermsLabel,signUpButton:l?.signUpButton,hasAccountLink:l?.hasAccountLink},initialEmail:a,initialName:n,onSignUp:h,passwordRules:c,showPasswordStrength:r}),P.Stack(e.attr.class("bc-auth-form__footer"),x())),"reset-password":()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.resetPasswordTitle,S.$.resetPasswordTitle)),Z({labels:{backToSignInLink:l?.backToSignInLink,emailLabel:l?.emailLabel,resetPasswordButton:l?.resetPasswordButton,resetPasswordDescription:l?.resetPasswordDescription},onResetPassword:w}),P.Stack(e.attr.class("bc-auth-form__footer"),x()))}),...U)})}function Fe(t){return f.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(o,n)=>t(a=>o({body:K({showContainer:!1,...a}),header:e.Use(m.AuthI18n,c=>e.coalesce(a.modalTitle,c.$.authenticationTitle))})))}function F({labels:t,className:o}={}){return e.html.div(e.attr.class("bc-auth-divider"),e.attr.class(o),e.html.div(e.attr.class("bc-auth-divider__line")),e.Use(m.AuthI18n,n=>e.html.span(e.attr.class("bc-auth-divider__text"),e.coalesce(t?.text,n.$.orDivider))),e.html.div(e.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=Ue;exports.AppleLoginButton=Le;exports.AuthContainer=K;exports.AuthDivider=F;exports.AuthModal=Fe;exports.DiscordLoginButton=Pe;exports.EpicLoginButton=$e;exports.FacebookLoginButton=_e;exports.GitHubLoginButton=be;exports.GoogleLoginButton=we;exports.InstagramLoginButton=Be;exports.LinkedInLoginButton=ye;exports.MicrosoftLoginButton=Se;exports.PasswordStrengthBar=ge;exports.PasswordStrengthIndicator=X;exports.PasswordStrengthText=fe;exports.PayPalLoginButton=We;exports.PinterestLoginButton=Ae;exports.PlayStationLoginButton=Ee;exports.RedditLoginButton=xe;exports.ResetPasswordForm=Z;exports.SignInForm=H;exports.SignUpForm=Y;exports.SnapchatLoginButton=Ie;exports.SocialLoginButton=p;exports.SocialLoginButtons=J;exports.SocialProviders=W;exports.SteamLoginButton=Te;exports.TiktokLoginButton=qe;exports.TwitchLoginButton=Ce;exports.TwitterLoginButton=ve;exports.WeChatLoginButton=Re;exports.WhatsAppLoginButton=ze;exports.XLoginButtin=ke;exports.XboxLoginButton=Me;exports.YahooLoginButton=Oe;exports.authSchemas=de;exports.calculatePasswordStrength=R;exports.createEmailSchema=A;exports.createPasswordSchema=E;exports.createSignInSchema=M;exports.createSignUpSchema=z;exports.createSocialLoginUrl=se;exports.defaultPasswordRules=B;exports.defaultSignInSchema=ue;exports.defaultSignUpSchema=me;exports.emailSchema=N;exports.formatAuthError=ce;exports.formatProviderName=G;exports.formatSocialLoginText=ne;exports.generateRandomString=j;exports.getProviderColor=ae;exports.getProviderIcon=oe;exports.isBrowser=le;exports.isValidEmail=re;exports.openSocialLoginPopup=ie;exports.providerInfo=T;exports.requestToControllerValidation=$;exports.resetPasswordSchema=V;exports.socialProviderInfo=d;exports.useAuthEmailProp=D;exports.validateEmail=pe;exports.validatePassword=he;
|
|
1
|
+
"use strict";const e=require("@tempots/dom"),P=require("./stack-4VUGISn6.cjs"),L=require("./use-form-i97PToWB.cjs"),f=require("./modal-jJMS0ZlW.cjs"),m=require("./translations-CZ0KOii3.cjs"),y=require("./notice-9lpZ-VDn.cjs"),C=require("./input-container-B31Seozh.cjs"),Q=require("./text-input-w0eVcqk5.cjs"),ee=require("./translations-gVgMyNno.cjs"),te=require("@tempots/ui"),T={google:{name:"Google",icon:"logos:google-icon",color:"#4285f4"},github:{name:"GitHub",icon:"logos:github-icon",color:"#333"},apple:{name:"Apple",icon:"logos:apple",color:"#000"},facebook:{name:"Facebook",icon:"logos:facebook",color:"#1877f2"},twitter:{name:"Twitter",icon:"logos:twitter",color:"#1da1f2"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"#00a4ef"},discord:{name:"Discord",icon:"logos:discord-icon",color:"#5865f2"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"#0077b5"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"#e4405f"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"#000"},snapchat:{name:"Snapchat",icon:"logos:snapchat-icon",color:"#fffc00"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"#ff4500"},pinterest:{name:"Pinterest",icon:"logos:pinterest-icon",color:"#bd081c"},twitch:{name:"Twitch",icon:"logos:twitch",color:"#9146ff"},steam:{name:"Steam",icon:"logos:steam-icon",color:"#000"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"#313131"},playstation:{name:"PlayStation",icon:"logos:playstation-icon",color:"#003791"},xbox:{name:"Xbox",icon:"logos:xbox-icon",color:"#107c10"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"#25d366"},wechat:{name:"WeChat",icon:"logos:wechat-icon",color:"#1aad19"},amazon:{name:"Amazon",icon:"logos:amazon-icon",color:"#ff9900"},yahoo:{name:"Yahoo",icon:"logos:yahoo-icon",color:"#720e9e"},paypal:{name:"PayPal",icon:"logos:paypal",color:"#0070ba"},x:{name:"X",icon:"simple-icons:x",color:"#000"}};function G(t){return T[t]?.name||t}function oe(t){return T[t]?.icon||"mdi:account"}function ae(t){return T[t]?.color||"#666"}function ne(t,o="Continue with {provider}"){return o.replace("{provider}",G(t))}const B={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function re(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function j(t=32){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let a=0;a<t;a++)n+=o.charAt(Math.floor(Math.random()*o.length));return n}function se(t,o,n,a=[],c={}){const s={google:"https://accounts.google.com/oauth/authorize",github:"https://github.com/login/oauth/authorize",apple:"https://appleid.apple.com/auth/authorize",facebook:"https://www.facebook.com/v18.0/dialog/oauth",twitter:"https://twitter.com/i/oauth2/authorize",microsoft:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",discord:"https://discord.com/api/oauth2/authorize",linkedin:"https://www.linkedin.com/oauth/v2/authorization",instagram:"https://api.instagram.com/oauth/authorize",tiktok:"https://www.tiktok.com/v2/auth/authorize",snapchat:"https://accounts.snapchat.com/accounts/oauth2/authorize",reddit:"https://www.reddit.com/api/v1/authorize",pinterest:"https://api.pinterest.com/oauth/",twitch:"https://id.twitch.tv/oauth2/authorize",steam:"https://steamcommunity.com/oauth/authorize",epic:"https://auth.epicgames.com/authorize",playstation:"https://auth.api.sonyentertainmentnetwork.com/oauth/authorize",xbox:"https://login.live.com/oauth20_authorize.srf",whatsapp:"https://web.whatsapp.com/oauth/authorize",wechat:"https://open.weixin.qq.com/connect/qrconnect",amazon:"https://www.amazon.com/ap/oa",yahoo:"https://api.login.yahoo.com/oauth2/request_auth",paypal:"https://www.paypal.com/signin/authorize",x:"https://api.twitter.com/oauth2/authorize"},u={google:["openid","email","profile"],github:["user:email"],apple:["email","name"],facebook:["email"],twitter:["users.read"],microsoft:["openid","email","profile"],discord:["identify","email"],linkedin:["r_liteprofile","r_emailaddress"],instagram:["user_profile","user_media"],tiktok:["user.info.basic","user.external.id"],snapchat:["user.info.basic","user.external.id"],reddit:["identity","email"],pinterest:["read_public","read_relationships"],twitch:["openid","email","profile"],steam:["openid","email","profile"],epic:["openid","email","profile"],playstation:["openid","email","profile"],xbox:["openid","email","profile"],whatsapp:["openid","email","profile"],wechat:["openid","email","profile"],amazon:["openid","email","profile"],yahoo:["openid","email","profile"],paypal:["openid","email","profile"],x:["openid","email","profile"]},r=s[t];if(!r)throw new Error(`Unsupported provider: ${t}`);const l=a.length>0?a:u[t],i=j(),h=new URLSearchParams({client_id:o,redirect_uri:n,scope:l.join(" "),state:i,response_type:"code",...c});return`${r}?${h.toString()}`}function ie(t,o,n,a){const c=window.open(t,`${o}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){a?.(new Error("Failed to open popup window"));return}const s=setInterval(()=>{c.closed&&(clearInterval(s),a?.(new Error("Login cancelled")))},1e3),u=r=>{r.origin===window.location.origin&&(r.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(s),c.close(),window.removeEventListener("message",u),n?.(r.data.result)):r.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(s),c.close(),window.removeEventListener("message",u),a?.(new Error(r.data.error))))};window.addEventListener("message",u)}function ce(t){return t instanceof Error?t.message:typeof t=="string"?t:t&&typeof t=="object"&&"message"in t?String(t.message):"An unexpected error occurred"}function le(){return typeof window<"u"&&typeof document<"u"}function $({task:t,message:o,onStart:n,onEnd:a}){return async c=>{n?.();const s=await L.taskToValidation({task:t!=null?()=>t(c):async()=>null,errorMessage:o,errorPath:["root"],validation:u=>u!=null?P.i.invalid({message:u}):P.i.valid});return a?.(),s}}function E(t=B,o){const n=o??m.defaultMessages;let a=f.string();return t.minLength&&(a=a.min(t.minLength,(n.passwordMinLength??m.defaultMessages.passwordMinLength)(t.minLength))),t.requireUppercase&&(a=a.regex(/[A-Z]/,n.passwordRequireUppercase??m.defaultMessages.passwordRequireUppercase)),t.requireLowercase&&(a=a.regex(/[a-z]/,n.passwordRequireLowercase??m.defaultMessages.passwordRequireLowercase)),t.requireNumbers&&(a=a.regex(/[0-9]/,n.passwordRequireNumber??m.defaultMessages.passwordRequireNumber)),t.requireSymbols&&(a=a.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,n.passwordRequireSpecialChar??m.defaultMessages.passwordRequireSpecialChar)),t.customValidation&&(a=a.refine(c=>t.customValidation(c))),a}function A(t){const o=t??m.defaultMessages;return f.string().min(1,o.emailRequired??m.defaultMessages.emailRequired).email(o.invalidEmail??m.defaultMessages.invalidEmail)}const N=A();function M(t,o){const n=o??m.defaultMessages,a=t?E(t,o):f.string().refine(c=>c.length>0?null:n.passwordRequired??m.defaultMessages.passwordRequired);return f.object({email:A(o),password:a,rememberMe:f.boolean().default(!1)}).schema()}function z(t=B,o,n){const a=n??m.defaultMessages,c=E(t,n),s=o?.showNameField!==!1,u=o?.showConfirmPassword!==!1,r=o?.showAcceptTermsAndConditions!==!1,l={name:s?f.string().min(1,a.nameRequired??m.defaultMessages.nameRequired).optional():f.string().optional(),email:A(n),password:c,confirmPassword:u?f.string().min(1,a.confirmPasswordRequired??m.defaultMessages.confirmPasswordRequired):f.string(),acceptTerms:r?f.boolean().refine(h=>h===!0,a.acceptTermsRequired??m.defaultMessages.acceptTermsRequired):f.boolean().default(!0)},i=f.object(l);return u?i.refine(h=>h.password===h.confirmPassword?null:a.passwordsDoNotMatch??m.defaultMessages.passwordsDoNotMatch,{path:["confirmPassword"]}).schema():i.schema()}const V=f.object({email:N}).schema(),ue=M(),me=z(),de={signIn:M,signUp:z,resetPassword:()=>V};function pe(t,o){const n=o??m.defaultMessages,c=(o?A(o):N).validate(t);return c.success?null:c.errors[0]?.message||(n.invalidEmailAddress??m.defaultMessages.invalidEmailAddress)}function he(t,o=B,n){const a=n??m.defaultMessages,s=E(o,n).validate(t);return s.success?null:s.errors[0]?.message||(a.invalidPassword??m.defaultMessages.invalidPassword)}function R(t,o=B){const n={length:t.length>=(o.minLength||8),uppercase:/[A-Z]/.test(t),lowercase:/[a-z]/.test(t),numbers:/[0-9]/.test(t),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(t),custom:o.customValidation?o.customValidation(t)===null:t.length>0},a=[!0,o.requireUppercase,o.requireLowercase,o.requireNumbers,o.requireSymbols,!!o.customValidation].filter(Boolean).length,c=[n.length,o.requireUppercase?n.uppercase:null,o.requireLowercase?n.lowercase:null,o.requireNumbers?n.numbers:null,o.requireSymbols?n.symbols:null,o.customValidation?n.custom:null].filter(r=>r===!0).length,s=a>0?Math.round(c/a*100):0;let u;return s<40?u="weak":s<60?u="fair":s<80?u="good":u="strong",{strength:u,score:s,checks:n}}const D=()=>e.localStorageProp({key:"bui_auth_email",defaultValue:null});function H({onSignIn:t,passwordRules:o,labels:n,showRememberMe:a}){const c=e.prop(!1),s=D(),u=M(o),r=L.useForm({schema:u,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{c.set(!0),r.controller.disable()},onEnd:()=>{c.set(!1),r.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:l,submit:i}=r;c.on(l.setDisabled);const h=l.field("email"),w=l.field("password");return s.on(b=>{b!=null&&h.change(b)}),h.signal.on(b=>{s.value!=null&&(s.value=b)}),e.Use(m.AuthI18n,b=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(i),P.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(l.error,_=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(_))),L.Control(y.EmailInput,{controller:h,label:e.coalesce(n?.emailLabel,b.$.emailLabel)}),L.Control(y.PasswordInput,{controller:w,label:e.coalesce(n?.passwordLabel,b.$.passwordLabel)}),e.When(a??!0,()=>e.html.div(e.attr.class("bc-auth-form__remember-me"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:s.map(_=>_!=null),after:e.html.span(e.coalesce(n?.rememberMeLabel,b.$.rememberMeLabel)),onChange:_=>{_?s.value=h.signal.value??"":s.value=null}}))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:l.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(n?.signInButton,b.$.signInButton))))}function X({password:t,rules:o=B,showLabel:n=!0,className:a}){const c=e.computedOf(t)(i=>!i||i.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:R(i,o)),s=c.map(i=>i.strength),u=c.map(i=>i.score),r=c.map(i=>i.checks),l=e.computedOf(s,a)((i,h)=>["bc-password-strength",`bc-password-strength--${i}`,h].filter(Boolean).join(" "));return e.html.div(e.attr.class(l),e.html.div(e.attr.class("bc-password-strength__bar"),e.html.div(e.attr.class("bc-password-strength__fill"),e.attr.style(u.map(i=>`width: ${i}%`)))),e.When(n,()=>e.Use(m.AuthI18n,i=>e.html.div(e.attr.class("bc-password-strength__label"),e.computedOf(s,i)((h,w)=>{switch(h){case"weak":return w.passwordStrengthWeak;case"fair":return w.passwordStrengthFair;case"good":return w.passwordStrengthGood;case"strong":return w.passwordStrengthStrong;default:return w.passwordStrengthWeak}})))),e.html.div(e.attr.class("bc-password-strength__requirements"),e.When(o.minLength!==void 0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.length?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.length?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),`At least ${o.minLength} characters`))),e.When(o.requireUppercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.uppercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.uppercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),e.When(o.requireLowercase===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.lowercase?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.lowercase?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),e.When(o.requireNumbers===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.numbers?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.numbers?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One number"))),e.When(o.requireSymbols===!0,()=>e.html.div(e.attr.class("bc-password-strength__requirement"),e.attr.class(e.computedOf(r)(i=>i.symbols?"bc-password-strength__requirement--met":"")),e.html.span(e.attr.class("bc-password-strength__requirement-icon"),e.computedOf(r)(i=>i.symbols?"✓":"○")),e.html.span(e.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function ge({password:t,rules:o=B,className:n}){const a=e.computedOf(t)(r=>!r||r.length===0?{strength:"weak",score:0}:R(r,o)),c=a.map(r=>r.strength),s=a.map(r=>r.score),u=e.computedOf(c,n)((r,l)=>["bc-password-strength-bar",`bc-password-strength-bar--${r}`,l].filter(Boolean).join(" "));return e.html.div(e.attr.class(u),e.html.div(e.attr.class("bc-password-strength-bar__fill"),e.attr.style(s.map(r=>`width: ${r}%`))))}function fe({password:t,rules:o=B,className:n}){const a=e.computedOf(t)(s=>!s||s.length===0?"weak":R(s,o).strength),c=e.computedOf(a,n)((s,u)=>["bc-password-strength-text",`bc-password-strength-text--${s}`,u].filter(Boolean).join(" "));return e.Use(m.AuthI18n,s=>e.html.span(e.attr.class(c),e.computedOf(a,s)((u,r)=>{switch(u){case"weak":return r.passwordStrengthWeak;case"fair":return r.passwordStrengthFair;case"good":return r.passwordStrengthGood;case"strong":return r.passwordStrengthStrong;default:return r.passwordStrengthWeak}})))}function Y({passwordRules:t,labels:o,initialEmail:n,initialName:a,showPasswordStrength:c,onSignUp:s,showNameField:u,showConfirmPassword:r,showAcceptTermsAndConditions:l,termsAndConditions:i}){const h=e.prop(!1),w=t||B,b=z(w,{showNameField:u!==!1,showConfirmPassword:r!==!1,showAcceptTermsAndConditions:l!==!1}),_=L.useForm({schema:b,onSubmit:$({task:s!=null?g=>s({email:g.email,password:g.password,name:g.name,acceptTerms:g.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{h.set(!0),_.controller.disable()},onEnd:()=>{h.set(!1),_.controller.enable()}}),initialValue:{name:a??"",email:n??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:v,submit:U}=_;h.on(v.setDisabled);const q=v.field("name"),S=v.field("email"),x=v.field("password"),O=v.field("confirmPassword"),I=v.field("acceptTerms");return e.Use(m.AuthI18n,g=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(U),P.Stack(e.attr.class("bc-auth-form__fields"),e.Ensure(v.error,k=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(k))),e.When(u!==!1,()=>L.Control(Q.TextInput,{controller:q.transform(k=>k??"",k=>k===""?void 0:k),label:e.coalesce(o?.nameLabel,g.$.nameLabel)})),L.Control(y.EmailInput,{controller:S,label:e.coalesce(o?.emailLabel,g.$.emailLabel)}),L.Control(y.PasswordInput,{controller:x,label:e.coalesce(o?.passwordLabel,g.$.passwordLabel)}),e.When(c??!1,()=>X({password:x.signal,rules:w,showLabel:!0})),e.When(r??!1,()=>L.Control(y.PasswordInput,{controller:O,label:e.coalesce(o?.confirmPasswordLabel,g.$.confirmPasswordLabel)})),e.When(l??!1,()=>e.html.div(e.attr.class("bc-auth-form__terms"),e.html.label(e.attr.class("bc-auth-form__checkbox-label"),L.CheckboxInput({value:I.signal.map(k=>k??!1),onChange:k=>I.change(k)}),e.html.span(i||e.coalesce(o?.acceptTermsLabel,g.$.acceptTermsLabel))),e.When(I.errorVisible,()=>e.html.div(e.attr.class("bc-auth-form__field-error"),I.error.map(k=>k||"")))))),C.Button({type:"submit",variant:"filled",color:"primary",loading:h,disabled:v.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.signUpButton,g.$.signUpButton))))}function Z({onResetPassword:t,labels:o={}}){const n=D(),a=e.prop(!1),c=L.useForm({schema:V,onSubmit:$({task:t,message:"Reset password failed",onStart:()=>{a.set(!0),c.controller.disable()},onEnd:()=>{a.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:s,submit:u}=c;a.on(s.setDisabled);const r=s.field("email");return n.on(l=>{l!=null&&r.change(l)}),e.Use(m.AuthI18n,l=>e.html.form(e.attr.class("bc-auth-form__form"),e.Ensure(s.error,i=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(i))),e.html.p(e.attr.class("bc-auth-form__description"),e.coalesce(o?.resetPasswordDescription,l.$.resetPasswordDescription)),e.on.submit(u),P.Stack(e.attr.class("bc-auth-form__fields"),L.Control(y.EmailInput,{controller:r,label:e.coalesce(o?.emailLabel,l.$.emailLabel)})),C.Button({loading:a,type:"submit",variant:"filled",color:"primary",disabled:s.disabledOrHasErrors},e.attr.class("bc-auth-form__submit"),e.coalesce(o?.resetPasswordButton,l.$.resetPasswordButton))))}function p({provider:t,onClick:o,size:n="md",name:a,icon:c,color:s,flow:u,labels:r}){const l=async()=>{if(o)try{u==="popup"?await o():await o()}catch(i){console.error(`Social login error for ${t} (${u||"redirect"} flow):`,i)}};return C.Button({type:"button",variant:"filled",size:n,color:s,onClick:l,roundedness:"full"},e.attr.class("bc-social-login-button"),e.attr.class(e.computedOf(t)(i=>`bc-social-login-button--${i}`)),e.html.span(e.attr.class("bc-social-login-button__inner"),e.html.span(e.attr.class("bc-social-login-button__icon"),ee.Icon({icon:c,size:n},e.attr.class("bc-social-login-button__icon-inner"))),e.Use(m.AuthI18n,i=>e.html.span(e.attr.class("bc-social-login-button__label"),e.bind(e.coalesce(r?.continueWithProvider,i.$.continueWithProvider))(a)))))}function J({providers:t,onProviderClick:o,size:n="md",className:a}){return P.Stack(e.attr.class("bc-social-login-buttons"),e.attr.class(a),e.ForEach(t,c=>p({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:s})=>d[s].color),name:c.map(({provider:s})=>d[s].name),icon:c.map(({provider:s})=>d[s].icon),onClick:async()=>{o&&await o(c.$.provider.value)},size:n})))}const d={google:{name:"Google",icon:"logos:google-icon",color:"red"},github:{name:"GitHub",icon:"logos:github-icon",color:"black"},apple:{name:"Apple",icon:"logos:apple",color:"stone"},facebook:{name:"Facebook",icon:"logos:facebook",color:"blue"},twitter:{name:"Twitter",icon:"logos:twitter",color:"sky"},x:{name:"X",icon:"logos:x",color:"zinc"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"amber"},discord:{name:"Discord",icon:"logos:discord-icon",color:"indigo"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"cyan"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"fuchsia"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"teal"},snapchat:{name:"Snapchat",icon:"simple-icons:snapchat",color:"yellow"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"orange"},pinterest:{name:"Pinterest",icon:"logos:pinterest",color:"rose"},twitch:{name:"Twitch",icon:"logos:twitch",color:"purple"},steam:{name:"Steam",icon:"logos:steam",color:"slate"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"neutral"},playstation:{name:"PlayStation",icon:"simple-icons:playstation",color:"violet"},xbox:{name:"Xbox",icon:"simple-icons:xbox",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"simple-icons:wechat",color:"lime"},amazon:{name:"Amazon",icon:"simple-icons:amazon",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},we=t=>p({...t,...d.google,provider:"google"}),be=t=>p({...t,...d.github,provider:"github"}),Le=t=>p({...t,...d.apple,provider:"apple"}),_e=t=>p({...t,...d.facebook,provider:"facebook"}),ke=t=>p({...t,...d.x,provider:"x"}),ve=t=>p({...t,...d.twitter,provider:"twitter"}),Se=t=>p({...t,...d.microsoft,provider:"microsoft"}),Pe=t=>p({...t,...d.discord,provider:"discord"}),ye=t=>p({...t,...d.linkedin,provider:"linkedin"}),Be=t=>p({...t,...d.instagram,provider:"instagram"}),qe=t=>p({...t,...d.tiktok,provider:"tiktok"}),Ie=t=>p({...t,...d.snapchat,provider:"snapchat"}),xe=t=>p({...t,...d.reddit,provider:"reddit"}),Ae=t=>p({...t,...d.pinterest,provider:"pinterest"}),Ce=t=>p({...t,...d.twitch,provider:"twitch"}),Te=t=>p({...t,...d.steam,provider:"steam"}),$e=t=>p({...t,...d.epic,provider:"epic"}),Ee=t=>p({...t,...d.playstation,provider:"playstation"}),Me=t=>p({...t,...d.xbox,provider:"xbox"}),ze=t=>p({...t,...d.whatsapp,provider:"whatsapp"}),Re=t=>p({...t,...d.wechat,provider:"wechat"}),Ue=t=>p({...t,...d.amazon,provider:"amazon"}),Oe=t=>p({...t,...d.yahoo,provider:"yahoo"}),We=t=>p({...t,...d.paypal,provider:"paypal"});function W({providers:t,onSocialLogin:o}){return P.Stack(J({providers:t,onProviderClick:o}))}function K({mode:t,socialProviders:o,initialName:n,initialEmail:a,passwordRules:c,showRememberMe:s,showSocialDivider:u,showPasswordStrength:r,labels:l,onSignIn:i,onSignUp:h,onResetPassword:w,onModeChange:b,onSocialLogin:_,showContainer:v},...U){const q=t!=null?e.Value.deriveProp(t):e.prop("signin");return q.on(S=>b?.(S)),e.Use(m.AuthI18n,S=>{function x(){const g=e.coalesce(l?.hasAccountLink,S.$.hasAccountLink);return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>q.set("signin")),g)}function O(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>q.set("signup")),e.coalesce(l?.noAccountLink,S.$.noAccountLink))}function I(){return e.html.button(e.attr.type("button"),e.attr.class("bc-auth-form__link"),e.on.click(()=>q.set("reset-password")),e.coalesce(l?.forgotPasswordLink,S.$.forgotPasswordLink))}return e.html.div(te.classes({"bc-auth-container":!0,"bc-auth-container--styled":e.Value.map(v??!0,g=>g)}),e.attr.class(q.map(g=>`bc-auth-container--${g}`)),e.attr.class("bc-auth-form"),e.OneOfValue(q,{signin:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signInTitle,S.$.signInTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,H({onSignIn:i,showRememberMe:s,passwordRules:c,labels:{emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,rememberMeLabel:l?.rememberMeLabel,signInButton:l?.signInButton,forgotPasswordLink:l?.forgotPasswordLink,noAccountLink:l?.noAccountLink}}),P.Stack(e.attr.class("bc-auth-form__footer"),O(),I())),signup:()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.signUpTitle,S.$.signUpTitle)),o!=null?e.Fragment(W({providers:o,onSocialLogin:_}),e.When(u??!1,F)):null,Y({labels:{nameLabel:l?.nameLabel,emailLabel:l?.emailLabel,passwordLabel:l?.passwordLabel,confirmPasswordLabel:l?.confirmPasswordLabel,acceptTermsLabel:l?.acceptTermsLabel,signUpButton:l?.signUpButton,hasAccountLink:l?.hasAccountLink},initialEmail:a,initialName:n,onSignUp:h,passwordRules:c,showPasswordStrength:r}),P.Stack(e.attr.class("bc-auth-form__footer"),x())),"reset-password":()=>e.Fragment(e.html.h2(e.attr.class("bc-auth-form__title"),e.coalesce(l?.resetPasswordTitle,S.$.resetPasswordTitle)),Z({labels:{backToSignInLink:l?.backToSignInLink,emailLabel:l?.emailLabel,resetPasswordButton:l?.resetPasswordButton,resetPasswordDescription:l?.resetPasswordDescription},onResetPassword:w}),P.Stack(e.attr.class("bc-auth-form__footer"),x()))}),...U)})}function Fe(t){return f.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(o,n)=>t(a=>o({body:K({showContainer:!1,...a}),header:e.Use(m.AuthI18n,c=>e.coalesce(a.modalTitle,c.$.authenticationTitle))})))}function F({labels:t,className:o}={}){return e.html.div(e.attr.class("bc-auth-divider"),e.attr.class(o),e.html.div(e.attr.class("bc-auth-divider__line")),e.Use(m.AuthI18n,n=>e.html.span(e.attr.class("bc-auth-divider__text"),e.coalesce(t?.text,n.$.orDivider))),e.html.div(e.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=Ue;exports.AppleLoginButton=Le;exports.AuthContainer=K;exports.AuthDivider=F;exports.AuthModal=Fe;exports.DiscordLoginButton=Pe;exports.EpicLoginButton=$e;exports.FacebookLoginButton=_e;exports.GitHubLoginButton=be;exports.GoogleLoginButton=we;exports.InstagramLoginButton=Be;exports.LinkedInLoginButton=ye;exports.MicrosoftLoginButton=Se;exports.PasswordStrengthBar=ge;exports.PasswordStrengthIndicator=X;exports.PasswordStrengthText=fe;exports.PayPalLoginButton=We;exports.PinterestLoginButton=Ae;exports.PlayStationLoginButton=Ee;exports.RedditLoginButton=xe;exports.ResetPasswordForm=Z;exports.SignInForm=H;exports.SignUpForm=Y;exports.SnapchatLoginButton=Ie;exports.SocialLoginButton=p;exports.SocialLoginButtons=J;exports.SocialProviders=W;exports.SteamLoginButton=Te;exports.TiktokLoginButton=qe;exports.TwitchLoginButton=Ce;exports.TwitterLoginButton=ve;exports.WeChatLoginButton=Re;exports.WhatsAppLoginButton=ze;exports.XLoginButtin=ke;exports.XboxLoginButton=Me;exports.YahooLoginButton=Oe;exports.authSchemas=de;exports.calculatePasswordStrength=R;exports.createEmailSchema=A;exports.createPasswordSchema=E;exports.createSignInSchema=M;exports.createSignUpSchema=z;exports.createSocialLoginUrl=se;exports.defaultPasswordRules=B;exports.defaultSignInSchema=ue;exports.defaultSignUpSchema=me;exports.emailSchema=N;exports.formatAuthError=ce;exports.formatProviderName=G;exports.formatSocialLoginText=ne;exports.generateRandomString=j;exports.getProviderColor=ae;exports.getProviderIcon=oe;exports.isBrowser=le;exports.isValidEmail=re;exports.openSocialLoginPopup=ie;exports.providerInfo=T;exports.requestToControllerValidation=$;exports.resetPasswordSchema=V;exports.socialProviderInfo=d;exports.useAuthEmailProp=D;exports.validateEmail=pe;exports.validatePassword=he;
|
package/dist/beatui.css
CHANGED
|
@@ -875,6 +875,29 @@ input:where([type='button'], [type='reset'], [type='submit']),
|
|
|
875
875
|
display: none !important;
|
|
876
876
|
}
|
|
877
877
|
|
|
878
|
+
/* Default (light) semantic tokens at :root so components work without .dark/.light class */
|
|
879
|
+
:root {
|
|
880
|
+
--text-normal: var(--text-normal-light);
|
|
881
|
+
--text-muted: var(--text-muted-light);
|
|
882
|
+
--text-inverted: var(--text-inverted-light);
|
|
883
|
+
--bg-background: var(--bg-background-light);
|
|
884
|
+
--bg-surface: var(--bg-surface-light);
|
|
885
|
+
--bg-subtle: var(--bg-subtle-light);
|
|
886
|
+
--bg-elevated: var(--bg-elevated-light);
|
|
887
|
+
--bg-raised: var(--bg-raised-light);
|
|
888
|
+
--bg-overlay: var(--bg-overlay-light);
|
|
889
|
+
--border-subtle: var(--border-subtle-light);
|
|
890
|
+
--border-muted: var(--border-muted-light);
|
|
891
|
+
--border-default: var(--border-border-light);
|
|
892
|
+
--border-divider: var(--border-divider-light);
|
|
893
|
+
--border-input: var(--border-input-light);
|
|
894
|
+
--border-strong: var(--border-strong-light);
|
|
895
|
+
--border-inverted: var(--border-inverted-light);
|
|
896
|
+
--interactive-focus: var(--interactive-focus-light);
|
|
897
|
+
--interactive-hover: var(--interactive-hover-light);
|
|
898
|
+
--interactive-active: var(--interactive-active-light);
|
|
899
|
+
}
|
|
900
|
+
|
|
878
901
|
/* BeatUI theme helpers */
|
|
879
902
|
.dark {
|
|
880
903
|
color-scheme: dark;
|
package/dist/beatui.tailwind.css
CHANGED
|
@@ -547,6 +547,29 @@
|
|
|
547
547
|
|
|
548
548
|
}
|
|
549
549
|
@layer base {
|
|
550
|
+
/* Default (light) semantic tokens at :root so components work without .dark/.light class */
|
|
551
|
+
:root {
|
|
552
|
+
--text-normal: var(--text-normal-light);
|
|
553
|
+
--text-muted: var(--text-muted-light);
|
|
554
|
+
--text-inverted: var(--text-inverted-light);
|
|
555
|
+
--bg-background: var(--bg-background-light);
|
|
556
|
+
--bg-surface: var(--bg-surface-light);
|
|
557
|
+
--bg-subtle: var(--bg-subtle-light);
|
|
558
|
+
--bg-elevated: var(--bg-elevated-light);
|
|
559
|
+
--bg-raised: var(--bg-raised-light);
|
|
560
|
+
--bg-overlay: var(--bg-overlay-light);
|
|
561
|
+
--border-subtle: var(--border-subtle-light);
|
|
562
|
+
--border-muted: var(--border-muted-light);
|
|
563
|
+
--border-default: var(--border-border-light);
|
|
564
|
+
--border-divider: var(--border-divider-light);
|
|
565
|
+
--border-input: var(--border-input-light);
|
|
566
|
+
--border-strong: var(--border-strong-light);
|
|
567
|
+
--border-inverted: var(--border-inverted-light);
|
|
568
|
+
--interactive-focus: var(--interactive-focus-light);
|
|
569
|
+
--interactive-hover: var(--interactive-hover-light);
|
|
570
|
+
--interactive-active: var(--interactive-active-light);
|
|
571
|
+
}
|
|
572
|
+
|
|
550
573
|
/* BeatUI theme helpers */
|
|
551
574
|
.dark {
|
|
552
575
|
color-scheme: dark;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),L=require("../auth-divider-V_Se6Qhe.cjs"),I=require("../translations-gVgMyNno.cjs"),w=require("../notice-DMK7dx9a.cjs"),y=require("../stack-DcZ_u50f.cjs"),b=require("../input-container-B31Seozh.cjs"),v=require("../text-input-w0eVcqk5.cjs");function g(a,t){return a.error?(t.onError?.({message:a.error.message,status:a.error.status}),a.error.message):null}function F(a,t,s){return async n=>{const i=await a.signIn.email({email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function A(a,t,s){return async n=>{const i=await a.signUp.email({name:n.name,email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function U(a,t){return async s=>{const n=await a.requestPasswordReset({email:s.email,redirectTo:t.callbackURL});return g(n,t)}}function $(a,t){return async s=>{const n=await a.signIn.social({provider:s,callbackURL:t.callbackURL,errorCallbackURL:t.errorCallbackURL});g(n,t)}}function P(a,t={}){const s=e.prop(null),n=e.prop(!0),i=e.computedOf(s)(h=>h?.user??null),o=e.computedOf(s)(h=>h!=null);let u;async function d(){try{const h=await a.getSession();h.error||!h.data?s.set(null):s.set({user:h.data.user,session:h.data.session})}catch{s.set(null)}finally{n.set(!1)}}t.onSessionChange&&s.on(t.onSessionChange),d(),t.refreshInterval&&t.refreshInterval>0&&(u=setInterval(d,t.refreshInterval));function p(){u!=null&&(clearInterval(u),u=void 0),s.dispose(),n.dispose(),i.dispose(),o.dispose()}return{session:s,isPending:n,user:i,isAuthenticated:o,refresh:d,dispose:p}}function _(a){return a.map(t=>({provider:t}))}function C(a,t={}){const s=P(a,{refreshInterval:t.refreshInterval,onSessionChange:t.onSessionChange}),n=()=>s.refresh(),i=F(a,t,n),o=A(a,t,n),u=U(a,t),d=$(a,t),p=t.socialProviders?_(t.socialProviders):[],h={onSignIn:i,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,labels:t.labels?{emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,rememberMeLabel:t.labels.rememberMeLabel,signInButton:t.labels.signInButton,forgotPasswordLink:t.labels.forgotPasswordLink,noAccountLink:t.labels.noAccountLink}:void 0},c={onSignUp:o,passwordRules:t.passwordRules,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels?{nameLabel:t.labels.nameLabel,emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,confirmPasswordLabel:t.labels.confirmPasswordLabel,acceptTermsLabel:t.labels.acceptTermsLabel,signUpButton:t.labels.signUpButton,hasAccountLink:t.labels.hasAccountLink}:void 0},m={onResetPassword:u,labels:t.labels?{resetPasswordButton:t.labels.resetPasswordButton,resetPasswordDescription:t.labels.resetPasswordDescription,emailLabel:t.labels.emailLabel,backToSignInLink:t.labels.backToSignInLink}:void 0},l={onSignIn:i,onSignUp:o,onResetPassword:u,onSocialLogin:d,socialProviders:p.length>0?p:void 0,showSocialDivider:p.length>0,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels};async function r(){await a.signOut(),await n()}function f(){s.dispose()}return{session:s.session,isPending:s.isPending,user:s.user,isAuthenticated:s.isAuthenticated,containerOptions:l,signInOptions:h,signUpOptions:c,resetOptions:m,socialProviders:p,signOut:r,refreshSession:n,dispose:f}}const R={mark:e.makeProviderMark("BetterAuth"),create:a=>{if(!a)throw new Error("BetterAuth provider requires a client option");const t=C(a.client,a);return{value:t,dispose:()=>t.dispose()}}};function E(a,t,...s){return L.AuthContainer({...a.containerOptions,...t},...s)}function O(a,t){return L.AuthModal(s=>t(n=>s({...a.containerOptions,...n})))}function M(a,t){return e.When(a.isAuthenticated,t)}function D(a,t){return e.Unless(a.isAuthenticated,t)}const T={twoFactorSetupDescription:"Enter your password to enable two-factor authentication.",twoFactorEnableButton:"Enable 2FA",twoFactorVerifyButton:"Verify",twoFactorScanDescription:"Scan the code below with your authenticator app, then enter the verification code.",twoFactorBackupCodesDescription:"Save these backup codes in a safe place. You can use them to sign in if you lose access to your authenticator.",twoFactorCodePlaceholder:"Enter 6-digit code",twoFactorBackupCodePlaceholder:"Enter backup code",twoFactorEnabled:"Two-factor authentication has been enabled.",twoFactorTotpDescription:"Enter the code from your authenticator app.",twoFactorOtpDescription:"Enter the one-time code sent to you.",twoFactorBackupDescription:"Enter one of your backup codes.",twoFactorSendOtpButton:"Send Code",twoFactorMethodLabel:a=>{switch(a){case"totp":return"Authenticator";case"otp":return"Email/SMS";case"backup":return"Backup Code";default:return a}},passwordPlaceholder:"Enter your password",magicLinkDescription:"Enter your email to receive a sign-in link.",magicLinkSendButton:"Send Magic Link",magicLinkSent:"A sign-in link has been sent to your email.",passkeySignInButton:"Sign in with Passkey",passkeyAddButton:"Add Passkey",passkeyDeleteButton:"Delete",passkeyRenameButton:"Rename",passkeySaveButton:"Save",passkeyCancelButton:"Cancel",passkeyNamePlaceholder:"Passkey name (optional)",passkeyUnnamed:"Unnamed passkey"},B=T,S="en",N=Object.assign({}),k=I.makeI18nProvider({defaultLocale:S,defaultMessages:B,localeLoader:async a=>{if(a===S)return B;const t=N[`./locales/${a}.ts`];return t?await t():B},providerName:"BetterAuthI18n"});function q({twoFactor:a,issuer:t,onComplete:s}){const n=e.prop(""),i=e.prop(null),o=e.prop([]),u=e.prop(""),d=e.prop(null),p=e.prop(!1),h=e.prop("password");async function c(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.enable({password:n.value,issuer:t});if(p.set(!1),r.error){d.set(r.error.message);return}r.data&&(i.set(r.data.totpURI),o.set(r.data.backupCodes),h.set("verify"))}async function m(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.verifyTotp({code:u.value});if(p.set(!1),r.error){d.set(r.error.message);return}h.set("complete"),s?.()}return e.Use(k,l=>e.html.div(e.attr.class("bc-two-factor"),e.Ensure(d,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.OneOfValue(h,{password:()=>e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(c),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),l.$.twoFactorSetupDescription),w.PasswordInput({value:n,onChange:r=>n.set(r),placeholder:l.$.passwordPlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorEnableButton))),verify:()=>e.Fragment(e.Ensure(i,r=>e.html.div(e.attr.class("bc-two-factor__totp-uri"),e.html.p(l.$.twoFactorScanDescription),e.html.code(e.attr.class("bc-two-factor__code-display"),r))),e.NotEmpty(o,()=>e.html.div(e.attr.class("bc-two-factor__backup-codes"),e.html.p(l.$.twoFactorBackupCodesDescription),e.html.ul(e.ForEach(o,r=>e.html.li(r))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(m),y.Stack(v.TextInput({value:u,onChange:r=>u.set(r),placeholder:l.$.twoFactorCodePlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorVerifyButton)))),complete:()=>e.html.div(e.attr.class("bc-two-factor__complete"),w.Notice({variant:"success",tone:"prominent"},e.html.div(l.$.twoFactorEnabled)))})))}function x({twoFactor:a,methods:t=["totp","backup"],trustDevice:s,onVerified:n}){const i=e.prop(""),o=e.prop(null),u=e.prop(!1),d=e.prop(t[0]??"totp");async function p(c){c.preventDefault(),u.set(!0),o.set(null);const m=d.value;let l;if(m==="totp")l=await a.verifyTotp({code:i.value,trustDevice:s});else if(m==="otp"&&a.verifyOtp)l=await a.verifyOtp({code:i.value,trustDevice:s});else if(m==="backup")l=await a.verifyBackupCode({code:i.value});else{o.set("Unsupported verification method"),u.set(!1);return}if(u.set(!1),l.error){o.set(l.error.message);return}n?.()}async function h(){if(!a.sendOtp)return;u.set(!0),o.set(null);const c=await a.sendOtp({trustDevice:s});u.set(!1),c.error&&o.set(c.error.message)}return e.Use(k,c=>{const m=e.computedOf(d,c)((r,f)=>r==="totp"?f.twoFactorTotpDescription:r==="otp"?f.twoFactorOtpDescription:f.twoFactorBackupDescription),l=e.computedOf(d,c)((r,f)=>r==="backup"?f.twoFactorBackupCodePlaceholder:f.twoFactorCodePlaceholder);return e.html.div(e.attr.class("bc-two-factor"),e.Ensure(o,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.When(t.length>1,()=>e.html.div(e.attr.class("bc-two-factor__methods"),...t.map(r=>e.html.button(e.attr.type("button"),e.attr.class("bc-two-factor__method-button"),e.attr.class(d.map(f=>f===r?"bc-two-factor__method-button--active":"")),e.on.click(()=>{d.set(r),i.set(""),o.set(null)}),c.$.twoFactorMethodLabel.map(f=>f(r)))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(p),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),m),e.When(d.map(r=>r==="otp"&&a.sendOtp!=null),()=>b.Button({type:"button",variant:"outline",color:"primary",onClick:h,loading:u},c.$.twoFactorSendOtpButton)),v.TextInput({value:i,onChange:r=>i.set(r),placeholder:l}),b.Button({type:"submit",variant:"filled",color:"primary",loading:u},e.attr.class("bc-auth-form__submit"),c.$.twoFactorVerifyButton))))})}function V({client:a,callbackURL:t}){const s=e.prop(""),n=e.prop(null),i=e.prop(!1),o=e.prop(!1);async function u(d){if(d.preventDefault(),!a.signIn.magicLink){n.set("Magic link sign-in is not configured");return}i.set(!0),n.set(null);const p=await a.signIn.magicLink({email:s.value,callbackURL:t});if(i.set(!1),p.error){n.set(p.error.message);return}o.set(!0)}return e.Use(k,d=>e.html.div(e.attr.class("bc-auth-form"),e.Ensure(n,p=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(p))),e.Unless(o,()=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(u),y.Stack(e.attr.class("bc-auth-form__fields"),e.html.p(e.attr.class("bc-auth-form__description"),d.$.magicLinkDescription),w.EmailInput({value:s,onChange:p=>s.set(p)}),b.Button({type:"submit",variant:"filled",color:"primary",loading:i},e.attr.class("bc-auth-form__submit"),d.$.magicLinkSendButton)))),e.When(o,()=>w.Notice({variant:"success",tone:"prominent"},e.html.div(d.$.magicLinkSent)))))}function W({client:a,autoFill:t,onSuccess:s,onError:n}){const i=e.prop(!1);async function o(){if(!a.signIn.passkey)return;i.set(!0);const u=await a.signIn.passkey({autoFill:t});if(i.set(!1),u.error){n?.({message:u.error.message,status:u.error.status});return}s?.()}return e.Use(k,u=>b.Button({type:"button",variant:"outline",color:"primary",onClick:o,loading:i},e.attr.class("bc-passkey-signin"),u.$.passkeySignInButton))}function z({passkey:a}){const t=e.prop([]),s=e.prop(null),n=e.prop(!1),i=e.prop("");async function o(c,m){n.set(!0),s.set(null);const l=await c();if(n.set(!1),l.error){s.set(l.error.message);return}await m?.(l.data)}async function u(){await o(()=>a.listUserPasskeys(),c=>t.set(c??[]))}async function d(){const c=i.value||void 0;await o(()=>a.addPasskey({name:c}),async()=>{i.set(""),await u()})}async function p(c){await o(()=>a.deletePasskey({id:c}),()=>u())}async function h(c,m){await o(()=>a.updatePasskey({id:c,name:m}),()=>u())}return u(),e.Use(k,c=>e.html.div(e.attr.class("bc-passkey-management"),e.Ensure(s,m=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(m))),e.html.div(e.attr.class("bc-passkey-list"),e.ForEach(t,m=>{const l=e.prop(!1),r=e.prop(m.$.name?.value??"");return e.html.div(e.attr.class("bc-passkey-item"),e.Unless(l,()=>e.html.div(e.attr.class("bc-passkey-item__info"),e.html.span(e.attr.class("bc-passkey-item__name"),m.$.name?.map(f=>f??c.$.passkeyUnnamed.value)??c.$.passkeyUnnamed),e.html.span(e.attr.class("bc-passkey-item__date"),m.$.createdAt))),e.When(l,()=>e.html.div(e.attr.class("bc-passkey-item__edit"),v.TextInput({value:r,onChange:f=>r.set(f)}))),e.html.div(e.attr.class("bc-passkey-item__actions"),e.Unless(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:()=>{r.set(m.$.name?.value??""),l.set(!0)}},c.$.passkeyRenameButton),b.Button({type:"button",variant:"text",size:"sm",color:"danger",onClick:()=>p(m.$.id.value)},c.$.passkeyDeleteButton))),e.When(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:async()=>{await h(m.$.id.value,r.value),l.set(!1)}},c.$.passkeySaveButton),b.Button({type:"button",variant:"text",size:"sm",onClick:()=>l.set(!1)},c.$.passkeyCancelButton)))))})),e.html.div(e.attr.class("bc-passkey-add"),y.Stack(v.TextInput({value:i,onChange:m=>i.set(m),placeholder:c.$.passkeyNamePlaceholder}),b.Button({type:"button",variant:"filled",color:"primary",onClick:d,loading:n},c.$.passkeyAddButton)))))}exports.Authenticated=M;exports.BetterAuth=R;exports.BetterAuthContainer=E;exports.BetterAuthI18n=k;exports.BetterAuthModal=O;exports.MagicLinkForm=V;exports.PasskeyManagement=z;exports.PasskeySignIn=W;exports.TwoFactorSetup=q;exports.TwoFactorVerify=x;exports.Unauthenticated=D;exports.createBetterAuthBridge=C;exports.createSessionManager=P;exports.mapSocialProviders=_;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),L=require("../auth-divider-Cj-xJxF_.cjs"),I=require("../translations-gVgMyNno.cjs"),w=require("../notice-9lpZ-VDn.cjs"),y=require("../stack-4VUGISn6.cjs"),b=require("../input-container-B31Seozh.cjs"),v=require("../text-input-w0eVcqk5.cjs");function g(a,t){return a.error?(t.onError?.({message:a.error.message,status:a.error.status}),a.error.message):null}function F(a,t,s){return async n=>{const i=await a.signIn.email({email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function A(a,t,s){return async n=>{const i=await a.signUp.email({name:n.name,email:n.email,password:n.password,callbackURL:t.callbackURL}),o=g(i,t);return o||(await s(),null)}}function U(a,t){return async s=>{const n=await a.requestPasswordReset({email:s.email,redirectTo:t.callbackURL});return g(n,t)}}function $(a,t){return async s=>{const n=await a.signIn.social({provider:s,callbackURL:t.callbackURL,errorCallbackURL:t.errorCallbackURL});g(n,t)}}function P(a,t={}){const s=e.prop(null),n=e.prop(!0),i=e.computedOf(s)(h=>h?.user??null),o=e.computedOf(s)(h=>h!=null);let u;async function d(){try{const h=await a.getSession();h.error||!h.data?s.set(null):s.set({user:h.data.user,session:h.data.session})}catch{s.set(null)}finally{n.set(!1)}}t.onSessionChange&&s.on(t.onSessionChange),d(),t.refreshInterval&&t.refreshInterval>0&&(u=setInterval(d,t.refreshInterval));function p(){u!=null&&(clearInterval(u),u=void 0),s.dispose(),n.dispose(),i.dispose(),o.dispose()}return{session:s,isPending:n,user:i,isAuthenticated:o,refresh:d,dispose:p}}function _(a){return a.map(t=>({provider:t}))}function C(a,t={}){const s=P(a,{refreshInterval:t.refreshInterval,onSessionChange:t.onSessionChange}),n=()=>s.refresh(),i=F(a,t,n),o=A(a,t,n),u=U(a,t),d=$(a,t),p=t.socialProviders?_(t.socialProviders):[],h={onSignIn:i,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,labels:t.labels?{emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,rememberMeLabel:t.labels.rememberMeLabel,signInButton:t.labels.signInButton,forgotPasswordLink:t.labels.forgotPasswordLink,noAccountLink:t.labels.noAccountLink}:void 0},c={onSignUp:o,passwordRules:t.passwordRules,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels?{nameLabel:t.labels.nameLabel,emailLabel:t.labels.emailLabel,passwordLabel:t.labels.passwordLabel,confirmPasswordLabel:t.labels.confirmPasswordLabel,acceptTermsLabel:t.labels.acceptTermsLabel,signUpButton:t.labels.signUpButton,hasAccountLink:t.labels.hasAccountLink}:void 0},m={onResetPassword:u,labels:t.labels?{resetPasswordButton:t.labels.resetPasswordButton,resetPasswordDescription:t.labels.resetPasswordDescription,emailLabel:t.labels.emailLabel,backToSignInLink:t.labels.backToSignInLink}:void 0},l={onSignIn:i,onSignUp:o,onResetPassword:u,onSocialLogin:d,socialProviders:p.length>0?p:void 0,showSocialDivider:p.length>0,passwordRules:t.passwordRules,showRememberMe:t.showRememberMe,showPasswordStrength:t.showPasswordStrength,showNameField:t.showNameField,showConfirmPassword:t.showConfirmPassword,labels:t.labels};async function r(){await a.signOut(),await n()}function f(){s.dispose()}return{session:s.session,isPending:s.isPending,user:s.user,isAuthenticated:s.isAuthenticated,containerOptions:l,signInOptions:h,signUpOptions:c,resetOptions:m,socialProviders:p,signOut:r,refreshSession:n,dispose:f}}const R={mark:e.makeProviderMark("BetterAuth"),create:a=>{if(!a)throw new Error("BetterAuth provider requires a client option");const t=C(a.client,a);return{value:t,dispose:()=>t.dispose()}}};function E(a,t,...s){return L.AuthContainer({...a.containerOptions,...t},...s)}function O(a,t){return L.AuthModal(s=>t(n=>s({...a.containerOptions,...n})))}function M(a,t){return e.When(a.isAuthenticated,t)}function D(a,t){return e.Unless(a.isAuthenticated,t)}const T={twoFactorSetupDescription:"Enter your password to enable two-factor authentication.",twoFactorEnableButton:"Enable 2FA",twoFactorVerifyButton:"Verify",twoFactorScanDescription:"Scan the code below with your authenticator app, then enter the verification code.",twoFactorBackupCodesDescription:"Save these backup codes in a safe place. You can use them to sign in if you lose access to your authenticator.",twoFactorCodePlaceholder:"Enter 6-digit code",twoFactorBackupCodePlaceholder:"Enter backup code",twoFactorEnabled:"Two-factor authentication has been enabled.",twoFactorTotpDescription:"Enter the code from your authenticator app.",twoFactorOtpDescription:"Enter the one-time code sent to you.",twoFactorBackupDescription:"Enter one of your backup codes.",twoFactorSendOtpButton:"Send Code",twoFactorMethodLabel:a=>{switch(a){case"totp":return"Authenticator";case"otp":return"Email/SMS";case"backup":return"Backup Code";default:return a}},passwordPlaceholder:"Enter your password",magicLinkDescription:"Enter your email to receive a sign-in link.",magicLinkSendButton:"Send Magic Link",magicLinkSent:"A sign-in link has been sent to your email.",passkeySignInButton:"Sign in with Passkey",passkeyAddButton:"Add Passkey",passkeyDeleteButton:"Delete",passkeyRenameButton:"Rename",passkeySaveButton:"Save",passkeyCancelButton:"Cancel",passkeyNamePlaceholder:"Passkey name (optional)",passkeyUnnamed:"Unnamed passkey"},B=T,S="en",N=Object.assign({}),k=I.makeI18nProvider({defaultLocale:S,defaultMessages:B,localeLoader:async a=>{if(a===S)return B;const t=N[`./locales/${a}.ts`];return t?await t():B},providerName:"BetterAuthI18n"});function q({twoFactor:a,issuer:t,onComplete:s}){const n=e.prop(""),i=e.prop(null),o=e.prop([]),u=e.prop(""),d=e.prop(null),p=e.prop(!1),h=e.prop("password");async function c(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.enable({password:n.value,issuer:t});if(p.set(!1),r.error){d.set(r.error.message);return}r.data&&(i.set(r.data.totpURI),o.set(r.data.backupCodes),h.set("verify"))}async function m(l){l.preventDefault(),p.set(!0),d.set(null);const r=await a.verifyTotp({code:u.value});if(p.set(!1),r.error){d.set(r.error.message);return}h.set("complete"),s?.()}return e.Use(k,l=>e.html.div(e.attr.class("bc-two-factor"),e.Ensure(d,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.OneOfValue(h,{password:()=>e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(c),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),l.$.twoFactorSetupDescription),w.PasswordInput({value:n,onChange:r=>n.set(r),placeholder:l.$.passwordPlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorEnableButton))),verify:()=>e.Fragment(e.Ensure(i,r=>e.html.div(e.attr.class("bc-two-factor__totp-uri"),e.html.p(l.$.twoFactorScanDescription),e.html.code(e.attr.class("bc-two-factor__code-display"),r))),e.NotEmpty(o,()=>e.html.div(e.attr.class("bc-two-factor__backup-codes"),e.html.p(l.$.twoFactorBackupCodesDescription),e.html.ul(e.ForEach(o,r=>e.html.li(r))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(m),y.Stack(v.TextInput({value:u,onChange:r=>u.set(r),placeholder:l.$.twoFactorCodePlaceholder}),b.Button({type:"submit",variant:"filled",color:"primary",loading:p},e.attr.class("bc-auth-form__submit"),l.$.twoFactorVerifyButton)))),complete:()=>e.html.div(e.attr.class("bc-two-factor__complete"),w.Notice({variant:"success",tone:"prominent"},e.html.div(l.$.twoFactorEnabled)))})))}function x({twoFactor:a,methods:t=["totp","backup"],trustDevice:s,onVerified:n}){const i=e.prop(""),o=e.prop(null),u=e.prop(!1),d=e.prop(t[0]??"totp");async function p(c){c.preventDefault(),u.set(!0),o.set(null);const m=d.value;let l;if(m==="totp")l=await a.verifyTotp({code:i.value,trustDevice:s});else if(m==="otp"&&a.verifyOtp)l=await a.verifyOtp({code:i.value,trustDevice:s});else if(m==="backup")l=await a.verifyBackupCode({code:i.value});else{o.set("Unsupported verification method"),u.set(!1);return}if(u.set(!1),l.error){o.set(l.error.message);return}n?.()}async function h(){if(!a.sendOtp)return;u.set(!0),o.set(null);const c=await a.sendOtp({trustDevice:s});u.set(!1),c.error&&o.set(c.error.message)}return e.Use(k,c=>{const m=e.computedOf(d,c)((r,f)=>r==="totp"?f.twoFactorTotpDescription:r==="otp"?f.twoFactorOtpDescription:f.twoFactorBackupDescription),l=e.computedOf(d,c)((r,f)=>r==="backup"?f.twoFactorBackupCodePlaceholder:f.twoFactorCodePlaceholder);return e.html.div(e.attr.class("bc-two-factor"),e.Ensure(o,r=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(r))),e.When(t.length>1,()=>e.html.div(e.attr.class("bc-two-factor__methods"),...t.map(r=>e.html.button(e.attr.type("button"),e.attr.class("bc-two-factor__method-button"),e.attr.class(d.map(f=>f===r?"bc-two-factor__method-button--active":"")),e.on.click(()=>{d.set(r),i.set(""),o.set(null)}),c.$.twoFactorMethodLabel.map(f=>f(r)))))),e.html.form(e.attr.class("bc-two-factor__form"),e.on.submit(p),y.Stack(e.html.p(e.attr.class("bc-auth-form__description"),m),e.When(d.map(r=>r==="otp"&&a.sendOtp!=null),()=>b.Button({type:"button",variant:"outline",color:"primary",onClick:h,loading:u},c.$.twoFactorSendOtpButton)),v.TextInput({value:i,onChange:r=>i.set(r),placeholder:l}),b.Button({type:"submit",variant:"filled",color:"primary",loading:u},e.attr.class("bc-auth-form__submit"),c.$.twoFactorVerifyButton))))})}function V({client:a,callbackURL:t}){const s=e.prop(""),n=e.prop(null),i=e.prop(!1),o=e.prop(!1);async function u(d){if(d.preventDefault(),!a.signIn.magicLink){n.set("Magic link sign-in is not configured");return}i.set(!0),n.set(null);const p=await a.signIn.magicLink({email:s.value,callbackURL:t});if(i.set(!1),p.error){n.set(p.error.message);return}o.set(!0)}return e.Use(k,d=>e.html.div(e.attr.class("bc-auth-form"),e.Ensure(n,p=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(p))),e.Unless(o,()=>e.html.form(e.attr.class("bc-auth-form__form"),e.on.submit(u),y.Stack(e.attr.class("bc-auth-form__fields"),e.html.p(e.attr.class("bc-auth-form__description"),d.$.magicLinkDescription),w.EmailInput({value:s,onChange:p=>s.set(p)}),b.Button({type:"submit",variant:"filled",color:"primary",loading:i},e.attr.class("bc-auth-form__submit"),d.$.magicLinkSendButton)))),e.When(o,()=>w.Notice({variant:"success",tone:"prominent"},e.html.div(d.$.magicLinkSent)))))}function W({client:a,autoFill:t,onSuccess:s,onError:n}){const i=e.prop(!1);async function o(){if(!a.signIn.passkey)return;i.set(!0);const u=await a.signIn.passkey({autoFill:t});if(i.set(!1),u.error){n?.({message:u.error.message,status:u.error.status});return}s?.()}return e.Use(k,u=>b.Button({type:"button",variant:"outline",color:"primary",onClick:o,loading:i},e.attr.class("bc-passkey-signin"),u.$.passkeySignInButton))}function z({passkey:a}){const t=e.prop([]),s=e.prop(null),n=e.prop(!1),i=e.prop("");async function o(c,m){n.set(!0),s.set(null);const l=await c();if(n.set(!1),l.error){s.set(l.error.message);return}await m?.(l.data)}async function u(){await o(()=>a.listUserPasskeys(),c=>t.set(c??[]))}async function d(){const c=i.value||void 0;await o(()=>a.addPasskey({name:c}),async()=>{i.set(""),await u()})}async function p(c){await o(()=>a.deletePasskey({id:c}),()=>u())}async function h(c,m){await o(()=>a.updatePasskey({id:c,name:m}),()=>u())}return u(),e.Use(k,c=>e.html.div(e.attr.class("bc-passkey-management"),e.Ensure(s,m=>w.Notice({variant:"danger",tone:"prominent",role:"alert"},e.html.div(m))),e.html.div(e.attr.class("bc-passkey-list"),e.ForEach(t,m=>{const l=e.prop(!1),r=e.prop(m.$.name?.value??"");return e.html.div(e.attr.class("bc-passkey-item"),e.Unless(l,()=>e.html.div(e.attr.class("bc-passkey-item__info"),e.html.span(e.attr.class("bc-passkey-item__name"),m.$.name?.map(f=>f??c.$.passkeyUnnamed.value)??c.$.passkeyUnnamed),e.html.span(e.attr.class("bc-passkey-item__date"),m.$.createdAt))),e.When(l,()=>e.html.div(e.attr.class("bc-passkey-item__edit"),v.TextInput({value:r,onChange:f=>r.set(f)}))),e.html.div(e.attr.class("bc-passkey-item__actions"),e.Unless(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:()=>{r.set(m.$.name?.value??""),l.set(!0)}},c.$.passkeyRenameButton),b.Button({type:"button",variant:"text",size:"sm",color:"danger",onClick:()=>p(m.$.id.value)},c.$.passkeyDeleteButton))),e.When(l,()=>e.html.div(b.Button({type:"button",variant:"text",size:"sm",onClick:async()=>{await h(m.$.id.value,r.value),l.set(!1)}},c.$.passkeySaveButton),b.Button({type:"button",variant:"text",size:"sm",onClick:()=>l.set(!1)},c.$.passkeyCancelButton)))))})),e.html.div(e.attr.class("bc-passkey-add"),y.Stack(v.TextInput({value:i,onChange:m=>i.set(m),placeholder:c.$.passkeyNamePlaceholder}),b.Button({type:"button",variant:"filled",color:"primary",onClick:d,loading:n},c.$.passkeyAddButton)))))}exports.Authenticated=M;exports.BetterAuth=R;exports.BetterAuthContainer=E;exports.BetterAuthI18n=k;exports.BetterAuthModal=O;exports.MagicLinkForm=V;exports.PasskeyManagement=z;exports.PasskeySignIn=W;exports.TwoFactorSetup=q;exports.TwoFactorVerify=x;exports.Unauthenticated=D;exports.createBetterAuthBridge=C;exports.createSessionManager=P;exports.mapSocialProviders=_;
|