@sikka/hawa 0.48.0-next → 0.48.1-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.
@@ -4638,385 +4638,398 @@ var RegisterForm = ({
4638
4638
  headless: registerTypes ? registerTypes.length <= 1 : true,
4639
4639
  noPadding: props.cardless
4640
4640
  },
4641
- /* @__PURE__ */ import_react37.default.createElement("div", null, props.showError && /* @__PURE__ */ import_react37.default.createElement(
4642
- Alert,
4641
+ /* @__PURE__ */ import_react37.default.createElement(
4642
+ "div",
4643
4643
  {
4644
- direction: props.direction,
4645
- title: props.errorTitle,
4646
- text: props.errorText,
4647
- severity: "error",
4648
- onAlertClosed: () => {
4649
- if (props.onErrorDismissed) {
4650
- props.onErrorDismissed();
4644
+ className: cn(registerTypes && registerTypes.length > 1 ? "hawa-mt-6 hawa-mb-0" : "")
4645
+ },
4646
+ props.showError && /* @__PURE__ */ import_react37.default.createElement(
4647
+ Alert,
4648
+ {
4649
+ direction: props.direction,
4650
+ title: props.errorTitle,
4651
+ text: props.errorText,
4652
+ severity: "error",
4653
+ onAlertClosed: () => {
4654
+ if (props.onErrorDismissed) {
4655
+ props.onErrorDismissed();
4656
+ }
4651
4657
  }
4652
4658
  }
4653
- }
4654
- ), /* @__PURE__ */ import_react37.default.createElement(import_react_hook_form2.FormProvider, { ...methods }, /* @__PURE__ */ import_react37.default.createElement(
4655
- "form",
4656
- {
4657
- noValidate: true,
4658
- onSubmit: handleSubmit((e) => {
4659
- if (props.onRegister) {
4660
- return props.onRegister(e);
4661
- } else {
4662
- console.log("Form is submitted but onRegister prop is missing");
4663
- }
4664
- }),
4665
- className: "hawa-flex hawa-flex-col hawa-gap-4"
4666
- },
4667
- /* @__PURE__ */ import_react37.default.createElement(
4668
- Tabs,
4659
+ ),
4660
+ /* @__PURE__ */ import_react37.default.createElement(import_react_hook_form2.FormProvider, { ...methods }, /* @__PURE__ */ import_react37.default.createElement(
4661
+ "form",
4669
4662
  {
4670
- dir: props.direction,
4671
- value: selectedRegisterType.value,
4672
- onValueChange: (e) => setSelectedRegisterType(
4673
- (registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
4674
- label: "Password",
4675
- value: "password"
4663
+ noValidate: true,
4664
+ onSubmit: handleSubmit((e) => {
4665
+ if (props.onRegister) {
4666
+ return props.onRegister(e);
4667
+ } else {
4668
+ console.log("Form is submitted but onRegister prop is missing");
4676
4669
  }
4677
- )
4670
+ }),
4671
+ className: "hawa-flex hawa-flex-col hawa-gap-4"
4678
4672
  },
4679
- registerTypes && registerTypes.length > 1 && /* @__PURE__ */ import_react37.default.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-my-4 hawa-mt-6" }, /* @__PURE__ */ import_react37.default.createElement(TabsList, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ import_react37.default.createElement(TabsTrigger, { value: registerType.value }, registerType.label)))),
4680
4673
  /* @__PURE__ */ import_react37.default.createElement(
4681
- TabsContent,
4674
+ Tabs,
4682
4675
  {
4683
- value: "password",
4684
- className: cn(
4685
- "hawa-flex hawa-flex-col hawa-gap-4",
4686
- selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
4687
- ),
4688
- dir: props.direction
4689
- },
4690
- /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
4691
- if (fld === "fullname") {
4692
- return /* @__PURE__ */ import_react37.default.createElement(
4693
- import_react_hook_form2.Controller,
4694
- {
4695
- key: i,
4696
- control,
4697
- name: "fullName",
4698
- render: ({ field }) => {
4699
- var _a2, _b2, _c2;
4700
- return /* @__PURE__ */ import_react37.default.createElement(
4701
- Input,
4702
- {
4703
- width: "full",
4704
- label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
4705
- placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
4706
- helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
4707
- ...field
4708
- }
4709
- );
4710
- }
4711
- }
4712
- );
4713
- }
4714
- if (fld === "email") {
4715
- return /* @__PURE__ */ import_react37.default.createElement(
4716
- import_react_hook_form2.Controller,
4717
- {
4718
- key: i,
4719
- control,
4720
- name: "email",
4721
- render: ({ field }) => {
4722
- var _a2, _b2, _c2;
4723
- return /* @__PURE__ */ import_react37.default.createElement(
4724
- Input,
4725
- {
4726
- dir: "ltr",
4727
- inputProps: {
4728
- className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
4729
- },
4730
- width: "full",
4731
- autoComplete: "email",
4732
- label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
4733
- helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
4734
- placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
4735
- ...field,
4736
- onChange: (e) => {
4737
- field.onChange(e.target.value.toLowerCase().trim());
4738
- }
4739
- }
4740
- );
4741
- }
4742
- }
4743
- );
4744
- }
4745
- if (fld === "username") {
4746
- return /* @__PURE__ */ import_react37.default.createElement(
4747
- import_react_hook_form2.Controller,
4748
- {
4749
- key: i,
4750
- control,
4751
- name: "username",
4752
- render: ({ field }) => {
4753
- var _a2, _b2, _c2, _d2;
4754
- return /* @__PURE__ */ import_react37.default.createElement(
4755
- Input,
4756
- {
4757
- width: "full",
4758
- autoComplete: "username",
4759
- label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
4760
- labelProps: {
4761
- ...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
4762
- },
4763
- helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
4764
- placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
4765
- ...field
4766
- }
4767
- );
4768
- }
4676
+ dir: props.direction,
4677
+ value: selectedRegisterType.value,
4678
+ onValueChange: (e) => {
4679
+ if (props.onRegisterTypeChange) {
4680
+ props.onRegisterTypeChange(e);
4681
+ }
4682
+ setSelectedRegisterType(
4683
+ (registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
4684
+ label: "Password",
4685
+ value: "password"
4769
4686
  }
4770
4687
  );
4771
4688
  }
4772
- })),
4689
+ },
4690
+ registerTypes && registerTypes.length > 1 && /* @__PURE__ */ import_react37.default.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-mb-4" }, /* @__PURE__ */ import_react37.default.createElement(TabsList, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ import_react37.default.createElement(TabsTrigger, { value: registerType.value }, registerType.label)))),
4773
4691
  /* @__PURE__ */ import_react37.default.createElement(
4774
- import_react_hook_form2.Controller,
4692
+ TabsContent,
4775
4693
  {
4776
- control,
4777
- name: "password",
4778
- render: ({ field }) => {
4779
- var _a2, _b2, _c2;
4694
+ value: "password",
4695
+ className: cn(
4696
+ "hawa-flex hawa-flex-col hawa-gap-4",
4697
+ selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
4698
+ ),
4699
+ dir: props.direction
4700
+ },
4701
+ /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
4702
+ if (fld === "fullname") {
4780
4703
  return /* @__PURE__ */ import_react37.default.createElement(
4781
- Input,
4704
+ import_react_hook_form2.Controller,
4782
4705
  {
4783
- width: "full",
4784
- type: passwordVisible ? "text" : "password",
4785
- autoComplete: "new-password",
4786
- label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
4787
- placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
4788
- helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
4789
- endIcon: /* @__PURE__ */ import_react37.default.createElement(
4790
- "div",
4791
- {
4792
- className: "hawa-cursor-pointer",
4793
- onClick: () => setPasswordVisible(!passwordVisible)
4794
- },
4795
- passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
4796
- " "
4797
- ),
4798
- ...field
4706
+ key: i,
4707
+ control,
4708
+ name: "fullName",
4709
+ render: ({ field }) => {
4710
+ var _a2, _b2, _c2;
4711
+ return /* @__PURE__ */ import_react37.default.createElement(
4712
+ Input,
4713
+ {
4714
+ width: "full",
4715
+ label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
4716
+ placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
4717
+ helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
4718
+ ...field
4719
+ }
4720
+ );
4721
+ }
4799
4722
  }
4800
4723
  );
4801
4724
  }
4802
- }
4803
- ),
4804
- /* @__PURE__ */ import_react37.default.createElement(
4805
- import_react_hook_form2.Controller,
4806
- {
4807
- control,
4808
- name: "confirm_password",
4809
- render: ({ field }) => {
4810
- var _a2, _b2, _c2;
4725
+ if (fld === "email") {
4811
4726
  return /* @__PURE__ */ import_react37.default.createElement(
4812
- Input,
4727
+ import_react_hook_form2.Controller,
4813
4728
  {
4814
- width: "full",
4815
- type: passwordVisible ? "text" : "password",
4816
- autoComplete: "new-password",
4817
- label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
4818
- placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
4819
- helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
4820
- endIcon: /* @__PURE__ */ import_react37.default.createElement(
4821
- "div",
4822
- {
4823
- className: "hawa-cursor-pointer",
4824
- onClick: () => setPasswordVisible(!passwordVisible)
4825
- },
4826
- passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
4827
- " "
4828
- ),
4829
- ...field
4729
+ key: i,
4730
+ control,
4731
+ name: "email",
4732
+ render: ({ field }) => {
4733
+ var _a2, _b2, _c2;
4734
+ return /* @__PURE__ */ import_react37.default.createElement(
4735
+ Input,
4736
+ {
4737
+ dir: "ltr",
4738
+ inputProps: {
4739
+ className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
4740
+ },
4741
+ width: "full",
4742
+ autoComplete: "email",
4743
+ label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
4744
+ helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
4745
+ placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
4746
+ ...field,
4747
+ onChange: (e) => {
4748
+ field.onChange(e.target.value.toLowerCase().trim());
4749
+ }
4750
+ }
4751
+ );
4752
+ }
4830
4753
  }
4831
4754
  );
4832
4755
  }
4833
- }
4834
- ),
4835
- props.additionalInputs,
4836
- props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
4837
- import_react_hook_form2.Controller,
4838
- {
4839
- control,
4840
- name: "refCode",
4841
- render: ({ field }) => {
4842
- var _a2;
4756
+ if (fld === "username") {
4843
4757
  return /* @__PURE__ */ import_react37.default.createElement(
4844
- Input,
4758
+ import_react_hook_form2.Controller,
4845
4759
  {
4846
- width: "full",
4847
- label: texts == null ? void 0 : texts.refCode,
4848
- placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
4849
- helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
4850
- ...field
4760
+ key: i,
4761
+ control,
4762
+ name: "username",
4763
+ render: ({ field }) => {
4764
+ var _a2, _b2, _c2, _d2;
4765
+ return /* @__PURE__ */ import_react37.default.createElement(
4766
+ Input,
4767
+ {
4768
+ width: "full",
4769
+ autoComplete: "username",
4770
+ label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
4771
+ labelProps: {
4772
+ ...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
4773
+ },
4774
+ helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
4775
+ placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
4776
+ ...field
4777
+ }
4778
+ );
4779
+ }
4851
4780
  }
4852
4781
  );
4853
4782
  }
4854
- }
4855
- ),
4856
- props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
4857
- import_react_hook_form2.Controller,
4858
- {
4859
- control,
4860
- name: "reference",
4861
- render: ({ field }) => {
4862
- var _a2, _b2;
4863
- return /* @__PURE__ */ import_react37.default.createElement(
4864
- Select,
4865
- {
4866
- label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
4867
- placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
4868
- isCreatable: false,
4869
- isMulti: false,
4870
- isSearchable: false,
4871
- isClearable: false,
4872
- options: props.userReferenceOptions || [],
4873
- onChange: (e) => field.onChange(e)
4874
- }
4875
- );
4783
+ })),
4784
+ /* @__PURE__ */ import_react37.default.createElement(
4785
+ import_react_hook_form2.Controller,
4786
+ {
4787
+ control,
4788
+ name: "password",
4789
+ render: ({ field }) => {
4790
+ var _a2, _b2, _c2;
4791
+ return /* @__PURE__ */ import_react37.default.createElement(
4792
+ Input,
4793
+ {
4794
+ width: "full",
4795
+ type: passwordVisible ? "text" : "password",
4796
+ autoComplete: "new-password",
4797
+ label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
4798
+ placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
4799
+ helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
4800
+ endIcon: /* @__PURE__ */ import_react37.default.createElement(
4801
+ "div",
4802
+ {
4803
+ className: "hawa-cursor-pointer",
4804
+ onClick: () => setPasswordVisible(!passwordVisible)
4805
+ },
4806
+ passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
4807
+ " "
4808
+ ),
4809
+ ...field
4810
+ }
4811
+ );
4812
+ }
4876
4813
  }
4877
- }
4878
- )
4879
- ),
4880
- /* @__PURE__ */ import_react37.default.createElement(
4881
- TabsContent,
4882
- {
4883
- value: "phone",
4884
- className: cn(
4885
- "hawa-flex hawa-flex-col hawa-gap-4",
4886
- selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
4887
4814
  ),
4888
- dir: props.direction
4889
- },
4815
+ /* @__PURE__ */ import_react37.default.createElement(
4816
+ import_react_hook_form2.Controller,
4817
+ {
4818
+ control,
4819
+ name: "confirm_password",
4820
+ render: ({ field }) => {
4821
+ var _a2, _b2, _c2;
4822
+ return /* @__PURE__ */ import_react37.default.createElement(
4823
+ Input,
4824
+ {
4825
+ width: "full",
4826
+ type: passwordVisible ? "text" : "password",
4827
+ autoComplete: "new-password",
4828
+ label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
4829
+ placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
4830
+ helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
4831
+ endIcon: /* @__PURE__ */ import_react37.default.createElement(
4832
+ "div",
4833
+ {
4834
+ className: "hawa-cursor-pointer",
4835
+ onClick: () => setPasswordVisible(!passwordVisible)
4836
+ },
4837
+ passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
4838
+ " "
4839
+ ),
4840
+ ...field
4841
+ }
4842
+ );
4843
+ }
4844
+ }
4845
+ ),
4846
+ props.additionalInputs,
4847
+ props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
4848
+ import_react_hook_form2.Controller,
4849
+ {
4850
+ control,
4851
+ name: "refCode",
4852
+ render: ({ field }) => {
4853
+ var _a2;
4854
+ return /* @__PURE__ */ import_react37.default.createElement(
4855
+ Input,
4856
+ {
4857
+ width: "full",
4858
+ label: texts == null ? void 0 : texts.refCode,
4859
+ placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
4860
+ helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
4861
+ ...field
4862
+ }
4863
+ );
4864
+ }
4865
+ }
4866
+ ),
4867
+ props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
4868
+ import_react_hook_form2.Controller,
4869
+ {
4870
+ control,
4871
+ name: "reference",
4872
+ render: ({ field }) => {
4873
+ var _a2, _b2;
4874
+ return /* @__PURE__ */ import_react37.default.createElement(
4875
+ Select,
4876
+ {
4877
+ label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
4878
+ placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
4879
+ isCreatable: false,
4880
+ isMulti: false,
4881
+ isSearchable: false,
4882
+ isClearable: false,
4883
+ options: props.userReferenceOptions || [],
4884
+ onChange: (e) => field.onChange(e)
4885
+ }
4886
+ );
4887
+ }
4888
+ }
4889
+ )
4890
+ ),
4890
4891
  /* @__PURE__ */ import_react37.default.createElement(
4891
- import_react_hook_form2.Controller,
4892
+ TabsContent,
4892
4893
  {
4893
- control,
4894
- name: "phone",
4895
- render: ({ field }) => {
4896
- var _a2, _b2;
4897
- return /* @__PURE__ */ import_react37.default.createElement(
4898
- PhoneInput,
4899
- {
4900
- label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
4901
- helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
4902
- preferredCountry: { label: "+966" },
4903
- ...props.phoneInputProps,
4904
- handleChange: (e) => {
4905
- if ((0, import_libphonenumber_js2.isValidPhoneNumber)(e) && (0, import_libphonenumber_js2.isPossiblePhoneNumber)(e) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(e) === void 0) {
4906
- let parsed = (0, import_libphonenumber_js2.parsePhoneNumber)(e);
4907
- field.onChange(parsed.number);
4908
- } else {
4909
- field.onChange(e);
4894
+ value: "phone",
4895
+ className: cn(
4896
+ "hawa-flex hawa-flex-col hawa-gap-4",
4897
+ selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
4898
+ ),
4899
+ dir: props.direction
4900
+ },
4901
+ /* @__PURE__ */ import_react37.default.createElement(
4902
+ import_react_hook_form2.Controller,
4903
+ {
4904
+ control,
4905
+ name: "phone",
4906
+ render: ({ field }) => {
4907
+ var _a2, _b2;
4908
+ return /* @__PURE__ */ import_react37.default.createElement(
4909
+ PhoneInput,
4910
+ {
4911
+ label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
4912
+ helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
4913
+ preferredCountry: { label: "+966" },
4914
+ ...props.phoneInputProps,
4915
+ handleChange: (e) => {
4916
+ if ((0, import_libphonenumber_js2.isValidPhoneNumber)(e) && (0, import_libphonenumber_js2.isPossiblePhoneNumber)(e) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(e) === void 0) {
4917
+ let parsed = (0, import_libphonenumber_js2.parsePhoneNumber)(e);
4918
+ field.onChange(parsed.number);
4919
+ } else {
4920
+ field.onChange(e);
4921
+ }
4910
4922
  }
4911
4923
  }
4912
- }
4913
- );
4924
+ );
4925
+ }
4914
4926
  }
4915
- }
4927
+ ),
4928
+ props.additionalInputs,
4929
+ props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
4930
+ import_react_hook_form2.Controller,
4931
+ {
4932
+ control,
4933
+ name: "refCode",
4934
+ render: ({ field }) => {
4935
+ var _a2;
4936
+ return /* @__PURE__ */ import_react37.default.createElement(
4937
+ Input,
4938
+ {
4939
+ width: "full",
4940
+ label: texts == null ? void 0 : texts.refCode,
4941
+ placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
4942
+ helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
4943
+ ...field
4944
+ }
4945
+ );
4946
+ }
4947
+ }
4948
+ ),
4949
+ props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
4950
+ import_react_hook_form2.Controller,
4951
+ {
4952
+ control,
4953
+ name: "reference",
4954
+ render: ({ field }) => {
4955
+ var _a2, _b2;
4956
+ return /* @__PURE__ */ import_react37.default.createElement(
4957
+ Select,
4958
+ {
4959
+ label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
4960
+ placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
4961
+ isCreatable: false,
4962
+ isMulti: false,
4963
+ isSearchable: false,
4964
+ isClearable: false,
4965
+ options: props.userReferenceOptions || [],
4966
+ onChange: (e) => field.onChange(e)
4967
+ }
4968
+ );
4969
+ }
4970
+ }
4971
+ )
4916
4972
  ),
4917
- props.additionalInputs,
4918
- props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
4973
+ showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react37.default.createElement(
4919
4974
  import_react_hook_form2.Controller,
4920
4975
  {
4921
4976
  control,
4922
- name: "refCode",
4977
+ name: "terms_accepted",
4923
4978
  render: ({ field }) => {
4924
- var _a2;
4979
+ var _a2, _b2;
4925
4980
  return /* @__PURE__ */ import_react37.default.createElement(
4926
- Input,
4981
+ Checkbox,
4927
4982
  {
4928
- width: "full",
4929
- label: texts == null ? void 0 : texts.refCode,
4930
- placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
4931
- helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
4932
- ...field
4983
+ id: "terms_accepted",
4984
+ helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
4985
+ onCheckedChange: (e) => field.onChange(e),
4986
+ label: /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5 hawa-whitespace-nowrap hawa-flex-wrap" }, (texts == null ? void 0 : texts.iAcceptText) || "I accept the", " ", /* @__PURE__ */ import_react37.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react37.default.createElement(
4987
+ "span",
4988
+ {
4989
+ onClick: (e) => {
4990
+ e.preventDefault();
4991
+ if (props.onRouteToTOS) {
4992
+ props.onRouteToTOS();
4993
+ }
4994
+ },
4995
+ className: "clickable-link"
4996
+ },
4997
+ (texts == null ? void 0 : texts.termsText) || "Terms of Service"
4998
+ )))
4933
4999
  }
4934
5000
  );
4935
5001
  }
4936
5002
  }
4937
- ),
4938
- props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
5003
+ ), showNewsletterOption && /* @__PURE__ */ import_react37.default.createElement(
4939
5004
  import_react_hook_form2.Controller,
4940
5005
  {
4941
5006
  control,
4942
- name: "reference",
4943
- render: ({ field }) => {
4944
- var _a2, _b2;
4945
- return /* @__PURE__ */ import_react37.default.createElement(
4946
- Select,
4947
- {
4948
- label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
4949
- placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
4950
- isCreatable: false,
4951
- isMulti: false,
4952
- isSearchable: false,
4953
- isClearable: false,
4954
- options: props.userReferenceOptions || [],
4955
- onChange: (e) => field.onChange(e)
4956
- }
4957
- );
4958
- }
4959
- }
4960
- )
4961
- ),
4962
- showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react37.default.createElement(
4963
- import_react_hook_form2.Controller,
4964
- {
4965
- control,
4966
- name: "terms_accepted",
4967
- render: ({ field }) => {
4968
- var _a2, _b2;
4969
- return /* @__PURE__ */ import_react37.default.createElement(
5007
+ name: "newsletter_accepted",
5008
+ render: ({ field }) => /* @__PURE__ */ import_react37.default.createElement(
4970
5009
  Checkbox,
4971
5010
  {
4972
- id: "terms_accepted",
4973
- helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
4974
- onCheckedChange: (e) => field.onChange(e),
4975
- label: /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5 hawa-whitespace-nowrap hawa-flex-wrap" }, (texts == null ? void 0 : texts.iAcceptText) || "I accept the", " ", /* @__PURE__ */ import_react37.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react37.default.createElement(
4976
- "span",
4977
- {
4978
- onClick: (e) => {
4979
- e.preventDefault();
4980
- if (props.onRouteToTOS) {
4981
- props.onRouteToTOS();
4982
- }
4983
- },
4984
- className: "clickable-link"
4985
- },
4986
- (texts == null ? void 0 : texts.termsText) || "Terms of Service"
4987
- )))
5011
+ id: "newsletter_accepted",
5012
+ label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
5013
+ onCheckedChange: field.onChange
4988
5014
  }
4989
- );
5015
+ )
4990
5016
  }
