@sikka/hawa 0.31.16-next → 0.32.0-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/{Radio-D52-m4Ns.d.mts → Radio-BpXOu4Hr.d.mts} +17 -1
- package/dist/{Radio-B-DG0FMr.d.ts → Radio-CREjhlGz.d.ts} +17 -1
- package/dist/blocks/auth/index.d.mts +25 -8
- package/dist/blocks/auth/index.d.ts +25 -8
- package/dist/blocks/auth/index.js +32 -8
- package/dist/blocks/auth/index.mjs +38 -9
- package/dist/blocks/index.d.mts +3 -1
- package/dist/blocks/index.d.ts +3 -1
- package/dist/blocks/index.js +32 -8
- package/dist/blocks/index.mjs +36 -9
- package/dist/{chunk-VZNDYO6H.mjs → chunk-WFPAI2QC.mjs} +3 -1
- package/dist/elements/index.d.mts +3 -16
- package/dist/elements/index.d.ts +3 -16
- package/dist/elements/index.js +3 -1
- package/dist/elements/index.mjs +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +32 -8
- package/dist/index.mjs +38 -9
- package/dist/phoneInput/index.d.mts +6 -3
- package/dist/phoneInput/index.d.ts +6 -3
- package/dist/phoneInput/index.js +3 -1
- package/dist/phoneInput/index.js.map +1 -1
- package/dist/phoneInput/index.mjs +3 -1
- package/dist/phoneInput/index.mjs.map +1 -1
- package/package.json +1 -1
@@ -10,6 +10,22 @@ type LabelProps = {
|
|
10
10
|
};
|
11
11
|
declare const Label: React.ForwardRefExoticComponent<React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
12
12
|
|
13
|
+
type PhoneInputProps = {
|
14
|
+
preferredCountry?: {
|
15
|
+
label: string;
|
16
|
+
};
|
17
|
+
helperText?: any;
|
18
|
+
label?: string;
|
19
|
+
labelProps?: LabelProps;
|
20
|
+
placeholder?: string;
|
21
|
+
handleChange?: (value: string) => void;
|
22
|
+
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
23
|
+
countryCodes?: {
|
24
|
+
label: string;
|
25
|
+
}[];
|
26
|
+
};
|
27
|
+
declare const PhoneInput: FC<PhoneInputProps>;
|
28
|
+
|
13
29
|
type SelectOptionProps = {
|
14
30
|
value: any;
|
15
31
|
label: any;
|
@@ -76,4 +92,4 @@ type RadioTypes = {
|
|
76
92
|
};
|
77
93
|
declare const Radio: React__default.ForwardRefExoticComponent<RadioTypes & React__default.RefAttributes<HTMLInputElement>>;
|
78
94
|
|
79
|
-
export { type LabelProps as L, type RadioOptionsTypes as R, type SelectOptionProps as S, Radio as a, Label as b, Select as c };
|
95
|
+
export { type LabelProps as L, type PhoneInputProps as P, type RadioOptionsTypes as R, type SelectOptionProps as S, Radio as a, Label as b, Select as c, PhoneInput as d };
|
@@ -10,6 +10,22 @@ type LabelProps = {
|
|
10
10
|
};
|
11
11
|
declare const Label: React.ForwardRefExoticComponent<React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
12
12
|
|
13
|
+
type PhoneInputProps = {
|
14
|
+
preferredCountry?: {
|
15
|
+
label: string;
|
16
|
+
};
|
17
|
+
helperText?: any;
|
18
|
+
label?: string;
|
19
|
+
labelProps?: LabelProps;
|
20
|
+
placeholder?: string;
|
21
|
+
handleChange?: (value: string) => void;
|
22
|
+
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
23
|
+
countryCodes?: {
|
24
|
+
label: string;
|
25
|
+
}[];
|
26
|
+
};
|
27
|
+
declare const PhoneInput: FC<PhoneInputProps>;
|
28
|
+
|
13
29
|
type SelectOptionProps = {
|
14
30
|
value: any;
|
15
31
|
label: any;
|
@@ -76,4 +92,4 @@ type RadioTypes = {
|
|
76
92
|
};
|
77
93
|
declare const Radio: React__default.ForwardRefExoticComponent<RadioTypes & React__default.RefAttributes<HTMLInputElement>>;
|
78
94
|
|
79
|
-
export { type LabelProps as L, type RadioOptionsTypes as R, type SelectOptionProps as S, Radio as a, Label as b, Select as c };
|
95
|
+
export { type LabelProps as L, type PhoneInputProps as P, type RadioOptionsTypes as R, type SelectOptionProps as S, Radio as a, Label as b, Select as c, PhoneInput as d };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import React__default, { FC } from 'react';
|
3
|
-
import { a as ThirdPartyAuthTextsTypes,
|
3
|
+
import { a as ThirdPartyAuthTextsTypes, P as PositionType, L as LoginFormTextsTypes, D as DirectionType, b as RegisterFormTextsTypes, N as NewPasswordTextsTypes, c as ResetPasswordTextsTypes } from '../../textTypes-DXLtO2fL.mjs';
|
4
4
|
|
5
5
|
type AuthButtonsType = {
|
6
6
|
texts?: ThirdPartyAuthTextsTypes;
|
@@ -34,6 +34,28 @@ type AuthButtonsType = {
|
|
34
34
|
};
|
35
35
|
declare const AuthButtons: React__default.FC<AuthButtonsType>;
|
36
36
|
|
37
|
+
type LabelProps = {
|
38
|
+
hint?: React.ReactNode;
|
39
|
+
hintSide?: PositionType;
|
40
|
+
htmlFor?: string;
|
41
|
+
required?: boolean;
|
42
|
+
};
|
43
|
+
|
44
|
+
type PhoneInputProps = {
|
45
|
+
preferredCountry?: {
|
46
|
+
label: string;
|
47
|
+
};
|
48
|
+
helperText?: any;
|
49
|
+
label?: string;
|
50
|
+
labelProps?: LabelProps;
|
51
|
+
placeholder?: string;
|
52
|
+
handleChange?: (value: string) => void;
|
53
|
+
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
54
|
+
countryCodes?: {
|
55
|
+
label: string;
|
56
|
+
}[];
|
57
|
+
};
|
58
|
+
|
37
59
|
type LoginFormTypes = {
|
38
60
|
/** Object containing text labels used throughout the form. */
|
39
61
|
texts?: LoginFormTextsTypes;
|
@@ -85,16 +107,11 @@ type LoginFormTypes = {
|
|
85
107
|
passwordLength?: number;
|
86
108
|
/** If true, the form is displayed without a card container styling.*/
|
87
109
|
cardless?: boolean;
|
110
|
+
/** Props to pass to the PhoneInput component */
|
111
|
+
phoneInputProps: PhoneInputProps;
|
88
112
|
};
|
89
113
|
declare const LoginForm: FC<LoginFormTypes>;
|
90
114
|
|
91
|
-
type LabelProps = {
|
92
|
-
hint?: React.ReactNode;
|
93
|
-
hintSide?: PositionType;
|
94
|
-
htmlFor?: string;
|
95
|
-
required?: boolean;
|
96
|
-
};
|
97
|
-
|
98
115
|
type SelectOptionProps = {
|
99
116
|
value: any;
|
100
117
|
label: any;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import React__default, { FC } from 'react';
|
3
|
-
import { a as ThirdPartyAuthTextsTypes,
|
3
|
+
import { a as ThirdPartyAuthTextsTypes, P as PositionType, L as LoginFormTextsTypes, D as DirectionType, b as RegisterFormTextsTypes, N as NewPasswordTextsTypes, c as ResetPasswordTextsTypes } from '../../textTypes-DXLtO2fL.js';
|
4
4
|
|
5
5
|
type AuthButtonsType = {
|
6
6
|
texts?: ThirdPartyAuthTextsTypes;
|
@@ -34,6 +34,28 @@ type AuthButtonsType = {
|
|
34
34
|
};
|
35
35
|
declare const AuthButtons: React__default.FC<AuthButtonsType>;
|
36
36
|
|
37
|
+
type LabelProps = {
|
38
|
+
hint?: React.ReactNode;
|
39
|
+
hintSide?: PositionType;
|
40
|
+
htmlFor?: string;
|
41
|
+
required?: boolean;
|
42
|
+
};
|
43
|
+
|
44
|
+
type PhoneInputProps = {
|
45
|
+
preferredCountry?: {
|
46
|
+
label: string;
|
47
|
+
};
|
48
|
+
helperText?: any;
|
49
|
+
label?: string;
|
50
|
+
labelProps?: LabelProps;
|
51
|
+
placeholder?: string;
|
52
|
+
handleChange?: (value: string) => void;
|
53
|
+
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
54
|
+
countryCodes?: {
|
55
|
+
label: string;
|
56
|
+
}[];
|
57
|
+
};
|
58
|
+
|
37
59
|
type LoginFormTypes = {
|
38
60
|
/** Object containing text labels used throughout the form. */
|
39
61
|
texts?: LoginFormTextsTypes;
|
@@ -85,16 +107,11 @@ type LoginFormTypes = {
|
|
85
107
|
passwordLength?: number;
|
86
108
|
/** If true, the form is displayed without a card container styling.*/
|
87
109
|
cardless?: boolean;
|
110
|
+
/** Props to pass to the PhoneInput component */
|
111
|
+
phoneInputProps: PhoneInputProps;
|
88
112
|
};
|
89
113
|
declare const LoginForm: FC<LoginFormTypes>;
|
90
114
|
|
91
|
-
type LabelProps = {
|
92
|
-
hint?: React.ReactNode;
|
93
|
-
hintSide?: PositionType;
|
94
|
-
htmlFor?: string;
|
95
|
-
required?: boolean;
|
96
|
-
};
|
97
|
-
|
98
115
|
type SelectOptionProps = {
|
99
116
|
value: any;
|
100
117
|
label: any;
|
@@ -3228,12 +3228,14 @@ var Select = ({
|
|
3228
3228
|
var PhoneInput = ({
|
3229
3229
|
labelProps,
|
3230
3230
|
inputProps,
|
3231
|
+
countryCodes,
|
3231
3232
|
...props
|
3232
3233
|
}) => {
|
3233
3234
|
const [phoneNumber, setPhoneNumber] = (0, import_react9.useState)("");
|
3234
3235
|
const [countryCode, setCountryCode] = (0, import_react9.useState)(props.preferredCountry);
|
3235
3236
|
const inputRef = (0, import_react9.useRef)(null);
|
3236
3237
|
const handleInputChange = (e) => {
|
3238
|
+
console.log("test e ", e.target.value);
|
3237
3239
|
const validChars = /^[0-9-()]+$/;
|
3238
3240
|
const input = e.target.value;
|
3239
3241
|
if (input === "" || validChars.test(input)) {
|
@@ -3256,7 +3258,7 @@ var PhoneInput = ({
|
|
3256
3258
|
isSearchable: true,
|
3257
3259
|
isClearable: false,
|
3258
3260
|
placeholder: "Code",
|
3259
|
-
options: countries_default,
|
3261
|
+
options: countryCodes || countries_default,
|
3260
3262
|
onChange: setCountryCode,
|
3261
3263
|
value: countryCode == null ? void 0 : countryCode.label,
|
3262
3264
|
defaultValue: props.preferredCountry
|
@@ -3377,8 +3379,8 @@ var LoginForm = ({
|
|
3377
3379
|
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
3378
3380
|
}).refine(
|
3379
3381
|
(value) => {
|
3380
|
-
let
|
3381
|
-
return
|
3382
|
+
let isPhoneValid = (0, import_libphonenumber_js.isPossiblePhoneNumber)(value) && (0, import_libphonenumber_js.isValidPhoneNumber)(value) && (0, import_libphonenumber_js.validatePhoneNumberLength)(value) === void 0;
|
3383
|
+
return isPhoneValid;
|
3382
3384
|
},
|
3383
3385
|
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
3384
3386
|
)
|
@@ -3415,7 +3417,10 @@ var LoginForm = ({
|
|
3415
3417
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3416
3418
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3417
3419
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
3418
|
-
...field
|
3420
|
+
...field,
|
3421
|
+
onChange: (e) => {
|
3422
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
3423
|
+
}
|
3419
3424
|
}
|
3420
3425
|
);
|
3421
3426
|
}
|
@@ -3529,7 +3534,15 @@ var LoginForm = ({
|
|
3529
3534
|
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
3530
3535
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
3531
3536
|
preferredCountry: { label: "+966" },
|
3532
|
-
|
3537
|
+
...props.phoneInputProps,
|
3538
|
+
handleChange: (e) => {
|
3539
|
+
if ((0, import_libphonenumber_js.isValidPhoneNumber)(e) && (0, import_libphonenumber_js.isPossiblePhoneNumber)(e) && (0, import_libphonenumber_js.validatePhoneNumberLength)(e) === void 0) {
|
3540
|
+
let parsed = (0, import_libphonenumber_js.parsePhoneNumber)(e);
|
3541
|
+
field.onChange(parsed.number);
|
3542
|
+
} else {
|
3543
|
+
field.onChange(e);
|
3544
|
+
}
|
3545
|
+
}
|
3533
3546
|
}
|
3534
3547
|
);
|
3535
3548
|
}
|
@@ -3551,7 +3564,10 @@ var LoginForm = ({
|
|
3551
3564
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3552
3565
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3553
3566
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
3554
|
-
...field
|
3567
|
+
...field,
|
3568
|
+
onChange: (e) => {
|
3569
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
3570
|
+
}
|
3555
3571
|
}
|
3556
3572
|
);
|
3557
3573
|
}
|
@@ -3955,7 +3971,12 @@ var RegisterForm = ({
|
|
3955
3971
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3956
3972
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3957
3973
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3958
|
-
...field
|
3974
|
+
...field,
|
3975
|
+
onChange: (e) => {
|
3976
|
+
field.onChange(
|
3977
|
+
e.target.value.toLowerCase().trim()
|
3978
|
+
);
|
3979
|
+
}
|
3959
3980
|
}
|
3960
3981
|
);
|
3961
3982
|
}
|
@@ -4385,7 +4406,10 @@ var ResetPasswordForm = ({
|
|
4385
4406
|
label: ((_b2 = (_a2 = props.texts) == null ? void 0 : _a2.email) == null ? void 0 : _b2.label) || "Email",
|
4386
4407
|
helperText: (_c2 = formState.errors.email) == null ? void 0 : _c2.message,
|
4387
4408
|
placeholder: (_e2 = (_d2 = props.texts) == null ? void 0 : _d2.email) == null ? void 0 : _e2.placeholder,
|
4388
|
-
...field
|
4409
|
+
...field,
|
4410
|
+
onChange: (e) => {
|
4411
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
4412
|
+
}
|
4389
4413
|
}
|
4390
4414
|
);
|
4391
4415
|
}
|
@@ -482,7 +482,12 @@ import React5 from "react";
|
|
482
482
|
import { useState as useState3 } from "react";
|
483
483
|
import { Controller, useForm } from "react-hook-form";
|
484
484
|
import { zodResolver } from "@hookform/resolvers/zod";
|
485
|
-
import {
|
485
|
+
import {
|
486
|
+
isPossiblePhoneNumber,
|
487
|
+
isValidPhoneNumber,
|
488
|
+
parsePhoneNumber,
|
489
|
+
validatePhoneNumberLength
|
490
|
+
} from "libphonenumber-js";
|
486
491
|
import * as z from "zod";
|
487
492
|
|
488
493
|
// elements/alert/Alert.tsx
|
@@ -2329,12 +2334,14 @@ var countries_default = countries;
|
|
2329
2334
|
var PhoneInput = ({
|
2330
2335
|
labelProps,
|
2331
2336
|
inputProps,
|
2337
|
+
countryCodes,
|
2332
2338
|
...props
|
2333
2339
|
}) => {
|
2334
2340
|
const [phoneNumber, setPhoneNumber] = useState2("");
|
2335
2341
|
const [countryCode, setCountryCode] = useState2(props.preferredCountry);
|
2336
2342
|
const inputRef = useRef2(null);
|
2337
2343
|
const handleInputChange = (e) => {
|
2344
|
+
console.log("test e ", e.target.value);
|
2338
2345
|
const validChars = /^[0-9-()]+$/;
|
2339
2346
|
const input = e.target.value;
|
2340
2347
|
if (input === "" || validChars.test(input)) {
|
@@ -2357,7 +2364,7 @@ var PhoneInput = ({
|
|
2357
2364
|
isSearchable: true,
|
2358
2365
|
isClearable: false,
|
2359
2366
|
placeholder: "Code",
|
2360
|
-
options: countries_default,
|
2367
|
+
options: countryCodes || countries_default,
|
2361
2368
|
onChange: setCountryCode,
|
2362
2369
|
value: countryCode == null ? void 0 : countryCode.label,
|
2363
2370
|
defaultValue: props.preferredCountry
|
@@ -2439,8 +2446,8 @@ var LoginForm = ({
|
|
2439
2446
|
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
2440
2447
|
}).refine(
|
2441
2448
|
(value) => {
|
2442
|
-
let
|
2443
|
-
return
|
2449
|
+
let isPhoneValid = isPossiblePhoneNumber(value) && isValidPhoneNumber(value) && validatePhoneNumberLength(value) === void 0;
|
2450
|
+
return isPhoneValid;
|
2444
2451
|
},
|
2445
2452
|
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
2446
2453
|
)
|
@@ -2477,7 +2484,10 @@ var LoginForm = ({
|
|
2477
2484
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
2478
2485
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
2479
2486
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
2480
|
-
...field
|
2487
|
+
...field,
|
2488
|
+
onChange: (e) => {
|
2489
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
2490
|
+
}
|
2481
2491
|
}
|
2482
2492
|
);
|
2483
2493
|
}
|
@@ -2591,7 +2601,15 @@ var LoginForm = ({
|
|
2591
2601
|
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
2592
2602
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
2593
2603
|
preferredCountry: { label: "+966" },
|
2594
|
-
|
2604
|
+
...props.phoneInputProps,
|
2605
|
+
handleChange: (e) => {
|
2606
|
+
if (isValidPhoneNumber(e) && isPossiblePhoneNumber(e) && validatePhoneNumberLength(e) === void 0) {
|
2607
|
+
let parsed = parsePhoneNumber(e);
|
2608
|
+
field.onChange(parsed.number);
|
2609
|
+
} else {
|
2610
|
+
field.onChange(e);
|
2611
|
+
}
|
2612
|
+
}
|
2595
2613
|
}
|
2596
2614
|
);
|
2597
2615
|
}
|
@@ -2613,7 +2631,10 @@ var LoginForm = ({
|
|
2613
2631
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
2614
2632
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
2615
2633
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
2616
|
-
...field
|
2634
|
+
...field,
|
2635
|
+
onChange: (e) => {
|
2636
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
2637
|
+
}
|
2617
2638
|
}
|
2618
2639
|
);
|
2619
2640
|
}
|
@@ -3008,7 +3029,12 @@ var RegisterForm = ({
|
|
3008
3029
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3009
3030
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3010
3031
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3011
|
-
...field
|
3032
|
+
...field,
|
3033
|
+
onChange: (e) => {
|
3034
|
+
field.onChange(
|
3035
|
+
e.target.value.toLowerCase().trim()
|
3036
|
+
);
|
3037
|
+
}
|
3012
3038
|
}
|
3013
3039
|
);
|
3014
3040
|
}
|
@@ -3438,7 +3464,10 @@ var ResetPasswordForm = ({
|
|
3438
3464
|
label: ((_b2 = (_a2 = props.texts) == null ? void 0 : _a2.email) == null ? void 0 : _b2.label) || "Email",
|
3439
3465
|
helperText: (_c2 = formState.errors.email) == null ? void 0 : _c2.message,
|
3440
3466
|
placeholder: (_e2 = (_d2 = props.texts) == null ? void 0 : _d2.email) == null ? void 0 : _e2.placeholder,
|
3441
|
-
...field
|
3467
|
+
...field,
|
3468
|
+
onChange: (e) => {
|
3469
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
3470
|
+
}
|
3442
3471
|
}
|
3443
3472
|
);
|
3444
3473
|
}
|
package/dist/blocks/index.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React__default, { FC, InputHTMLAttributes } from 'react';
|
2
2
|
import { ThirdPartyAuthTextsTypes, LoginFormTextsTypes, RegisterFormTextsTypes, NewPasswordTextsTypes, ResetPasswordTextsTypes, BaseInputType, TextInputType, PricingCardProps, PlanFeature, PricingPlanTexts } from '../types/index.mjs';
|
3
|
+
import { P as PhoneInputProps, S as SelectOptionProps, L as LabelProps, R as RadioOptionsTypes } from '../Radio-BpXOu4Hr.mjs';
|
3
4
|
import { D as DirectionType, a as RadioOptionType, O as OrientationType } from '../commonTypes-C-g8nFFC.mjs';
|
4
|
-
import { S as SelectOptionProps, L as LabelProps, R as RadioOptionsTypes } from '../Radio-D52-m4Ns.mjs';
|
5
5
|
import { M as MenuItemType } from '../DropdownMenu-K3ztliYc.mjs';
|
6
6
|
import '@radix-ui/react-dropdown-menu';
|
7
7
|
|
@@ -88,6 +88,8 @@ type LoginFormTypes = {
|
|
88
88
|
passwordLength?: number;
|
89
89
|
/** If true, the form is displayed without a card container styling.*/
|
90
90
|
cardless?: boolean;
|
91
|
+
/** Props to pass to the PhoneInput component */
|
92
|
+
phoneInputProps: PhoneInputProps;
|
91
93
|
};
|
92
94
|
declare const LoginForm: FC<LoginFormTypes>;
|
93
95
|
|
package/dist/blocks/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React__default, { FC, InputHTMLAttributes } from 'react';
|
2
2
|
import { ThirdPartyAuthTextsTypes, LoginFormTextsTypes, RegisterFormTextsTypes, NewPasswordTextsTypes, ResetPasswordTextsTypes, BaseInputType, TextInputType, PricingCardProps, PlanFeature, PricingPlanTexts } from '../types/index.js';
|
3
|
+
import { P as PhoneInputProps, S as SelectOptionProps, L as LabelProps, R as RadioOptionsTypes } from '../Radio-CREjhlGz.js';
|
3
4
|
import { D as DirectionType, a as RadioOptionType, O as OrientationType } from '../commonTypes-C-g8nFFC.js';
|
4
|
-
import { S as SelectOptionProps, L as LabelProps, R as RadioOptionsTypes } from '../Radio-B-DG0FMr.js';
|
5
5
|
import { M as MenuItemType } from '../DropdownMenu-CJblb-9q.js';
|
6
6
|
import '@radix-ui/react-dropdown-menu';
|
7
7
|
|
@@ -88,6 +88,8 @@ type LoginFormTypes = {
|
|
88
88
|
passwordLength?: number;
|
89
89
|
/** If true, the form is displayed without a card container styling.*/
|
90
90
|
cardless?: boolean;
|
91
|
+
/** Props to pass to the PhoneInput component */
|
92
|
+
phoneInputProps: PhoneInputProps;
|
91
93
|
};
|
92
94
|
declare const LoginForm: FC<LoginFormTypes>;
|
93
95
|
|
package/dist/blocks/index.js
CHANGED
@@ -3249,12 +3249,14 @@ var Select = ({
|
|
3249
3249
|
var PhoneInput = ({
|
3250
3250
|
labelProps,
|
3251
3251
|
inputProps,
|
3252
|
+
countryCodes,
|
3252
3253
|
...props
|
3253
3254
|
}) => {
|
3254
3255
|
const [phoneNumber, setPhoneNumber] = (0, import_react9.useState)("");
|
3255
3256
|
const [countryCode, setCountryCode] = (0, import_react9.useState)(props.preferredCountry);
|
3256
3257
|
const inputRef = (0, import_react9.useRef)(null);
|
3257
3258
|
const handleInputChange = (e) => {
|
3259
|
+
console.log("test e ", e.target.value);
|
3258
3260
|
const validChars = /^[0-9-()]+$/;
|
3259
3261
|
const input = e.target.value;
|
3260
3262
|
if (input === "" || validChars.test(input)) {
|
@@ -3277,7 +3279,7 @@ var PhoneInput = ({
|
|
3277
3279
|
isSearchable: true,
|
3278
3280
|
isClearable: false,
|
3279
3281
|
placeholder: "Code",
|
3280
|
-
options: countries_default,
|
3282
|
+
options: countryCodes || countries_default,
|
3281
3283
|
onChange: setCountryCode,
|
3282
3284
|
value: countryCode == null ? void 0 : countryCode.label,
|
3283
3285
|
defaultValue: props.preferredCountry
|
@@ -3534,8 +3536,8 @@ var LoginForm = ({
|
|
3534
3536
|
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
3535
3537
|
}).refine(
|
3536
3538
|
(value) => {
|
3537
|
-
let
|
3538
|
-
return
|
3539
|
+
let isPhoneValid = (0, import_libphonenumber_js.isPossiblePhoneNumber)(value) && (0, import_libphonenumber_js.isValidPhoneNumber)(value) && (0, import_libphonenumber_js.validatePhoneNumberLength)(value) === void 0;
|
3540
|
+
return isPhoneValid;
|
3539
3541
|
},
|
3540
3542
|
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
3541
3543
|
)
|
@@ -3572,7 +3574,10 @@ var LoginForm = ({
|
|
3572
3574
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3573
3575
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3574
3576
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
3575
|
-
...field
|
3577
|
+
...field,
|
3578
|
+
onChange: (e) => {
|
3579
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
3580
|
+
}
|
3576
3581
|
}
|
3577
3582
|
);
|
3578
3583
|
}
|
@@ -3686,7 +3691,15 @@ var LoginForm = ({
|
|
3686
3691
|
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
3687
3692
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
3688
3693
|
preferredCountry: { label: "+966" },
|
3689
|
-
|
3694
|
+
...props.phoneInputProps,
|
3695
|
+
handleChange: (e) => {
|
3696
|
+
if ((0, import_libphonenumber_js.isValidPhoneNumber)(e) && (0, import_libphonenumber_js.isPossiblePhoneNumber)(e) && (0, import_libphonenumber_js.validatePhoneNumberLength)(e) === void 0) {
|
3697
|
+
let parsed = (0, import_libphonenumber_js.parsePhoneNumber)(e);
|
3698
|
+
field.onChange(parsed.number);
|
3699
|
+
} else {
|
3700
|
+
field.onChange(e);
|
3701
|
+
}
|
3702
|
+
}
|
3690
3703
|
}
|
3691
3704
|
);
|
3692
3705
|
}
|
@@ -3708,7 +3721,10 @@ var LoginForm = ({
|
|
3708
3721
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3709
3722
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3710
3723
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
3711
|
-
...field
|
3724
|
+
...field,
|
3725
|
+
onChange: (e) => {
|
3726
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
3727
|
+
}
|
3712
3728
|
}
|
3713
3729
|
);
|
3714
3730
|
}
|
@@ -4112,7 +4128,12 @@ var RegisterForm = ({
|
|
4112
4128
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
4113
4129
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
4114
4130
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
4115
|
-
...field
|
4131
|
+
...field,
|
4132
|
+
onChange: (e) => {
|
4133
|
+
field.onChange(
|
4134
|
+
e.target.value.toLowerCase().trim()
|
4135
|
+
);
|
4136
|
+
}
|
4116
4137
|
}
|
4117
4138
|
);
|
4118
4139
|
}
|
@@ -4542,7 +4563,10 @@ var ResetPasswordForm = ({
|
|
4542
4563
|
label: ((_b2 = (_a2 = props.texts) == null ? void 0 : _a2.email) == null ? void 0 : _b2.label) || "Email",
|
4543
4564
|
helperText: (_c2 = formState.errors.email) == null ? void 0 : _c2.message,
|
4544
4565
|
placeholder: (_e2 = (_d2 = props.texts) == null ? void 0 : _d2.email) == null ? void 0 : _e2.placeholder,
|
4545
|
-
...field
|
4566
|
+
...field,
|
4567
|
+
onChange: (e) => {
|
4568
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
4569
|
+
}
|
4546
4570
|
}
|
4547
4571
|
);
|
4548
4572
|
}
|
package/dist/blocks/index.mjs
CHANGED
@@ -26,7 +26,7 @@ import {
|
|
26
26
|
UncheckMark,
|
27
27
|
VeryBadEmoji,
|
28
28
|
VeryGoodEmoji
|
29
|
-
} from "../chunk-
|
29
|
+
} from "../chunk-WFPAI2QC.mjs";
|
30
30
|
import "../chunk-OPYDG34F.mjs";
|
31
31
|
import {
|
32
32
|
Button,
|
@@ -148,7 +148,12 @@ import React2 from "react";
|
|
148
148
|
import { useState } from "react";
|
149
149
|
import { Controller, useForm } from "react-hook-form";
|
150
150
|
import { zodResolver } from "@hookform/resolvers/zod";
|
151
|
-
import {
|
151
|
+
import {
|
152
|
+
isPossiblePhoneNumber,
|
153
|
+
isValidPhoneNumber,
|
154
|
+
parsePhoneNumber,
|
155
|
+
validatePhoneNumberLength
|
156
|
+
} from "libphonenumber-js";
|
152
157
|
import * as z from "zod";
|
153
158
|
var LoginForm = ({
|
154
159
|
loginType = "email",
|
@@ -200,8 +205,8 @@ var LoginForm = ({
|
|
200
205
|
required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
|
201
206
|
}).refine(
|
202
207
|
(value) => {
|
203
|
-
let
|
204
|
-
return
|
208
|
+
let isPhoneValid = isPossiblePhoneNumber(value) && isValidPhoneNumber(value) && validatePhoneNumberLength(value) === void 0;
|
209
|
+
return isPhoneValid;
|
205
210
|
},
|
206
211
|
{ message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
|
207
212
|
)
|
@@ -238,7 +243,10 @@ var LoginForm = ({
|
|
238
243
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
239
244
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
240
245
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
241
|
-
...field
|
246
|
+
...field,
|
247
|
+
onChange: (e) => {
|
248
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
249
|
+
}
|
242
250
|
}
|
243
251
|
);
|
244
252
|
}
|
@@ -352,7 +360,15 @@ var LoginForm = ({
|
|
352
360
|
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
353
361
|
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
354
362
|
preferredCountry: { label: "+966" },
|
355
|
-
|
363
|
+
...props.phoneInputProps,
|
364
|
+
handleChange: (e) => {
|
365
|
+
if (isValidPhoneNumber(e) && isPossiblePhoneNumber(e) && validatePhoneNumberLength(e) === void 0) {
|
366
|
+
let parsed = parsePhoneNumber(e);
|
367
|
+
field.onChange(parsed.number);
|
368
|
+
} else {
|
369
|
+
field.onChange(e);
|
370
|
+
}
|
371
|
+
}
|
356
372
|
}
|
357
373
|
);
|
358
374
|
}
|
@@ -374,7 +390,10 @@ var LoginForm = ({
|
|
374
390
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
375
391
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
376
392
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
|
377
|
-
...field
|
393
|
+
...field,
|
394
|
+
onChange: (e) => {
|
395
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
396
|
+
}
|
378
397
|
}
|
379
398
|
);
|
380
399
|
}
|
@@ -631,7 +650,12 @@ var RegisterForm = ({
|
|
631
650
|
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
632
651
|
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
633
652
|
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
634
|
-
...field
|
653
|
+
...field,
|
654
|
+
onChange: (e) => {
|
655
|
+
field.onChange(
|
656
|
+
e.target.value.toLowerCase().trim()
|
657
|
+
);
|
658
|
+
}
|
635
659
|
}
|
636
660
|
);
|
637
661
|
}
|
@@ -1061,7 +1085,10 @@ var ResetPasswordForm = ({
|
|
1061
1085
|
label: ((_b2 = (_a2 = props.texts) == null ? void 0 : _a2.email) == null ? void 0 : _b2.label) || "Email",
|
1062
1086
|
helperText: (_c2 = formState.errors.email) == null ? void 0 : _c2.message,
|
1063
1087
|
placeholder: (_e2 = (_d2 = props.texts) == null ? void 0 : _d2.email) == null ? void 0 : _e2.placeholder,
|
1064
|
-
...field
|
1088
|
+
...field,
|
1089
|
+
onChange: (e) => {
|
1090
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
1091
|
+
}
|
1065
1092
|
}
|
1066
1093
|
);
|
1067
1094
|
}
|
@@ -2233,12 +2233,14 @@ var countries_default = countries;
|
|
2233
2233
|
var PhoneInput = ({
|
2234
2234
|
labelProps,
|
2235
2235
|
inputProps,
|
2236
|
+
countryCodes,
|
2236
2237
|
...props
|
2237
2238
|
}) => {
|
2238
2239
|
const [phoneNumber, setPhoneNumber] = useState2("");
|
2239
2240
|
const [countryCode, setCountryCode] = useState2(props.preferredCountry);
|
2240
2241
|
const inputRef = useRef2(null);
|
2241
2242
|
const handleInputChange = (e) => {
|
2243
|
+
console.log("test e ", e.target.value);
|
2242
2244
|
const validChars = /^[0-9-()]+$/;
|
2243
2245
|
const input = e.target.value;
|
2244
2246
|
if (input === "" || validChars.test(input)) {
|
@@ -2261,7 +2263,7 @@ var PhoneInput = ({
|
|
2261
2263
|
isSearchable: true,
|
2262
2264
|
isClearable: false,
|
2263
2265
|
placeholder: "Code",
|
2264
|
-
options: countries_default,
|
2266
|
+
options: countryCodes || countries_default,
|
2265
2267
|
onChange: setCountryCode,
|
2266
2268
|
value: countryCode == null ? void 0 : countryCode.label,
|
2267
2269
|
defaultValue: props.preferredCountry
|