@sikka/hawa 0.27.12-next → 0.27.13-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.d.mts +2 -2
- package/dist/blocks/auth/index.d.ts +2 -2
- package/dist/blocks/auth/index.js +33 -19
- package/dist/blocks/auth/index.mjs +26 -14
- package/dist/blocks/index.d.mts +2 -2
- package/dist/blocks/index.d.ts +2 -2
- package/dist/blocks/index.js +33 -19
- package/dist/blocks/index.mjs +26 -14
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -14
- package/dist/index.mjs +26 -14
- package/package.json +11 -11
@@ -18,7 +18,7 @@ type LoginFormTypes = {
|
|
18
18
|
/** Login identifier type user will use to log in. */
|
19
19
|
loginType?: "email" | "username" | "phone" | "link";
|
20
20
|
/** If true, the reset password option is hidden. */
|
21
|
-
|
21
|
+
withResetPassword?: boolean;
|
22
22
|
/** If true, the register option is hidden. */
|
23
23
|
allowRegister?: boolean;
|
24
24
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
@@ -36,7 +36,7 @@ type LoginFormTypes = {
|
|
36
36
|
/** If true, Twitter login option is displayed. */
|
37
37
|
viaTwitter?: boolean;
|
38
38
|
/** Function to handle form submission. */
|
39
|
-
onLogin
|
39
|
+
onLogin: (e: any) => void;
|
40
40
|
/** Function to route user to the register page. */
|
41
41
|
onRouteToRegister?: () => void;
|
42
42
|
/** Function to handle forgotten password case. */
|
@@ -18,7 +18,7 @@ type LoginFormTypes = {
|
|
18
18
|
/** Login identifier type user will use to log in. */
|
19
19
|
loginType?: "email" | "username" | "phone" | "link";
|
20
20
|
/** If true, the reset password option is hidden. */
|
21
|
-
|
21
|
+
withResetPassword?: boolean;
|
22
22
|
/** If true, the register option is hidden. */
|
23
23
|
allowRegister?: boolean;
|
24
24
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
@@ -36,7 +36,7 @@ type LoginFormTypes = {
|
|
36
36
|
/** If true, Twitter login option is displayed. */
|
37
37
|
viaTwitter?: boolean;
|
38
38
|
/** Function to handle form submission. */
|
39
|
-
onLogin
|
39
|
+
onLogin: (e: any) => void;
|
40
40
|
/** Function to route user to the register page. */
|
41
41
|
onRouteToRegister?: () => void;
|
42
42
|
/** Function to handle forgotten password case. */
|
@@ -45,11 +45,6 @@ module.exports = __toCommonJS(auth_exports);
|
|
45
45
|
var import_react13 = __toESM(require("react"));
|
46
46
|
var import_react_hook_form = require("react-hook-form");
|
47
47
|
var import_zod = require("@hookform/resolvers/zod");
|
48
|
-
var import_libphonenumber_js = require("libphonenumber-js");
|
49
|
-
var z = __toESM(require("zod"));
|
50
|
-
|
51
|
-
// elements/alert/Alert.tsx
|
52
|
-
var import_react2 = __toESM(require("react"));
|
53
48
|
|
54
49
|
// util/index.ts
|
55
50
|
var import_clsx = require("clsx");
|
@@ -58,6 +53,13 @@ function cn(...inputs) {
|
|
58
53
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
59
54
|
}
|
60
55
|
|
56
|
+
// blocks/auth/LoginForm.tsx
|
57
|
+
var import_libphonenumber_js = require("libphonenumber-js");
|
58
|
+
var z = __toESM(require("zod"));
|
59
|
+
|
60
|
+
// elements/alert/Alert.tsx
|
61
|
+
var import_react2 = __toESM(require("react"));
|
62
|
+
|
61
63
|
// elements/button/Button.tsx
|
62
64
|
var React2 = __toESM(require("react"));
|
63
65
|
var import_class_variance_authority = require("class-variance-authority");
|
@@ -3082,7 +3084,7 @@ var AuthButtons = (props) => {
|
|
3082
3084
|
|
3083
3085
|
// blocks/auth/LoginForm.tsx
|
3084
3086
|
var LoginForm = ({
|
3085
|
-
loginType,
|
3087
|
+
loginType = "email",
|
3086
3088
|
texts,
|
3087
3089
|
passwordLength = 8,
|
3088
3090
|
...props
|
@@ -3101,33 +3103,45 @@ var LoginForm = ({
|
|
3101
3103
|
let formSchema;
|
3102
3104
|
if (loginType === "email") {
|
3103
3105
|
formSchema = z.object({
|
3104
|
-
email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
|
3105
|
-
password: z.string({
|
3106
|
+
email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
|
3107
|
+
password: z.string({
|
3108
|
+
required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
|
3109
|
+
}).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
|
3110
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
|
3111
|
+
})
|
3106
3112
|
});
|
3107
3113
|
} else if (loginType === "username") {
|
3108
3114
|
formSchema = z.object({
|
3109
|
-
username: z.string({
|
3115
|
+
username: z.string({
|
3116
|
+
required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
|
3117
|
+
}).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
|
3110
3118
|
(value) => {
|
3111
3119
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
3112
3120
|
return isValid;
|
3113
3121
|
},
|
3114
|
-
{ message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
|
3122
|
+
{ message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
|
3115
3123
|
),
|
3116
|
-
password: z.string({
|
3124
|
+
password: z.string({
|
3125
|
+
required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
|
3126
|
+
}).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
|
3127
|
+
message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
|
3128
|
+
})
|
3117
3129
|
});
|
3118
3130
|
} else if (loginType === "phone") {
|
3119
3131
|
formSchema = z.object({
|
3120
|
-
phone: z.string({
|
3132
|
+
phone: z.string({
|
3133
|
+
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
3134
|
+
}).refine(
|
3121
3135
|
(value) => {
|
3122
3136
|
let phoneNumber = (0, import_libphonenumber_js.parsePhoneNumber)(value);
|
3123
3137
|
return phoneNumber.isValid();
|
3124
3138
|
},
|
3125
|
-
{ message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
|
3139
|
+
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
3126
3140
|
)
|
3127
3141
|
});
|
3128
3142
|
} else if (loginType === "link") {
|
3129
3143
|
formSchema = z.object({
|
3130
|
-
email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
|
3144
|
+
email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
|
3131
3145
|
});
|
3132
3146
|
} else {
|
3133
3147
|
formSchema = z.object({});
|
@@ -3154,7 +3168,7 @@ var LoginForm = ({
|
|
3154
3168
|
dir: "ltr",
|
3155
3169
|
width: "full",
|
3156
3170
|
autoComplete: "email",
|
3157
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
3171
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3158
3172
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3159
3173
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
3160
3174
|
...field
|
@@ -3191,7 +3205,7 @@ var LoginForm = ({
|
|
3191
3205
|
);
|
3192
3206
|
}
|
3193
3207
|
}
|
3194
|
-
),
|
3208
|
+
), props.withResetPassword && /* @__PURE__ */ import_react13.default.createElement(
|
3195
3209
|
"div",
|
3196
3210
|
{
|
3197
3211
|
onClick: props.onForgotPassword,
|
@@ -3233,7 +3247,7 @@ var LoginForm = ({
|
|
3233
3247
|
width: "full",
|
3234
3248
|
autoComplete: "current-password",
|
3235
3249
|
type: passwordVisible ? "text" : "password",
|
3236
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
3250
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3237
3251
|
endIcon: /* @__PURE__ */ import_react13.default.createElement(
|
3238
3252
|
"div",
|
3239
3253
|
{
|
@@ -3249,7 +3263,7 @@ var LoginForm = ({
|
|
3249
3263
|
);
|
3250
3264
|
}
|
3251
3265
|
}
|
3252
|
-
),
|
3266
|
+
), props.withResetPassword && /* @__PURE__ */ import_react13.default.createElement(
|
3253
3267
|
"div",
|
3254
3268
|
{
|
3255
3269
|
onClick: props.onForgotPassword,
|
@@ -3268,7 +3282,7 @@ var LoginForm = ({
|
|
3268
3282
|
return /* @__PURE__ */ import_react13.default.createElement(
|
3269
3283
|
PhoneInput,
|
3270
3284
|
{
|
3271
|
-
label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
|
3285
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
3272
3286
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
3273
3287
|
preferredCountry: { label: "+966" },
|
3274
3288
|
handleChange: (e) => field.onChange((0, import_libphonenumber_js.parsePhoneNumber)(e).number)
|
@@ -2219,7 +2219,7 @@ var AuthButtons = (props) => {
|
|
2219
2219
|
|
2220
2220
|
// blocks/auth/LoginForm.tsx
|
2221
2221
|
var LoginForm = ({
|
2222
|
-
loginType,
|
2222
|
+
loginType = "email",
|
2223
2223
|
texts,
|
2224
2224
|
passwordLength = 8,
|
2225
2225
|
...props
|
@@ -2238,33 +2238,45 @@ var LoginForm = ({
|
|
2238
2238
|
let formSchema;
|
2239
2239
|
if (loginType === "email") {
|
2240
2240
|
formSchema = z.object({
|
2241
|
-
email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
|
2242
|
-
password: z.string({
|
2241
|
+
email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
|
2242
|
+
password: z.string({
|
2243
|
+
required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
|
2244
|
+
}).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
|
2245
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
|
2246
|
+
})
|
2243
2247
|
});
|
2244
2248
|
} else if (loginType === "username") {
|
2245
2249
|
formSchema = z.object({
|
2246
|
-
username: z.string({
|
2250
|
+
username: z.string({
|
2251
|
+
required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
|
2252
|
+
}).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
|
2247
2253
|
(value) => {
|
2248
2254
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
2249
2255
|
return isValid;
|
2250
2256
|
},
|
2251
|
-
{ message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
|
2257
|
+
{ message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
|
2252
2258
|
),
|
2253
|
-
password: z.string({
|
2259
|
+
password: z.string({
|
2260
|
+
required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
|
2261
|
+
}).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
|
2262
|
+
message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
|
2263
|
+
})
|
2254
2264
|
});
|
2255
2265
|
} else if (loginType === "phone") {
|
2256
2266
|
formSchema = z.object({
|
2257
|
-
phone: z.string({
|
2267
|
+
phone: z.string({
|
2268
|
+
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
2269
|
+
}).refine(
|
2258
2270
|
(value) => {
|
2259
2271
|
let phoneNumber = parsePhoneNumber(value);
|
2260
2272
|
return phoneNumber.isValid();
|
2261
2273
|
},
|
2262
|
-
{ message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
|
2274
|
+
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
2263
2275
|
)
|
2264
2276
|
});
|
2265
2277
|
} else if (loginType === "link") {
|
2266
2278
|
formSchema = z.object({
|
2267
|
-
email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
|
2279
|
+
email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
|
2268
2280
|
});
|
2269
2281
|
} else {
|
2270
2282
|
formSchema = z.object({});
|
@@ -2291,7 +2303,7 @@ var LoginForm = ({
|
|
2291
2303
|
dir: "ltr",
|
2292
2304
|
width: "full",
|
2293
2305
|
autoComplete: "email",
|
2294
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
2306
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
2295
2307
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
2296
2308
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
2297
2309
|
...field
|
@@ -2328,7 +2340,7 @@ var LoginForm = ({
|
|
2328
2340
|
);
|
2329
2341
|
}
|
2330
2342
|
}
|
2331
|
-
),
|
2343
|
+
), props.withResetPassword && /* @__PURE__ */ React5.createElement(
|
2332
2344
|
"div",
|
2333
2345
|
{
|
2334
2346
|
onClick: props.onForgotPassword,
|
@@ -2370,7 +2382,7 @@ var LoginForm = ({
|
|
2370
2382
|
width: "full",
|
2371
2383
|
autoComplete: "current-password",
|
2372
2384
|
type: passwordVisible ? "text" : "password",
|
2373
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
2385
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
2374
2386
|
endIcon: /* @__PURE__ */ React5.createElement(
|
2375
2387
|
"div",
|
2376
2388
|
{
|
@@ -2386,7 +2398,7 @@ var LoginForm = ({
|
|
2386
2398
|
);
|
2387
2399
|
}
|
2388
2400
|
}
|
2389
|
-
),
|
2401
|
+
), props.withResetPassword && /* @__PURE__ */ React5.createElement(
|
2390
2402
|
"div",
|
2391
2403
|
{
|
2392
2404
|
onClick: props.onForgotPassword,
|
@@ -2405,7 +2417,7 @@ var LoginForm = ({
|
|
2405
2417
|
return /* @__PURE__ */ React5.createElement(
|
2406
2418
|
PhoneInput,
|
2407
2419
|
{
|
2408
|
-
label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
|
2420
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
2409
2421
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
2410
2422
|
preferredCountry: { label: "+966" },
|
2411
2423
|
handleChange: (e) => field.onChange(parsePhoneNumber(e).number)
|
package/dist/blocks/index.d.mts
CHANGED
@@ -21,7 +21,7 @@ type LoginFormTypes = {
|
|
21
21
|
/** Login identifier type user will use to log in. */
|
22
22
|
loginType?: "email" | "username" | "phone" | "link";
|
23
23
|
/** If true, the reset password option is hidden. */
|
24
|
-
|
24
|
+
withResetPassword?: boolean;
|
25
25
|
/** If true, the register option is hidden. */
|
26
26
|
allowRegister?: boolean;
|
27
27
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
@@ -39,7 +39,7 @@ type LoginFormTypes = {
|
|
39
39
|
/** If true, Twitter login option is displayed. */
|
40
40
|
viaTwitter?: boolean;
|
41
41
|
/** Function to handle form submission. */
|
42
|
-
onLogin
|
42
|
+
onLogin: (e: any) => void;
|
43
43
|
/** Function to route user to the register page. */
|
44
44
|
onRouteToRegister?: () => void;
|
45
45
|
/** Function to handle forgotten password case. */
|
package/dist/blocks/index.d.ts
CHANGED
@@ -21,7 +21,7 @@ type LoginFormTypes = {
|
|
21
21
|
/** Login identifier type user will use to log in. */
|
22
22
|
loginType?: "email" | "username" | "phone" | "link";
|
23
23
|
/** If true, the reset password option is hidden. */
|
24
|
-
|
24
|
+
withResetPassword?: boolean;
|
25
25
|
/** If true, the register option is hidden. */
|
26
26
|
allowRegister?: boolean;
|
27
27
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
@@ -39,7 +39,7 @@ type LoginFormTypes = {
|
|
39
39
|
/** If true, Twitter login option is displayed. */
|
40
40
|
viaTwitter?: boolean;
|
41
41
|
/** Function to handle form submission. */
|
42
|
-
onLogin
|
42
|
+
onLogin: (e: any) => void;
|
43
43
|
/** Function to route user to the register page. */
|
44
44
|
onRouteToRegister?: () => void;
|
45
45
|
/** Function to handle forgotten password case. */
|
package/dist/blocks/index.js
CHANGED
@@ -66,11 +66,6 @@ module.exports = __toCommonJS(blocks_exports);
|
|
66
66
|
var import_react13 = __toESM(require("react"));
|
67
67
|
var import_react_hook_form = require("react-hook-form");
|
68
68
|
var import_zod = require("@hookform/resolvers/zod");
|
69
|
-
var import_libphonenumber_js = require("libphonenumber-js");
|
70
|
-
var z = __toESM(require("zod"));
|
71
|
-
|
72
|
-
// elements/alert/Alert.tsx
|
73
|
-
var import_react2 = __toESM(require("react"));
|
74
69
|
|
75
70
|
// util/index.ts
|
76
71
|
var import_clsx = require("clsx");
|
@@ -79,6 +74,13 @@ function cn(...inputs) {
|
|
79
74
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
80
75
|
}
|
81
76
|
|
77
|
+
// blocks/auth/LoginForm.tsx
|
78
|
+
var import_libphonenumber_js = require("libphonenumber-js");
|
79
|
+
var z = __toESM(require("zod"));
|
80
|
+
|
81
|
+
// elements/alert/Alert.tsx
|
82
|
+
var import_react2 = __toESM(require("react"));
|
83
|
+
|
82
84
|
// elements/button/Button.tsx
|
83
85
|
var React2 = __toESM(require("react"));
|
84
86
|
var import_class_variance_authority = require("class-variance-authority");
|
@@ -3239,7 +3241,7 @@ var AuthButtons = (props) => {
|
|
3239
3241
|
|
3240
3242
|
// blocks/auth/LoginForm.tsx
|
3241
3243
|
var LoginForm = ({
|
3242
|
-
loginType,
|
3244
|
+
loginType = "email",
|
3243
3245
|
texts,
|
3244
3246
|
passwordLength = 8,
|
3245
3247
|
...props
|
@@ -3258,33 +3260,45 @@ var LoginForm = ({
|
|
3258
3260
|
let formSchema;
|
3259
3261
|
if (loginType === "email") {
|
3260
3262
|
formSchema = z.object({
|
3261
|
-
email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
|
3262
|
-
password: z.string({
|
3263
|
+
email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
|
3264
|
+
password: z.string({
|
3265
|
+
required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
|
3266
|
+
}).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
|
3267
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
|
3268
|
+
})
|
3263
3269
|
});
|
3264
3270
|
} else if (loginType === "username") {
|
3265
3271
|
formSchema = z.object({
|
3266
|
-
username: z.string({
|
3272
|
+
username: z.string({
|
3273
|
+
required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
|
3274
|
+
}).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
|
3267
3275
|
(value) => {
|
3268
3276
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
3269
3277
|
return isValid;
|
3270
3278
|
},
|
3271
|
-
{ message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
|
3279
|
+
{ message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
|
3272
3280
|
),
|
3273
|
-
password: z.string({
|
3281
|
+
password: z.string({
|
3282
|
+
required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
|
3283
|
+
}).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
|
3284
|
+
message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
|
3285
|
+
})
|
3274
3286
|
});
|
3275
3287
|
} else if (loginType === "phone") {
|
3276
3288
|
formSchema = z.object({
|
3277
|
-
phone: z.string({
|
3289
|
+
phone: z.string({
|
3290
|
+
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
3291
|
+
}).refine(
|
3278
3292
|
(value) => {
|
3279
3293
|
let phoneNumber = (0, import_libphonenumber_js.parsePhoneNumber)(value);
|
3280
3294
|
return phoneNumber.isValid();
|
3281
3295
|
},
|
3282
|
-
{ message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
|
3296
|
+
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
3283
3297
|
)
|
3284
3298
|
});
|
3285
3299
|
} else if (loginType === "link") {
|
3286
3300
|
formSchema = z.object({
|
3287
|
-
email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
|
3301
|
+
email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
|
3288
3302
|
});
|
3289
3303
|
} else {
|
3290
3304
|
formSchema = z.object({});
|
@@ -3311,7 +3325,7 @@ var LoginForm = ({
|
|
3311
3325
|
dir: "ltr",
|
3312
3326
|
width: "full",
|
3313
3327
|
autoComplete: "email",
|
3314
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
3328
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3315
3329
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3316
3330
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
3317
3331
|
...field
|
@@ -3348,7 +3362,7 @@ var LoginForm = ({
|
|
3348
3362
|
);
|
3349
3363
|
}
|
3350
3364
|
}
|
3351
|
-
),
|
3365
|
+
), props.withResetPassword && /* @__PURE__ */ import_react13.default.createElement(
|
3352
3366
|
"div",
|
3353
3367
|
{
|
3354
3368
|
onClick: props.onForgotPassword,
|
@@ -3390,7 +3404,7 @@ var LoginForm = ({
|
|
3390
3404
|
width: "full",
|
3391
3405
|
autoComplete: "current-password",
|
3392
3406
|
type: passwordVisible ? "text" : "password",
|
3393
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
3407
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3394
3408
|
endIcon: /* @__PURE__ */ import_react13.default.createElement(
|
3395
3409
|
"div",
|
3396
3410
|
{
|
@@ -3406,7 +3420,7 @@ var LoginForm = ({
|
|
3406
3420
|
);
|
3407
3421
|
}
|
3408
3422
|
}
|
3409
|
-
),
|
3423
|
+
), props.withResetPassword && /* @__PURE__ */ import_react13.default.createElement(
|
3410
3424
|
"div",
|
3411
3425
|
{
|
3412
3426
|
onClick: props.onForgotPassword,
|
@@ -3425,7 +3439,7 @@ var LoginForm = ({
|
|
3425
3439
|
return /* @__PURE__ */ import_react13.default.createElement(
|
3426
3440
|
PhoneInput,
|
3427
3441
|
{
|
3428
|
-
label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
|
3442
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
3429
3443
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
3430
3444
|
preferredCountry: { label: "+966" },
|
3431
3445
|
handleChange: (e) => field.onChange((0, import_libphonenumber_js.parsePhoneNumber)(e).number)
|
package/dist/blocks/index.mjs
CHANGED
@@ -131,7 +131,7 @@ var AuthButtons = (props) => {
|
|
131
131
|
|
132
132
|
// blocks/auth/LoginForm.tsx
|
133
133
|
var LoginForm = ({
|
134
|
-
loginType,
|
134
|
+
loginType = "email",
|
135
135
|
texts,
|
136
136
|
passwordLength = 8,
|
137
137
|
...props
|
@@ -150,33 +150,45 @@ var LoginForm = ({
|
|
150
150
|
let formSchema;
|
151
151
|
if (loginType === "email") {
|
152
152
|
formSchema = z.object({
|
153
|
-
email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
|
154
|
-
password: z.string({
|
153
|
+
email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
|
154
|
+
password: z.string({
|
155
|
+
required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
|
156
|
+
}).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
|
157
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
|
158
|
+
})
|
155
159
|
});
|
156
160
|
} else if (loginType === "username") {
|
157
161
|
formSchema = z.object({
|
158
|
-
username: z.string({
|
162
|
+
username: z.string({
|
163
|
+
required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
|
164
|
+
}).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
|
159
165
|
(value) => {
|
160
166
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
161
167
|
return isValid;
|
162
168
|
},
|
163
|
-
{ message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
|
169
|
+
{ message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
|
164
170
|
),
|
165
|
-
password: z.string({
|
171
|
+
password: z.string({
|
172
|
+
required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
|
173
|
+
}).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
|
174
|
+
message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
|
175
|
+
})
|
166
176
|
});
|
167
177
|
} else if (loginType === "phone") {
|
168
178
|
formSchema = z.object({
|
169
|
-
phone: z.string({
|
179
|
+
phone: z.string({
|
180
|
+
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
181
|
+
}).refine(
|
170
182
|
(value) => {
|
171
183
|
let phoneNumber = parsePhoneNumber(value);
|
172
184
|
return phoneNumber.isValid();
|
173
185
|
},
|
174
|
-
{ message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
|
186
|
+
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
175
187
|
)
|
176
188
|
});
|
177
189
|
} else if (loginType === "link") {
|
178
190
|
formSchema = z.object({
|
179
|
-
email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
|
191
|
+
email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
|
180
192
|
});
|
181
193
|
} else {
|
182
194
|
formSchema = z.object({});
|
@@ -203,7 +215,7 @@ var LoginForm = ({
|
|
203
215
|
dir: "ltr",
|
204
216
|
width: "full",
|
205
217
|
autoComplete: "email",
|
206
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
218
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
207
219
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
208
220
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
209
221
|
...field
|
@@ -240,7 +252,7 @@ var LoginForm = ({
|
|
240
252
|
);
|
241
253
|
}
|
242
254
|
}
|
243
|
-
),
|
255
|
+
), props.withResetPassword && /* @__PURE__ */ React2.createElement(
|
244
256
|
"div",
|
245
257
|
{
|
246
258
|
onClick: props.onForgotPassword,
|
@@ -282,7 +294,7 @@ var LoginForm = ({
|
|
282
294
|
width: "full",
|
283
295
|
autoComplete: "current-password",
|
284
296
|
type: passwordVisible ? "text" : "password",
|
285
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
297
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
286
298
|
endIcon: /* @__PURE__ */ React2.createElement(
|
287
299
|
"div",
|
288
300
|
{
|
@@ -298,7 +310,7 @@ var LoginForm = ({
|
|
298
310
|
);
|
299
311
|
}
|
300
312
|
}
|
301
|
-
),
|
313
|
+
), props.withResetPassword && /* @__PURE__ */ React2.createElement(
|
302
314
|
"div",
|
303
315
|
{
|
304
316
|
onClick: props.onForgotPassword,
|
@@ -317,7 +329,7 @@ var LoginForm = ({
|
|
317
329
|
return /* @__PURE__ */ React2.createElement(
|
318
330
|
PhoneInput,
|
319
331
|
{
|
320
|
-
label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
|
332
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
321
333
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
322
334
|
preferredCountry: { label: "+966" },
|
323
335
|
handleChange: (e) => field.onChange(parsePhoneNumber(e).number)
|
package/dist/index.d.mts
CHANGED
@@ -1426,7 +1426,7 @@ type LoginFormTypes = {
|
|
1426
1426
|
/** Login identifier type user will use to log in. */
|
1427
1427
|
loginType?: "email" | "username" | "phone" | "link";
|
1428
1428
|
/** If true, the reset password option is hidden. */
|
1429
|
-
|
1429
|
+
withResetPassword?: boolean;
|
1430
1430
|
/** If true, the register option is hidden. */
|
1431
1431
|
allowRegister?: boolean;
|
1432
1432
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
@@ -1444,7 +1444,7 @@ type LoginFormTypes = {
|
|
1444
1444
|
/** If true, Twitter login option is displayed. */
|
1445
1445
|
viaTwitter?: boolean;
|
1446
1446
|
/** Function to handle form submission. */
|
1447
|
-
onLogin
|
1447
|
+
onLogin: (e: any) => void;
|
1448
1448
|
/** Function to route user to the register page. */
|
1449
1449
|
onRouteToRegister?: () => void;
|
1450
1450
|
/** Function to handle forgotten password case. */
|
package/dist/index.d.ts
CHANGED
@@ -1426,7 +1426,7 @@ type LoginFormTypes = {
|
|
1426
1426
|
/** Login identifier type user will use to log in. */
|
1427
1427
|
loginType?: "email" | "username" | "phone" | "link";
|
1428
1428
|
/** If true, the reset password option is hidden. */
|
1429
|
-
|
1429
|
+
withResetPassword?: boolean;
|
1430
1430
|
/** If true, the register option is hidden. */
|
1431
1431
|
allowRegister?: boolean;
|
1432
1432
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
@@ -1444,7 +1444,7 @@ type LoginFormTypes = {
|
|
1444
1444
|
/** If true, Twitter login option is displayed. */
|
1445
1445
|
viaTwitter?: boolean;
|
1446
1446
|
/** Function to handle form submission. */
|
1447
|
-
onLogin
|
1447
|
+
onLogin: (e: any) => void;
|
1448
1448
|
/** Function to route user to the register page. */
|
1449
1449
|
onRouteToRegister?: () => void;
|
1450
1450
|
/** Function to handle forgotten password case. */
|
package/dist/index.js
CHANGED
@@ -9267,7 +9267,7 @@ var AuthButtons = (props) => {
|
|
9267
9267
|
|
9268
9268
|
// blocks/auth/LoginForm.tsx
|
9269
9269
|
var LoginForm = ({
|
9270
|
-
loginType,
|
9270
|
+
loginType = "email",
|
9271
9271
|
texts,
|
9272
9272
|
passwordLength = 8,
|
9273
9273
|
...props
|
@@ -9286,33 +9286,45 @@ var LoginForm = ({
|
|
9286
9286
|
let formSchema;
|
9287
9287
|
if (loginType === "email") {
|
9288
9288
|
formSchema = z.object({
|
9289
|
-
email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
|
9290
|
-
password: z.string({
|
9289
|
+
email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
|
9290
|
+
password: z.string({
|
9291
|
+
required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
|
9292
|
+
}).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
|
9293
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
|
9294
|
+
})
|
9291
9295
|
});
|
9292
9296
|
} else if (loginType === "username") {
|
9293
9297
|
formSchema = z.object({
|
9294
|
-
username: z.string({
|
9298
|
+
username: z.string({
|
9299
|
+
required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
|
9300
|
+
}).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
|
9295
9301
|
(value) => {
|
9296
9302
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
9297
9303
|
return isValid;
|
9298
9304
|
},
|
9299
|
-
{ message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
|
9305
|
+
{ message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
|
9300
9306
|
),
|
9301
|
-
password: z.string({
|
9307
|
+
password: z.string({
|
9308
|
+
required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
|
9309
|
+
}).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
|
9310
|
+
message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
|
9311
|
+
})
|
9302
9312
|
});
|
9303
9313
|
} else if (loginType === "phone") {
|
9304
9314
|
formSchema = z.object({
|
9305
|
-
phone: z.string({
|
9315
|
+
phone: z.string({
|
9316
|
+
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
9317
|
+
}).refine(
|
9306
9318
|
(value) => {
|
9307
9319
|
let phoneNumber = (0, import_libphonenumber_js.parsePhoneNumber)(value);
|
9308
9320
|
return phoneNumber.isValid();
|
9309
9321
|
},
|
9310
|
-
{ message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
|
9322
|
+
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
9311
9323
|
)
|
9312
9324
|
});
|
9313
9325
|
} else if (loginType === "link") {
|
9314
9326
|
formSchema = z.object({
|
9315
|
-
email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
|
9327
|
+
email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
|
9316
9328
|
});
|
9317
9329
|
} else {
|
9318
9330
|
formSchema = z.object({});
|
@@ -9339,7 +9351,7 @@ var LoginForm = ({
|
|
9339
9351
|
dir: "ltr",
|
9340
9352
|
width: "full",
|
9341
9353
|
autoComplete: "email",
|
9342
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
9354
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
9343
9355
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
9344
9356
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
9345
9357
|
...field
|
@@ -9376,7 +9388,7 @@ var LoginForm = ({
|
|
9376
9388
|
);
|
9377
9389
|
}
|
9378
9390
|
}
|
9379
|
-
),
|
9391
|
+
), props.withResetPassword && /* @__PURE__ */ import_react46.default.createElement(
|
9380
9392
|
"div",
|
9381
9393
|
{
|
9382
9394
|
onClick: props.onForgotPassword,
|
@@ -9418,7 +9430,7 @@ var LoginForm = ({
|
|
9418
9430
|
width: "full",
|
9419
9431
|
autoComplete: "current-password",
|
9420
9432
|
type: passwordVisible ? "text" : "password",
|
9421
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
9433
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
9422
9434
|
endIcon: /* @__PURE__ */ import_react46.default.createElement(
|
9423
9435
|
"div",
|
9424
9436
|
{
|
@@ -9434,7 +9446,7 @@ var LoginForm = ({
|
|
9434
9446
|
);
|
9435
9447
|
}
|
9436
9448
|
}
|
9437
|
-
),
|
9449
|
+
), props.withResetPassword && /* @__PURE__ */ import_react46.default.createElement(
|
9438
9450
|
"div",
|
9439
9451
|
{
|
9440
9452
|
onClick: props.onForgotPassword,
|
@@ -9453,7 +9465,7 @@ var LoginForm = ({
|
|
9453
9465
|
return /* @__PURE__ */ import_react46.default.createElement(
|
9454
9466
|
PhoneInput,
|
9455
9467
|
{
|
9456
|
-
label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
|
9468
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
9457
9469
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
9458
9470
|
preferredCountry: { label: "+966" },
|
9459
9471
|
handleChange: (e) => field.onChange((0, import_libphonenumber_js.parsePhoneNumber)(e).number)
|
package/dist/index.mjs
CHANGED
@@ -9049,7 +9049,7 @@ var AuthButtons = (props) => {
|
|
9049
9049
|
|
9050
9050
|
// blocks/auth/LoginForm.tsx
|
9051
9051
|
var LoginForm = ({
|
9052
|
-
loginType,
|
9052
|
+
loginType = "email",
|
9053
9053
|
texts,
|
9054
9054
|
passwordLength = 8,
|
9055
9055
|
...props
|
@@ -9068,33 +9068,45 @@ var LoginForm = ({
|
|
9068
9068
|
let formSchema;
|
9069
9069
|
if (loginType === "email") {
|
9070
9070
|
formSchema = z.object({
|
9071
|
-
email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
|
9072
|
-
password: z.string({
|
9071
|
+
email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
|
9072
|
+
password: z.string({
|
9073
|
+
required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
|
9074
|
+
}).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
|
9075
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
|
9076
|
+
})
|
9073
9077
|
});
|
9074
9078
|
} else if (loginType === "username") {
|
9075
9079
|
formSchema = z.object({
|
9076
|
-
username: z.string({
|
9080
|
+
username: z.string({
|
9081
|
+
required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
|
9082
|
+
}).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
|
9077
9083
|
(value) => {
|
9078
9084
|
const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
|
9079
9085
|
return isValid;
|
9080
9086
|
},
|
9081
|
-
{ message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
|
9087
|
+
{ message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
|
9082
9088
|
),
|
9083
|
-
password: z.string({
|
9089
|
+
password: z.string({
|
9090
|
+
required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
|
9091
|
+
}).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
|
9092
|
+
message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
|
9093
|
+
})
|
9084
9094
|
});
|
9085
9095
|
} else if (loginType === "phone") {
|
9086
9096
|
formSchema = z.object({
|
9087
|
-
phone: z.string({
|
9097
|
+
phone: z.string({
|
9098
|
+
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
9099
|
+
}).refine(
|
9088
9100
|
(value) => {
|
9089
9101
|
let phoneNumber = parsePhoneNumber(value);
|
9090
9102
|
return phoneNumber.isValid();
|
9091
9103
|
},
|
9092
|
-
{ message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
|
9104
|
+
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
9093
9105
|
)
|
9094
9106
|
});
|
9095
9107
|
} else if (loginType === "link") {
|
9096
9108
|
formSchema = z.object({
|
9097
|
-
email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
|
9109
|
+
email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
|
9098
9110
|
});
|
9099
9111
|
} else {
|
9100
9112
|
formSchema = z.object({});
|
@@ -9121,7 +9133,7 @@ var LoginForm = ({
|
|
9121
9133
|
dir: "ltr",
|
9122
9134
|
width: "full",
|
9123
9135
|
autoComplete: "email",
|
9124
|
-
label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
|
9136
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
9125
9137
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
9126
9138
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
9127
9139
|
...field
|
@@ -9158,7 +9170,7 @@ var LoginForm = ({
|
|
9158
9170
|
);
|
9159
9171
|
}
|
9160
9172
|
}
|
9161
|
-
),
|
9173
|
+
), props.withResetPassword && /* @__PURE__ */ React73.createElement(
|
9162
9174
|
"div",
|
9163
9175
|
{
|
9164
9176
|
onClick: props.onForgotPassword,
|
@@ -9200,7 +9212,7 @@ var LoginForm = ({
|
|
9200
9212
|
width: "full",
|
9201
9213
|
autoComplete: "current-password",
|
9202
9214
|
type: passwordVisible ? "text" : "password",
|
9203
|
-
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
9215
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
9204
9216
|
endIcon: /* @__PURE__ */ React73.createElement(
|
9205
9217
|
"div",
|
9206
9218
|
{
|
@@ -9216,7 +9228,7 @@ var LoginForm = ({
|
|
9216
9228
|
);
|
9217
9229
|
}
|
9218
9230
|
}
|
9219
|
-
),
|
9231
|
+
), props.withResetPassword && /* @__PURE__ */ React73.createElement(
|
9220
9232
|
"div",
|
9221
9233
|
{
|
9222
9234
|
onClick: props.onForgotPassword,
|
@@ -9235,7 +9247,7 @@ var LoginForm = ({
|
|
9235
9247
|
return /* @__PURE__ */ React73.createElement(
|
9236
9248
|
PhoneInput,
|
9237
9249
|
{
|
9238
|
-
label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
|
9250
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
9239
9251
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
9240
9252
|
preferredCountry: { label: "+966" },
|
9241
9253
|
handleChange: (e) => field.onChange(parsePhoneNumber(e).number)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sikka/hawa",
|
3
|
-
"version": "0.27.
|
3
|
+
"version": "0.27.13-next",
|
4
4
|
"description": "Modern UI Kit made with Tailwind",
|
5
5
|
"author": {
|
6
6
|
"name": "Sikka Software",
|
@@ -65,9 +65,9 @@
|
|
65
65
|
"@tanstack/table-core": "^8.11.7",
|
66
66
|
"class-variance-authority": "^0.7.0",
|
67
67
|
"clsx": "^2.1.0",
|
68
|
-
"cmdk": "^0.2.
|
69
|
-
"embla-carousel-auto-height": "^8.0.0-
|
70
|
-
"embla-carousel-react": "^8.0.0-
|
68
|
+
"cmdk": "^0.2.1",
|
69
|
+
"embla-carousel-auto-height": "^8.0.0-rc22",
|
70
|
+
"embla-carousel-react": "^8.0.0-rc22",
|
71
71
|
"eslint": "^8.56.0",
|
72
72
|
"eslint-config-next": "^14.1.0",
|
73
73
|
"libphonenumber-js": "^1.10.54",
|
@@ -77,7 +77,7 @@
|
|
77
77
|
"react-dom": "18.2.0",
|
78
78
|
"react-dropzone": "^14.2.3",
|
79
79
|
"react-headless-pagination": "^1.1.5",
|
80
|
-
"react-hook-form": "^7.
|
80
|
+
"react-hook-form": "^7.50.0",
|
81
81
|
"react-select": "^5.8.0",
|
82
82
|
"signature_pad": "^4.1.7",
|
83
83
|
"tailwind-merge": "^2.2.1",
|
@@ -87,16 +87,16 @@
|
|
87
87
|
"devDependencies": {
|
88
88
|
"@babel/preset-react": "^7.23.3",
|
89
89
|
"@sikka/alam": "^0.0.4",
|
90
|
-
"@testing-library/jest-dom": "^6.
|
91
|
-
"@testing-library/react": "^14.1
|
92
|
-
"@types/jest": "^29.5.
|
93
|
-
"@types/react": "^18.2.
|
90
|
+
"@testing-library/jest-dom": "^6.4.1",
|
91
|
+
"@testing-library/react": "^14.2.1",
|
92
|
+
"@types/jest": "^29.5.12",
|
93
|
+
"@types/react": "^18.2.51",
|
94
94
|
"@types/react-dom": "^18.2.18",
|
95
95
|
"autoprefixer": "^10.4.17",
|
96
|
-
"embla-carousel": "8.0.0-
|
96
|
+
"embla-carousel": "8.0.0-rc22",
|
97
97
|
"jest": "^29.7.0",
|
98
98
|
"jest-environment-jsdom": "^29.7.0",
|
99
|
-
"lucide-react": "^0.
|
99
|
+
"lucide-react": "^0.321.0",
|
100
100
|
"postcss": "^8.4.33",
|
101
101
|
"postcss-cli": "^11.0.0",
|
102
102
|
"postcss-import": "^16.0.0",
|