@tempots/beatui 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ar-zUaskoUZ.js → ar-C__uXRig.js} +5 -3
- package/dist/ar-D9ef1rPL.js +38 -0
- package/dist/beatui.css +1 -1
- package/dist/{de-C0vbdZdj.js → de-CaqDmb7M.js} +3 -1
- package/dist/{de-O2DMrfiH.js → de-DvSVUCKi.js} +3 -2
- package/dist/{es-BALLrljC.js → es-D2MgpsFw.js} +6 -4
- package/dist/{es-CsNVN5AY.js → es-kZH0y7yE.js} +3 -2
- package/dist/{fa-4g9jzgMM.js → fa-7Lh__M6_.js} +3 -1
- package/dist/fa-CZ1jHeSI.js +38 -0
- package/dist/{fr-CzyXyFEo.js → fr-BFb9eub-.js} +3 -1
- package/dist/{fr-CJjx2YoL.js → fr-Bi9Ce2bU.js} +6 -5
- package/dist/{he-CBxtA7rr.js → he-DCxEMw1h.js} +3 -1
- package/dist/he-iAAKM-JS.js +38 -0
- package/dist/hi-BMfFIHn-.js +38 -0
- package/dist/{hi-B6LQz-RO.js → hi-Bbnlpps9.js} +4 -2
- package/dist/index.es.js +3978 -3738
- package/dist/index.umd.js +27 -27
- package/dist/{it-CFHKs1al.js → it-CWTDpmhc.js} +3 -1
- package/dist/{it-BKzoVost.js → it-RYZ8E-C6.js} +3 -2
- package/dist/{ja-ZBFmK5Uj.js → ja-4x5hNiAy.js} +6 -5
- package/dist/{ja-D6tNi1ze.js → ja-C1Nynl79.js} +3 -1
- package/dist/ko-BFy6uytC.js +38 -0
- package/dist/{ko-71CknADn.js → ko-BnQv3_8f.js} +3 -1
- package/dist/nl-BRZt7kSA.js +38 -0
- package/dist/{nl-CnSz3Cp_.js → nl-CH2009II.js} +3 -1
- package/dist/{pl-og-2JJLB.js → pl-Cd4dZDyG.js} +3 -1
- package/dist/pl-DKbc4KpN.js +38 -0
- package/dist/{pt-DumIX3mi.js → pt-Bful1nYu.js} +3 -2
- package/dist/{pt-M61qKkTf.js → pt-CZER9j0r.js} +3 -1
- package/dist/{ru-_EKfu_bO.js → ru-9lG4xtda.js} +3 -2
- package/dist/{ru-CIn0tYwk.js → ru-CCEGJYwF.js} +3 -1
- package/dist/{tr-BXwpkxgd.js → tr-BVIGQcgy.js} +3 -1
- package/dist/tr-D3uQnNr4.js +38 -0
- package/dist/types/auth-i18n/default.d.ts +1 -1
- package/dist/types/auth-i18n/locales/ar.d.ts +29 -0
- package/dist/types/auth-i18n/locales/de.d.ts +1 -1
- package/dist/types/auth-i18n/locales/en.d.ts +1 -1
- package/dist/types/auth-i18n/locales/es.d.ts +1 -1
- package/dist/types/auth-i18n/locales/fa.d.ts +29 -0
- package/dist/types/auth-i18n/locales/fr.d.ts +1 -1
- package/dist/types/auth-i18n/locales/he.d.ts +29 -0
- package/dist/types/auth-i18n/locales/hi.d.ts +29 -0
- package/dist/types/auth-i18n/locales/it.d.ts +1 -1
- package/dist/types/auth-i18n/locales/ja.d.ts +1 -1
- package/dist/types/auth-i18n/locales/ko.d.ts +29 -0
- package/dist/types/auth-i18n/locales/nl.d.ts +29 -0
- package/dist/types/auth-i18n/locales/pl.d.ts +29 -0
- package/dist/types/auth-i18n/locales/pt.d.ts +1 -1
- package/dist/types/auth-i18n/locales/ru.d.ts +1 -1
- package/dist/types/auth-i18n/locales/tr.d.ts +29 -0
- package/dist/types/auth-i18n/locales/ur.d.ts +29 -0
- package/dist/types/auth-i18n/locales/vi.d.ts +29 -0
- package/dist/types/auth-i18n/locales/zh.d.ts +1 -1
- package/dist/types/auth-i18n/translations.d.ts +1 -1
- package/dist/types/beatui-i18n/default.d.ts +1 -0
- package/dist/types/beatui-i18n/locales/en.d.ts +1 -0
- package/dist/types/beatui-i18n/translations.d.ts +1 -0
- package/dist/types/components/auth/auth-container.d.ts +5 -9
- package/dist/types/components/auth/auth-email-prop.d.ts +1 -0
- package/dist/types/components/auth/reset-password-form.d.ts +1 -1
- package/dist/types/components/auth/schemas.d.ts +20 -10
- package/dist/types/components/auth/signin-form.d.ts +1 -1
- package/dist/types/components/auth/signup-form.d.ts +1 -1
- package/dist/types/components/auth/social-login-button.d.ts +2 -4
- package/dist/types/components/auth/social-providers.d.ts +2 -0
- package/dist/types/components/auth/types.d.ts +76 -93
- package/dist/types/components/auth/utils.d.ts +6 -4
- package/dist/types/components/form/controller/controller-validation.d.ts +8 -0
- package/dist/types/components/form/controller/controller.d.ts +22 -20
- package/dist/types/components/form/controller/index.d.ts +1 -1
- package/dist/types/components/form/schema/schema-utils.d.ts +2 -2
- package/dist/types/components/form/use-form.d.ts +44 -11
- package/dist/ur-BThJLsvD.js +38 -0
- package/dist/{ur-B7AcyGH1.js → ur-BVAP8WLA.js} +3 -1
- package/dist/vi-Cd6F8iSa.js +38 -0
- package/dist/{vi-CaJ4-itr.js → vi-Dv4aIcRH.js} +3 -1
- package/dist/{zh-cAmOB1FQ.js → zh-BcAbijvs.js} +3 -1
- package/dist/{zh-DEZH0fdq.js → zh-Boy-i2zO.js} +3 -2
- package/package.json +2 -2
- package/dist/types/components/form/controller/validation-result.d.ts +0 -13
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const tr: {
|
|
2
|
+
signInTitle: () => string;
|
|
3
|
+
signInButton: () => string;
|
|
4
|
+
emailLabel: () => string;
|
|
5
|
+
passwordLabel: () => string;
|
|
6
|
+
rememberMeLabel: () => string;
|
|
7
|
+
forgotPasswordLink: () => string;
|
|
8
|
+
noAccountLink: () => string;
|
|
9
|
+
signUpTitle: () => string;
|
|
10
|
+
signUpButton: () => string;
|
|
11
|
+
nameLabel: () => string;
|
|
12
|
+
confirmPasswordLabel: () => string;
|
|
13
|
+
acceptTermsLabel: () => string;
|
|
14
|
+
hasAccountLink: () => string;
|
|
15
|
+
resetPasswordTitle: () => string;
|
|
16
|
+
resetPasswordButton: () => string;
|
|
17
|
+
resetPasswordDescription: () => string;
|
|
18
|
+
backToSignInLink: () => string;
|
|
19
|
+
continueWithProvider: (provider: string) => string;
|
|
20
|
+
passwordStrengthWeak: () => string;
|
|
21
|
+
passwordStrengthFair: () => string;
|
|
22
|
+
passwordStrengthGood: () => string;
|
|
23
|
+
passwordStrengthStrong: () => string;
|
|
24
|
+
orDivider: () => string;
|
|
25
|
+
error: () => string;
|
|
26
|
+
required: () => string;
|
|
27
|
+
authenticationTitle: () => string;
|
|
28
|
+
};
|
|
29
|
+
export default tr;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const ur: {
|
|
2
|
+
signInTitle: () => string;
|
|
3
|
+
signInButton: () => string;
|
|
4
|
+
emailLabel: () => string;
|
|
5
|
+
passwordLabel: () => string;
|
|
6
|
+
rememberMeLabel: () => string;
|
|
7
|
+
forgotPasswordLink: () => string;
|
|
8
|
+
noAccountLink: () => string;
|
|
9
|
+
signUpTitle: () => string;
|
|
10
|
+
signUpButton: () => string;
|
|
11
|
+
nameLabel: () => string;
|
|
12
|
+
confirmPasswordLabel: () => string;
|
|
13
|
+
acceptTermsLabel: () => string;
|
|
14
|
+
hasAccountLink: () => string;
|
|
15
|
+
resetPasswordTitle: () => string;
|
|
16
|
+
resetPasswordButton: () => string;
|
|
17
|
+
resetPasswordDescription: () => string;
|
|
18
|
+
backToSignInLink: () => string;
|
|
19
|
+
continueWithProvider: (provider: string) => string;
|
|
20
|
+
passwordStrengthWeak: () => string;
|
|
21
|
+
passwordStrengthFair: () => string;
|
|
22
|
+
passwordStrengthGood: () => string;
|
|
23
|
+
passwordStrengthStrong: () => string;
|
|
24
|
+
orDivider: () => string;
|
|
25
|
+
error: () => string;
|
|
26
|
+
required: () => string;
|
|
27
|
+
authenticationTitle: () => string;
|
|
28
|
+
};
|
|
29
|
+
export default ur;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const vi: {
|
|
2
|
+
signInTitle: () => string;
|
|
3
|
+
signInButton: () => string;
|
|
4
|
+
emailLabel: () => string;
|
|
5
|
+
passwordLabel: () => string;
|
|
6
|
+
rememberMeLabel: () => string;
|
|
7
|
+
forgotPasswordLink: () => string;
|
|
8
|
+
noAccountLink: () => string;
|
|
9
|
+
signUpTitle: () => string;
|
|
10
|
+
signUpButton: () => string;
|
|
11
|
+
nameLabel: () => string;
|
|
12
|
+
confirmPasswordLabel: () => string;
|
|
13
|
+
acceptTermsLabel: () => string;
|
|
14
|
+
hasAccountLink: () => string;
|
|
15
|
+
resetPasswordTitle: () => string;
|
|
16
|
+
resetPasswordButton: () => string;
|
|
17
|
+
resetPasswordDescription: () => string;
|
|
18
|
+
backToSignInLink: () => string;
|
|
19
|
+
continueWithProvider: (provider: string) => string;
|
|
20
|
+
passwordStrengthWeak: () => string;
|
|
21
|
+
passwordStrengthFair: () => string;
|
|
22
|
+
passwordStrengthGood: () => string;
|
|
23
|
+
passwordStrengthStrong: () => string;
|
|
24
|
+
orDivider: () => string;
|
|
25
|
+
error: () => string;
|
|
26
|
+
required: () => string;
|
|
27
|
+
authenticationTitle: () => string;
|
|
28
|
+
};
|
|
29
|
+
export default vi;
|
|
@@ -22,8 +22,8 @@ declare const zh: {
|
|
|
22
22
|
passwordStrengthGood: () => string;
|
|
23
23
|
passwordStrengthStrong: () => string;
|
|
24
24
|
orDivider: () => string;
|
|
25
|
-
loading: () => string;
|
|
26
25
|
error: () => string;
|
|
27
26
|
required: () => string;
|
|
27
|
+
authenticationTitle: () => string;
|
|
28
28
|
};
|
|
29
29
|
export default zh;
|
|
@@ -22,7 +22,7 @@ export declare const AuthI18n: import("@tempots/dom").Provider<import("..").Reac
|
|
|
22
22
|
passwordStrengthGood: () => string;
|
|
23
23
|
passwordStrengthStrong: () => string;
|
|
24
24
|
orDivider: () => string;
|
|
25
|
-
loading: () => string;
|
|
26
25
|
error: () => string;
|
|
27
26
|
required: () => string;
|
|
27
|
+
authenticationTitle: () => string;
|
|
28
28
|
}>, object>;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { TNode
|
|
1
|
+
import { TNode } from '@tempots/dom';
|
|
2
2
|
import { AuthContainerOptions } from './index';
|
|
3
|
-
export declare function AuthContainer({ mode: initialMode,
|
|
4
|
-
export declare function AuthModal(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}): TNode;
|
|
8
|
-
export declare function SignInContainer(options: Omit<AuthContainerOptions, 'initialMode'>): TNode;
|
|
9
|
-
export declare function SignUpContainer(options: Omit<AuthContainerOptions, 'initialMode'>): TNode;
|
|
10
|
-
export declare function ResetPasswordContainer(options: Omit<AuthContainerOptions, 'initialMode'>): TNode;
|
|
3
|
+
export declare function AuthContainer({ mode: initialMode, socialProviders, passwordRules, showRememberMe, showSocialDivider, showPasswordStrength, labels, onSignIn, onSignUp, onResetPassword, onModeChange, showContainer, }: AuthContainerOptions, ...children: TNode[]): TNode;
|
|
4
|
+
export declare function AuthModal(fn: (open: (options: AuthContainerOptions & {
|
|
5
|
+
modalTitle?: () => string;
|
|
6
|
+
}) => void) => TNode): TNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAuthEmailProp: () => import("@tempots/dom").Prop<string | null>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TNode } from '@tempots/dom';
|
|
2
2
|
import { ResetPasswordFormOptions } from './index';
|
|
3
|
-
export declare function ResetPasswordForm({
|
|
3
|
+
export declare function ResetPasswordForm({ onResetPassword, labels, }: ResetPasswordFormOptions): TNode;
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
import { StringValidator } from '../form/schema/custom-validation';
|
|
1
|
+
import { StringValidator, SafeParseResult } from '../form/schema/custom-validation';
|
|
2
2
|
import { StandardSchemaV1 } from '../form/schema/standard-schema-v1';
|
|
3
|
-
import { PasswordRules,
|
|
3
|
+
import { PasswordRules, ResetPasswordData, SignInFormData, SignUpFormData } from './types';
|
|
4
4
|
export declare function createPasswordSchema(rules?: PasswordRules): StringValidator;
|
|
5
5
|
export declare const emailSchema: StringValidator;
|
|
6
|
-
export declare function createSignInSchema(passwordRules?: PasswordRules): StandardSchemaV1<
|
|
6
|
+
export declare function createSignInSchema(passwordRules?: PasswordRules): StandardSchemaV1<SignInFormData> & {
|
|
7
|
+
safeParse: (value: unknown) => SafeParseResult<SignInFormData>;
|
|
8
|
+
};
|
|
7
9
|
export declare function createSignUpSchema(passwordRules?: PasswordRules, options?: {
|
|
8
10
|
showNameField?: boolean;
|
|
9
11
|
showConfirmPassword?: boolean;
|
|
10
12
|
showAcceptTermsAndConditions?: boolean;
|
|
11
|
-
}): StandardSchemaV1<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
}): StandardSchemaV1<SignUpFormData> & {
|
|
14
|
+
safeParse: (value: unknown) => SafeParseResult<SignUpFormData>;
|
|
15
|
+
};
|
|
16
|
+
export declare const resetPasswordSchema: StandardSchemaV1<ResetPasswordData> & {
|
|
17
|
+
safeParse: (value: unknown) => SafeParseResult<ResetPasswordData>;
|
|
18
|
+
};
|
|
19
|
+
export declare const defaultSignInSchema: StandardSchemaV1<import("./types").SignInData, import("./types").SignInData> & {
|
|
20
|
+
safeParse: (value: unknown) => SafeParseResult<SignInFormData>;
|
|
21
|
+
};
|
|
22
|
+
export declare const defaultSignUpSchema: StandardSchemaV1<SignUpFormData, SignUpFormData> & {
|
|
23
|
+
safeParse: (value: unknown) => SafeParseResult<SignUpFormData>;
|
|
24
|
+
};
|
|
17
25
|
export type ResetPasswordFormData = ResetPasswordData;
|
|
18
26
|
export declare const authSchemas: {
|
|
19
27
|
signIn: typeof createSignInSchema;
|
|
20
28
|
signUp: typeof createSignUpSchema;
|
|
21
|
-
resetPassword: () => StandardSchemaV1<ResetPasswordData, ResetPasswordData
|
|
29
|
+
resetPassword: () => StandardSchemaV1<ResetPasswordData, ResetPasswordData> & {
|
|
30
|
+
safeParse: (value: unknown) => SafeParseResult<ResetPasswordData>;
|
|
31
|
+
};
|
|
22
32
|
};
|
|
23
33
|
export declare function validateEmail(email: string): string | null;
|
|
24
34
|
export declare function validatePassword(password: string, rules?: PasswordRules): string | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TNode } from '@tempots/dom';
|
|
2
2
|
import { SignInFormOptions } from './index';
|
|
3
|
-
export declare function SignInForm({
|
|
3
|
+
export declare function SignInForm({ onSignIn, passwordRules, labels, showRememberMe, }: SignInFormOptions): TNode;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TNode } from '@tempots/dom';
|
|
2
2
|
import { SignUpFormOptions } from './index';
|
|
3
|
-
export declare function SignUpForm({
|
|
3
|
+
export declare function SignUpForm({ passwordRules, labels, showPasswordStrength, onSignUp, showNameField, showConfirmPassword, showAcceptTermsAndConditions, termsAndConditions, }: SignUpFormOptions): TNode;
|
|
@@ -2,16 +2,14 @@ import { TNode, Value } from '@tempots/dom';
|
|
|
2
2
|
import { SocialLoginButtonOptions, AuthProviderName } from './index';
|
|
3
3
|
import { ControlSize } from '../theme';
|
|
4
4
|
import { ThemeColorName } from '@/tokens';
|
|
5
|
-
export declare function SocialLoginButton({ provider, onClick,
|
|
5
|
+
export declare function SocialLoginButton({ provider, onClick, size, name, icon, color, flow, labels, }: SocialLoginButtonOptions): TNode;
|
|
6
6
|
export type AuthProviderInfo = {
|
|
7
7
|
provider: AuthProviderName;
|
|
8
8
|
flow?: 'redirect' | 'popup';
|
|
9
9
|
};
|
|
10
|
-
export declare function SocialLoginButtons({ providers, onProviderClick,
|
|
10
|
+
export declare function SocialLoginButtons({ providers, onProviderClick, size, className, }: {
|
|
11
11
|
providers: Value<Array<AuthProviderInfo>>;
|
|
12
12
|
onProviderClick?: (provider: AuthProviderName) => Promise<void>;
|
|
13
|
-
loading?: Value<boolean>;
|
|
14
|
-
disabled?: Value<boolean>;
|
|
15
13
|
size?: Value<ControlSize>;
|
|
16
14
|
className?: Value<string>;
|
|
17
15
|
}): TNode;
|
|
@@ -9,12 +9,14 @@ export type PasswordStrength = 'weak' | 'fair' | 'good' | 'strong';
|
|
|
9
9
|
export interface SignInData {
|
|
10
10
|
email: string;
|
|
11
11
|
password: string;
|
|
12
|
-
rememberMe?: boolean;
|
|
13
12
|
}
|
|
13
|
+
export type SignInFormData = SignInData;
|
|
14
14
|
export interface SignUpData {
|
|
15
15
|
name?: string;
|
|
16
16
|
email: string;
|
|
17
17
|
password: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SignUpFormData extends SignUpData {
|
|
18
20
|
confirmPassword: string;
|
|
19
21
|
acceptTerms: boolean;
|
|
20
22
|
}
|
|
@@ -38,116 +40,97 @@ export interface PasswordRules {
|
|
|
38
40
|
requireSymbols?: boolean;
|
|
39
41
|
customValidation?: (password: string) => string | null;
|
|
40
42
|
}
|
|
43
|
+
export interface AuthContainerLabels {
|
|
44
|
+
signInTitle?: () => string;
|
|
45
|
+
emailLabel?: () => string;
|
|
46
|
+
passwordLabel?: () => string;
|
|
47
|
+
rememberMeLabel?: () => string;
|
|
48
|
+
signInButton?: () => string;
|
|
49
|
+
forgotPasswordLink?: () => string;
|
|
50
|
+
noAccountLink?: () => string;
|
|
51
|
+
acceptTermsLabel?: () => string;
|
|
52
|
+
confirmPasswordLabel?: () => string;
|
|
53
|
+
signUpTitle?: () => string;
|
|
54
|
+
signUpButton?: () => string;
|
|
55
|
+
nameLabel?: () => string;
|
|
56
|
+
hasAccountLink?: () => string;
|
|
57
|
+
resetPasswordTitle?: () => string;
|
|
58
|
+
resetPasswordButton?: () => string;
|
|
59
|
+
resetPasswordDescription?: () => string;
|
|
60
|
+
backToSignInLink?: () => string;
|
|
61
|
+
}
|
|
41
62
|
export interface AuthContainerOptions {
|
|
42
63
|
mode?: Value<AuthMode>;
|
|
43
64
|
className?: Value<string>;
|
|
44
|
-
socialProviders?:
|
|
65
|
+
socialProviders?: AuthProviderInfo[];
|
|
45
66
|
passwordRules?: PasswordRules;
|
|
46
|
-
showRememberMe?:
|
|
47
|
-
showSocialDivider?:
|
|
48
|
-
allowSignUp?:
|
|
49
|
-
allowPasswordReset?:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
passwordLabel?: () => string;
|
|
55
|
-
rememberMeLabel?: () => string;
|
|
56
|
-
loading?: () => string;
|
|
57
|
-
signInButton?: () => string;
|
|
58
|
-
forgotPasswordLink?: () => string;
|
|
59
|
-
noAccountLink?: () => string;
|
|
60
|
-
acceptTermsLabel?: () => string;
|
|
61
|
-
confirmPasswordLabel?: () => string;
|
|
62
|
-
signUpTitle?: () => string;
|
|
63
|
-
signUpButton?: () => string;
|
|
64
|
-
nameLabel?: () => string;
|
|
65
|
-
hasAccountLink?: () => string;
|
|
66
|
-
resetPasswordTitle?: () => string;
|
|
67
|
-
resetPasswordButton?: () => string;
|
|
68
|
-
resetPasswordDescription?: () => string;
|
|
69
|
-
backToSignInLink?: () => string;
|
|
70
|
-
};
|
|
71
|
-
onSignIn?: (data: SignInData) => Promise<void>;
|
|
72
|
-
onSignUp?: (data: SignUpData) => Promise<void>;
|
|
73
|
-
onResetPassword?: (data: ResetPasswordData) => Promise<void>;
|
|
67
|
+
showRememberMe?: boolean;
|
|
68
|
+
showSocialDivider?: boolean;
|
|
69
|
+
allowSignUp?: boolean;
|
|
70
|
+
allowPasswordReset?: boolean;
|
|
71
|
+
labels?: AuthContainerLabels;
|
|
72
|
+
onSignIn?: (data: SignInData) => Promise<string | null>;
|
|
73
|
+
onSignUp?: (data: SignUpData) => Promise<string | null>;
|
|
74
|
+
onResetPassword?: (data: ResetPasswordData) => Promise<string | null>;
|
|
74
75
|
onModeChange?: (mode: AuthMode) => void;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
showPasswordStrength?: boolean;
|
|
77
|
+
showAlreadyHaveAccountLink?: boolean;
|
|
78
|
+
showNameField?: boolean;
|
|
79
|
+
showConfirmPassword?: boolean;
|
|
80
|
+
showAcceptTermsAndConditions?: boolean;
|
|
81
|
+
termsAndConditions?: TNode;
|
|
82
|
+
showContainer?: Value<boolean>;
|
|
83
|
+
}
|
|
84
|
+
export interface SocialProvidersOptions {
|
|
85
|
+
providers: AuthProviderInfo[];
|
|
86
|
+
}
|
|
87
|
+
export interface SignInFormLabels {
|
|
88
|
+
emailLabel?: () => string;
|
|
89
|
+
passwordLabel?: () => string;
|
|
90
|
+
rememberMeLabel?: () => string;
|
|
91
|
+
signInButton?: () => string;
|
|
92
|
+
forgotPasswordLink?: () => string;
|
|
93
|
+
noAccountLink?: () => string;
|
|
79
94
|
}
|
|
80
95
|
export interface SignInFormOptions {
|
|
81
|
-
|
|
82
|
-
onModeChange?: (mode: AuthMode) => void;
|
|
83
|
-
onSignIn?: (data: SignInData) => Promise<void>;
|
|
84
|
-
onSocialLogin?: (provider: AuthProviderName) => Promise<void>;
|
|
85
|
-
loading?: Value<boolean>;
|
|
86
|
-
error?: Value<string | null>;
|
|
96
|
+
onSignIn?: (data: SignInData) => Promise<string | null>;
|
|
87
97
|
passwordRules?: PasswordRules;
|
|
88
|
-
labels?:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
showSocialDivider?: Value<boolean>;
|
|
100
|
-
showRememberMe?: Value<boolean>;
|
|
101
|
-
allowPasswordReset?: Value<boolean>;
|
|
102
|
-
allowSignUp?: Value<boolean>;
|
|
98
|
+
labels?: SignInFormLabels;
|
|
99
|
+
showRememberMe?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface SignUpFormLabels {
|
|
102
|
+
nameLabel?: () => string;
|
|
103
|
+
emailLabel?: () => string;
|
|
104
|
+
passwordLabel?: () => string;
|
|
105
|
+
confirmPasswordLabel?: () => string;
|
|
106
|
+
acceptTermsLabel?: () => string;
|
|
107
|
+
signUpButton?: () => string;
|
|
108
|
+
hasAccountLink?: () => string;
|
|
103
109
|
}
|
|
104
110
|
export interface SignUpFormOptions {
|
|
105
|
-
onSubmit?: (data: SignUpData) => Promise<void>;
|
|
106
|
-
onModeChange?: (mode: AuthMode) => void;
|
|
107
|
-
loading?: Value<boolean>;
|
|
108
|
-
error?: Value<string | null>;
|
|
109
111
|
passwordRules?: PasswordRules;
|
|
110
|
-
labels?:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
loading?: () => string;
|
|
118
|
-
signUpButton?: () => string;
|
|
119
|
-
hasAccountLink?: () => string;
|
|
120
|
-
};
|
|
121
|
-
socialProviders?: Value<AuthProviderInfo[]>;
|
|
122
|
-
showSocialDivider?: Value<boolean>;
|
|
123
|
-
showPasswordStrength?: Value<boolean>;
|
|
124
|
-
onSignUp?: (data: SignUpData) => Promise<void>;
|
|
125
|
-
onSocialLogin?: (provider: AuthProviderName) => Promise<void>;
|
|
126
|
-
showAlreadyHaveAccountLink?: Value<boolean>;
|
|
127
|
-
showNameField?: Value<boolean>;
|
|
128
|
-
showConfirmPassword?: Value<boolean>;
|
|
129
|
-
showAcceptTermsAndConditions?: Value<boolean>;
|
|
112
|
+
labels?: SignUpFormLabels;
|
|
113
|
+
onSignUp?: (data: SignUpData) => Promise<string | null>;
|
|
114
|
+
showPasswordStrength?: boolean;
|
|
115
|
+
showAlreadyHaveAccountLink?: boolean;
|
|
116
|
+
showNameField?: boolean;
|
|
117
|
+
showConfirmPassword?: boolean;
|
|
118
|
+
showAcceptTermsAndConditions?: boolean;
|
|
130
119
|
termsAndConditions?: TNode;
|
|
131
120
|
}
|
|
121
|
+
export interface ResetPasswordFormLabels {
|
|
122
|
+
resetPasswordButton?: () => string;
|
|
123
|
+
resetPasswordDescription?: () => string;
|
|
124
|
+
emailLabel?: () => string;
|
|
125
|
+
backToSignInLink?: () => string;
|
|
126
|
+
}
|
|
132
127
|
export interface ResetPasswordFormOptions {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
onResetPassword?: (data: ResetPasswordData) => Promise<void>;
|
|
136
|
-
loading?: Value<boolean>;
|
|
137
|
-
error?: Value<string | null>;
|
|
138
|
-
labels?: {
|
|
139
|
-
resetPasswordTitle?: () => string;
|
|
140
|
-
resetPasswordButton?: () => string;
|
|
141
|
-
resetPasswordDescription?: () => string;
|
|
142
|
-
emailLabel?: () => string;
|
|
143
|
-
loading?: () => string;
|
|
144
|
-
backToSignInLink?: () => string;
|
|
145
|
-
};
|
|
128
|
+
onResetPassword?: (data: ResetPasswordData) => Promise<string | null>;
|
|
129
|
+
labels?: ResetPasswordFormLabels;
|
|
146
130
|
}
|
|
147
131
|
export interface SocialLoginButtonOptions {
|
|
148
132
|
provider: Value<AuthProviderName>;
|
|
149
133
|
onClick?: () => Promise<void>;
|
|
150
|
-
loading?: Value<boolean>;
|
|
151
134
|
disabled?: Value<boolean>;
|
|
152
135
|
size?: Value<ControlSize>;
|
|
153
136
|
flow?: Value<'redirect' | 'popup' | undefined>;
|
|
@@ -16,8 +16,10 @@ export declare function createSocialLoginUrl(provider: AuthProviderName, clientI
|
|
|
16
16
|
export declare function openSocialLoginPopup<T>(url: string, provider: AuthProviderName, onSuccess?: (result: T) => void, onError?: (error: Error) => void): void;
|
|
17
17
|
export declare function formatAuthError(error: unknown): string;
|
|
18
18
|
export declare function isBrowser(): boolean;
|
|
19
|
-
export declare const REMEMBER_EMAIL_KEY = "bui_auth_remember_email";
|
|
20
|
-
export declare function saveRememberMe(email: string): void;
|
|
21
|
-
export declare function getRememberedEmail(): string | null;
|
|
22
|
-
export declare function clearRememberedEmail(): void;
|
|
23
19
|
export declare function functionOrReactiveMessage<T extends Value<unknown>[]>(fn: undefined | ((...args: GetValueTypes<T>) => string), reactiveFn: (...args: T) => Signal<string>, ...args: T): Signal<string>;
|
|
20
|
+
export declare function requestToControllerValidation<T>({ task, message, onStart, onEnd, }: {
|
|
21
|
+
task: undefined | ((value: T) => Promise<string | null>);
|
|
22
|
+
message: string;
|
|
23
|
+
onStart?: () => void;
|
|
24
|
+
onEnd?: () => void;
|
|
25
|
+
}): (value: T) => Promise<import("../form").ControllerValidation>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Validation } from '@tempots/std';
|
|
2
|
+
import { PathSegment } from './path';
|
|
3
|
+
export type ControllerError = {
|
|
4
|
+
message?: string;
|
|
5
|
+
dependencies?: Record<PathSegment, ControllerError>;
|
|
6
|
+
};
|
|
7
|
+
export type ControllerValidation = Validation<ControllerError>;
|
|
8
|
+
export declare function makeMapValidation(fields: PathSegment[]): (status: ControllerValidation) => ControllerValidation;
|
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
import { Signal } from '@tempots/dom';
|
|
2
2
|
import { Path, PathSegment } from './path';
|
|
3
|
-
import {
|
|
4
|
-
export declare class Controller<
|
|
3
|
+
import { ControllerError, ControllerValidation } from './controller-validation';
|
|
4
|
+
export declare class Controller<T> {
|
|
5
5
|
#private;
|
|
6
6
|
readonly path: Path;
|
|
7
|
-
readonly change: (value:
|
|
8
|
-
readonly value: Signal<
|
|
9
|
-
readonly status: Signal<
|
|
7
|
+
readonly change: (value: T) => void;
|
|
8
|
+
readonly value: Signal<T>;
|
|
9
|
+
readonly status: Signal<ControllerValidation>;
|
|
10
10
|
readonly error: Signal<undefined | string>;
|
|
11
11
|
readonly hasError: Signal<boolean>;
|
|
12
|
-
readonly dependencyErrors: Signal<undefined | Record<string | number,
|
|
12
|
+
readonly dependencyErrors: Signal<undefined | Record<string | number, ControllerError>>;
|
|
13
13
|
protected readonly parent: {
|
|
14
14
|
disabled: Signal<boolean>;
|
|
15
15
|
};
|
|
16
16
|
readonly disabled: Signal<boolean>;
|
|
17
|
-
|
|
17
|
+
readonly disabledOrHasErrors: Signal<boolean>;
|
|
18
|
+
constructor(path: Path, change: (value: T) => void, value: Signal<T>, status: Signal<ControllerValidation>, parent: {
|
|
18
19
|
disabled: Signal<boolean>;
|
|
19
20
|
});
|
|
20
21
|
get name(): string;
|
|
21
22
|
readonly onDispose: (callback: () => void) => void;
|
|
22
23
|
readonly dispose: () => void;
|
|
24
|
+
readonly setDisabled: (disabled: boolean) => void;
|
|
23
25
|
readonly disable: () => void;
|
|
24
26
|
readonly enable: () => void;
|
|
25
|
-
readonly array: (equals?: (a:
|
|
26
|
-
readonly object: (equals?: (a:
|
|
27
|
-
readonly transform: <Out>(transform: (value:
|
|
27
|
+
readonly array: (equals?: (a: T, b: T) => boolean) => ArrayController<T extends any[] ? T : never>;
|
|
28
|
+
readonly object: (equals?: (a: T, b: T) => boolean) => ObjectController<T extends Record<string, any> ? T : never>;
|
|
29
|
+
readonly transform: <Out>(transform: (value: T) => Out, untransform: (value: Out) => T, subpath?: PathSegment[], equals?: (a: Out, b: Out) => boolean) => Controller<Out>;
|
|
28
30
|
}
|
|
29
|
-
export declare class ObjectController<
|
|
31
|
+
export declare class ObjectController<T extends Record<keyof T, T[keyof T]>> extends Controller<T> {
|
|
30
32
|
#private;
|
|
31
|
-
constructor(path: Path, change: (value:
|
|
33
|
+
constructor(path: Path, change: (value: T) => void, value: Signal<T>, status: Signal<ControllerValidation>, parent: {
|
|
32
34
|
disabled: Signal<boolean>;
|
|
33
|
-
}, equals: (a:
|
|
34
|
-
readonly field: <K extends keyof
|
|
35
|
+
}, equals: (a: T, b: T) => boolean);
|
|
36
|
+
readonly field: <K extends keyof T & string>(field: K) => Controller<T[K]>;
|
|
35
37
|
}
|
|
36
|
-
export declare class ArrayController<
|
|
38
|
+
export declare class ArrayController<T extends unknown[]> extends Controller<T> {
|
|
37
39
|
#private;
|
|
38
40
|
readonly length: Signal<number>;
|
|
39
|
-
constructor(path: Path, change: (value:
|
|
41
|
+
constructor(path: Path, change: (value: T) => void, value: Signal<T>, status: Signal<ControllerValidation>, parent: {
|
|
40
42
|
disabled: Signal<boolean>;
|
|
41
|
-
}, equals: (a:
|
|
42
|
-
readonly item: (index: number) => Controller<
|
|
43
|
-
readonly push: (...value:
|
|
43
|
+
}, equals: (a: T, b: T) => boolean);
|
|
44
|
+
readonly item: (index: number) => Controller<T[number]>;
|
|
45
|
+
readonly push: (...value: T[number][]) => void;
|
|
44
46
|
readonly pop: () => void;
|
|
45
47
|
readonly shift: () => void;
|
|
46
|
-
readonly unshift: (...value:
|
|
48
|
+
readonly unshift: (...value: T) => void;
|
|
47
49
|
readonly removeAt: (index: number) => void;
|
|
48
50
|
readonly splice: (start: number, deleteCount?: number) => void;
|
|
49
51
|
readonly move: (from: number, to: number, length?: number) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ControllerError } from '../controller/controller-validation';
|
|
2
2
|
import { StandardSchemaV1 } from './standard-schema-v1';
|
|
3
3
|
export declare function convertStandardSchemaPathToPath(path: ReadonlyArray<PropertyKey | StandardSchemaV1.PathSegment>): (string | number)[];
|
|
4
|
-
export declare function convertStandardSchemaIssues(issues: readonly StandardSchemaV1.Issue[]):
|
|
4
|
+
export declare function convertStandardSchemaIssues(issues: readonly StandardSchemaV1.Issue[]): ControllerError;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from './schema/standard-schema-v1';
|
|
2
|
-
import {
|
|
3
|
-
export interface UseFormOptions<
|
|
4
|
-
schema: StandardSchemaV1<
|
|
5
|
-
defaultValue?:
|
|
2
|
+
import { ControllerValidation, Controller, ObjectController } from './controller';
|
|
3
|
+
export interface UseFormOptions<T> {
|
|
4
|
+
schema: StandardSchemaV1<T, T>;
|
|
5
|
+
defaultValue?: T;
|
|
6
|
+
submit?: (value: T) => Promise<ControllerValidation>;
|
|
6
7
|
}
|
|
7
|
-
export interface UseControllerOptions<
|
|
8
|
-
defaultValue:
|
|
9
|
-
onChange?: (value:
|
|
10
|
-
validate?: (value:
|
|
8
|
+
export interface UseControllerOptions<T> {
|
|
9
|
+
defaultValue: T;
|
|
10
|
+
onChange?: (value: T) => void;
|
|
11
|
+
validate?: (value: T) => Promise<ControllerValidation> | ControllerValidation;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Creates a Controller instance with automatic resource cleanup.
|
|
14
15
|
* The controller will be automatically disposed when the component unmounts.
|
|
15
16
|
*/
|
|
16
|
-
export declare function useController<
|
|
17
|
+
export declare function useController<T>({ defaultValue, onChange, validate, }: UseControllerOptions<T>): {
|
|
18
|
+
controller: Controller<T>;
|
|
19
|
+
setStatus: (result: ControllerValidation) => void;
|
|
20
|
+
};
|
|
17
21
|
export declare function connectCommonAttributes<T>(value: Controller<T>): import("@tempots/dom").Renderable<import("@tempots/dom").DOMContext>;
|
|
18
22
|
export declare function connectStringInput(value: Controller<string>, { triggerOn, }?: {
|
|
19
23
|
triggerOn?: 'change' | 'input';
|
|
@@ -21,5 +25,34 @@ export declare function connectStringInput(value: Controller<string>, { triggerO
|
|
|
21
25
|
export declare function connectNumberInput(value: Controller<number>, { triggerOn, }?: {
|
|
22
26
|
triggerOn?: 'change' | 'input';
|
|
23
27
|
}): import("@tempots/dom").Renderable<import("@tempots/dom").DOMContext>;
|
|
24
|
-
export declare function
|
|
25
|
-
|
|
28
|
+
export declare function standardSchemaResultToValidation<Out>(result: StandardSchemaV1.Result<Out>): ControllerValidation;
|
|
29
|
+
/**
|
|
30
|
+
* Wraps an async operation and converts any thrown errors into a ControllerValidation.
|
|
31
|
+
* This is useful for form submission handlers that need to convert async operations
|
|
32
|
+
* into the ControllerValidation format expected by the form system.
|
|
33
|
+
*
|
|
34
|
+
* @param task - The async operation to execute
|
|
35
|
+
* @param errorMessage - Optional custom error message. If not provided, uses the error's message or a default message
|
|
36
|
+
* @param errorPath - Optional path for the error. Defaults to ['root']
|
|
37
|
+
* @returns A Promise that resolves to a ControllerValidation
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const result = await taskToValidation(
|
|
42
|
+
* () => signUpUser(userData),
|
|
43
|
+
* 'Sign up failed'
|
|
44
|
+
* )
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function taskToValidation<T>({ task, errorMessage, errorPath, validation, }: {
|
|
48
|
+
task: () => Promise<T>;
|
|
49
|
+
errorMessage?: string;
|
|
50
|
+
errorPath?: string[];
|
|
51
|
+
validation?: (result: T) => ControllerValidation;
|
|
52
|
+
}): Promise<ControllerValidation>;
|
|
53
|
+
export type UseFormResult<T> = {
|
|
54
|
+
controller: ObjectController<T>;
|
|
55
|
+
setStatus: (result: ControllerValidation) => void;
|
|
56
|
+
onSubmit: (e: Event) => Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
export declare function useForm<T>({ defaultValue, schema, submit, }: UseFormOptions<T>): UseFormResult<T>;
|