4991
- }
4992
- ), showNewsletterOption && /* @__PURE__ */ import_react37.default.createElement(
4993
- import_react_hook_form2.Controller,
5017
+ )) : null
5018
+ ),
5019
+ /* @__PURE__ */ import_react37.default.createElement(
5020
+ Button,
4994
5021
  {
4995
- control,
4996
- name: "newsletter_accepted",
4997
- render: ({ field }) => /* @__PURE__ */ import_react37.default.createElement(
4998
- Checkbox,
4999
- {
5000
- id: "newsletter_accepted",
5001
- label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
5002
- onCheckedChange: field.onChange
5003
- }
5004
- )
5005
- }
5006
- )) : null
5007
- ),
5008
- /* @__PURE__ */ import_react37.default.createElement(
5009
- Button,
5010
- {
5011
- className: "hawa-w-full",
5012
- type: "submit",
5013
- isLoading: props.isLoading,
5014
- disabled: props.isLoading
5015
- },
5016
- (texts == null ? void 0 : texts.registerText) || "Register"
5017
- ),
5018
- props.additionalButtons
5019
- )), props.onRouteToLogin && /* @__PURE__ */ import_react37.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_react37.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react37.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
5022
+ className: "hawa-w-full",
5023
+ type: "submit",
5024
+ isLoading: props.isLoading,
5025
+ disabled: props.isLoading
5026
+ },
5027
+ (texts == null ? void 0 : texts.registerText) || "Register"
5028
+ ),
5029
+ props.additionalButtons
5030
+ )),
5031
+ props.onRouteToLogin && /* @__PURE__ */ import_react37.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_react37.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react37.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login"))
5032
+ )
5020
5033
  ),
5021
5034
  props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react37.default.createElement(
5022
5035
  CardFooter,