@sikka/hawa 0.10.26-next → 0.10.27-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.d.mts CHANGED
@@ -1139,8 +1139,10 @@ declare const CheckEmail: FC<CheckEmailBlocks>;
1139
1139
 
1140
1140
  type NewPasswordTypes = {
1141
1141
  handleNewPassword: (e: any) => void;
1142
+ handleRouteToRegister: () => void;
1142
1143
  direction?: "rtl" | "ltr";
1143
1144
  headless?: boolean;
1145
+ allowRegister?: boolean;
1144
1146
  passwordChanged: any;
1145
1147
  texts: {
1146
1148
  updatePassword: string;
@@ -1153,6 +1155,8 @@ type NewPasswordTypes = {
1153
1155
  confirmPasswordPlaceholder: string;
1154
1156
  confirmPasswordLabel: string;
1155
1157
  confirmPasswordRequired: string;
1158
+ dontHaveAccount?: string;
1159
+ registerText?: string;
1156
1160
  };
1157
1161
  };
1158
1162
  declare const NewPasswordForm: FC<NewPasswordTypes>;
@@ -1161,18 +1165,21 @@ type ResetPasswordType = {
1161
1165
  handleResetPassword: (e: any) => void;
1162
1166
  handleRouteToRegister: () => void;
1163
1167
  sent: any;
1168
+ headless?: boolean;
1169
+ allowRegister?: boolean;
1170
+ direction?: "rtl" | "ltr";
1164
1171
  texts?: {
1165
1172
  emailLabel: string;
1166
1173
  emailPlaceholder: string;
1167
- emailRequiredText: string;
1168
- emailInvalidText: string;
1174
+ emailRequired: string;
1175
+ emailInvalid: string;
1169
1176
  emailSentText: string;
1170
- resetPassword: string;
1171
1177
  registerText: string;
1178
+ resetPassword: string;
1172
1179
  dontHaveAccount: string;
1180
+ headTitle?: string;
1181
+ headDescription?: string;
1173
1182
  };
1174
- headless?: boolean;
1175
- direction?: "rtl" | "ltr";
1176
1183
  };
1177
1184
  declare const ResetPasswordForm: FC<ResetPasswordType>;
1178
1185
 
package/dist/index.d.ts CHANGED
@@ -1139,8 +1139,10 @@ declare const CheckEmail: FC<CheckEmailBlocks>;
1139
1139
 
1140
1140
  type NewPasswordTypes = {
1141
1141
  handleNewPassword: (e: any) => void;
1142
+ handleRouteToRegister: () => void;
1142
1143
  direction?: "rtl" | "ltr";
1143
1144
  headless?: boolean;
1145
+ allowRegister?: boolean;
1144
1146
  passwordChanged: any;
1145
1147
  texts: {
1146
1148
  updatePassword: string;
@@ -1153,6 +1155,8 @@ type NewPasswordTypes = {
1153
1155
  confirmPasswordPlaceholder: string;
1154
1156
  confirmPasswordLabel: string;
1155
1157
  confirmPasswordRequired: string;
1158
+ dontHaveAccount?: string;
1159
+ registerText?: string;
1156
1160
  };
1157
1161
  };
1158
1162
  declare const NewPasswordForm: FC<NewPasswordTypes>;
@@ -1161,18 +1165,21 @@ type ResetPasswordType = {
1161
1165
  handleResetPassword: (e: any) => void;
1162
1166
  handleRouteToRegister: () => void;
1163
1167
  sent: any;
1168
+ headless?: boolean;
1169
+ allowRegister?: boolean;
1170
+ direction?: "rtl" | "ltr";
1164
1171
  texts?: {
1165
1172
  emailLabel: string;
1166
1173
  emailPlaceholder: string;
1167
- emailRequiredText: string;
1168
- emailInvalidText: string;
1174
+ emailRequired: string;
1175
+ emailInvalid: string;
1169
1176
  emailSentText: string;
1170
- resetPassword: string;
1171
1177
  registerText: string;
1178
+ resetPassword: string;
1172
1179
  dontHaveAccount: string;
1180
+ headTitle?: string;
1181
+ headDescription?: string;
1173
1182
  };
1174
- headless?: boolean;
1175
- direction?: "rtl" | "ltr";
1176
1183
  };
1177
1184
  declare const ResetPasswordForm: FC<ResetPasswordType>;
1178
1185
 
package/dist/index.js CHANGED
@@ -7623,6 +7623,7 @@ var NewPasswordForm = function(_param) {
7623
7623
  resolver: (0, import_zod3.zodResolver)(formSchema)
7624
7624
  }), handleSubmit = _ref.handleSubmit, control = _ref.control, formState = _ref.formState;
7625
7625
  var _ref1 = _sliced_to_array((0, import_react42.useState)(false), 2), matchError = _ref1[0], setMatchError = _ref1[1];
7626
+ var _texts_dontHaveAccount, _texts_registerText;
7626
7627
  return /* @__PURE__ */ import_react42.default.createElement(Card, {
7627
7628
  dir: props.direction
7628
7629
  }, matchError && /* @__PURE__ */ import_react42.default.createElement(Alert, {
@@ -7673,10 +7674,17 @@ var NewPasswordForm = function(_param) {
7673
7674
  helperText: (_formState_errors_confirm_password = formState.errors.confirm_password) === null || _formState_errors_confirm_password === void 0 ? void 0 : _formState_errors_confirm_password.message
7674
7675
  }, field));
7675
7676
  }
7676
- })), /* @__PURE__ */ import_react42.default.createElement(CardFooter, null, /* @__PURE__ */ import_react42.default.createElement(Button, {
7677
+ })), /* @__PURE__ */ import_react42.default.createElement(CardFooter, {
7678
+ className: "hawa-flex hawa-flex-col"
7679
+ }, /* @__PURE__ */ import_react42.default.createElement(Button, {
7677
7680
  className: "hawa-w-full",
7678
7681
  type: "submit"
7679
- }, texts === null || texts === void 0 ? void 0 : texts.updatePassword))));
7682
+ }, texts === null || texts === void 0 ? void 0 : texts.updatePassword), props.allowRegister && /* @__PURE__ */ import_react42.default.createElement("div", {
7683
+ className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300"
7684
+ }, (_texts_dontHaveAccount = texts === null || texts === void 0 ? void 0 : texts.dontHaveAccount) !== null && _texts_dontHaveAccount !== void 0 ? _texts_dontHaveAccount : "Don't have an account? ", /* @__PURE__ */ import_react42.default.createElement("span", {
7685
+ className: "clickable-link",
7686
+ onClick: props.handleRouteToRegister
7687
+ }, (_texts_registerText = texts === null || texts === void 0 ? void 0 : texts.registerText) !== null && _texts_registerText !== void 0 ? _texts_registerText : "Register")))));
7680
7688
  };
