@sikka/hawa 0.27.13-next → 0.27.14-next
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/blocks/auth/index.js +31 -17
- package/dist/blocks/auth/index.mjs +31 -17
- package/dist/blocks/index.js +31 -17
- package/dist/blocks/index.mjs +31 -17
- package/dist/index.js +31 -17
- package/dist/index.mjs +31 -17
- package/package.json +1 -1
@@ -3538,6 +3538,8 @@ var StopPropagationWrapper = (props) => {
|
|
3538
3538
|
var RegisterForm = ({
|
3539
3539
|
texts,
|
3540
3540
|
registerFields = ["email"],
|
3541
|
+
showTermsOption = false,
|
3542
|
+
showNewsletterOption = false,
|
3541
3543
|
...props
|
3542
3544
|
}) => {
|
3543
3545
|
var _a, _b, _c, _d, _e, _f;
|
@@ -3560,26 +3562,38 @@ var RegisterForm = ({
|
|
3560
3562
|
fieldSchemas["fullName"] = z2.string().optional();
|
3561
3563
|
break;
|
3562
3564
|
case "email":
|
3563
|
-
fieldSchemas["email"] = z2.string({
|
3565
|
+
fieldSchemas["email"] = z2.string({
|
3566
|
+
required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
|
3567
|
+
}).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
|
3564
3568
|
break;
|
3565
3569
|
case "username":
|
3566
|
-
fieldSchemas["username"] = z2.string({
|
3570
|
+
fieldSchemas["username"] = z2.string({
|
3571
|
+
required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
|
3572
|
+
}).min(1, {
|
3573
|
+
message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
|
3574
|
+
}).refine(
|
3567
3575
|
(value) => {
|
3568
3576
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
3569
3577
|
return isValid;
|
3570
3578
|
},
|
3571
|
-
{ message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
|
3579
|
+
{ message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
|
3572
3580
|
);
|
3573
3581
|
break;
|
3574
3582
|
}
|
3575
3583
|
});
|
3576
3584
|
const formSchema = z2.object({
|
3577
3585
|
...fieldSchemas,
|
3578
|
-
password: z2.string({
|
3579
|
-
|
3586
|
+
password: z2.string({
|
3587
|
+
required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
|
3588
|
+
}).min(5, {
|
3589
|
+
message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
|
3590
|
+
}).refine((value) => value !== "", {
|
3591
|
+
message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
|
3580
3592
|
}),
|
3581
|
-
confirm_password: z2.string({
|
3582
|
-
|
3593
|
+
confirm_password: z2.string({
|
3594
|
+
required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
|
3595
|
+
}).refine((value) => value !== "", {
|
3596
|
+
message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
|
3583
3597
|
}),
|
3584
3598
|
refCode: z2.string().optional(),
|
3585
3599
|
reference: z2.string().optional(),
|
@@ -3628,7 +3642,7 @@ var RegisterForm = ({
|
|
3628
3642
|
Input,
|
3629
3643
|
{
|
3630
3644
|
width: "full",
|
3631
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
3645
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
3632
3646
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
3633
3647
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
3634
3648
|
...field
|
@@ -3656,7 +3670,7 @@ var RegisterForm = ({
|
|
3656
3670
|
},
|
3657
3671
|
width: "full",
|
3658
3672
|
autoComplete: "email",
|
3659
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
3673
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3660
3674
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3661
3675
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3662
3676
|
...field
|
@@ -3680,7 +3694,7 @@ var RegisterForm = ({
|
|
3680
3694
|
{
|
3681
3695
|
width: "full",
|
3682
3696
|
autoComplete: "username",
|
3683
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
3697
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
3684
3698
|
labelProps: {
|
3685
3699
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
3686
3700
|
},
|
@@ -3716,7 +3730,7 @@ var RegisterForm = ({
|
|
3716
3730
|
" "
|
3717
3731
|
),
|
3718
3732
|
autoComplete: "new-password",
|
3719
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
3733
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3720
3734
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
3721
3735
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
3722
3736
|
...field
|
@@ -3738,7 +3752,7 @@ var RegisterForm = ({
|
|
3738
3752
|
width: "full",
|
3739
3753
|
type: "password",
|
3740
3754
|
autoComplete: "new-password",
|
3741
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
3755
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
3742
3756
|
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
3743
3757
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
3744
3758
|
...field
|
@@ -3793,7 +3807,7 @@ var RegisterForm = ({
|
|
3793
3807
|
}
|
3794
3808
|
}
|
3795
3809
|
),
|
3796
|
-
/* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
3810
|
+
/* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ import_react15.default.createElement(
|
3797
3811
|
import_react_hook_form2.Controller,
|
3798
3812
|
{
|
3799
3813
|
control,
|
@@ -3806,19 +3820,19 @@ var RegisterForm = ({
|
|
3806
3820
|
id: "terms_accepted",
|
3807
3821
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
3808
3822
|
onCheckedChange: (e) => field.onChange(e),
|
3809
|
-
label: /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react15.default.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ import_react15.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react15.default.createElement(
|
3823
|
+
label: /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react15.default.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ import_react15.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react15.default.createElement(
|
3810
3824
|
"a",
|
3811
3825
|
{
|
3812
3826
|
onClick: props.onRouteToTOS,
|
3813
3827
|
className: "clickable-link"
|
3814
3828
|
},
|
3815
|
-
texts == null ? void 0 : texts.termsText
|
3829
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3816
3830
|
)))
|
3817
3831
|
}
|
3818
3832
|
);
|
3819
3833
|
}
|
3820
3834
|
}
|
3821
|
-
),
|
3835
|
+
), showNewsletterOption && /* @__PURE__ */ import_react15.default.createElement(
|
3822
3836
|
import_react_hook_form2.Controller,
|
3823
3837
|
{
|
3824
3838
|
control,
|
@@ -3844,7 +3858,7 @@ var RegisterForm = ({
|
|
3844
3858
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
3845
3859
|
),
|
3846
3860
|
props.additionalButtons
|
3847
|
-
)), /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react15.default.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ import_react15.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react15.default.createElement(
|
3861
|
+
)), /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react15.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react15.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react15.default.createElement(
|
3848
3862
|
CardFooter,
|
3849
3863
|
{
|
3850
3864
|
className: cn(
|
@@ -2664,6 +2664,8 @@ CheckboxElement.displayName = CheckboxPrimitive.Root.displayName;
|
|
2664
2664
|
var RegisterForm = ({
|
2665
2665
|
texts,
|
2666
2666
|
registerFields = ["email"],
|
2667
|
+
showTermsOption = false,
|
2668
|
+
showNewsletterOption = false,
|
2667
2669
|
...props
|
2668
2670
|
}) => {
|
2669
2671
|
var _a, _b, _c, _d, _e, _f;
|
@@ -2686,26 +2688,38 @@ var RegisterForm = ({
|
|
2686
2688
|
fieldSchemas["fullName"] = z2.string().optional();
|
2687
2689
|
break;
|
2688
2690
|
case "email":
|
2689
|
-
fieldSchemas["email"] = z2.string({
|
2691
|
+
fieldSchemas["email"] = z2.string({
|
2692
|
+
required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
|
2693
|
+
}).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
|
2690
2694
|
break;
|
2691
2695
|
case "username":
|
2692
|
-
fieldSchemas["username"] = z2.string({
|
2696
|
+
fieldSchemas["username"] = z2.string({
|
2697
|
+
required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
|
2698
|
+
}).min(1, {
|
2699
|
+
message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
|
2700
|
+
}).refine(
|
2693
2701
|
(value) => {
|
2694
2702
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
2695
2703
|
return isValid;
|
2696
2704
|
},
|
2697
|
-
{ message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
|
2705
|
+
{ message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
|
2698
2706
|
);
|
2699
2707
|
break;
|
2700
2708
|
}
|
2701
2709
|
});
|
2702
2710
|
const formSchema = z2.object({
|
2703
2711
|
...fieldSchemas,
|
2704
|
-
password: z2.string({
|
2705
|
-
|
2712
|
+
password: z2.string({
|
2713
|
+
required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
|
2714
|
+
}).min(5, {
|
2715
|
+
message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
|
2716
|
+
}).refine((value) => value !== "", {
|
2717
|
+
message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
|
2706
2718
|
}),
|
2707
|
-
confirm_password: z2.string({
|
2708
|
-
|
2719
|
+
confirm_password: z2.string({
|
2720
|
+
required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
|
2721
|
+
}).refine((value) => value !== "", {
|
2722
|
+
message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
|
2709
2723
|
}),
|
2710
2724
|
refCode: z2.string().optional(),
|
2711
2725
|
reference: z2.string().optional(),
|
@@ -2754,7 +2768,7 @@ var RegisterForm = ({
|
|
2754
2768
|
Input,
|
2755
2769
|
{
|
2756
2770
|
width: "full",
|
2757
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
2771
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
2758
2772
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
2759
2773
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
2760
2774
|
...field
|
@@ -2782,7 +2796,7 @@ var RegisterForm = ({
|
|
2782
2796
|
},
|
2783
2797
|
width: "full",
|
2784
2798
|
autoComplete: "email",
|
2785
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
2799
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
2786
2800
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
2787
2801
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
2788
2802
|
...field
|
@@ -2806,7 +2820,7 @@ var RegisterForm = ({
|
|
2806
2820
|
{
|
2807
2821
|
width: "full",
|
2808
2822
|
autoComplete: "username",
|
2809
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
2823
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
2810
2824
|
labelProps: {
|
2811
2825
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
2812
2826
|
},
|
@@ -2842,7 +2856,7 @@ var RegisterForm = ({
|
|
2842
2856
|
" "
|
2843
2857
|
),
|
2844
2858
|
autoComplete: "new-password",
|
2845
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
2859
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
2846
2860
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
2847
2861
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
2848
2862
|
...field
|
@@ -2864,7 +2878,7 @@ var RegisterForm = ({
|
|
2864
2878
|
width: "full",
|
2865
2879
|
type: "password",
|
2866
2880
|
autoComplete: "new-password",
|
2867
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
2881
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
2868
2882
|
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
2869
2883
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
2870
2884
|
...field
|
@@ -2919,7 +2933,7 @@ var RegisterForm = ({
|
|
2919
2933
|
}
|
2920
2934
|
}
|
2921
2935
|
),
|
2922
|
-
/* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
2936
|
+
/* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ React7.createElement(
|
2923
2937
|
Controller2,
|
2924
2938
|
{
|
2925
2939
|
control,
|
@@ -2932,19 +2946,19 @@ var RegisterForm = ({
|
|
2932
2946
|
id: "terms_accepted",
|
2933
2947
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
2934
2948
|
onCheckedChange: (e) => field.onChange(e),
|
2935
|
-
label: /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React7.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ React7.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React7.createElement(
|
2949
|
+
label: /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React7.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ React7.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React7.createElement(
|
2936
2950
|
"a",
|
2937
2951
|
{
|
2938
2952
|
onClick: props.onRouteToTOS,
|
2939
2953
|
className: "clickable-link"
|
2940
2954
|
},
|
2941
|
-
texts == null ? void 0 : texts.termsText
|
2955
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
2942
2956
|
)))
|
2943
2957
|
}
|
2944
2958
|
);
|
2945
2959
|
}
|
2946
2960
|
}
|
2947
|
-
),
|
2961
|
+
), showNewsletterOption && /* @__PURE__ */ React7.createElement(
|
2948
2962
|
Controller2,
|
2949
2963
|
{
|
2950
2964
|
control,
|
@@ -2970,7 +2984,7 @@ var RegisterForm = ({
|
|
2970
2984
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
2971
2985
|
),
|
2972
2986
|
props.additionalButtons
|
2973
|
-
)), /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React7.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ React7.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React7.createElement(
|
2987
|
+
)), /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React7.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React7.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React7.createElement(
|
2974
2988
|
CardFooter,
|
2975
2989
|
{
|
2976
2990
|
className: cn(
|
package/dist/blocks/index.js
CHANGED
@@ -3695,6 +3695,8 @@ var StopPropagationWrapper = (props) => {
|
|
3695
3695
|
var RegisterForm = ({
|
3696
3696
|
texts,
|
3697
3697
|
registerFields = ["email"],
|
3698
|
+
showTermsOption = false,
|
3699
|
+
showNewsletterOption = false,
|
3698
3700
|
...props
|
3699
3701
|
}) => {
|
3700
3702
|
var _a, _b, _c, _d, _e, _f;
|
@@ -3717,26 +3719,38 @@ var RegisterForm = ({
|
|
3717
3719
|
fieldSchemas["fullName"] = z2.string().optional();
|
3718
3720
|
break;
|
3719
3721
|
case "email":
|
3720
|
-
fieldSchemas["email"] = z2.string({
|
3722
|
+
fieldSchemas["email"] = z2.string({
|
3723
|
+
required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
|
3724
|
+
}).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
|
3721
3725
|
break;
|
3722
3726
|
case "username":
|
3723
|
-
fieldSchemas["username"] = z2.string({
|
3727
|
+
fieldSchemas["username"] = z2.string({
|
3728
|
+
required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
|
3729
|
+
}).min(1, {
|
3730
|
+
message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
|
3731
|
+
}).refine(
|
3724
3732
|
(value) => {
|
3725
3733
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
3726
3734
|
return isValid;
|
3727
3735
|
},
|
3728
|
-
{ message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
|
3736
|
+
{ message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
|
3729
3737
|
);
|
3730
3738
|
break;
|
3731
3739
|
}
|
3732
3740
|
});
|
3733
3741
|
const formSchema = z2.object({
|
3734
3742
|
...fieldSchemas,
|
3735
|
-
password: z2.string({
|
3736
|
-
|
3743
|
+
password: z2.string({
|
3744
|
+
required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
|
3745
|
+
}).min(5, {
|
3746
|
+
message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
|
3747
|
+
}).refine((value) => value !== "", {
|
3748
|
+
message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
|
3737
3749
|
}),
|
3738
|
-
confirm_password: z2.string({
|
3739
|
-
|
3750
|
+
confirm_password: z2.string({
|
3751
|
+
required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
|
3752
|
+
}).refine((value) => value !== "", {
|
3753
|
+
message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
|
3740
3754
|
}),
|
3741
3755
|
refCode: z2.string().optional(),
|
3742
3756
|
reference: z2.string().optional(),
|
@@ -3785,7 +3799,7 @@ var RegisterForm = ({
|
|
3785
3799
|
Input,
|
3786
3800
|
{
|
3787
3801
|
width: "full",
|
3788
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
3802
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
3789
3803
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
3790
3804
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
3791
3805
|
...field
|
@@ -3813,7 +3827,7 @@ var RegisterForm = ({
|
|
3813
3827
|
},
|
3814
3828
|
width: "full",
|
3815
3829
|
autoComplete: "email",
|
3816
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
3830
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3817
3831
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3818
3832
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3819
3833
|
...field
|
@@ -3837,7 +3851,7 @@ var RegisterForm = ({
|
|
3837
3851
|
{
|
3838
3852
|
width: "full",
|
3839
3853
|
autoComplete: "username",
|
3840
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
3854
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
3841
3855
|
labelProps: {
|
3842
3856
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
3843
3857
|
},
|
@@ -3873,7 +3887,7 @@ var RegisterForm = ({
|
|
3873
3887
|
" "
|
3874
3888
|
),
|
3875
3889
|
autoComplete: "new-password",
|
3876
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
3890
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3877
3891
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
3878
3892
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
3879
3893
|
...field
|
@@ -3895,7 +3909,7 @@ var RegisterForm = ({
|
|
3895
3909
|
width: "full",
|
3896
3910
|
type: "password",
|
3897
3911
|
autoComplete: "new-password",
|
3898
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
3912
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
3899
3913
|
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
3900
3914
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
3901
3915
|
...field
|
@@ -3950,7 +3964,7 @@ var RegisterForm = ({
|
|
3950
3964
|
}
|
3951
3965
|
}
|
3952
3966
|
),
|
3953
|
-
/* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
3967
|
+
/* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ import_react15.default.createElement(
|
3954
3968
|
import_react_hook_form2.Controller,
|
3955
3969
|
{
|
3956
3970
|
control,
|
@@ -3963,19 +3977,19 @@ var RegisterForm = ({
|
|
3963
3977
|
id: "terms_accepted",
|
3964
3978
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
3965
3979
|
onCheckedChange: (e) => field.onChange(e),
|
3966
|
-
label: /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react15.default.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ import_react15.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react15.default.createElement(
|
3980
|
+
label: /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react15.default.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ import_react15.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react15.default.createElement(
|
3967
3981
|
"a",
|
3968
3982
|
{
|
3969
3983
|
onClick: props.onRouteToTOS,
|
3970
3984
|
className: "clickable-link"
|
3971
3985
|
},
|
3972
|
-
texts == null ? void 0 : texts.termsText
|
3986
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3973
3987
|
)))
|
3974
3988
|
}
|
3975
3989
|
);
|
3976
3990
|
}
|
3977
3991
|
}
|
3978
|
-
),
|
3992
|
+
), showNewsletterOption && /* @__PURE__ */ import_react15.default.createElement(
|
3979
3993
|
import_react_hook_form2.Controller,
|
3980
3994
|
{
|
3981
3995
|
control,
|
@@ -4001,7 +4015,7 @@ var RegisterForm = ({
|
|
4001
4015
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
4002
4016
|
),
|
4003
4017
|
props.additionalButtons
|
4004
|
-
)), /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react15.default.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ import_react15.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react15.default.createElement(
|
4018
|
+
)), /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react15.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react15.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react15.default.createElement(
|
4005
4019
|
CardFooter,
|
4006
4020
|
{
|
4007
4021
|
className: cn(
|
package/dist/blocks/index.mjs
CHANGED
@@ -438,6 +438,8 @@ import * as z2 from "zod";
|
|
438
438
|
var RegisterForm = ({
|
439
439
|
texts,
|
440
440
|
registerFields = ["email"],
|
441
|
+
showTermsOption = false,
|
442
|
+
showNewsletterOption = false,
|
441
443
|
...props
|
442
444
|
}) => {
|
443
445
|
var _a, _b, _c, _d, _e, _f;
|
@@ -460,26 +462,38 @@ var RegisterForm = ({
|
|
460
462
|
fieldSchemas["fullName"] = z2.string().optional();
|
461
463
|
break;
|
462
464
|
case "email":
|
463
|
-
fieldSchemas["email"] = z2.string({
|
465
|
+
fieldSchemas["email"] = z2.string({
|
466
|
+
required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
|
467
|
+
}).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
|
464
468
|
break;
|
465
469
|
case "username":
|
466
|
-
fieldSchemas["username"] = z2.string({
|
470
|
+
fieldSchemas["username"] = z2.string({
|
471
|
+
required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
|
472
|
+
}).min(1, {
|
473
|
+
message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
|
474
|
+
}).refine(
|
467
475
|
(value) => {
|
468
476
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
469
477
|
return isValid;
|
470
478
|
},
|
471
|
-
{ message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
|
479
|
+
{ message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
|
472
480
|
);
|
473
481
|
break;
|
474
482
|
}
|
475
483
|
});
|
476
484
|
const formSchema = z2.object({
|
477
485
|
...fieldSchemas,
|
478
|
-
password: z2.string({
|
479
|
-
|
486
|
+
password: z2.string({
|
487
|
+
required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
|
488
|
+
}).min(5, {
|
489
|
+
message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
|
490
|
+
}).refine((value) => value !== "", {
|
491
|
+
message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
|
480
492
|
}),
|
481
|
-
confirm_password: z2.string({
|
482
|
-
|
493
|
+
confirm_password: z2.string({
|
494
|
+
required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
|
495
|
+
}).refine((value) => value !== "", {
|
496
|
+
message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
|
483
497
|
}),
|
484
498
|
refCode: z2.string().optional(),
|
485
499
|
reference: z2.string().optional(),
|
@@ -528,7 +542,7 @@ var RegisterForm = ({
|
|
528
542
|
Input,
|
529
543
|
{
|
530
544
|
width: "full",
|
531
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
545
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
532
546
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
533
547
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
534
548
|
...field
|
@@ -556,7 +570,7 @@ var RegisterForm = ({
|
|
556
570
|
},
|
557
571
|
width: "full",
|
558
572
|
autoComplete: "email",
|
559
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
573
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
560
574
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
561
575
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
562
576
|
...field
|
@@ -580,7 +594,7 @@ var RegisterForm = ({
|
|
580
594
|
{
|
581
595
|
width: "full",
|
582
596
|
autoComplete: "username",
|
583
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
597
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
584
598
|
labelProps: {
|
585
599
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
586
600
|
},
|
@@ -616,7 +630,7 @@ var RegisterForm = ({
|
|
616
630
|
" "
|
617
631
|
),
|
618
632
|
autoComplete: "new-password",
|
619
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
633
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
620
634
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
621
635
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
622
636
|
...field
|
@@ -638,7 +652,7 @@ var RegisterForm = ({
|
|
638
652
|
width: "full",
|
639
653
|
type: "password",
|
640
654
|
autoComplete: "new-password",
|
641
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
655
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
642
656
|
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
643
657
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
644
658
|
...field
|
@@ -693,7 +707,7 @@ var RegisterForm = ({
|
|
693
707
|
}
|
694
708
|
}
|
695
709
|
),
|
696
|
-
/* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
710
|
+
/* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ React3.createElement(
|
697
711
|
Controller2,
|
698
712
|
{
|
699
713
|
control,
|
@@ -706,19 +720,19 @@ var RegisterForm = ({
|
|
706
720
|
id: "terms_accepted",
|
707
721
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
708
722
|
onCheckedChange: (e) => field.onChange(e),
|
709
|
-
label: /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React3.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ React3.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React3.createElement(
|
723
|
+
label: /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React3.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ React3.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React3.createElement(
|
710
724
|
"a",
|
711
725
|
{
|
712
726
|
onClick: props.onRouteToTOS,
|
713
727
|
className: "clickable-link"
|
714
728
|
},
|
715
|
-
texts == null ? void 0 : texts.termsText
|
729
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
716
730
|
)))
|
717
731
|
}
|
718
732
|
);
|
719
733
|
}
|
720
734
|
}
|
721
|
-
),
|
735
|
+
), showNewsletterOption && /* @__PURE__ */ React3.createElement(
|
722
736
|
Controller2,
|
723
737
|
{
|
724
738
|
control,
|
@@ -744,7 +758,7 @@ var RegisterForm = ({
|
|
744
758
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
745
759
|
),
|
746
760
|
props.additionalButtons
|
747
|
-
)), /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React3.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ React3.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React3.createElement(
|
761
|
+
)), /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React3.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React3.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React3.createElement(
|
748
762
|
CardFooter,
|
749
763
|
{
|
750
764
|
className: cn(
|
package/dist/index.js
CHANGED
@@ -9574,6 +9574,8 @@ var z2 = __toESM(require("zod"));
|
|
9574
9574
|
var RegisterForm = ({
|
9575
9575
|
texts,
|
9576
9576
|
registerFields = ["email"],
|
9577
|
+
showTermsOption = false,
|
9578
|
+
showNewsletterOption = false,
|
9577
9579
|
...props
|
9578
9580
|
}) => {
|
9579
9581
|
var _a, _b, _c, _d, _e, _f;
|
@@ -9596,26 +9598,38 @@ var RegisterForm = ({
|
|
9596
9598
|
fieldSchemas["fullName"] = z2.string().optional();
|
9597
9599
|
break;
|
9598
9600
|
case "email":
|
9599
|
-
fieldSchemas["email"] = z2.string({
|
9601
|
+
fieldSchemas["email"] = z2.string({
|
9602
|
+
required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
|
9603
|
+
}).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
|
9600
9604
|
break;
|
9601
9605
|
case "username":
|
9602
|
-
fieldSchemas["username"] = z2.string({
|
9606
|
+
fieldSchemas["username"] = z2.string({
|
9607
|
+
required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
|
9608
|
+
}).min(1, {
|
9609
|
+
message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
|
9610
|
+
}).refine(
|
9603
9611
|
(value) => {
|
9604
9612
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
9605
9613
|
return isValid;
|
9606
9614
|
},
|
9607
|
-
{ message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
|
9615
|
+
{ message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
|
9608
9616
|
);
|
9609
9617
|
break;
|
9610
9618
|
}
|
9611
9619
|
});
|
9612
9620
|
const formSchema = z2.object({
|
9613
9621
|
...fieldSchemas,
|
9614
|
-
password: z2.string({
|
9615
|
-
|
9622
|
+
password: z2.string({
|
9623
|
+
required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
|
9624
|
+
}).min(5, {
|
9625
|
+
message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
|
9626
|
+
}).refine((value) => value !== "", {
|
9627
|
+
message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
|
9616
9628
|
}),
|
9617
|
-
confirm_password: z2.string({
|
9618
|
-
|
9629
|
+
confirm_password: z2.string({
|
9630
|
+
required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
|
9631
|
+
}).refine((value) => value !== "", {
|
9632
|
+
message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
|
9619
9633
|
}),
|
9620
9634
|
refCode: z2.string().optional(),
|
9621
9635
|
reference: z2.string().optional(),
|
@@ -9664,7 +9678,7 @@ var RegisterForm = ({
|
|
9664
9678
|
Input,
|
9665
9679
|
{
|
9666
9680
|
width: "full",
|
9667
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
9681
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
9668
9682
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
9669
9683
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
9670
9684
|
...field
|
@@ -9692,7 +9706,7 @@ var RegisterForm = ({
|
|
9692
9706
|
},
|
9693
9707
|
width: "full",
|
9694
9708
|
autoComplete: "email",
|
9695
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
9709
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
9696
9710
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
9697
9711
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
9698
9712
|
...field
|
@@ -9716,7 +9730,7 @@ var RegisterForm = ({
|
|
9716
9730
|
{
|
9717
9731
|
width: "full",
|
9718
9732
|
autoComplete: "username",
|
9719
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
9733
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
9720
9734
|
labelProps: {
|
9721
9735
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
9722
9736
|
},
|
@@ -9752,7 +9766,7 @@ var RegisterForm = ({
|
|
9752
9766
|
" "
|
9753
9767
|
),
|
9754
9768
|
autoComplete: "new-password",
|
9755
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
9769
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
9756
9770
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
9757
9771
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
9758
9772
|
...field
|
@@ -9774,7 +9788,7 @@ var RegisterForm = ({
|
|
9774
9788
|
width: "full",
|
9775
9789
|
type: "password",
|
9776
9790
|
autoComplete: "new-password",
|
9777
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
9791
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
9778
9792
|
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
9779
9793
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
9780
9794
|
...field
|
@@ -9829,7 +9843,7 @@ var RegisterForm = ({
|
|
9829
9843
|
}
|
9830
9844
|
}
|
9831
9845
|
),
|
9832
|
-
/* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
9846
|
+
/* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ import_react47.default.createElement(
|
9833
9847
|
import_react_hook_form2.Controller,
|
9834
9848
|
{
|
9835
9849
|
control,
|
@@ -9842,19 +9856,19 @@ var RegisterForm = ({
|
|
9842
9856
|
id: "terms_accepted",
|
9843
9857
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
9844
9858
|
onCheckedChange: (e) => field.onChange(e),
|
9845
|
-
label: /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react47.default.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ import_react47.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react47.default.createElement(
|
9859
|
+
label: /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react47.default.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ import_react47.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react47.default.createElement(
|
9846
9860
|
"a",
|
9847
9861
|
{
|
9848
9862
|
onClick: props.onRouteToTOS,
|
9849
9863
|
className: "clickable-link"
|
9850
9864
|
},
|
9851
|
-
texts == null ? void 0 : texts.termsText
|
9865
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
9852
9866
|
)))
|
9853
9867
|
}
|
9854
9868
|
);
|
9855
9869
|
}
|
9856
9870
|
}
|
9857
|
-
),
|
9871
|
+
), showNewsletterOption && /* @__PURE__ */ import_react47.default.createElement(
|
9858
9872
|
import_react_hook_form2.Controller,
|
9859
9873
|
{
|
9860
9874
|
control,
|
@@ -9880,7 +9894,7 @@ var RegisterForm = ({
|
|
9880
9894
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
9881
9895
|
),
|
9882
9896
|
props.additionalButtons
|
9883
|
-
)), /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react47.default.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ import_react47.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react47.default.createElement(
|
9897
|
+
)), /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react47.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react47.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react47.default.createElement(
|
9884
9898
|
CardFooter,
|
9885
9899
|
{
|
9886
9900
|
className: cn(
|
package/dist/index.mjs
CHANGED
@@ -9356,6 +9356,8 @@ import * as z2 from "zod";
|
|
9356
9356
|
var RegisterForm = ({
|
9357
9357
|
texts,
|
9358
9358
|
registerFields = ["email"],
|
9359
|
+
showTermsOption = false,
|
9360
|
+
showNewsletterOption = false,
|
9359
9361
|
...props
|
9360
9362
|
}) => {
|
9361
9363
|
var _a, _b, _c, _d, _e, _f;
|
@@ -9378,26 +9380,38 @@ var RegisterForm = ({
|
|
9378
9380
|
fieldSchemas["fullName"] = z2.string().optional();
|
9379
9381
|
break;
|
9380
9382
|
case "email":
|
9381
|
-
fieldSchemas["email"] = z2.string({
|
9383
|
+
fieldSchemas["email"] = z2.string({
|
9384
|
+
required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
|
9385
|
+
}).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
|
9382
9386
|
break;
|
9383
9387
|
case "username":
|
9384
|
-
fieldSchemas["username"] = z2.string({
|
9388
|
+
fieldSchemas["username"] = z2.string({
|
9389
|
+
required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
|
9390
|
+
}).min(1, {
|
9391
|
+
message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
|
9392
|
+
}).refine(
|
9385
9393
|
(value) => {
|
9386
9394
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
9387
9395
|
return isValid;
|
9388
9396
|
},
|
9389
|
-
{ message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
|
9397
|
+
{ message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
|
9390
9398
|
);
|
9391
9399
|
break;
|
9392
9400
|
}
|
9393
9401
|
});
|
9394
9402
|
const formSchema = z2.object({
|
9395
9403
|
...fieldSchemas,
|
9396
|
-
password: z2.string({
|
9397
|
-
|
9404
|
+
password: z2.string({
|
9405
|
+
required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
|
9406
|
+
}).min(5, {
|
9407
|
+
message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
|
9408
|
+
}).refine((value) => value !== "", {
|
9409
|
+
message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
|
9398
9410
|
}),
|
9399
|
-
confirm_password: z2.string({
|
9400
|
-
|
9411
|
+
confirm_password: z2.string({
|
9412
|
+
required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
|
9413
|
+
}).refine((value) => value !== "", {
|
9414
|
+
message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
|
9401
9415
|
}),
|
9402
9416
|
refCode: z2.string().optional(),
|
9403
9417
|
reference: z2.string().optional(),
|
@@ -9446,7 +9460,7 @@ var RegisterForm = ({
|
|
9446
9460
|
Input,
|
9447
9461
|
{
|
9448
9462
|
width: "full",
|
9449
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
9463
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
9450
9464
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
9451
9465
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
9452
9466
|
...field
|
@@ -9474,7 +9488,7 @@ var RegisterForm = ({
|
|
9474
9488
|
},
|
9475
9489
|
width: "full",
|
9476
9490
|
autoComplete: "email",
|
9477
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
9491
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
9478
9492
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
9479
9493
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
9480
9494
|
...field
|
@@ -9498,7 +9512,7 @@ var RegisterForm = ({
|
|
9498
9512
|
{
|
9499
9513
|
width: "full",
|
9500
9514
|
autoComplete: "username",
|
9501
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
9515
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
9502
9516
|
labelProps: {
|
9503
9517
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
9504
9518
|
},
|
@@ -9534,7 +9548,7 @@ var RegisterForm = ({
|
|
9534
9548
|
" "
|
9535
9549
|
),
|
9536
9550
|
autoComplete: "new-password",
|
9537
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
9551
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
9538
9552
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
9539
9553
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
9540
9554
|
...field
|
@@ -9556,7 +9570,7 @@ var RegisterForm = ({
|
|
9556
9570
|
width: "full",
|
9557
9571
|
type: "password",
|
9558
9572
|
autoComplete: "new-password",
|
9559
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
9573
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
9560
9574
|
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
9561
9575
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
9562
9576
|
...field
|
@@ -9611,7 +9625,7 @@ var RegisterForm = ({
|
|
9611
9625
|
}
|
9612
9626
|
}
|
9613
9627
|
),
|
9614
|
-
/* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
9628
|
+
/* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ React74.createElement(
|
9615
9629
|
Controller2,
|
9616
9630
|
{
|
9617
9631
|
control,
|
@@ -9624,19 +9638,19 @@ var RegisterForm = ({
|
|
9624
9638
|
id: "terms_accepted",
|
9625
9639
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
9626
9640
|
onCheckedChange: (e) => field.onChange(e),
|
9627
|
-
label: /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React74.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ React74.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React74.createElement(
|
9641
|
+
label: /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React74.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ React74.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React74.createElement(
|
9628
9642
|
"a",
|
9629
9643
|
{
|
9630
9644
|
onClick: props.onRouteToTOS,
|
9631
9645
|
className: "clickable-link"
|
9632
9646
|
},
|
9633
|
-
texts == null ? void 0 : texts.termsText
|
9647
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
9634
9648
|
)))
|
9635
9649
|
}
|
9636
9650
|
);
|
9637
9651
|
}
|
9638
9652
|
}
|
9639
|
-
),
|
9653
|
+
), showNewsletterOption && /* @__PURE__ */ React74.createElement(
|
9640
9654
|
Controller2,
|
9641
9655
|
{
|
9642
9656
|
control,
|
@@ -9662,7 +9676,7 @@ var RegisterForm = ({
|
|
9662
9676
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
9663
9677
|
),
|
9664
9678
|
props.additionalButtons
|
9665
|
-
)), /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React74.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ React74.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React74.createElement(
|
9679
|
+
)), /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React74.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React74.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React74.createElement(
|
9666
9680
|
CardFooter,
|
9667
9681
|
{
|
9668
9682
|
className: cn(
|