@sikka/hawa 0.27.13-next → 0.27.15-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 +39 -23
- package/dist/blocks/auth/index.mjs +39 -23
- package/dist/blocks/index.js +39 -23
- package/dist/blocks/index.mjs +39 -23
- package/dist/index.js +39 -23
- package/dist/index.mjs +39 -23
- package/package.json +4 -2
@@ -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,33 +3562,47 @@ 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(),
|
3586
|
-
terms_accepted: z2.boolean({ required_error: texts == null ? void 0 : texts.termsRequired }).refine((value) => value, {
|
3600
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
3601
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
3602
|
+
}),
|
3587
3603
|
newsletter_accepted: z2.boolean().optional()
|
3588
3604
|
}).refine((data) => data.password === data.confirm_password, {
|
3589
|
-
message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
|
3605
|
+
message: ((_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch) || "Passwords don't match",
|
3590
3606
|
path: ["confirm_password"]
|
3591
3607
|
});
|
3592
3608
|
const { handleSubmit, control, formState } = (0, import_react_hook_form2.useForm)({
|
@@ -3628,7 +3644,7 @@ var RegisterForm = ({
|
|
3628
3644
|
Input,
|
3629
3645
|
{
|
3630
3646
|
width: "full",
|
3631
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
3647
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
3632
3648
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
3633
3649
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
3634
3650
|
...field
|
@@ -3656,7 +3672,7 @@ var RegisterForm = ({
|
|
3656
3672
|
},
|
3657
3673
|
width: "full",
|
3658
3674
|
autoComplete: "email",
|
3659
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
3675
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3660
3676
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3661
3677
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3662
3678
|
...field
|
@@ -3680,7 +3696,7 @@ var RegisterForm = ({
|
|
3680
3696
|
{
|
3681
3697
|
width: "full",
|
3682
3698
|
autoComplete: "username",
|
3683
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
3699
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
3684
3700
|
labelProps: {
|
3685
3701
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
3686
3702
|
},
|
@@ -3716,7 +3732,7 @@ var RegisterForm = ({
|
|
3716
3732
|
" "
|
3717
3733
|
),
|
3718
3734
|
autoComplete: "new-password",
|
3719
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
3735
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3720
3736
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
3721
3737
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
3722
3738
|
...field
|
@@ -3738,8 +3754,8 @@ var RegisterForm = ({
|
|
3738
3754
|
width: "full",
|
3739
3755
|
type: "password",
|
3740
3756
|
autoComplete: "new-password",
|
3741
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
3742
|
-
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
3757
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
3758
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
3743
3759
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
3744
3760
|
...field
|
3745
3761
|
}
|
@@ -3793,7 +3809,7 @@ var RegisterForm = ({
|
|
3793
3809
|
}
|
3794
3810
|
}
|
3795
3811
|
),
|
3796
|
-
/* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
3812
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react15.default.createElement(
|
3797
3813
|
import_react_hook_form2.Controller,
|
3798
3814
|
{
|
3799
3815
|
control,
|
@@ -3806,19 +3822,19 @@ var RegisterForm = ({
|
|
3806
3822
|
id: "terms_accepted",
|
3807
3823
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
3808
3824
|
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(
|
3825
|
+
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
3826
|
"a",
|
3811
3827
|
{
|
3812
3828
|
onClick: props.onRouteToTOS,
|
3813
3829
|
className: "clickable-link"
|
3814
3830
|
},
|
3815
|
-
texts == null ? void 0 : texts.termsText
|
3831
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3816
3832
|
)))
|
3817
3833
|
}
|
3818
3834
|
);
|
3819
3835
|
}
|
3820
3836
|
}
|
3821
|
-
),
|
3837
|
+
), showNewsletterOption && /* @__PURE__ */ import_react15.default.createElement(
|
3822
3838
|
import_react_hook_form2.Controller,
|
3823
3839
|
{
|
3824
3840
|
control,
|
@@ -3827,16 +3843,16 @@ var RegisterForm = ({
|
|
3827
3843
|
Checkbox,
|
3828
3844
|
{
|
3829
3845
|
id: "newsletter_accepted",
|
3830
|
-
label: texts == null ? void 0 : texts.subscribeToNewsletter,
|
3846
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
3831
3847
|
onCheckedChange: field.onChange
|
3832
3848
|
}
|
3833
3849
|
)
|
3834
3850
|
}
|
3835
|
-
)),
|
3851
|
+
)) : null,
|
3836
3852
|
/* @__PURE__ */ import_react15.default.createElement(
|
3837
3853
|
Button,
|
3838
3854
|
{
|
3839
|
-
className: "
|
3855
|
+
className: " hawa-w-full",
|
3840
3856
|
type: "submit",
|
3841
3857
|
isLoading: props.isLoading,
|
3842
3858
|
disabled: props.isLoading
|
@@ -3844,7 +3860,7 @@ var RegisterForm = ({
|
|
3844
3860
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
3845
3861
|
),
|
3846
3862
|
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(
|
3863
|
+
)), /* @__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
3864
|
CardFooter,
|
3849
3865
|
{
|
3850
3866
|
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,33 +2688,47 @@ 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(),
|
2712
|
-
terms_accepted: z2.boolean({ required_error: texts == null ? void 0 : texts.termsRequired }).refine((value) => value, {
|
2726
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
2727
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
2728
|
+
}),
|
2713
2729
|
newsletter_accepted: z2.boolean().optional()
|
2714
2730
|
}).refine((data) => data.password === data.confirm_password, {
|
2715
|
-
message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
|
2731
|
+
message: ((_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch) || "Passwords don't match",
|
2716
2732
|
path: ["confirm_password"]
|
2717
2733
|
});
|
2718
2734
|
const { handleSubmit, control, formState } = useForm2({
|
@@ -2754,7 +2770,7 @@ var RegisterForm = ({
|
|
2754
2770
|
Input,
|
2755
2771
|
{
|
2756
2772
|
width: "full",
|
2757
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
2773
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
2758
2774
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
2759
2775
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
2760
2776
|
...field
|
@@ -2782,7 +2798,7 @@ var RegisterForm = ({
|
|
2782
2798
|
},
|
2783
2799
|
width: "full",
|
2784
2800
|
autoComplete: "email",
|
2785
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
2801
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
2786
2802
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
2787
2803
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
2788
2804
|
...field
|
@@ -2806,7 +2822,7 @@ var RegisterForm = ({
|
|
2806
2822
|
{
|
2807
2823
|
width: "full",
|
2808
2824
|
autoComplete: "username",
|
2809
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
2825
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
2810
2826
|
labelProps: {
|
2811
2827
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
2812
2828
|
},
|
@@ -2842,7 +2858,7 @@ var RegisterForm = ({
|
|
2842
2858
|
" "
|
2843
2859
|
),
|
2844
2860
|
autoComplete: "new-password",
|
2845
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
2861
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
2846
2862
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
2847
2863
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
2848
2864
|
...field
|
@@ -2864,8 +2880,8 @@ var RegisterForm = ({
|
|
2864
2880
|
width: "full",
|
2865
2881
|
type: "password",
|
2866
2882
|
autoComplete: "new-password",
|
2867
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
2868
|
-
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
2883
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
2884
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
2869
2885
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
2870
2886
|
...field
|
2871
2887
|
}
|
@@ -2919,7 +2935,7 @@ var RegisterForm = ({
|
|
2919
2935
|
}
|
2920
2936
|
}
|
2921
2937
|
),
|
2922
|
-
/* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
2938
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React7.createElement(
|
2923
2939
|
Controller2,
|
2924
2940
|
{
|
2925
2941
|
control,
|
@@ -2932,19 +2948,19 @@ var RegisterForm = ({
|
|
2932
2948
|
id: "terms_accepted",
|
2933
2949
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
2934
2950
|
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(
|
2951
|
+
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
2952
|
"a",
|
2937
2953
|
{
|
2938
2954
|
onClick: props.onRouteToTOS,
|
2939
2955
|
className: "clickable-link"
|
2940
2956
|
},
|
2941
|
-
texts == null ? void 0 : texts.termsText
|
2957
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
2942
2958
|
)))
|
2943
2959
|
}
|
2944
2960
|
);
|
2945
2961
|
}
|
2946
2962
|
}
|
2947
|
-
),
|
2963
|
+
), showNewsletterOption && /* @__PURE__ */ React7.createElement(
|
2948
2964
|
Controller2,
|
2949
2965
|
{
|
2950
2966
|
control,
|
@@ -2953,16 +2969,16 @@ var RegisterForm = ({
|
|
2953
2969
|
Checkbox,
|
2954
2970
|
{
|
2955
2971
|
id: "newsletter_accepted",
|
2956
|
-
label: texts == null ? void 0 : texts.subscribeToNewsletter,
|
2972
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
2957
2973
|
onCheckedChange: field.onChange
|
2958
2974
|
}
|
2959
2975
|
)
|
2960
2976
|
}
|
2961
|
-
)),
|
2977
|
+
)) : null,
|
2962
2978
|
/* @__PURE__ */ React7.createElement(
|
2963
2979
|
Button,
|
2964
2980
|
{
|
2965
|
-
className: "
|
2981
|
+
className: " hawa-w-full",
|
2966
2982
|
type: "submit",
|
2967
2983
|
isLoading: props.isLoading,
|
2968
2984
|
disabled: props.isLoading
|
@@ -2970,7 +2986,7 @@ var RegisterForm = ({
|
|
2970
2986
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
2971
2987
|
),
|
2972
2988
|
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(
|
2989
|
+
)), /* @__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
2990
|
CardFooter,
|
2975
2991
|
{
|
2976
2992
|
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,33 +3719,47 @@ 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(),
|
3743
|
-
terms_accepted: z2.boolean({ required_error: texts == null ? void 0 : texts.termsRequired }).refine((value) => value, {
|
3757
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
3758
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
3759
|
+
}),
|
3744
3760
|
newsletter_accepted: z2.boolean().optional()
|
3745
3761
|
}).refine((data) => data.password === data.confirm_password, {
|
3746
|
-
message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
|
3762
|
+
message: ((_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch) || "Passwords don't match",
|
3747
3763
|
path: ["confirm_password"]
|
3748
3764
|
});
|
3749
3765
|
const { handleSubmit, control, formState } = (0, import_react_hook_form2.useForm)({
|
@@ -3785,7 +3801,7 @@ var RegisterForm = ({
|
|
3785
3801
|
Input,
|
3786
3802
|
{
|
3787
3803
|
width: "full",
|
3788
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
3804
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
3789
3805
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
3790
3806
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
3791
3807
|
...field
|
@@ -3813,7 +3829,7 @@ var RegisterForm = ({
|
|
3813
3829
|
},
|
3814
3830
|
width: "full",
|
3815
3831
|
autoComplete: "email",
|
3816
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
3832
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3817
3833
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3818
3834
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3819
3835
|
...field
|
@@ -3837,7 +3853,7 @@ var RegisterForm = ({
|
|
3837
3853
|
{
|
3838
3854
|
width: "full",
|
3839
3855
|
autoComplete: "username",
|
3840
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
3856
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
3841
3857
|
labelProps: {
|
3842
3858
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
3843
3859
|
},
|
@@ -3873,7 +3889,7 @@ var RegisterForm = ({
|
|
3873
3889
|
" "
|
3874
3890
|
),
|
3875
3891
|
autoComplete: "new-password",
|
3876
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
3892
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3877
3893
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
3878
3894
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
3879
3895
|
...field
|
@@ -3895,8 +3911,8 @@ var RegisterForm = ({
|
|
3895
3911
|
width: "full",
|
3896
3912
|
type: "password",
|
3897
3913
|
autoComplete: "new-password",
|
3898
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
3899
|
-
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
3914
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
3915
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
3900
3916
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
3901
3917
|
...field
|
3902
3918
|
}
|
@@ -3950,7 +3966,7 @@ var RegisterForm = ({
|
|
3950
3966
|
}
|
3951
3967
|
}
|
3952
3968
|
),
|
3953
|
-
/* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
3969
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react15.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react15.default.createElement(
|
3954
3970
|
import_react_hook_form2.Controller,
|
3955
3971
|
{
|
3956
3972
|
control,
|
@@ -3963,19 +3979,19 @@ var RegisterForm = ({
|
|
3963
3979
|
id: "terms_accepted",
|
3964
3980
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
3965
3981
|
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(
|
3982
|
+
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
3983
|
"a",
|
3968
3984
|
{
|
3969
3985
|
onClick: props.onRouteToTOS,
|
3970
3986
|
className: "clickable-link"
|
3971
3987
|
},
|
3972
|
-
texts == null ? void 0 : texts.termsText
|
3988
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3973
3989
|
)))
|
3974
3990
|
}
|
3975
3991
|
);
|
3976
3992
|
}
|
3977
3993
|
}
|
3978
|
-
),
|
3994
|
+
), showNewsletterOption && /* @__PURE__ */ import_react15.default.createElement(
|
3979
3995
|
import_react_hook_form2.Controller,
|
3980
3996
|
{
|
3981
3997
|
control,
|
@@ -3984,16 +4000,16 @@ var RegisterForm = ({
|
|
3984
4000
|
Checkbox,
|
3985
4001
|
{
|
3986
4002
|
id: "newsletter_accepted",
|
3987
|
-
label: texts == null ? void 0 : texts.subscribeToNewsletter,
|
4003
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
3988
4004
|
onCheckedChange: field.onChange
|
3989
4005
|
}
|
3990
4006
|
)
|
3991
4007
|
}
|
3992
|
-
)),
|
4008
|
+
)) : null,
|
3993
4009
|
/* @__PURE__ */ import_react15.default.createElement(
|
3994
4010
|
Button,
|
3995
4011
|
{
|
3996
|
-
className: "
|
4012
|
+
className: " hawa-w-full",
|
3997
4013
|
type: "submit",
|
3998
4014
|
isLoading: props.isLoading,
|
3999
4015
|
disabled: props.isLoading
|
@@ -4001,7 +4017,7 @@ var RegisterForm = ({
|
|
4001
4017
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
4002
4018
|
),
|
4003
4019
|
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(
|
4020
|
+
)), /* @__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
4021
|
CardFooter,
|
4006
4022
|
{
|
4007
4023
|
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,33 +462,47 @@ 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(),
|
486
|
-
terms_accepted: z2.boolean({ required_error: texts == null ? void 0 : texts.termsRequired }).refine((value) => value, {
|
500
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
501
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
502
|
+
}),
|
487
503
|
newsletter_accepted: z2.boolean().optional()
|
488
504
|
}).refine((data) => data.password === data.confirm_password, {
|
489
|
-
message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
|
505
|
+
message: ((_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch) || "Passwords don't match",
|
490
506
|
path: ["confirm_password"]
|
491
507
|
});
|
492
508
|
const { handleSubmit, control, formState } = useForm2({
|
@@ -528,7 +544,7 @@ var RegisterForm = ({
|
|
528
544
|
Input,
|
529
545
|
{
|
530
546
|
width: "full",
|
531
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
547
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
532
548
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
533
549
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
534
550
|
...field
|
@@ -556,7 +572,7 @@ var RegisterForm = ({
|
|
556
572
|
},
|
557
573
|
width: "full",
|
558
574
|
autoComplete: "email",
|
559
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
575
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
560
576
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
561
577
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
562
578
|
...field
|
@@ -580,7 +596,7 @@ var RegisterForm = ({
|
|
580
596
|
{
|
581
597
|
width: "full",
|
582
598
|
autoComplete: "username",
|
583
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
599
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
584
600
|
labelProps: {
|
585
601
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
586
602
|
},
|
@@ -616,7 +632,7 @@ var RegisterForm = ({
|
|
616
632
|
" "
|
617
633
|
),
|
618
634
|
autoComplete: "new-password",
|
619
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
635
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
620
636
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
621
637
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
622
638
|
...field
|
@@ -638,8 +654,8 @@ var RegisterForm = ({
|
|
638
654
|
width: "full",
|
639
655
|
type: "password",
|
640
656
|
autoComplete: "new-password",
|
641
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
642
|
-
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
657
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
658
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
643
659
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
644
660
|
...field
|
645
661
|
}
|
@@ -693,7 +709,7 @@ var RegisterForm = ({
|
|
693
709
|
}
|
694
710
|
}
|
695
711
|
),
|
696
|
-
/* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
712
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React3.createElement(
|
697
713
|
Controller2,
|
698
714
|
{
|
699
715
|
control,
|
@@ -706,19 +722,19 @@ var RegisterForm = ({
|
|
706
722
|
id: "terms_accepted",
|
707
723
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
708
724
|
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(
|
725
|
+
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
726
|
"a",
|
711
727
|
{
|
712
728
|
onClick: props.onRouteToTOS,
|
713
729
|
className: "clickable-link"
|
714
730
|
},
|
715
|
-
texts == null ? void 0 : texts.termsText
|
731
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
716
732
|
)))
|
717
733
|
}
|
718
734
|
);
|
719
735
|
}
|
720
736
|
}
|
721
|
-
),
|
737
|
+
), showNewsletterOption && /* @__PURE__ */ React3.createElement(
|
722
738
|
Controller2,
|
723
739
|
{
|
724
740
|
control,
|
@@ -727,16 +743,16 @@ var RegisterForm = ({
|
|
727
743
|
Checkbox,
|
728
744
|
{
|
729
745
|
id: "newsletter_accepted",
|
730
|
-
label: texts == null ? void 0 : texts.subscribeToNewsletter,
|
746
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
731
747
|
onCheckedChange: field.onChange
|
732
748
|
}
|
733
749
|
)
|
734
750
|
}
|
735
|
-
)),
|
751
|
+
)) : null,
|
736
752
|
/* @__PURE__ */ React3.createElement(
|
737
753
|
Button,
|
738
754
|
{
|
739
|
-
className: "
|
755
|
+
className: " hawa-w-full",
|
740
756
|
type: "submit",
|
741
757
|
isLoading: props.isLoading,
|
742
758
|
disabled: props.isLoading
|
@@ -744,7 +760,7 @@ var RegisterForm = ({
|
|
744
760
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
745
761
|
),
|
746
762
|
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(
|
763
|
+
)), /* @__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
764
|
CardFooter,
|
749
765
|
{
|
750
766
|
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,33 +9598,47 @@ 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(),
|
9622
|
-
terms_accepted: z2.boolean({ required_error: texts == null ? void 0 : texts.termsRequired }).refine((value) => value, {
|
9636
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
9637
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
9638
|
+
}),
|
9623
9639
|
newsletter_accepted: z2.boolean().optional()
|
9624
9640
|
}).refine((data) => data.password === data.confirm_password, {
|
9625
|
-
message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
|
9641
|
+
message: ((_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch) || "Passwords don't match",
|
9626
9642
|
path: ["confirm_password"]
|
9627
9643
|
});
|
9628
9644
|
const { handleSubmit, control, formState } = (0, import_react_hook_form2.useForm)({
|
@@ -9664,7 +9680,7 @@ var RegisterForm = ({
|
|
9664
9680
|
Input,
|
9665
9681
|
{
|
9666
9682
|
width: "full",
|
9667
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
9683
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
9668
9684
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
9669
9685
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
9670
9686
|
...field
|
@@ -9692,7 +9708,7 @@ var RegisterForm = ({
|
|
9692
9708
|
},
|
9693
9709
|
width: "full",
|
9694
9710
|
autoComplete: "email",
|
9695
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
9711
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
9696
9712
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
9697
9713
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
9698
9714
|
...field
|
@@ -9716,7 +9732,7 @@ var RegisterForm = ({
|
|
9716
9732
|
{
|
9717
9733
|
width: "full",
|
9718
9734
|
autoComplete: "username",
|
9719
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
9735
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
9720
9736
|
labelProps: {
|
9721
9737
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
9722
9738
|
},
|
@@ -9752,7 +9768,7 @@ var RegisterForm = ({
|
|
9752
9768
|
" "
|
9753
9769
|
),
|
9754
9770
|
autoComplete: "new-password",
|
9755
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
9771
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
9756
9772
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
9757
9773
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
9758
9774
|
...field
|
@@ -9774,8 +9790,8 @@ var RegisterForm = ({
|
|
9774
9790
|
width: "full",
|
9775
9791
|
type: "password",
|
9776
9792
|
autoComplete: "new-password",
|
9777
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
9778
|
-
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
9793
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
9794
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
9779
9795
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
9780
9796
|
...field
|
9781
9797
|
}
|
@@ -9829,7 +9845,7 @@ var RegisterForm = ({
|
|
9829
9845
|
}
|
9830
9846
|
}
|
9831
9847
|
),
|
9832
|
-
/* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
9848
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react47.default.createElement(
|
9833
9849
|
import_react_hook_form2.Controller,
|
9834
9850
|
{
|
9835
9851
|
control,
|
@@ -9842,19 +9858,19 @@ var RegisterForm = ({
|
|
9842
9858
|
id: "terms_accepted",
|
9843
9859
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
9844
9860
|
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(
|
9861
|
+
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
9862
|
"a",
|
9847
9863
|
{
|
9848
9864
|
onClick: props.onRouteToTOS,
|
9849
9865
|
className: "clickable-link"
|
9850
9866
|
},
|
9851
|
-
texts == null ? void 0 : texts.termsText
|
9867
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
9852
9868
|
)))
|
9853
9869
|
}
|
9854
9870
|
);
|
9855
9871
|
}
|
9856
9872
|
}
|
9857
|
-
),
|
9873
|
+
), showNewsletterOption && /* @__PURE__ */ import_react47.default.createElement(
|
9858
9874
|
import_react_hook_form2.Controller,
|
9859
9875
|
{
|
9860
9876
|
control,
|
@@ -9863,16 +9879,16 @@ var RegisterForm = ({
|
|
9863
9879
|
Checkbox,
|
9864
9880
|
{
|
9865
9881
|
id: "newsletter_accepted",
|
9866
|
-
label: texts == null ? void 0 : texts.subscribeToNewsletter,
|
9882
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
9867
9883
|
onCheckedChange: field.onChange
|
9868
9884
|
}
|
9869
9885
|
)
|
9870
9886
|
}
|
9871
|
-
)),
|
9887
|
+
)) : null,
|
9872
9888
|
/* @__PURE__ */ import_react47.default.createElement(
|
9873
9889
|
Button,
|
9874
9890
|
{
|
9875
|
-
className: "
|
9891
|
+
className: " hawa-w-full",
|
9876
9892
|
type: "submit",
|
9877
9893
|
isLoading: props.isLoading,
|
9878
9894
|
disabled: props.isLoading
|
@@ -9880,7 +9896,7 @@ var RegisterForm = ({
|
|
9880
9896
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
9881
9897
|
),
|
9882
9898
|
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(
|
9899
|
+
)), /* @__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
9900
|
CardFooter,
|
9885
9901
|
{
|
9886
9902
|
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,33 +9380,47 @@ 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(),
|
9404
|
-
terms_accepted: z2.boolean({ required_error: texts == null ? void 0 : texts.termsRequired }).refine((value) => value, {
|
9418
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
9419
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
9420
|
+
}),
|
9405
9421
|
newsletter_accepted: z2.boolean().optional()
|
9406
9422
|
}).refine((data) => data.password === data.confirm_password, {
|
9407
|
-
message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
|
9423
|
+
message: ((_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch) || "Passwords don't match",
|
9408
9424
|
path: ["confirm_password"]
|
9409
9425
|
});
|
9410
9426
|
const { handleSubmit, control, formState } = useForm2({
|
@@ -9446,7 +9462,7 @@ var RegisterForm = ({
|
|
9446
9462
|
Input,
|
9447
9463
|
{
|
9448
9464
|
width: "full",
|
9449
|
-
label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
|
9465
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
9450
9466
|
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
9451
9467
|
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
9452
9468
|
...field
|
@@ -9474,7 +9490,7 @@ var RegisterForm = ({
|
|
9474
9490
|
},
|
9475
9491
|
width: "full",
|
9476
9492
|
autoComplete: "email",
|
9477
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
9493
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
9478
9494
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
9479
9495
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
9480
9496
|
...field
|
@@ -9498,7 +9514,7 @@ var RegisterForm = ({
|
|
9498
9514
|
{
|
9499
9515
|
width: "full",
|
9500
9516
|
autoComplete: "username",
|
9501
|
-
label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
|
9517
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
9502
9518
|
labelProps: {
|
9503
9519
|
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
9504
9520
|
},
|
@@ -9534,7 +9550,7 @@ var RegisterForm = ({
|
|
9534
9550
|
" "
|
9535
9551
|
),
|
9536
9552
|
autoComplete: "new-password",
|
9537
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
9553
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
9538
9554
|
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
9539
9555
|
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
9540
9556
|
...field
|
@@ -9556,8 +9572,8 @@ var RegisterForm = ({
|
|
9556
9572
|
width: "full",
|
9557
9573
|
type: "password",
|
9558
9574
|
autoComplete: "new-password",
|
9559
|
-
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
9560
|
-
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
9575
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
9576
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
9561
9577
|
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
9562
9578
|
...field
|
9563
9579
|
}
|
@@ -9611,7 +9627,7 @@ var RegisterForm = ({
|
|
9611
9627
|
}
|
9612
9628
|
}
|
9613
9629
|
),
|
9614
|
-
/* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" },
|
9630
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React74.createElement(
|
9615
9631
|
Controller2,
|
9616
9632
|
{
|
9617
9633
|
control,
|
@@ -9624,19 +9640,19 @@ var RegisterForm = ({
|
|
9624
9640
|
id: "terms_accepted",
|
9625
9641
|
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
9626
9642
|
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(
|
9643
|
+
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
9644
|
"a",
|
9629
9645
|
{
|
9630
9646
|
onClick: props.onRouteToTOS,
|
9631
9647
|
className: "clickable-link"
|
9632
9648
|
},
|
9633
|
-
texts == null ? void 0 : texts.termsText
|
9649
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
9634
9650
|
)))
|
9635
9651
|
}
|
9636
9652
|
);
|
9637
9653
|
}
|
9638
9654
|
}
|
9639
|
-
),
|
9655
|
+
), showNewsletterOption && /* @__PURE__ */ React74.createElement(
|
9640
9656
|
Controller2,
|
9641
9657
|
{
|
9642
9658
|
control,
|
@@ -9645,16 +9661,16 @@ var RegisterForm = ({
|
|
9645
9661
|
Checkbox,
|
9646
9662
|
{
|
9647
9663
|
id: "newsletter_accepted",
|
9648
|
-
label: texts == null ? void 0 : texts.subscribeToNewsletter,
|
9664
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
9649
9665
|
onCheckedChange: field.onChange
|
9650
9666
|
}
|
9651
9667
|
)
|
9652
9668
|
}
|
9653
|
-
)),
|
9669
|
+
)) : null,
|
9654
9670
|
/* @__PURE__ */ React74.createElement(
|
9655
9671
|
Button,
|
9656
9672
|
{
|
9657
|
-
className: "
|
9673
|
+
className: " hawa-w-full",
|
9658
9674
|
type: "submit",
|
9659
9675
|
isLoading: props.isLoading,
|
9660
9676
|
disabled: props.isLoading
|
@@ -9662,7 +9678,7 @@ var RegisterForm = ({
|
|
9662
9678
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
9663
9679
|
),
|
9664
9680
|
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(
|
9681
|
+
)), /* @__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
9682
|
CardFooter,
|
9667
9683
|
{
|
9668
9684
|
className: cn(
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sikka/hawa",
|
3
|
-
"version": "0.27.
|
3
|
+
"version": "0.27.15-next",
|
4
4
|
"description": "Modern UI Kit made with Tailwind",
|
5
5
|
"author": {
|
6
6
|
"name": "Sikka Software",
|
@@ -93,6 +93,8 @@
|
|
93
93
|
"@types/react": "^18.2.51",
|
94
94
|
"@types/react-dom": "^18.2.18",
|
95
95
|
"autoprefixer": "^10.4.17",
|
96
|
+
"boxen": "^7.1.1",
|
97
|
+
"chalk": "^5.3.0",
|
96
98
|
"embla-carousel": "8.0.0-rc22",
|
97
99
|
"jest": "^29.7.0",
|
98
100
|
"jest-environment-jsdom": "^29.7.0",
|
@@ -109,7 +111,7 @@
|
|
109
111
|
"check": "tsc --noEmit",
|
110
112
|
"test": "jest",
|
111
113
|
"prebuild": "node ./util/pre-build.js",
|
112
|
-
"build:lib": "npm run prebuild && node ./util/build-library.
|
114
|
+
"build:lib": "npm run prebuild && node ./util/build-library.mjs",
|
113
115
|
"build:css": "postcss styles.css -o dist/index.css",
|
114
116
|
"build": "npm run build:lib && npm run build:css",
|
115
117
|
"pub:next": "npm publish --tag next",
|