@sikka/hawa 0.27.12-next → 0.27.14-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.js CHANGED
@@ -9267,7 +9267,7 @@ var AuthButtons = (props) => {
9267
9267
 
9268
9268
  // blocks/auth/LoginForm.tsx
9269
9269
  var LoginForm = ({
9270
- loginType,
9270
+ loginType = "email",
9271
9271
  texts,
9272
9272
  passwordLength = 8,
9273
9273
  ...props
@@ -9286,33 +9286,45 @@ var LoginForm = ({
9286
9286
  let formSchema;
9287
9287
  if (loginType === "email") {
9288
9288
  formSchema = z.object({
9289
- email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
9290
- password: z.string({ required_error: (_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required }).min(1, { message: (_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required }).min(passwordLength, { message: (_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort })
9289
+ email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
9290
+ password: z.string({
9291
+ required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
9292
+ }).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
9293
+ message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
9294
+ })
9291
9295
  });
9292
9296
  } else if (loginType === "username") {
9293
9297
  formSchema = z.object({
9294
- username: z.string({ required_error: (_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required }).min(2, { message: (_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort }).refine(
9298
+ username: z.string({
9299
+ required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
9300
+ }).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
9295
9301
  (value) => {
9296
9302
  const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
9297
9303
  return isValid;
9298
9304
  },
9299
- { message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
9305
+ { message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
9300
9306
  ),
9301
- password: z.string({ required_error: (_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required }).min(1, { message: (_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required }).min(passwordLength, { message: (_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort })
9307
+ password: z.string({
9308
+ required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
9309
+ }).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
9310
+ message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
9311
+ })
9302
9312
  });
9303
9313
  } else if (loginType === "phone") {
9304
9314
  formSchema = z.object({
9305
- phone: z.string({ required_error: (_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required }).refine(
9315
+ phone: z.string({
9316
+ required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
9317
+ }).refine(
9306
9318
  (value) => {
9307
9319
  let phoneNumber = (0, import_libphonenumber_js.parsePhoneNumber)(value);
9308
9320
  return phoneNumber.isValid();
9309
9321
  },
9310
- { message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
9322
+ { message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
9311
9323
  )
9312
9324
  });
9313
9325
  } else if (loginType === "link") {
9314
9326
  formSchema = z.object({
9315
- email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
9327
+ email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
9316
9328
  });
9317
9329
  } else {
9318
9330
  formSchema = z.object({});
@@ -9339,7 +9351,7 @@ var LoginForm = ({
9339
9351
  dir: "ltr",
9340
9352
  width: "full",
9341
9353
  autoComplete: "email",
9342
- label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
9354
+ label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
9343
9355
  helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
9344
9356
  placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
9345
9357
  ...field
@@ -9376,7 +9388,7 @@ var LoginForm = ({
9376
9388
  );
9377
9389
  }
9378
9390
  }
9379
- ), !props.withoutResetPassword && /* @__PURE__ */ import_react46.default.createElement(
9391
+ ), props.withResetPassword && /* @__PURE__ */ import_react46.default.createElement(
9380
9392
  "div",
9381
9393
  {
9382
9394
  onClick: props.onForgotPassword,
@@ -9418,7 +9430,7 @@ var LoginForm = ({
9418
9430
  width: "full",
9419
9431
  autoComplete: "current-password",
9420
9432
  type: passwordVisible ? "text" : "password",
9421
- label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
9433
+ label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
9422
9434
  endIcon: /* @__PURE__ */ import_react46.default.createElement(
9423
9435
  "div",
9424
9436
  {
@@ -9434,7 +9446,7 @@ var LoginForm = ({
9434
9446
  );
9435
9447
  }
9436
9448
  }
9437
- ), !props.withoutResetPassword && /* @__PURE__ */ import_react46.default.createElement(
9449
+ ), props.withResetPassword && /* @__PURE__ */ import_react46.default.createElement(
9438
9450
  "div",
9439
9451
  {
9440
9452
  onClick: props.onForgotPassword,
@@ -9453,7 +9465,7 @@ var LoginForm = ({
9453
9465
  return /* @__PURE__ */ import_react46.default.createElement(
9454
9466
  PhoneInput,
9455
9467
  {
9456
- label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
9468
+ label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
9457
9469
  helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
9458
9470
  preferredCountry: { label: "+966" },
9459
9471
  handleChange: (e) => field.onChange((0, import_libphonenumber_js.parsePhoneNumber)(e).number)
@@ -9562,6 +9574,8 @@ var z2 = __toESM(require("zod"));
9562
9574
  var RegisterForm = ({
9563
9575
  texts,
9564
9576
  registerFields = ["email"],
9577
+ showTermsOption = false,
9578
+ showNewsletterOption = false,
9565
9579
  ...props
9566
9580
  }) => {
9567
9581
  var _a, _b, _c, _d, _e, _f;
@@ -9584,26 +9598,38 @@ var RegisterForm = ({
9584
9598
  fieldSchemas["fullName"] = z2.string().optional();
9585
9599
  break;
9586
9600
  case "email":
9587
- fieldSchemas["email"] = z2.string({ required_error: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required }).email({ message: (_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid }).min(1, { message: (_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required });
9601
+ fieldSchemas["email"] = z2.string({
9602
+ required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
9603
+ }).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
9588
9604
  break;
9589
9605
  case "username":
9590
- fieldSchemas["username"] = z2.string({ required_error: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required }).min(1, { message: (_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required }).refine(
9606
+ fieldSchemas["username"] = z2.string({
9607
+ required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
9608
+ }).min(1, {
9609
+ message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
9610
+ }).refine(
9591
9611
  (value) => {
9592
9612
  const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
9593
9613
  return isValid;
9594
9614
  },
9595
- { message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
9615
+ { message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
9596
9616
  );
9597
9617
  break;
9598
9618
  }
9599
9619
  });
9600
9620
  const formSchema = z2.object({
9601
9621
  ...fieldSchemas,
9602
- password: z2.string({ required_error: (_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required }).min(5, { message: (_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort }).refine((value) => value !== "", {
9603
- message: (_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required
9622
+ password: z2.string({
9623
+ required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
9624
+ }).min(5, {
9625
+ message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
9626
+ }).refine((value) => value !== "", {
9627
+ message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
9604
9628
  }),
9605
- confirm_password: z2.string({ required_error: (_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required }).refine((value) => value !== "", {
9606
- message: (_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required
9629
+ confirm_password: z2.string({
9630
+ required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
9631
+ }).refine((value) => value !== "", {
9632
+ message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
9607
9633
  }),
9608
9634
  refCode: z2.string().optional(),
9609
9635
  reference: z2.string().optional(),
@@ -9652,7 +9678,7 @@ var RegisterForm = ({
9652
9678
  Input,
9653
9679
  {
9654
9680
  width: "full",
9655
- label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
9681
+ label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
9656
9682
  placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
9657
9683
  helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
9658
9684
  ...field
@@ -9680,7 +9706,7 @@ var RegisterForm = ({
9680
9706
  },
9681
9707
  width: "full",
9682
9708
  autoComplete: "email",
9683
- label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
9709
+ label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
9684
9710
  helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
9685
9711
  placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
9686
9712
  ...field
@@ -9704,7 +9730,7 @@ var RegisterForm = ({
9704
9730
  {
9705
9731
  width: "full",
9706
9732
  autoComplete: "username",
9707
- label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
9733
+ label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
9708
9734
  labelProps: {
9709
9735
  ...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
9710
9736
  },
@@ -9740,7 +9766,7 @@ var RegisterForm = ({
9740
9766
  " "
9741
9767
  ),
9742
9768
  autoComplete: "new-password",
9743
- label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
9769
+ label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
9744
9770
  placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
9745
9771
  helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
9746
9772
  ...field
@@ -9762,7 +9788,7 @@ var RegisterForm = ({
9762
9788
  width: "full",
9763
9789
  type: "password",
9764
9790
  autoComplete: "new-password",
9765
- label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
9791
+ label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
9766
9792
  placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
9767
9793
  helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
9768
9794
  ...field
@@ -9817,7 +9843,7 @@ var RegisterForm = ({
9817
9843
  }
9818
9844
  }
9819
9845
  ),
9820
- /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, props.showTermsOption && /* @__PURE__ */ import_react47.default.createElement(
9846
+ /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ import_react47.default.createElement(
9821
9847
  import_react_hook_form2.Controller,
9822
9848
  {
9823
9849
  control,
@@ -9830,19 +9856,19 @@ var RegisterForm = ({
9830
9856
  id: "terms_accepted",
9831
9857
  helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
9832
9858
  onCheckedChange: (e) => field.onChange(e),
9833
- label: /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react47.default.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ import_react47.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react47.default.createElement(
9859
+ label: /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ import_react47.default.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ import_react47.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react47.default.createElement(
9834
9860
  "a",
9835
9861
  {
9836
9862
  onClick: props.onRouteToTOS,
9837
9863
  className: "clickable-link"
9838
9864
  },
9839
- texts == null ? void 0 : texts.termsText
9865
+ (texts == null ? void 0 : texts.termsText) || "Terms of Service"
9840
9866
  )))
9841
9867
  }
9842
9868
  );
9843
9869
  }
9844
9870
  }
9845
- ), props.showNewsletterOption && /* @__PURE__ */ import_react47.default.createElement(
9871
+ ), showNewsletterOption && /* @__PURE__ */ import_react47.default.createElement(
9846
9872
  import_react_hook_form2.Controller,
9847
9873
  {
9848
9874
  control,
@@ -9868,7 +9894,7 @@ var RegisterForm = ({
9868
9894
  (texts == null ? void 0 : texts.registerText) || "Register"
9869
9895
  ),
9870
9896
  props.additionalButtons
9871
- )), /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react47.default.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ import_react47.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react47.default.createElement(
9897
+ )), /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react47.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react47.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react47.default.createElement(
9872
9898
  CardFooter,
9873
9899
  {
9874
9900
  className: cn(
package/dist/index.mjs CHANGED
@@ -9049,7 +9049,7 @@ var AuthButtons = (props) => {
9049
9049
 
9050
9050
  // blocks/auth/LoginForm.tsx
9051
9051
  var LoginForm = ({
9052
- loginType,
9052
+ loginType = "email",
9053
9053
  texts,
9054
9054
  passwordLength = 8,
9055
9055
  ...props
@@ -9068,33 +9068,45 @@ var LoginForm = ({
9068
9068
  let formSchema;
9069
9069
  if (loginType === "email") {
9070
9070
  formSchema = z.object({
9071
- email: z.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }),
9072
- password: z.string({ required_error: (_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required }).min(1, { message: (_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required }).min(passwordLength, { message: (_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort })
9071
+ email: z.string({ required_error: ((_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required) || "Email Required" }).min(1, { message: ((_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required) || "Email Required" }).email({ message: ((_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid) || "Email Invalid" }),
9072
+ password: z.string({
9073
+ required_error: ((_d = texts == null ? void 0 : texts.password) == null ? void 0 : _d.required) || "Password Required"
9074
+ }).min(1, { message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password Required" }).min(passwordLength, {
9075
+ message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password too short"
9076
+ })
9073
9077
  });
9074
9078
  } else if (loginType === "username") {
9075
9079
  formSchema = z.object({
9076
- username: z.string({ required_error: (_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required }).min(2, { message: (_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort }).refine(
9080
+ username: z.string({
9081
+ required_error: ((_g = texts == null ? void 0 : texts.username) == null ? void 0 : _g.required) || "Username Required"
9082
+ }).min(2, { message: ((_h = texts == null ? void 0 : texts.username) == null ? void 0 : _h.tooShort) || "Username too short" }).refine(
9077
9083
  (value) => {
9078
9084
  const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
9079
9085
  return isValid;
9080
9086
  },
9081
- { message: (_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid }
9087
+ { message: ((_i = texts == null ? void 0 : texts.username) == null ? void 0 : _i.invalid) || "Username Invalid" }
9082
9088
  ),
9083
- password: z.string({ required_error: (_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required }).min(1, { message: (_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required }).min(passwordLength, { message: (_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort })
9089
+ password: z.string({
9090
+ required_error: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Password Required"
9091
+ }).min(1, { message: ((_k = texts == null ? void 0 : texts.password) == null ? void 0 : _k.required) || "Password Required" }).min(passwordLength, {
9092
+ message: ((_l = texts == null ? void 0 : texts.password) == null ? void 0 : _l.tooShort) || "Password too short"
9093
+ })
9084
9094
  });
9085
9095
  } else if (loginType === "phone") {
9086
9096
  formSchema = z.object({
9087
- phone: z.string({ required_error: (_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required }).refine(
9097
+ phone: z.string({
9098
+ required_error: ((_m = texts == null ? void 0 : texts.phone) == null ? void 0 : _m.required) || "Phone Number Required"
9099
+ }).refine(
9088
9100
  (value) => {
9089
9101
  let phoneNumber = parsePhoneNumber(value);
9090
9102
  return phoneNumber.isValid();
9091
9103
  },
9092
- { message: (_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid }
9104
+ { message: ((_n = texts == null ? void 0 : texts.phone) == null ? void 0 : _n.invalid) || "Phone Number Invalid" }
9093
9105
  )
9094
9106
  });
9095
9107
  } else if (loginType === "link") {
9096
9108
  formSchema = z.object({
9097
- email: z.string({ required_error: (_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required }).min(1, { message: (_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required }).email({ message: (_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid })
9109
+ email: z.string({ required_error: ((_o = texts == null ? void 0 : texts.email) == null ? void 0 : _o.required) || "Email Required" }).min(1, { message: ((_p = texts == null ? void 0 : texts.email) == null ? void 0 : _p.required) || "Email Required" }).email({ message: ((_q = texts == null ? void 0 : texts.email) == null ? void 0 : _q.invalid) || "Email Invalid" })
9098
9110
  });
9099
9111
  } else {
9100
9112
  formSchema = z.object({});
@@ -9121,7 +9133,7 @@ var LoginForm = ({
9121
9133
  dir: "ltr",
9122
9134
  width: "full",
9123
9135
  autoComplete: "email",
9124
- label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
9136
+ label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
9125
9137
  helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
9126
9138
  placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "contact@sikka.io",
9127
9139
  ...field
@@ -9158,7 +9170,7 @@ var LoginForm = ({
9158
9170
  );
9159
9171
  }
9160
9172
  }
9161
- ), !props.withoutResetPassword && /* @__PURE__ */ React73.createElement(
9173
+ ), props.withResetPassword && /* @__PURE__ */ React73.createElement(
9162
9174
  "div",
9163
9175
  {
9164
9176
  onClick: props.onForgotPassword,
@@ -9200,7 +9212,7 @@ var LoginForm = ({
9200
9212
  width: "full",
9201
9213
  autoComplete: "current-password",
9202
9214
  type: passwordVisible ? "text" : "password",
9203
- label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
9215
+ label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
9204
9216
  endIcon: /* @__PURE__ */ React73.createElement(
9205
9217
  "div",
9206
9218
  {
@@ -9216,7 +9228,7 @@ var LoginForm = ({
9216
9228
  );
9217
9229
  }
9218
9230
  }
9219
- ), !props.withoutResetPassword && /* @__PURE__ */ React73.createElement(
9231
+ ), props.withResetPassword && /* @__PURE__ */ React73.createElement(
9220
9232
  "div",
9221
9233
  {
9222
9234
  onClick: props.onForgotPassword,
@@ -9235,7 +9247,7 @@ var LoginForm = ({
9235
9247
  return /* @__PURE__ */ React73.createElement(
9236
9248
  PhoneInput,
9237
9249
  {
9238
- label: (_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label,
9250
+ label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
9239
9251
  helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
9240
9252
  preferredCountry: { label: "+966" },
9241
9253
  handleChange: (e) => field.onChange(parsePhoneNumber(e).number)
@@ -9344,6 +9356,8 @@ import * as z2 from "zod";
9344
9356
  var RegisterForm = ({
9345
9357
  texts,
9346
9358
  registerFields = ["email"],
9359
+ showTermsOption = false,
9360
+ showNewsletterOption = false,
9347
9361
  ...props
9348
9362
  }) => {
9349
9363
  var _a, _b, _c, _d, _e, _f;
@@ -9366,26 +9380,38 @@ var RegisterForm = ({
9366
9380
  fieldSchemas["fullName"] = z2.string().optional();
9367
9381
  break;
9368
9382
  case "email":
9369
- fieldSchemas["email"] = z2.string({ required_error: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required }).email({ message: (_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid }).min(1, { message: (_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required });
9383
+ fieldSchemas["email"] = z2.string({
9384
+ required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
9385
+ }).email({ message: ((_b2 = texts == null ? void 0 : texts.email) == null ? void 0 : _b2.invalid) || "Invalid email" }).min(1, { message: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.required) || "Email is required" });
9370
9386
  break;
9371
9387
  case "username":
9372
- fieldSchemas["username"] = z2.string({ required_error: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required }).min(1, { message: (_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required }).refine(
9388
+ fieldSchemas["username"] = z2.string({
9389
+ required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
9390
+ }).min(1, {
9391
+ message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
9392
+ }).refine(
9373
9393
  (value) => {
9374
9394
  const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
9375
9395
  return isValid;
9376
9396
  },
9377
- { message: (_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid }
9397
+ { message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.invalid) || "Invalid username" }
9378
9398
  );
9379
9399
  break;
9380
9400
  }
9381
9401
  });
9382
9402
  const formSchema = z2.object({
9383
9403
  ...fieldSchemas,
9384
- password: z2.string({ required_error: (_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required }).min(5, { message: (_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort }).refine((value) => value !== "", {
9385
- message: (_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required
9404
+ password: z2.string({
9405
+ required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
9406
+ }).min(5, {
9407
+ message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
9408
+ }).refine((value) => value !== "", {
9409
+ message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
9386
9410
  }),
9387
- confirm_password: z2.string({ required_error: (_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required }).refine((value) => value !== "", {
9388
- message: (_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required
9411
+ confirm_password: z2.string({
9412
+ required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
9413
+ }).refine((value) => value !== "", {
9414
+ message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Confirm password is required"
9389
9415
  }),
9390
9416
  refCode: z2.string().optional(),
9391
9417
  reference: z2.string().optional(),
@@ -9434,7 +9460,7 @@ var RegisterForm = ({
9434
9460
  Input,
9435
9461
  {
9436
9462
  width: "full",
9437
- label: (_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label,
9463
+ label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
9438
9464
  placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
9439
9465
  helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
9440
9466
  ...field
@@ -9462,7 +9488,7 @@ var RegisterForm = ({
9462
9488
  },
9463
9489
  width: "full",
9464
9490
  autoComplete: "email",
9465
- label: (_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label,
9491
+ label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
9466
9492
  helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
9467
9493
  placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
9468
9494
  ...field
@@ -9486,7 +9512,7 @@ var RegisterForm = ({
9486
9512
  {
9487
9513
  width: "full",
9488
9514
  autoComplete: "username",
9489
- label: (_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label,
9515
+ label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
9490
9516
  labelProps: {
9491
9517
  ...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
9492
9518
  },
@@ -9522,7 +9548,7 @@ var RegisterForm = ({
9522
9548
  " "
9523
9549
  ),
9524
9550
  autoComplete: "new-password",
9525
- label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
9551
+ label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
9526
9552
  placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
9527
9553
  helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
9528
9554
  ...field
@@ -9544,7 +9570,7 @@ var RegisterForm = ({
9544
9570
  width: "full",
9545
9571
  type: "password",
9546
9572
  autoComplete: "new-password",
9547
- label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
9573
+ label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
9548
9574
  placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
9549
9575
  helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
9550
9576
  ...field
@@ -9599,7 +9625,7 @@ var RegisterForm = ({
9599
9625
  }
9600
9626
  }
9601
9627
  ),
9602
- /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, props.showTermsOption && /* @__PURE__ */ React74.createElement(
9628
+ /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3" }, showTermsOption && /* @__PURE__ */ React74.createElement(
9603
9629
  Controller2,
9604
9630
  {
9605
9631
  control,
@@ -9612,19 +9638,19 @@ var RegisterForm = ({
9612
9638
  id: "terms_accepted",
9613
9639
  helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
9614
9640
  onCheckedChange: (e) => field.onChange(e),
9615
- label: /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React74.createElement("span", null, texts == null ? void 0 : texts.iAcceptText), " ", /* @__PURE__ */ React74.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React74.createElement(
9641
+ label: /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5" }, /* @__PURE__ */ React74.createElement("span", null, (texts == null ? void 0 : texts.iAcceptText) || "I accept the "), " ", /* @__PURE__ */ React74.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React74.createElement(
9616
9642
  "a",
9617
9643
  {
9618
9644
  onClick: props.onRouteToTOS,
9619
9645
  className: "clickable-link"
9620
9646
  },
9621
- texts == null ? void 0 : texts.termsText
9647
+ (texts == null ? void 0 : texts.termsText) || "Terms of Service"
9622
9648
  )))
9623
9649
  }
9624
9650
  );
9625
9651
  }
9626
9652
  }
9627
- ), props.showNewsletterOption && /* @__PURE__ */ React74.createElement(
9653
+ ), showNewsletterOption && /* @__PURE__ */ React74.createElement(
9628
9654
  Controller2,
9629
9655
  {
9630
9656
  control,
@@ -9650,7 +9676,7 @@ var RegisterForm = ({
9650
9676
  (texts == null ? void 0 : texts.registerText) || "Register"
9651
9677
  ),
9652
9678
  props.additionalButtons
9653
- )), /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React74.createElement("span", null, texts == null ? void 0 : texts.existingUserText), /* @__PURE__ */ React74.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React74.createElement(
9679
+ )), /* @__PURE__ */ React74.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React74.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React74.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))), props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React74.createElement(
9654
9680
  CardFooter,
9655
9681
  {
9656
9682
  className: cn(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.27.12-next",
3
+ "version": "0.27.14-next",
4
4
  "description": "Modern UI Kit made with Tailwind",
5
5
  "author": {
6
6
  "name": "Sikka Software",
@@ -65,9 +65,9 @@
65
65
  "@tanstack/table-core": "^8.11.7",
66
66
  "class-variance-authority": "^0.7.0",
67
67
  "clsx": "^2.1.0",
68
- "cmdk": "^0.2.0",
69
- "embla-carousel-auto-height": "^8.0.0-rc20",
70
- "embla-carousel-react": "^8.0.0-rc20",
68
+ "cmdk": "^0.2.1",
69
+ "embla-carousel-auto-height": "^8.0.0-rc22",
70
+ "embla-carousel-react": "^8.0.0-rc22",
71
71
  "eslint": "^8.56.0",
72
72
  "eslint-config-next": "^14.1.0",
73
73
  "libphonenumber-js": "^1.10.54",
@@ -77,7 +77,7 @@
77
77
  "react-dom": "18.2.0",
78
78
  "react-dropzone": "^14.2.3",
79
79
  "react-headless-pagination": "^1.1.5",
80
- "react-hook-form": "^7.49.3",
80
+ "react-hook-form": "^7.50.0",
81
81
  "react-select": "^5.8.0",
82
82
  "signature_pad": "^4.1.7",
83
83
  "tailwind-merge": "^2.2.1",
@@ -87,16 +87,16 @@
87
87
  "devDependencies": {
88
88
  "@babel/preset-react": "^7.23.3",
89
89
  "@sikka/alam": "^0.0.4",
90
- "@testing-library/jest-dom": "^6.3.0",
91
- "@testing-library/react": "^14.1.2",
92
- "@types/jest": "^29.5.11",
93
- "@types/react": "^18.2.48",
90
+ "@testing-library/jest-dom": "^6.4.1",
91
+ "@testing-library/react": "^14.2.1",
92
+ "@types/jest": "^29.5.12",
93
+ "@types/react": "^18.2.51",
94
94
  "@types/react-dom": "^18.2.18",
95
95
  "autoprefixer": "^10.4.17",
96
- "embla-carousel": "8.0.0-rc20",
96
+ "embla-carousel": "8.0.0-rc22",
97
97
  "jest": "^29.7.0",
98
98
  "jest-environment-jsdom": "^29.7.0",
99
- "lucide-react": "^0.314.0",
99
+ "lucide-react": "^0.321.0",
100
100
  "postcss": "^8.4.33",
101
101
  "postcss-cli": "^11.0.0",
102
102
  "postcss-import": "^16.0.0",