@sikka/hawa 0.10.26-next → 0.10.28-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
@@ -2435,7 +2435,9 @@ var Alert = function(_param) {
2435
2435
  className: "hawa-flex hawa-flex-col"
2436
2436
  }, /* @__PURE__ */ import_react16.default.createElement("span", {
2437
2437
  className: (0, import_clsx7.default)("font-medium", direction === "rtl" ? "hawa-ml-8" : "hawa-mr-8")
2438
- }, props.title), /* @__PURE__ */ import_react16.default.createElement("span", null, props.text), props.actions && /* @__PURE__ */ import_react16.default.createElement("div", {
2438
+ }, props.title), /* @__PURE__ */ import_react16.default.createElement("span", {
2439
+ className: (0, import_clsx7.default)(direction === "rtl" ? "hawa-ml-8" : "hawa-mr-8")
2440
+ }, props.text), props.actions && /* @__PURE__ */ import_react16.default.createElement("div", {
2439
2441
  className: "hawa-mt-2 hawa-flex hawa-flex-row hawa-gap-2"
2440
2442
  }, props.actions.map(function(act, index) {
2441
2443
  return /* @__PURE__ */ import_react16.default.createElement(Button, {
@@ -7623,6 +7625,7 @@ var NewPasswordForm = function(_param) {
7623
7625
  resolver: (0, import_zod3.zodResolver)(formSchema)
7624
7626
  }), handleSubmit = _ref.handleSubmit, control = _ref.control, formState = _ref.formState;
7625
7627
  var _ref1 = _sliced_to_array((0, import_react42.useState)(false), 2), matchError = _ref1[0], setMatchError = _ref1[1];
7628
+ var _texts_dontHaveAccount, _texts_registerText;
7626
7629
  return /* @__PURE__ */ import_react42.default.createElement(Card, {
7627
7630
  dir: props.direction
7628
7631
  }, matchError && /* @__PURE__ */ import_react42.default.createElement(Alert, {
@@ -7673,10 +7676,17 @@ var NewPasswordForm = function(_param) {
7673
7676
  helperText: (_formState_errors_confirm_password = formState.errors.confirm_password) === null || _formState_errors_confirm_password === void 0 ? void 0 : _formState_errors_confirm_password.message
7674
7677
  }, field));
7675
7678
  }
7676
- })), /* @__PURE__ */ import_react42.default.createElement(CardFooter, null, /* @__PURE__ */ import_react42.default.createElement(Button, {
7679
+ })), /* @__PURE__ */ import_react42.default.createElement(CardFooter, {
7680
+ className: "hawa-flex hawa-flex-col"
7681
+ }, /* @__PURE__ */ import_react42.default.createElement(Button, {
7677
7682
  className: "hawa-w-full",
7678
7683
  type: "submit"
7679
- }, texts === null || texts === void 0 ? void 0 : texts.updatePassword))));
7684
+ }, texts === null || texts === void 0 ? void 0 : texts.updatePassword), props.allowRegister && /* @__PURE__ */ import_react42.default.createElement("div", {
7685
+ className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300"
7686
+ }, (_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", {
7687
+ className: "clickable-link",
7688
+ onClick: props.handleRouteToRegister
7689
+ }, (_texts_registerText = texts === null || texts === void 0 ? void 0 : texts.registerText) !== null && _texts_registerText !== void 0 ? _texts_registerText : "Register")))));
7680
7690
  };
7681
7691
  // components/blocks/auth/ResetPassword.tsx
7682
7692
  var import_react43 = __toESM(require("react"));
@@ -7684,14 +7694,14 @@ var import_react_hook_form5 = require("react-hook-form");
7684
7694
  var import_zod4 = require("@hookform/resolvers/zod");
7685
7695
  var z4 = __toESM(require("zod"));