7681
7689
  // components/blocks/auth/ResetPassword.tsx
7682
7690
  var import_react43 = __toESM(require("react"));
@@ -7684,14 +7692,14 @@ var import_react_hook_form5 = require("react-hook-form");
7684
7692
  var import_zod4 = require("@hookform/resolvers/zod");
7685
7693
  var z4 = __toESM(require("zod"));
7686
7694
  var ResetPasswordForm = function(props) {
7687
- var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6;
7695
+ var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6, _props_texts7, _props_texts8;
7688
7696
  var formSchema = z4.object({
7689
7697
  email: z4.string({
7690
- required_error: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailRequiredText
7698
+ required_error: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailRequired
7691
7699
  }).email({
7692
- message: (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.emailInvalidText
7693
- }).nonempty({
7694
- message: (_props_texts2 = props.texts) === null || _props_texts2 === void 0 ? void 0 : _props_texts2.emailRequiredText
7700
+ message: (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.emailInvalid
7701
+ }).min(1, {
7702
+ message: (_props_texts2 = props.texts) === null || _props_texts2 === void 0 ? void 0 : _props_texts2.emailRequired
7695
7703
  })
7696
7704
  });
7697
7705
  var _ref = (0, import_react_hook_form5.useForm)({
@@ -7700,12 +7708,12 @@ var ResetPasswordForm = function(props) {
7700
7708
  var _props_texts_dontHaveAccount, _props_texts_registerText;
7701
7709
  return /* @__PURE__ */ import_react43.default.createElement(Card, {
7702
7710
  dir: props.direction
7703
- }, !props.sent ? /* @__PURE__ */ import_react43.default.createElement(import_react43.default.Fragment, null, !props.headless && /* @__PURE__ */ import_react43.default.createElement(CardHeader, null, /* @__PURE__ */ import_react43.default.createElement(CardTitle, null, "Reset Password"), /* @__PURE__ */ import_react43.default.createElement(CardDescription, null, "Enter your email to reset your account password")), /* @__PURE__ */ import_react43.default.createElement("form", {
7711
+ }, !props.sent ? /* @__PURE__ */ import_react43.default.createElement(import_react43.default.Fragment, null, !props.headless && /* @__PURE__ */ import_react43.default.createElement(CardHeader, null, /* @__PURE__ */ import_react43.default.createElement(CardTitle, null, " ", ((_props_texts3 = props.texts) === null || _props_texts3 === void 0 ? void 0 : _props_texts3.headTitle) || "Reset Password"), /* @__PURE__ */ import_react43.default.createElement(CardDescription, null, ((_props_texts4 = props.texts) === null || _props_texts4 === void 0 ? void 0 : _props_texts4.headDescription) || "Enter your email to reset your account password")), /* @__PURE__ */ import_react43.default.createElement("form", {
7704
7712
  onSubmit: handleSubmit(function(e) {
7705
7713
  if (props.handleResetPassword) {
7706
7714
  return props.handleResetPassword(e);
7707
7715
  } else {
7708
- console.log("Form is submitted but handleResetPassword prop is missing");
7716
+ console.log("handleResetPassword prop is missing");
7709
7717
  }
7710
7718
  })
7711
7719
  }, /* @__PURE__ */ import_react43.default.createElement(CardContent, {
@@ -7713,33 +7721,31 @@ var ResetPasswordForm = function(props) {
7713
7721
  }, /* @__PURE__ */ import_react43.default.createElement(import_react_hook_form5.Controller, {
7714
7722
  control: control,
7715
7723
  name: "email",
7716
- render: function(param) /* @__PURE__ */ {
7724
+ render: function(param) {
7717
7725
  var field = param.field;
7718
7726
  var _props_texts, _formState_errors_email, _props_texts1;
7719
- var _field_value;
7720
- return import_react43.default.createElement(Input, _object_spread_props(_object_spread({
7727
+ return /* @__PURE__ */ import_react43.default.createElement(Input, _object_spread({
7721
7728
  width: "full",
7722
- type: "text",
7723
7729
  label: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailLabel,
7724
7730
  helperText: (_formState_errors_email = formState.errors.email) === null || _formState_errors_email === void 0 ? void 0 : _formState_errors_email.message,
7725
7731
  placeholder: (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.emailPlaceholder
7726
- }, field), {
7727
- value: (_field_value = field.value) !== null && _field_value !== void 0 ? _field_value : ""
7728
- }));
7732
+ }, field));
7729
7733
  }
7730
- }), /* @__PURE__ */ import_react43.default.createElement("div", {
7731
- className: "hawa-mt-2 hawa-pb-2 hawa-text-start hawa-text-sm dark:hawa-text-gray-300"
7732
- }, (_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_react43.default.createElement("span", {
7733
- onClick: props.handleRouteToRegister,
7734
- className: "clickable-link"
7735
- }, (_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_react43.default.createElement(CardFooter, null, /* @__PURE__ */ import_react43.default.createElement(Button, {
7734
+ })), /* @__PURE__ */ import_react43.default.createElement(CardFooter, {
7735
+ className: "hawa-flex hawa-flex-col"
7736
+ }, /* @__PURE__ */ import_react43.default.createElement(Button, {
7736
7737
  type: "submit",
7737
7738
  className: "hawa-w-full"
7738
- }, (_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.resetPassword)))) : /* @__PURE__ */ import_react43.default.createElement(CardContent, {
7739
+ }, (_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.resetPassword), props.allowRegister && /* @__PURE__ */ import_react43.default.createElement("div", {
7740
+ className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300"
7741
+ }, (_props_texts_dontHaveAccount = (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.dontHaveAccount) !== null && _props_texts_dontHaveAccount !== void 0 ? _props_texts_dontHaveAccount : "Don't have an account? ", /* @__PURE__ */ import_react43.default.createElement("span", {
7742
+ className: "clickable-link",
7743
+ onClick: props.handleRouteToRegister
7744
+ }, (_props_texts_registerText = (_props_texts7 = props.texts) === null || _props_texts7 === void 0 ? void 0 : _props_texts7.registerText) !== null && _props_texts_registerText !== void 0 ? _props_texts_registerText : "Register"))))) : /* @__PURE__ */ import_react43.default.createElement(CardContent, {
7739
7745
  headless: true
7740
7746
  }, /* @__PURE__ */ import_react43.default.createElement("div", {
7741
7747
  className: "hawa-text-center"
7742
- }, (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.emailSentText)));
7748
+ }, (_props_texts8 = props.texts) === null || _props_texts8 === void 0 ? void 0 : _props_texts8.emailSentText)));
7743
7749
  };
7744
7750
  // components/blocks/auth/CodeConfirmation.tsx
7745
7751
  var import_react44 = __toESM(require("react"));
package/dist/index.mjs CHANGED
@@ -7579,7 +7579,14 @@ var NewPasswordForm = ({ texts, ...props }) => {
7579
7579
  }
7580
7580
  )
7581
7581
  ),
7582
- /* @__PURE__ */ React62.createElement(CardFooter, null, /* @__PURE__ */ React62.createElement(Button, { className: "hawa-w-full", type: "submit" }, texts?.updatePassword))
7582
+ /* @__PURE__ */ React62.createElement(CardFooter, { className: "hawa-flex hawa-flex-col" }, /* @__PURE__ */ React62.createElement(Button, { className: "hawa-w-full", type: "submit" }, texts?.updatePassword), props.allowRegister && /* @__PURE__ */ React62.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, texts?.dontHaveAccount ?? "Don't have an account? ", /* @__PURE__ */ React62.createElement(
7583
+ "span",
7584
+ {
7585
+ className: "clickable-link",
7586
+ onClick: props.handleRouteToRegister
7587
+ },
7588
+ texts?.registerText ?? "Register"
7589
+ )))
7583
7590
  ));
7584
7591
  };
7585
7592
 
@@ -7590,21 +7597,19 @@ import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
7590
7597
  import * as z4 from "zod";
7591
7598
  var ResetPasswordForm = (props) => {
7592
7599
  const formSchema = z4.object({
7593
- email: z4.string({ required_error: props.texts?.emailRequiredText }).email({ message: props.texts?.emailInvalidText }).nonempty({ message: props.texts?.emailRequiredText })
7600
+ email: z4.string({ required_error: props.texts?.emailRequired }).email({ message: props.texts?.emailInvalid }).min(1, { message: props.texts?.emailRequired })
7594
7601
  });
7595
7602
  const { handleSubmit, control, formState } = useForm4({
7596
7603
  resolver: zodResolver4(formSchema)
7597
7604
  });
7598
- return /* @__PURE__ */ React63.createElement(Card, { dir: props.direction }, !props.sent ? /* @__PURE__ */ React63.createElement(React63.Fragment, null, !props.headless && /* @__PURE__ */ React63.createElement(CardHeader, null, /* @__PURE__ */ React63.createElement(CardTitle, null, "Reset Password"), /* @__PURE__ */ React63.createElement(CardDescription, null, "Enter your email to reset your account password")), /* @__PURE__ */ React63.createElement(
7605
+ return /* @__PURE__ */ React63.createElement(Card, { dir: props.direction }, !props.sent ? /* @__PURE__ */ React63.createElement(React63.Fragment, null, !props.headless && /* @__PURE__ */ React63.createElement(CardHeader, null, /* @__PURE__ */ React63.createElement(CardTitle, null, " ", props.texts?.headTitle || "Reset Password"), /* @__PURE__ */ React63.createElement(CardDescription, null, props.texts?.headDescription || "Enter your email to reset your account password")), /* @__PURE__ */ React63.createElement(
7599
7606
  "form",
7600
7607
  {
7601
7608
  onSubmit: handleSubmit((e) => {
7602
7609
  if (props.handleResetPassword) {
7603
7610
  return props.handleResetPassword(e);
7604
7611
  } else {
7605
- console.log(
7606
- "Form is submitted but handleResetPassword prop is missing"
7607
- );
7612
+ console.log("handleResetPassword prop is missing");
7608
7613
  }
7609
7614
  })
7610
7615
  },
@@ -7617,24 +7622,22 @@ var ResetPasswordForm = (props) => {
7617
7622
  Input,
7618
7623
  {
7619
7624
  width: "full",
7620
- type: "text",
7621
7625
  label: props.texts?.emailLabel,
7622
7626
  helperText: formState.errors.email?.message,
7623
7627
  placeholder: props.texts?.emailPlaceholder,
7624
- ...field,
7625
- value: field.value ?? ""
7628
+ ...field
7626
7629
  }
7627
7630
  )
7628
7631
  }
7629
- ), /* @__PURE__ */ React63.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__ */ React63.createElement(
7632
+ )),
7633
+ /* @__PURE__ */ React63.createElement(CardFooter, { className: "hawa-flex hawa-flex-col" }, /* @__PURE__ */ React63.createElement(Button, { type: "submit", className: "hawa-w-full" }, props.texts?.resetPassword), props.allowRegister && /* @__PURE__ */ React63.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, props.texts?.dontHaveAccount ?? "Don't have an account? ", /* @__PURE__ */ React63.createElement(
7630
7634
  "span",
7631
7635
  {
7632
- onClick: props.handleRouteToRegister,
7633
- className: "clickable-link"
7636
+ className: "clickable-link",
7637
+ onClick: props.handleRouteToRegister
7634
7638
  },
7635
7639
  props.texts?.registerText ?? "Register"
7636
- ))),
7637
- /* @__PURE__ */ React63.createElement(CardFooter, null, /* @__PURE__ */ React63.createElement(Button, { type: "submit", className: "hawa-w-full" }, props.texts?.resetPassword))
7640
+ )))
7638
7641
  )) : /* @__PURE__ */ React63.createElement(CardContent, { headless: true }, /* @__PURE__ */ React63.createElement("div", { className: "hawa-text-center" }, props.texts?.emailSentText)));
7639
7642
  };
7640
7643
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.10.26-next",
3
+ "version": "0.10.27-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {