@sikka/hawa 0.6.3-next → 0.6.5-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/index.css +4 -10
- package/dist/index.d.mts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +91 -55
- package/dist/index.mjs +123 -105
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -2384,6 +2384,10 @@ input[type="number"]::-webkit-inner-spin-button,
|
|
|
2384
2384
|
body {
|
|
2385
2385
|
font-family: "IBM Plex Sans Arabic", sans-serif;
|
|
2386
2386
|
}
|
|
2387
|
+
:is(.hawa-dark .dark\:hover\:dark-shadow:hover) {
|
|
2388
|
+
box-shadow: 0 10px 15px -3px rgba(255, 255, 255, 0.1),
|
|
2389
|
+
0 4px 6px -2px rgba(255, 255, 255, 0.05);
|
|
2390
|
+
}
|
|
2387
2391
|
.placeholder\:hawa-text-muted-foreground::-moz-placeholder {
|
|
2388
2392
|
color: hsl(var(--muted-foreground));
|
|
2389
2393
|
}
|
|
@@ -3050,11 +3054,6 @@ body {
|
|
|
3050
3054
|
--tw-text-opacity: 1;
|
|
3051
3055
|
color: rgb(133 77 14 / var(--tw-text-opacity));
|
|
3052
3056
|
}
|
|
3053
|
-
:is(.hawa-dark .dark\:hawa-shadow-dark) {
|
|
3054
|
-
--tw-shadow: 0 10px 15px -3px rgba(255, 255, 255, 0.1), 0 4px 6px -2px rgba(255, 255, 255, 0.05);
|
|
3055
|
-
--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -2px var(--tw-shadow-color);
|
|
3056
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
3057
|
-
}
|
|
3058
3057
|
:is(.hawa-dark .dark\:before\:hawa-via-white\/10)::before {
|
|
3059
3058
|
content: var(--tw-content);
|
|
3060
3059
|
--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);
|
|
@@ -3083,11 +3082,6 @@ body {
|
|
|
3083
3082
|
--tw-text-opacity: 1;
|
|
3084
3083
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
3085
3084
|
}
|
|
3086
|
-
:is(.hawa-dark .dark\:hover\:hawa-shadow-dark:hover) {
|
|
3087
|
-
--tw-shadow: 0 10px 15px -3px rgba(255, 255, 255, 0.1), 0 4px 6px -2px rgba(255, 255, 255, 0.05);
|
|
3088
|
-
--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -2px var(--tw-shadow-color);
|
|
3089
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
3090
|
-
}
|
|
3091
3085
|
:is(.hawa-dark .dark\:focus\:hawa-ring-blue-500:focus) {
|
|
3092
3086
|
--tw-ring-opacity: 1;
|
|
3093
3087
|
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
|
package/dist/index.d.mts
CHANGED
|
@@ -674,6 +674,7 @@ type StatTypes = {
|
|
|
674
674
|
width?: "full" | "min" | "normal";
|
|
675
675
|
isLoading?: boolean;
|
|
676
676
|
handleClick?: () => void;
|
|
677
|
+
className?: string;
|
|
677
678
|
};
|
|
678
679
|
declare const Stats: FC<StatTypes>;
|
|
679
680
|
|
|
@@ -811,8 +812,8 @@ type LoginFormTypes = {
|
|
|
811
812
|
loginType?: "email" | "username" | "phone";
|
|
812
813
|
/** If true, the reset password option is hidden. */
|
|
813
814
|
withoutResetPassword?: boolean;
|
|
814
|
-
/** If true, the
|
|
815
|
-
|
|
815
|
+
/** If true, the register option is hidden. */
|
|
816
|
+
withoutRegister?: boolean;
|
|
816
817
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
|
817
818
|
isLoading?: boolean;
|
|
818
819
|
/** If true, a loading spinner is displayed within the Google login button. */
|
|
@@ -829,8 +830,8 @@ type LoginFormTypes = {
|
|
|
829
830
|
viaTwitter?: boolean;
|
|
830
831
|
/** Function to handle form submission. */
|
|
831
832
|
handleLogin?: (e: any) => void;
|
|
832
|
-
/** Function to route user to the
|
|
833
|
-
|
|
833
|
+
/** Function to route user to the register page. */
|
|
834
|
+
handleRouteToRegister?: () => void;
|
|
834
835
|
/** Function to handle forgotten password case. */
|
|
835
836
|
handleForgotPassword?: () => void;
|
|
836
837
|
/** Function to handle Google login. */
|
|
@@ -952,7 +953,7 @@ type CheckEmailBlocks = {
|
|
|
952
953
|
declare const CheckEmail: FC<CheckEmailBlocks>;
|
|
953
954
|
|
|
954
955
|
type NewPasswordTypes = {
|
|
955
|
-
handleNewPassword: () => void;
|
|
956
|
+
handleNewPassword: (e: any) => void;
|
|
956
957
|
direction?: "rtl" | "ltr";
|
|
957
958
|
headless?: boolean;
|
|
958
959
|
passwordChanged: any;
|
|
@@ -966,6 +967,8 @@ type NewPasswordTypes = {
|
|
|
966
967
|
confirmPasswordRequiredText: string;
|
|
967
968
|
passwordMatchError: string;
|
|
968
969
|
passwordChanged: string;
|
|
970
|
+
passwordTooShortText: string;
|
|
971
|
+
confirmPasswordRequired: string;
|
|
969
972
|
};
|
|
970
973
|
};
|
|
971
974
|
declare const NewPasswordForm: FC<NewPasswordTypes>;
|
package/dist/index.d.ts
CHANGED
|
@@ -674,6 +674,7 @@ type StatTypes = {
|
|
|
674
674
|
width?: "full" | "min" | "normal";
|
|
675
675
|
isLoading?: boolean;
|
|
676
676
|
handleClick?: () => void;
|
|
677
|
+
className?: string;
|
|
677
678
|
};
|
|
678
679
|
declare const Stats: FC<StatTypes>;
|
|
679
680
|
|
|
@@ -811,8 +812,8 @@ type LoginFormTypes = {
|
|
|
811
812
|
loginType?: "email" | "username" | "phone";
|
|
812
813
|
/** If true, the reset password option is hidden. */
|
|
813
814
|
withoutResetPassword?: boolean;
|
|
814
|
-
/** If true, the
|
|
815
|
-
|
|
815
|
+
/** If true, the register option is hidden. */
|
|
816
|
+
withoutRegister?: boolean;
|
|
816
817
|
/** If true, a loading spinner is displayed within the main form submit button. */
|
|
817
818
|
isLoading?: boolean;
|
|
818
819
|
/** If true, a loading spinner is displayed within the Google login button. */
|
|
@@ -829,8 +830,8 @@ type LoginFormTypes = {
|
|
|
829
830
|
viaTwitter?: boolean;
|
|
830
831
|
/** Function to handle form submission. */
|
|
831
832
|
handleLogin?: (e: any) => void;
|
|
832
|
-
/** Function to route user to the
|
|
833
|
-
|
|
833
|
+
/** Function to route user to the register page. */
|
|
834
|
+
handleRouteToRegister?: () => void;
|
|
834
835
|
/** Function to handle forgotten password case. */
|
|
835
836
|
handleForgotPassword?: () => void;
|
|
836
837
|
/** Function to handle Google login. */
|
|
@@ -952,7 +953,7 @@ type CheckEmailBlocks = {
|
|
|
952
953
|
declare const CheckEmail: FC<CheckEmailBlocks>;
|
|
953
954
|
|
|
954
955
|
type NewPasswordTypes = {
|
|
955
|
-
handleNewPassword: () => void;
|
|
956
|
+
handleNewPassword: (e: any) => void;
|
|
956
957
|
direction?: "rtl" | "ltr";
|
|
957
958
|
headless?: boolean;
|
|
958
959
|
passwordChanged: any;
|
|
@@ -966,6 +967,8 @@ type NewPasswordTypes = {
|
|
|
966
967
|
confirmPasswordRequiredText: string;
|
|
967
968
|
passwordMatchError: string;
|
|
968
969
|
passwordChanged: string;
|
|
970
|
+
passwordTooShortText: string;
|
|
971
|
+
confirmPasswordRequired: string;
|
|
969
972
|
};
|
|
970
973
|
};
|
|
971
974
|
declare const NewPasswordForm: FC<NewPasswordTypes>;
|
package/dist/index.js
CHANGED
|
@@ -975,7 +975,7 @@ var Card = React5.forwardRef(function(_param, ref) /* @__PURE__ */ {
|
|
|
975
975
|
]);
|
|
976
976
|
return React5.createElement("div", _object_spread({
|
|
977
977
|
ref: ref,
|
|
978
|
-
className: cn("hawa-rounded-lg hawa-border hawa-bg-card hawa-text-card-foreground hawa-shadow-sm", clickable && "hawa-cursor-pointer hawa-transition-all hover:hawa-drop-shadow-md dark:hover:
|
|
978
|
+
className: cn("hawa-rounded-lg hawa-border hawa-bg-card hawa-text-card-foreground hawa-shadow-sm", clickable && "hawa-cursor-pointer hawa-transition-all hover:hawa-drop-shadow-md dark:hover:dark-shadow", className)
|
|
979
979
|
}, props));
|
|
980
980
|
});
|
|
981
981
|
Card.displayName = "Card";
|
|
@@ -2338,7 +2338,8 @@ var PinInput = function(_param) {
|
|
|
2338
2338
|
}
|
|
2339
2339
|
};
|
|
2340
2340
|
return /* @__PURE__ */ import_react15.default.createElement("div", {
|
|
2341
|
-
className: "hawa-flex hawa-w-full hawa-flex-row hawa-justify-center hawa-gap-2"
|
|
2341
|
+
className: "hawa-flex hawa-w-full hawa-flex-row hawa-justify-center hawa-gap-2",
|
|
2342
|
+
dir: "ltr"
|
|
2342
2343
|
}, pin.map(function(value, index) {
|
|
2343
2344
|
return /* @__PURE__ */ import_react15.default.createElement("input", _object_spread({
|
|
2344
2345
|
key: index,
|
|
@@ -4445,7 +4446,7 @@ var Select = function(props) {
|
|
|
4445
4446
|
var PhoneInput = function(props) {
|
|
4446
4447
|
var _ref = _sliced_to_array((0, import_react19.useState)("+966"), 2), selectedCountry = _ref[0], setSelectedCountry = _ref[1];
|
|
4447
4448
|
return /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
4448
|
-
className: "hawa-
|
|
4449
|
+
className: "hawa-flex hawa-flex-col"
|
|
4449
4450
|
}, props.label && /* @__PURE__ */ import_react19.default.createElement("label", {
|
|
4450
4451
|
className: "hawa-mb-2 hawa-block hawa-text-sm hawa-font-medium"
|
|
4451
4452
|
}, props.label), /* @__PURE__ */ import_react19.default.createElement("div", {
|
|
@@ -5874,7 +5875,8 @@ var Stats = function(_param) {
|
|
|
5874
5875
|
]);
|
|
5875
5876
|
return /* @__PURE__ */ import_react29.default.createElement(Card, {
|
|
5876
5877
|
onClick: props.handleClick,
|
|
5877
|
-
clickable: Boolean(props.handleClick)
|
|
5878
|
+
clickable: Boolean(props.handleClick),
|
|
5879
|
+
className: cn(props.className)
|
|
5878
5880
|
}, /* @__PURE__ */ import_react29.default.createElement("div", {
|
|
5879
5881
|
className: "hawa-flex hawa-flex-row hawa-justify-between hawa-p-4 hawa-items-center"
|
|
5880
5882
|
}, /* @__PURE__ */ import_react29.default.createElement(CardTitle, {
|
|
@@ -6459,10 +6461,10 @@ var LoginForm = function(props) {
|
|
|
6459
6461
|
className: "hawa-mt-0 hawa-w-full",
|
|
6460
6462
|
type: "submit",
|
|
6461
6463
|
isLoading: props.isLoading
|
|
6462
|
-
}, ((_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.loginText) || "Login"), !props.
|
|
6463
|
-
className: "hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300"
|
|
6464
|
+
}, ((_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.loginText) || "Login"), !props.withoutRegister && /* @__PURE__ */ import_react33.default.createElement("div", {
|
|
6465
|
+
className: "hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal hawa-select-none dark:hawa-text-gray-300"
|
|
6464
6466
|
}, ((_props_texts2 = props.texts) === null || _props_texts2 === void 0 ? void 0 : _props_texts2.newUserText) || "New user?", " ", /* @__PURE__ */ import_react33.default.createElement("span", {
|
|
6465
|
-
onClick: props.
|
|
6467
|
+
onClick: props.handleRouteToRegister,
|
|
6466
6468
|
className: "clickable-link"
|
|
6467
6469
|
}, ((_props_texts3 = props.texts) === null || _props_texts3 === void 0 ? void 0 : _props_texts3.createAccount) || "Create Account")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react33.default.createElement(CardFooter, {
|
|
6468
6470
|
className: cn(props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2")
|
|
@@ -6504,7 +6506,7 @@ var import_zod2 = require("@hookform/resolvers/zod");
|
|
|
6504
6506
|
var z2 = __toESM(require("zod"));
|
|
6505
6507
|
var RegisterForm = function(props) {
|
|
6506
6508
|
var methods = (0, import_react_hook_form3.useForm)();
|
|
6507
|
-
var _props_texts = props.texts,
|
|
6509
|
+
var _props_texts = props.texts, usernamePlaceholder = _props_texts.usernamePlaceholder, usernameRequired = _props_texts.usernameRequired, emailInvalidText = _props_texts.emailInvalidText, emailPlaceholder = _props_texts.emailPlaceholder, emailRequiredText = _props_texts.emailRequiredText, passwordPlaceholder = _props_texts.passwordPlaceholder, passwordRequiredText = _props_texts.passwordRequiredText, passwordTooShortText = _props_texts.passwordTooShortText, confirmPasswordRequired = _props_texts.confirmPasswordRequired, confirmPasswordPlaceholder = _props_texts.confirmPasswordPlaceholder, termsRequiredText = _props_texts.termsRequiredText, fullNameRequiredText = _props_texts.fullNameRequiredText;
|
|
6508
6510
|
var fieldSchemas = {};
|
|
6509
6511
|
props.registerFields.forEach(function(field) {
|
|
6510
6512
|
switch(field){
|
|
@@ -6949,17 +6951,38 @@ var CheckEmail = function(param) {
|
|
|
6949
6951
|
// components/blocks/auth/NewPassword.tsx
|
|
6950
6952
|
var import_react37 = __toESM(require("react"));
|
|
6951
6953
|
var import_react_hook_form4 = require("react-hook-form");
|
|
6954
|
+
var import_zod3 = require("@hookform/resolvers/zod");
|
|
6955
|
+
var z3 = __toESM(require("zod"));
|
|
6952
6956
|
var NewPasswordForm = function(props) {
|
|
6953
|
-
var
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6957
|
+
var formSchema2 = z3.object({
|
|
6958
|
+
password: z3.string({
|
|
6959
|
+
required_error: props.texts.passwordRequiredText
|
|
6960
|
+
}).min(5, {
|
|
6961
|
+
message: props.texts.passwordTooShortText
|
|
6962
|
+
}).refine(function(value) {
|
|
6963
|
+
return value !== "";
|
|
6964
|
+
}, {
|
|
6965
|
+
message: props.texts.passwordRequiredText
|
|
6966
|
+
}),
|
|
6967
|
+
confirm_password: z3.string({
|
|
6968
|
+
required_error: props.texts.confirmPasswordRequired
|
|
6969
|
+
}).refine(function(value) {
|
|
6970
|
+
return value !== "";
|
|
6971
|
+
}, {
|
|
6972
|
+
message: props.texts.passwordRequiredText
|
|
6973
|
+
})
|
|
6974
|
+
}).refine(function(data) {
|
|
6975
|
+
return data.password === data.confirm_password;
|
|
6976
|
+
}, {
|
|
6977
|
+
message: "Passwords don't match",
|
|
6978
|
+
path: [
|
|
6979
|
+
"confirm_password"
|
|
6980
|
+
]
|
|
6981
|
+
});
|
|
6982
|
+
var _ref = (0, import_react_hook_form4.useForm)({
|
|
6983
|
+
resolver: (0, import_zod3.zodResolver)(formSchema2)
|
|
6984
|
+
}), handleSubmit = _ref.handleSubmit, control = _ref.control, formState = _ref.formState;
|
|
6985
|
+
var _ref1 = _sliced_to_array((0, import_react37.useState)(false), 2), matchError = _ref1[0], setMatchError = _ref1[1];
|
|
6963
6986
|
return /* @__PURE__ */ import_react37.default.createElement(Card, {
|
|
6964
6987
|
dir: props.direction
|
|
6965
6988
|
}, matchError && /* @__PURE__ */ import_react37.default.createElement(Alert, {
|
|
@@ -6969,8 +6992,15 @@ var NewPasswordForm = function(props) {
|
|
|
6969
6992
|
headless: true
|
|
6970
6993
|
}, /* @__PURE__ */ import_react37.default.createElement("div", {
|
|
6971
6994
|
className: "hawa-text-center"
|
|
6972
|
-
}, props.texts.passwordChanged)) : /* @__PURE__ */ import_react37.default.createElement(
|
|
6973
|
-
onSubmit: handleSubmit(
|
|
6995
|
+
}, props.texts.passwordChanged)) : /* @__PURE__ */ import_react37.default.createElement("form", {
|
|
6996
|
+
onSubmit: handleSubmit(function(e) {
|
|
6997
|
+
if (props.handleNewPassword) {
|
|
6998
|
+
console.log("attempting to login");
|
|
6999
|
+
return props.handleNewPassword(e);
|
|
7000
|
+
} else {
|
|
7001
|
+
console.log("Form is submitted but handleSubmission prop is missing");
|
|
7002
|
+
}
|
|
7003
|
+
})
|
|
6974
7004
|
}, !props.headless && /* @__PURE__ */ import_react37.default.createElement(CardHeader, null, /* @__PURE__ */ import_react37.default.createElement(CardTitle, null, "Create Password"), /* @__PURE__ */ import_react37.default.createElement(CardDescription, null, "Set a new password for your account")), /* @__PURE__ */ import_react37.default.createElement(CardContent, {
|
|
6975
7005
|
headless: props.headless,
|
|
6976
7006
|
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
|
@@ -6979,7 +7009,7 @@ var NewPasswordForm = function(props) {
|
|
|
6979
7009
|
name: "password",
|
|
6980
7010
|
render: function(param) /* @__PURE__ */ {
|
|
6981
7011
|
var field = param.field;
|
|
6982
|
-
var
|
|
7012
|
+
var _formState_errors_password;
|
|
6983
7013
|
var _field_value;
|
|
6984
7014
|
return import_react37.default.createElement(Input, _object_spread_props(_object_spread({
|
|
6985
7015
|
width: "full",
|
|
@@ -6987,20 +7017,17 @@ var NewPasswordForm = function(props) {
|
|
|
6987
7017
|
autoComplete: "new-password",
|
|
6988
7018
|
label: props.texts.passwordLabel,
|
|
6989
7019
|
placeholder: props.texts.passwordPlaceholder,
|
|
6990
|
-
helperText: (
|
|
7020
|
+
helperText: (_formState_errors_password = formState.errors.password) === null || _formState_errors_password === void 0 ? void 0 : _formState_errors_password.message
|
|
6991
7021
|
}, field), {
|
|
6992
7022
|
value: (_field_value = field.value) !== null && _field_value !== void 0 ? _field_value : ""
|
|
6993
7023
|
}));
|
|
6994
|
-
},
|
|
6995
|
-
rules: {
|
|
6996
|
-
required: props.texts.passwordRequiredText
|
|
6997
7024
|
}
|
|
6998
7025
|
}), /* @__PURE__ */ import_react37.default.createElement(import_react_hook_form4.Controller, {
|
|
6999
7026
|
control: control,
|
|
7000
|
-
name: "
|
|
7027
|
+
name: "confirm_password",
|
|
7001
7028
|
render: function(param) /* @__PURE__ */ {
|
|
7002
7029
|
var field = param.field;
|
|
7003
|
-
var
|
|
7030
|
+
var _formState_errors_confirm_password;
|
|
7004
7031
|
var _field_value;
|
|
7005
7032
|
return import_react37.default.createElement(Input, _object_spread_props(_object_spread({
|
|
7006
7033
|
width: "full",
|
|
@@ -7008,31 +7035,47 @@ var NewPasswordForm = function(props) {
|
|
|
7008
7035
|
autoComplete: "new-password",
|
|
7009
7036
|
label: props.texts.confirmPasswordLabel,
|
|
7010
7037
|
placeholder: props.texts.confirmPasswordPlaceholder,
|
|
7011
|
-
helperText: (
|
|
7038
|
+
helperText: (_formState_errors_confirm_password = formState.errors.confirm_password) === null || _formState_errors_confirm_password === void 0 ? void 0 : _formState_errors_confirm_password.message
|
|
7012
7039
|
}, field), {
|
|
7013
7040
|
value: (_field_value = field.value) !== null && _field_value !== void 0 ? _field_value : ""
|
|
7014
7041
|
}));
|
|
7015
|
-
},
|
|
7016
|
-
rules: {
|
|
7017
|
-
required: props.texts.confirmPasswordRequiredText
|
|
7018
7042
|
}
|
|
7019
7043
|
})), /* @__PURE__ */ import_react37.default.createElement(CardFooter, null, /* @__PURE__ */ import_react37.default.createElement(Button, {
|
|
7020
7044
|
className: "hawa-w-full",
|
|
7021
7045
|
type: "submit"
|
|
7022
|
-
}, props.texts.updatePassword))))
|
|
7046
|
+
}, props.texts.updatePassword))));
|
|
7023
7047
|
};
|
|
7024
7048
|
// components/blocks/auth/ResetPassword.tsx
|
|
7025
7049
|
var import_react38 = __toESM(require("react"));
|
|
7026
7050
|
var import_react_hook_form5 = require("react-hook-form");
|
|
7051
|
+
var import_zod4 = require("@hookform/resolvers/zod");
|
|
7052
|
+
var z4 = __toESM(require("zod"));
|
|
7027
7053
|
var ResetPasswordForm = function(props) {
|
|
7028
|
-
var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5;
|
|
7029
|
-
var
|
|
7030
|
-
|
|
7054
|
+
var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6;
|
|
7055
|
+
var formSchema2 = z4.object({
|
|
7056
|
+
email: z4.string({
|
|
7057
|
+
required_error: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailRequiredText
|
|
7058
|
+
}).email({
|
|
7059
|
+
message: (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.emailInvalidText
|
|
7060
|
+
}).nonempty({
|
|
7061
|
+
message: (_props_texts2 = props.texts) === null || _props_texts2 === void 0 ? void 0 : _props_texts2.emailRequiredText
|
|
7062
|
+
})
|
|
7063
|
+
});
|
|
7064
|
+
var _ref = (0, import_react_hook_form5.useForm)({
|
|
7065
|
+
resolver: (0, import_zod4.zodResolver)(formSchema2)
|
|
7066
|
+
}), handleSubmit = _ref.handleSubmit, control = _ref.control, formState = _ref.formState;
|
|
7031
7067
|
var _props_texts_dontHaveAccount, _props_texts_registerText;
|
|
7032
7068
|
return /* @__PURE__ */ import_react38.default.createElement(Card, {
|
|
7033
7069
|
dir: props.direction
|
|
7034
7070
|
}, !props.sent ? /* @__PURE__ */ import_react38.default.createElement(import_react38.default.Fragment, null, !props.headless && /* @__PURE__ */ import_react38.default.createElement(CardHeader, null, /* @__PURE__ */ import_react38.default.createElement(CardTitle, null, "Reset Password"), /* @__PURE__ */ import_react38.default.createElement(CardDescription, null, "Enter your email to reset your account password")), /* @__PURE__ */ import_react38.default.createElement("form", {
|
|
7035
|
-
onSubmit: handleSubmit(
|
|
7071
|
+
onSubmit: handleSubmit(function(e) {
|
|
7072
|
+
if (props.handleResetPassword) {
|
|
7073
|
+
console.log("attempting to login");
|
|
7074
|
+
return props.handleResetPassword(e);
|
|
7075
|
+
} else {
|
|
7076
|
+
console.log("Form is submitted but handleResetPassword prop is missing");
|
|
7077
|
+
}
|
|
7078
|
+
})
|
|
7036
7079
|
}, /* @__PURE__ */ import_react38.default.createElement(CardContent, {
|
|
7037
7080
|
headless: props.headless
|
|
7038
7081
|
}, /* @__PURE__ */ import_react38.default.createElement(import_react_hook_form5.Controller, {
|
|
@@ -7040,38 +7083,31 @@ var ResetPasswordForm = function(props) {
|
|
|
7040
7083
|
name: "email",
|
|
7041
7084
|
render: function(param) /* @__PURE__ */ {
|
|
7042
7085
|
var field = param.field;
|
|
7043
|
-
var _props_texts,
|
|
7086
|
+
var _props_texts, _formState_errors_email, _props_texts1;
|
|
7044
7087
|
var _field_value;
|
|
7045
7088
|
return import_react38.default.createElement(Input, _object_spread_props(_object_spread({
|
|
7046
7089
|
width: "full",
|
|
7047
7090
|
type: "text",
|
|
7048
7091
|
label: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailLabel,
|
|
7049
|
-
helperText: (
|
|
7092
|
+
helperText: (_formState_errors_email = formState.errors.email) === null || _formState_errors_email === void 0 ? void 0 : _formState_errors_email.message,
|
|
7050
7093
|
placeholder: (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.emailPlaceholder
|
|
7051
7094
|
}, field), {
|
|
7052
7095
|
value: (_field_value = field.value) !== null && _field_value !== void 0 ? _field_value : ""
|
|
7053
7096
|
}));
|
|
7054
|
-
},
|
|
7055
|
-
rules: {
|
|
7056
|
-
required: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailRequiredText,
|
|
7057
|
-
pattern: {
|
|
7058
|
-
value: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
7059
|
-
message: ((_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.emailInvalidText) || "Email format is invalid"
|
|
7060
|
-
}
|
|
7061
7097
|
}
|
|
7062
7098
|
}), /* @__PURE__ */ import_react38.default.createElement("div", {
|
|
7063
7099
|
className: "hawa-mt-2 hawa-pb-2 hawa-text-start hawa-text-sm dark:hawa-text-gray-300"
|
|
7064
|
-
}, (_props_texts_dontHaveAccount = (
|
|
7100
|
+
}, (_props_texts_dontHaveAccount = (_props_texts3 = props.texts) === null || _props_texts3 === void 0 ? void 0 : _props_texts3.dontHaveAccount) !== null && _props_texts_dontHaveAccount !== void 0 ? _props_texts_dontHaveAccount : "Don't have an account? ", /* @__PURE__ */ import_react38.default.createElement("span", {
|
|
7065
7101
|
onClick: props.handleRouteToRegister,
|
|
7066
7102
|
className: "clickable-link"
|
|
7067
|
-
}, (_props_texts_registerText = (
|
|
7103
|
+
}, (_props_texts_registerText = (_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.registerText) !== null && _props_texts_registerText !== void 0 ? _props_texts_registerText : "Register"))), /* @__PURE__ */ import_react38.default.createElement(CardFooter, null, /* @__PURE__ */ import_react38.default.createElement(Button, {
|
|
7068
7104
|
type: "submit",
|
|
7069
7105
|
className: "hawa-w-full"
|
|
7070
|
-
}, (
|
|
7106
|
+
}, (_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.resetPassword)))) : /* @__PURE__ */ import_react38.default.createElement(CardContent, {
|
|
7071
7107
|
headless: true
|
|
7072
7108
|
}, /* @__PURE__ */ import_react38.default.createElement("div", {
|
|
7073
7109
|
className: "hawa-text-center"
|
|
7074
|
-
}, (
|
|
7110
|
+
}, (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.emailSentText)));
|
|
7075
7111
|
};
|
|
7076
7112
|
// components/blocks/auth/CodeConfirmation.tsx
|
|
7077
7113
|
var import_react39 = __toESM(require("react"));
|
|
@@ -7510,20 +7546,20 @@ var VeryBadEmoji = function() {
|
|
|
7510
7546
|
// components/blocks/feedback/FeedbackForm.tsx
|
|
7511
7547
|
var import_react43 = __toESM(require("react"));
|
|
7512
7548
|
var import_react_hook_form6 = require("react-hook-form");
|
|
7513
|
-
var
|
|
7514
|
-
var
|
|
7515
|
-
var formSchema =
|
|
7516
|
-
requestType:
|
|
7549
|
+
var import_zod5 = require("@hookform/resolvers/zod");
|
|
7550
|
+
var z5 = __toESM(require("zod"));
|
|
7551
|
+
var formSchema = z5.object({
|
|
7552
|
+
requestType: z5.string().nonempty({
|
|
7517
7553
|
message: "Request type is required."
|
|
7518
7554
|
}),
|
|
7519
|
-
description:
|
|
7555
|
+
description: z5.string().min(10, {
|
|
7520
7556
|
message: "Description must be at least 10 characters."
|
|
7521
7557
|
})
|
|
7522
7558
|
});
|
|
7523
7559
|
var FeedbackForm = function(param) {
|
|
7524
7560
|
var onSubmit = param.onSubmit;
|
|
7525
7561
|
var _ref = (0, import_react_hook_form6.useForm)({
|
|
7526
|
-
resolver: (0,
|
|
7562
|
+
resolver: (0, import_zod5.zodResolver)(formSchema)
|
|
7527
7563
|
}), handleSubmit = _ref.handleSubmit, control = _ref.control, formState = _ref.formState;
|
|
7528
7564
|
return /* @__PURE__ */ import_react43.default.createElement(Card, null, /* @__PURE__ */ import_react43.default.createElement(CardContent, {
|
|
7529
7565
|
headless: true
|
package/dist/index.mjs
CHANGED
|
@@ -278,7 +278,7 @@ var Card = React5.forwardRef(
|
|
|
278
278
|
ref,
|
|
279
279
|
className: cn(
|
|
280
280
|
"hawa-rounded-lg hawa-border hawa-bg-card hawa-text-card-foreground hawa-shadow-sm",
|
|
281
|
-
clickable && "hawa-cursor-pointer hawa-transition-all hover:hawa-drop-shadow-md dark:hover:
|
|
281
|
+
clickable && "hawa-cursor-pointer hawa-transition-all hover:hawa-drop-shadow-md dark:hover:dark-shadow",
|
|
282
282
|
className
|
|
283
283
|
),
|
|
284
284
|
...props
|
|
@@ -1888,7 +1888,7 @@ var PinInput = ({
|
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
1890
|
};
|
|
1891
|
-
return /* @__PURE__ */ React26.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-justify-center hawa-gap-2" }, pin.map((value, index) => /* @__PURE__ */ React26.createElement(
|
|
1891
|
+
return /* @__PURE__ */ React26.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-justify-center hawa-gap-2", dir: "ltr" }, pin.map((value, index) => /* @__PURE__ */ React26.createElement(
|
|
1892
1892
|
"input",
|
|
1893
1893
|
{
|
|
1894
1894
|
key: index,
|
|
@@ -4037,7 +4037,7 @@ var Select = (props) => {
|
|
|
4037
4037
|
// components/elements/PhoneInput.tsx
|
|
4038
4038
|
var PhoneInput = (props) => {
|
|
4039
4039
|
const [selectedCountry, setSelectedCountry] = useState12("+966");
|
|
4040
|
-
return /* @__PURE__ */ React30.createElement("div", { className: "hawa-
|
|
4040
|
+
return /* @__PURE__ */ React30.createElement("div", { className: "hawa-flex hawa-flex-col" }, props.label && /* @__PURE__ */ React30.createElement("label", { className: "hawa-mb-2 hawa-block hawa-text-sm hawa-font-medium" }, props.label), /* @__PURE__ */ React30.createElement("div", { dir: "ltr", className: "hawa-flex hawa-flex-row hawa-w-full " }, /* @__PURE__ */ React30.createElement(
|
|
4041
4041
|
Select,
|
|
4042
4042
|
{
|
|
4043
4043
|
width: "fit",
|
|
@@ -5508,7 +5508,16 @@ var InterfaceSettings = ({
|
|
|
5508
5508
|
// components/layout/Stats.tsx
|
|
5509
5509
|
import React47 from "react";
|
|
5510
5510
|
var Stats = ({ variant = "default", ...props }) => {
|
|
5511
|
-
return /* @__PURE__ */ React47.createElement(
|
|
5511
|
+
return /* @__PURE__ */ React47.createElement(
|
|
5512
|
+
Card,
|
|
5513
|
+
{
|
|
5514
|
+
onClick: props.handleClick,
|
|
5515
|
+
clickable: Boolean(props.handleClick),
|
|
5516
|
+
className: cn(props.className)
|
|
5517
|
+
},
|
|
5518
|
+
/* @__PURE__ */ React47.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between hawa-p-4 hawa-items-center" }, /* @__PURE__ */ React47.createElement(CardTitle, { className: "hawa-text-sm hawa-font-medium" }, props.label), props.icon && /* @__PURE__ */ React47.createElement("span", null, props.icon)),
|
|
5519
|
+
/* @__PURE__ */ React47.createElement(CardContent, null, props.isLoading ? /* @__PURE__ */ React47.createElement(Skeleton, { className: "hawa-h-8 hawa-w-3/4" }) : /* @__PURE__ */ React47.createElement("div", { className: "hawa-text-2xl hawa-font-bold" }, props.number), props.isLoading && props.helperText ? /* @__PURE__ */ React47.createElement(Skeleton, { className: "hawa-mt-2 hawa-h-4 hawa-w-1/2" }) : props.helperText && /* @__PURE__ */ React47.createElement("p", { className: "hawa-text-xs hawa-text-muted-foreground" }, props.helperText), props.isLoading && props.chart ? /* @__PURE__ */ React47.createElement(Skeleton, { className: "hawa-mt-2 hawa-h-4 hawa-w-1/2" }) : props.chart)
|
|
5520
|
+
);
|
|
5512
5521
|
};
|
|
5513
5522
|
|
|
5514
5523
|
// components/layout/Sidebar.tsx
|
|
@@ -6231,10 +6240,10 @@ var LoginForm = (props) => {
|
|
|
6231
6240
|
},
|
|
6232
6241
|
props.texts?.loginText || "Login"
|
|
6233
6242
|
),
|
|
6234
|
-
!props.
|
|
6243
|
+
!props.withoutRegister && /* @__PURE__ */ React52.createElement("div", { className: "hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal hawa-select-none dark:hawa-text-gray-300" }, props.texts?.newUserText || "New user?", " ", /* @__PURE__ */ React52.createElement(
|
|
6235
6244
|
"span",
|
|
6236
6245
|
{
|
|
6237
|
-
onClick: props.
|
|
6246
|
+
onClick: props.handleRouteToRegister,
|
|
6238
6247
|
className: "clickable-link"
|
|
6239
6248
|
},
|
|
6240
6249
|
props.texts?.createAccount || "Create Account"
|
|
@@ -6296,23 +6305,15 @@ import * as z2 from "zod";
|
|
|
6296
6305
|
var RegisterForm = (props) => {
|
|
6297
6306
|
const methods = useForm2();
|
|
6298
6307
|
const {
|
|
6299
|
-
userReferenceLabel,
|
|
6300
|
-
usernameLabel,
|
|
6301
6308
|
usernamePlaceholder,
|
|
6302
6309
|
usernameRequired,
|
|
6303
|
-
newUserText,
|
|
6304
|
-
existingUserText,
|
|
6305
6310
|
emailInvalidText,
|
|
6306
|
-
emailLabel,
|
|
6307
6311
|
emailPlaceholder,
|
|
6308
6312
|
emailRequiredText,
|
|
6309
|
-
passwordLabel,
|
|
6310
6313
|
passwordPlaceholder,
|
|
6311
6314
|
passwordRequiredText,
|
|
6312
6315
|
passwordTooShortText,
|
|
6313
6316
|
confirmPasswordRequired,
|
|
6314
|
-
forgotPasswordText,
|
|
6315
|
-
confirmPasswordLabel,
|
|
6316
6317
|
confirmPasswordPlaceholder,
|
|
6317
6318
|
termsRequiredText,
|
|
6318
6319
|
fullNameRequiredText
|
|
@@ -6772,94 +6773,118 @@ var CheckEmail = ({ texts, handleResend }) => {
|
|
|
6772
6773
|
|
|
6773
6774
|
// components/blocks/auth/NewPassword.tsx
|
|
6774
6775
|
import React56, { useState as useState20 } from "react";
|
|
6775
|
-
import { Controller as Controller4,
|
|
6776
|
+
import { Controller as Controller4, useForm as useForm3 } from "react-hook-form";
|
|
6777
|
+
import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
|
|
6778
|
+
import * as z3 from "zod";
|
|
6776
6779
|
var NewPasswordForm = (props) => {
|
|
6780
|
+
const formSchema2 = z3.object({
|
|
6781
|
+
password: z3.string({ required_error: props.texts.passwordRequiredText }).min(5, { message: props.texts.passwordTooShortText }).refine((value) => value !== "", {
|
|
6782
|
+
message: props.texts.passwordRequiredText
|
|
6783
|
+
}),
|
|
6784
|
+
confirm_password: z3.string({ required_error: props.texts.confirmPasswordRequired }).refine((value) => value !== "", {
|
|
6785
|
+
message: props.texts.passwordRequiredText
|
|
6786
|
+
})
|
|
6787
|
+
}).refine((data) => data.password === data.confirm_password, {
|
|
6788
|
+
message: "Passwords don't match",
|
|
6789
|
+
path: ["confirm_password"]
|
|
6790
|
+
});
|
|
6791
|
+
const { handleSubmit, control, formState } = useForm3({
|
|
6792
|
+
resolver: zodResolver3(formSchema2)
|
|
6793
|
+
});
|
|
6777
6794
|
const [matchError, setMatchError] = useState20(false);
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
formState: { errors },
|
|
6781
|
-
handleSubmit,
|
|
6782
|
-
control
|
|
6783
|
-
} = methods;
|
|
6784
|
-
const handleSubmission = (e) => {
|
|
6785
|
-
if (e.password === e.confirmPassword) {
|
|
6786
|
-
props.handleNewPassword();
|
|
6787
|
-
} else {
|
|
6788
|
-
setMatchError(true);
|
|
6789
|
-
}
|
|
6790
|
-
};
|
|
6791
|
-
return /* @__PURE__ */ React56.createElement(Card, { dir: props.direction }, matchError && /* @__PURE__ */ React56.createElement(Alert, { text: props.texts.passwordMatchError, severity: "error" }), props.passwordChanged ? /* @__PURE__ */ React56.createElement(CardContent, { headless: true }, /* @__PURE__ */ React56.createElement("div", { className: "hawa-text-center" }, props.texts.passwordChanged)) : /* @__PURE__ */ React56.createElement(FormProvider3, { ...methods }, /* @__PURE__ */ React56.createElement("form", { onSubmit: handleSubmit(handleSubmission) }, !props.headless && /* @__PURE__ */ React56.createElement(CardHeader, null, /* @__PURE__ */ React56.createElement(CardTitle, null, "Create Password"), /* @__PURE__ */ React56.createElement(CardDescription, null, "Set a new password for your account")), /* @__PURE__ */ React56.createElement(
|
|
6792
|
-
CardContent,
|
|
6795
|
+
return /* @__PURE__ */ React56.createElement(Card, { dir: props.direction }, matchError && /* @__PURE__ */ React56.createElement(Alert, { text: props.texts.passwordMatchError, severity: "error" }), props.passwordChanged ? /* @__PURE__ */ React56.createElement(CardContent, { headless: true }, /* @__PURE__ */ React56.createElement("div", { className: "hawa-text-center" }, props.texts.passwordChanged)) : /* @__PURE__ */ React56.createElement(
|
|
6796
|
+
"form",
|
|
6793
6797
|
{
|
|
6794
|
-
|
|
6795
|
-
|
|
6798
|
+
onSubmit: handleSubmit((e) => {
|
|
6799
|
+
if (props.handleNewPassword) {
|
|
6800
|
+
console.log("attempting to login");
|
|
6801
|
+
return props.handleNewPassword(e);
|
|
6802
|
+
} else {
|
|
6803
|
+
console.log(
|
|
6804
|
+
"Form is submitted but handleSubmission prop is missing"
|
|
6805
|
+
);
|
|
6806
|
+
}
|
|
6807
|
+
})
|
|
6796
6808
|
},
|
|
6809
|
+
!props.headless && /* @__PURE__ */ React56.createElement(CardHeader, null, /* @__PURE__ */ React56.createElement(CardTitle, null, "Create Password"), /* @__PURE__ */ React56.createElement(CardDescription, null, "Set a new password for your account")),
|
|
6797
6810
|
/* @__PURE__ */ React56.createElement(
|
|
6798
|
-
|
|
6811
|
+
CardContent,
|
|
6799
6812
|
{
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6813
|
+
headless: props.headless,
|
|
6814
|
+
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
|
6815
|
+
},
|
|
6816
|
+
/* @__PURE__ */ React56.createElement(
|
|
6817
|
+
Controller4,
|
|
6818
|
+
{
|
|
6819
|
+
control,
|
|
6820
|
+
name: "password",
|
|
6821
|
+
render: ({ field }) => /* @__PURE__ */ React56.createElement(
|
|
6822
|
+
Input,
|
|
6823
|
+
{
|
|
6824
|
+
width: "full",
|
|
6825
|
+
type: "password",
|
|
6826
|
+
autoComplete: "new-password",
|
|
6827
|
+
label: props.texts.passwordLabel,
|
|
6828
|
+
placeholder: props.texts.passwordPlaceholder,
|
|
6829
|
+
helperText: formState.errors.password?.message,
|
|
6830
|
+
...field,
|
|
6831
|
+
value: field.value ?? ""
|
|
6832
|
+
}
|
|
6833
|
+
)
|
|
6817
6834
|
}
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
),
|
|
6838
|
-
rules: {
|
|
6839
|
-
required: props.texts.confirmPasswordRequiredText
|
|
6835
|
+
),
|
|
6836
|
+
/* @__PURE__ */ React56.createElement(
|
|
6837
|
+
Controller4,
|
|
6838
|
+
{
|
|
6839
|
+
control,
|
|
6840
|
+
name: "confirm_password",
|
|
6841
|
+
render: ({ field }) => /* @__PURE__ */ React56.createElement(
|
|
6842
|
+
Input,
|
|
6843
|
+
{
|
|
6844
|
+
width: "full",
|
|
6845
|
+
type: "password",
|
|
6846
|
+
autoComplete: "new-password",
|
|
6847
|
+
label: props.texts.confirmPasswordLabel,
|
|
6848
|
+
placeholder: props.texts.confirmPasswordPlaceholder,
|
|
6849
|
+
helperText: formState.errors.confirm_password?.message,
|
|
6850
|
+
...field,
|
|
6851
|
+
value: field.value ?? ""
|
|
6852
|
+
}
|
|
6853
|
+
)
|
|
6840
6854
|
}
|
|
6841
|
-
|
|
6842
|
-
)
|
|
6843
|
-
|
|
6855
|
+
)
|
|
6856
|
+
),
|
|
6857
|
+
/* @__PURE__ */ React56.createElement(CardFooter, null, /* @__PURE__ */ React56.createElement(Button, { className: "hawa-w-full", type: "submit" }, props.texts.updatePassword))
|
|
6858
|
+
));
|
|
6844
6859
|
};
|
|
6845
6860
|
|
|
6846
6861
|
// components/blocks/auth/ResetPassword.tsx
|
|
6847
6862
|
import React57 from "react";
|
|
6848
6863
|
import { Controller as Controller5, useForm as useForm4 } from "react-hook-form";
|
|
6864
|
+
import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
|
|
6865
|
+
import * as z4 from "zod";
|
|
6849
6866
|
var ResetPasswordForm = (props) => {
|
|
6850
|
-
const
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
}
|
|
6857
|
-
|
|
6858
|
-
CardContent,
|
|
6867
|
+
const formSchema2 = z4.object({
|
|
6868
|
+
email: z4.string({ required_error: props.texts?.emailRequiredText }).email({ message: props.texts?.emailInvalidText }).nonempty({ message: props.texts?.emailRequiredText })
|
|
6869
|
+
});
|
|
6870
|
+
const { handleSubmit, control, formState } = useForm4({
|
|
6871
|
+
resolver: zodResolver4(formSchema2)
|
|
6872
|
+
});
|
|
6873
|
+
return /* @__PURE__ */ React57.createElement(Card, { dir: props.direction }, !props.sent ? /* @__PURE__ */ React57.createElement(React57.Fragment, null, !props.headless && /* @__PURE__ */ React57.createElement(CardHeader, null, /* @__PURE__ */ React57.createElement(CardTitle, null, "Reset Password"), /* @__PURE__ */ React57.createElement(CardDescription, null, "Enter your email to reset your account password")), /* @__PURE__ */ React57.createElement(
|
|
6874
|
+
"form",
|
|
6859
6875
|
{
|
|
6860
|
-
|
|
6876
|
+
onSubmit: handleSubmit((e) => {
|
|
6877
|
+
if (props.handleResetPassword) {
|
|
6878
|
+
console.log("attempting to login");
|
|
6879
|
+
return props.handleResetPassword(e);
|
|
6880
|
+
} else {
|
|
6881
|
+
console.log(
|
|
6882
|
+
"Form is submitted but handleResetPassword prop is missing"
|
|
6883
|
+
);
|
|
6884
|
+
}
|
|
6885
|
+
})
|
|
6861
6886
|
},
|
|
6862
|
-
/* @__PURE__ */ React57.createElement(
|
|
6887
|
+
/* @__PURE__ */ React57.createElement(CardContent, { headless: props.headless }, /* @__PURE__ */ React57.createElement(
|
|
6863
6888
|
Controller5,
|
|
6864
6889
|
{
|
|
6865
6890
|
control,
|
|
@@ -6870,30 +6895,23 @@ var ResetPasswordForm = (props) => {
|
|
|
6870
6895
|
width: "full",
|
|
6871
6896
|
type: "text",
|
|
6872
6897
|
label: props.texts?.emailLabel,
|
|
6873
|
-
helperText: errors.email?.message,
|
|
6898
|
+
helperText: formState.errors.email?.message,
|
|
6874
6899
|
placeholder: props.texts?.emailPlaceholder,
|
|
6875
6900
|
...field,
|
|
6876
6901
|
value: field.value ?? ""
|
|
6877
6902
|
}
|
|
6878
|
-
)
|
|
6879
|
-
rules: {
|
|
6880
|
-
required: props.texts?.emailRequiredText,
|
|
6881
|
-
pattern: {
|
|
6882
|
-
value: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
6883
|
-
message: props.texts?.emailInvalidText || "Email format is invalid"
|
|
6884
|
-
}
|
|
6885
|
-
}
|
|
6903
|
+
)
|
|
6886
6904
|
}
|
|
6887
|
-
),
|
|
6888
|
-
/* @__PURE__ */ React57.createElement("div", { className: "hawa-mt-2 hawa-pb-2 hawa-text-start hawa-text-sm dark:hawa-text-gray-300" }, props.texts?.dontHaveAccount ?? "Don't have an account? ", /* @__PURE__ */ React57.createElement(
|
|
6905
|
+
), /* @__PURE__ */ React57.createElement("div", { className: "hawa-mt-2 hawa-pb-2 hawa-text-start hawa-text-sm dark:hawa-text-gray-300" }, props.texts?.dontHaveAccount ?? "Don't have an account? ", /* @__PURE__ */ React57.createElement(
|
|
6889
6906
|
"span",
|
|
6890
6907
|
{
|
|
6891
6908
|
onClick: props.handleRouteToRegister,
|
|
6892
6909
|
className: "clickable-link"
|
|
6893
6910
|
},
|
|
6894
6911
|
props.texts?.registerText ?? "Register"
|
|
6895
|
-
))
|
|
6896
|
-
|
|
6912
|
+
))),
|
|
6913
|
+
/* @__PURE__ */ React57.createElement(CardFooter, null, /* @__PURE__ */ React57.createElement(Button, { type: "submit", className: "hawa-w-full" }, props.texts?.resetPassword))
|
|
6914
|
+
)) : /* @__PURE__ */ React57.createElement(CardContent, { headless: true }, /* @__PURE__ */ React57.createElement("div", { className: "hawa-text-center" }, props.texts?.emailSentText)));
|
|
6897
6915
|
};
|
|
6898
6916
|
|
|
6899
6917
|
// components/blocks/auth/CodeConfirmation.tsx
|
|
@@ -7328,15 +7346,15 @@ var VeryBadEmoji = () => /* @__PURE__ */ React61.createElement(
|
|
|
7328
7346
|
// components/blocks/feedback/FeedbackForm.tsx
|
|
7329
7347
|
import React62 from "react";
|
|
7330
7348
|
import { useForm as useForm5, Controller as Controller6 } from "react-hook-form";
|
|
7331
|
-
import { zodResolver as
|
|
7332
|
-
import * as
|
|
7333
|
-
var formSchema =
|
|
7334
|
-
requestType:
|
|
7335
|
-
description:
|
|
7349
|
+
import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
|
|
7350
|
+
import * as z5 from "zod";
|
|
7351
|
+
var formSchema = z5.object({
|
|
7352
|
+
requestType: z5.string().nonempty({ message: "Request type is required." }),
|
|
7353
|
+
description: z5.string().min(10, { message: "Description must be at least 10 characters." })
|
|
7336
7354
|
});
|
|
7337
7355
|
var FeedbackForm = ({ onSubmit }) => {
|
|
7338
7356
|
const { handleSubmit, control, formState } = useForm5({
|
|
7339
|
-
resolver:
|
|
7357
|
+
resolver: zodResolver5(formSchema)
|
|
7340
7358
|
});
|
|
7341
7359
|
return /* @__PURE__ */ React62.createElement(Card, null, /* @__PURE__ */ React62.createElement(CardContent, { headless: true }, /* @__PURE__ */ React62.createElement(
|
|
7342
7360
|
"form",
|