7686
7696
  var ResetPasswordForm = function(props) {
7687
- var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6;
7697
+ var _props_texts, _props_texts1, _props_texts2, _props_texts3, _props_texts4, _props_texts5, _props_texts6, _props_texts7, _props_texts8;
7688
7698
  var formSchema = z4.object({
7689
7699
  email: z4.string({
7690
- required_error: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailRequiredText
7700
+ required_error: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailRequired
7691
7701
  }).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
7702
+ message: (_props_texts1 = props.texts) === null || _props_texts1 === void 0 ? void 0 : _props_texts1.emailInvalid
7703
+ }).min(1, {
7704
+ message: (_props_texts2 = props.texts) === null || _props_texts2 === void 0 ? void 0 : _props_texts2.emailRequired
7695
7705
  })
7696
7706
  });
7697
7707
  var _ref = (0, import_react_hook_form5.useForm)({
@@ -7700,12 +7710,12 @@ var ResetPasswordForm = function(props) {
7700
7710
  var _props_texts_dontHaveAccount, _props_texts_registerText;
7701
7711
  return /* @__PURE__ */ import_react43.default.createElement(Card, {
7702
7712
  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", {
7713
+ }, !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
7714
  onSubmit: handleSubmit(function(e) {
7705
7715
  if (props.handleResetPassword) {
7706
7716
  return props.handleResetPassword(e);
7707
7717
  } else {
7708
- console.log("Form is submitted but handleResetPassword prop is missing");
7718
+ console.log("handleResetPassword prop is missing");
7709
7719
  }
7710
7720
  })
7711
7721
  }, /* @__PURE__ */ import_react43.default.createElement(CardContent, {
@@ -7713,33 +7723,31 @@ var ResetPasswordForm = function(props) {
7713
7723
  }, /* @__PURE__ */ import_react43.default.createElement(import_react_hook_form5.Controller, {
7714
7724
  control: control,
7715
7725
  name: "email",
7716
- render: function(param) /* @__PURE__ */ {
7726
+ render: function(param) {
7717
7727
  var field = param.field;
7718
7728
  var _props_texts, _formState_errors_email, _props_texts1;
7719
- var _field_value;
7720
- return import_react43.default.createElement(Input, _object_spread_props(_object_spread({
7729
+ return /* @__PURE__ */ import_react43.default.createElement(Input, _object_spread({
7721
7730
  width: "full",
7722
- type: "text",
7723
7731
  label: (_props_texts = props.texts) === null || _props_texts === void 0 ? void 0 : _props_texts.emailLabel,
7724
7732
  helperText: (_formState_errors_email = formState.errors.email) === null || _formState_errors_email === void 0 ? void 0 : _formState_errors_email.message,
7725
7733
  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
- }));
7734
+ }, field));
7729
7735
  }
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, {
7736
+ })), /* @__PURE__ */ import_react43.default.createElement(CardFooter, {
7737
+ className: "hawa-flex hawa-flex-col"
7738
+ }, /* @__PURE__ */ import_react43.default.createElement(Button, {
7736
7739
  type: "submit",
7737
7740
  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, {
7741
+ }, (_props_texts5 = props.texts) === null || _props_texts5 === void 0 ? void 0 : _props_texts5.resetPassword), props.allowRegister && /* @__PURE__ */ import_react43.default.createElement("div", {
7742
+ className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300"
7743
+ }, (_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", {
7744
+ className: "clickable-link",
7745
+ onClick: props.handleRouteToRegister
7746
+ }, (_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
7747
  headless: true
7740
7748
  }, /* @__PURE__ */ import_react43.default.createElement("div", {
7741
7749
  className: "hawa-text-center"
7742
- }, (_props_texts6 = props.texts) === null || _props_texts6 === void 0 ? void 0 : _props_texts6.emailSentText)));
7750
+ }, (_props_texts8 = props.texts) === null || _props_texts8 === void 0 ? void 0 : _props_texts8.emailSentText)));
7743
7751
  };
7744
7752
  // components/blocks/auth/CodeConfirmation.tsx
7745
7753
  var import_react44 = __toESM(require("react"));
package/dist/index.mjs CHANGED
@@ -1960,7 +1960,13 @@ var Alert = ({
1960
1960
  )
1961
1961
  },
1962
1962
  props.title
1963
- ), /* @__PURE__ */ React24.createElement("span", null, props.text), props.actions && /* @__PURE__ */ React24.createElement("div", { className: "hawa-mt-2 hawa-flex hawa-flex-row hawa-gap-2" }, props.actions.map((act, index) => /* @__PURE__ */ React24.createElement(
1963
+ ), /* @__PURE__ */ React24.createElement(
1964
+ "span",
1965
+ {
1966
+ className: clsx7(direction === "rtl" ? "hawa-ml-8" : "hawa-mr-8")
1967
+ },
1968
+ props.text
1969
+ ), props.actions && /* @__PURE__ */ React24.createElement("div", { className: "hawa-mt-2 hawa-flex hawa-flex-row hawa-gap-2" }, props.actions.map((act, index) => /* @__PURE__ */ React24.createElement(
1964
1970
  Button,
1965
1971
  {
1966
1972
  key: index,
@@ -7579,7 +7585,14 @@ var NewPasswordForm = ({ texts, ...props }) => {
7579
7585
  }
7580
7586
  )
7581
7587
  ),
7582
- /* @__PURE__ */ React62.createElement(CardFooter, null, /* @__PURE__ */ React62.createElement(Button, { className: "hawa-w-full", type: "submit" }, texts?.updatePassword))
7588
+ /* @__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(
7589
+ "span",
7590
+ {
7591
+ className: "clickable-link",
7592
+ onClick: props.handleRouteToRegister
7593
+ },
7594
+ texts?.registerText ?? "Register"
7595
+ )))
7583
7596
  ));
7584
7597
  };
7585
7598
 
@@ -7590,21 +7603,19 @@ import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
7590
7603
  import * as z4 from "zod";
7591
7604
  var ResetPasswordForm = (props) => {
7592
7605
  const formSchema = z4.object({
7593
- email: z4.string({ required_error: props.texts?.emailRequiredText }).email({ message: props.texts?.emailInvalidText }).nonempty({ message: props.texts?.emailRequiredText })
7606
+ email: z4.string({ required_error: props.texts?.emailRequired }).email({ message: props.texts?.emailInvalid }).min(1, { message: props.texts?.emailRequired })
7594
7607
  });
7595
7608
  const { handleSubmit, control, formState } = useForm4({
7596
7609
  resolver: zodResolver4(formSchema)
7597
7610
  });
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(
7611
+ 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
7612
  "form",
7600
7613
  {
7601
7614
  onSubmit: handleSubmit((e) => {
7602
7615
  if (props.handleResetPassword) {
7603
7616
  return props.handleResetPassword(e);
7604
7617
  } else {
7605
- console.log(
7606
- "Form is submitted but handleResetPassword prop is missing"
7607
- );
7618
+ console.log("handleResetPassword prop is missing");
7608
7619
  }
7609
7620
  })
7610
7621
  },
@@ -7617,24 +7628,22 @@ var ResetPasswordForm = (props) => {
7617
7628
  Input,
7618
7629
  {
7619
7630
  width: "full",
7620
- type: "text",
7621
7631
  label: props.texts?.emailLabel,
7622
7632
  helperText: formState.errors.email?.message,
7623
7633
  placeholder: props.texts?.emailPlaceholder,
7624
- ...field,
7625
- value: field.value ?? ""
7634
+ ...field
7626
7635
  }
7627
7636
  )
7628
7637
  }
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(
7638
+ )),
7639
+ /* @__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
7640
  "span",
7631
7641
  {
7632
- onClick: props.handleRouteToRegister,
7633
- className: "clickable-link"
7642
+ className: "clickable-link",
7643
+ onClick: props.handleRouteToRegister
7634
7644
  },
7635
7645
  props.texts?.registerText ?? "Register"
7636
- ))),
7637
- /* @__PURE__ */ React63.createElement(CardFooter, null, /* @__PURE__ */ React63.createElement(Button, { type: "submit", className: "hawa-w-full" }, props.texts?.resetPassword))
7646
+ )))
7638
7647
  )) : /* @__PURE__ */ React63.createElement(CardContent, { headless: true }, /* @__PURE__ */ React63.createElement("div", { className: "hawa-text-center" }, props.texts?.emailSentText)));
7639
7648
  };
7640
7649
 
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.28-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {