@sikka/hawa 0.46.4-next → 0.48.0-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.
Files changed (55) hide show
  1. package/dist/{Radio-Dyvlywnk.d.mts → Radio-BPHTeDMz.d.mts} +8 -7
  2. package/dist/{Radio-DlPwVCG4.d.ts → Radio-cRcIH8_L.d.ts} +8 -7
  3. package/dist/blocks/auth/index.d.mts +34 -17
  4. package/dist/blocks/auth/index.d.ts +34 -17
  5. package/dist/blocks/auth/index.js +1008 -430
  6. package/dist/blocks/auth/index.mjs +427 -297
  7. package/dist/blocks/feedback/index.d.mts +1 -1
  8. package/dist/blocks/feedback/index.d.ts +1 -1
  9. package/dist/blocks/feedback/index.js +68 -79
  10. package/dist/blocks/feedback/index.mjs +1 -1
  11. package/dist/blocks/index.d.mts +28 -11
  12. package/dist/blocks/index.d.ts +28 -11
  13. package/dist/blocks/index.js +2340 -2233
  14. package/dist/blocks/index.mjs +407 -269
  15. package/dist/blocks/misc/index.d.mts +1 -1
  16. package/dist/blocks/misc/index.d.ts +1 -1
  17. package/dist/blocks/misc/index.js +68 -79
  18. package/dist/blocks/misc/index.mjs +50 -367
  19. package/dist/blocks/pricing/index.d.mts +1 -1
  20. package/dist/blocks/pricing/index.d.ts +1 -1
  21. package/dist/blocks/pricing/index.mjs +1 -1
  22. package/dist/{chunk-6TG2PHZK.mjs → chunk-AWJSHOYU.mjs} +68 -79
  23. package/dist/{chunk-5CTMGPEF.mjs → chunk-GBLWUEYN.mjs} +650 -674
  24. package/dist/chunk-JFWD2ICY.mjs +511 -0
  25. package/dist/elements/index.d.mts +2 -2
  26. package/dist/elements/index.d.ts +2 -2
  27. package/dist/elements/index.js +81 -105
  28. package/dist/elements/index.mjs +1 -1
  29. package/dist/index.css +7 -0
  30. package/dist/index.d.mts +36 -17
  31. package/dist/index.d.ts +36 -17
  32. package/dist/index.js +482 -373
  33. package/dist/index.mjs +487 -373
  34. package/dist/phoneInput/index.d.mts +7 -7
  35. package/dist/phoneInput/index.d.ts +7 -7
  36. package/dist/phoneInput/index.js +78 -85
  37. package/dist/phoneInput/index.js.map +1 -1
  38. package/dist/phoneInput/index.mjs +78 -85
  39. package/dist/phoneInput/index.mjs.map +1 -1
  40. package/dist/pinInput/index.js +3 -20
  41. package/dist/pinInput/index.js.map +1 -1
  42. package/dist/pinInput/index.mjs +3 -20
  43. package/dist/pinInput/index.mjs.map +1 -1
  44. package/dist/select/index.d.mts +1 -0
  45. package/dist/select/index.d.ts +1 -0
  46. package/dist/select/index.js +68 -79
  47. package/dist/select/index.js.map +1 -1
  48. package/dist/select/index.mjs +68 -79
  49. package/dist/select/index.mjs.map +1 -1
  50. package/dist/{textTypes-DXLtO2fL.d.mts → textTypes-CYQYIsFt.d.mts} +1 -0
  51. package/dist/{textTypes-DXLtO2fL.d.ts → textTypes-CYQYIsFt.d.ts} +1 -0
  52. package/dist/types/index.d.mts +1 -0
  53. package/dist/types/index.d.ts +1 -0
  54. package/package.json +1 -1
  55. package/dist/chunk-EOH6A3GR.mjs +0 -183
@@ -3316,6 +3316,7 @@ var import_clsx2 = __toESM(require("clsx"));
3316
3316
  var Select = ({
3317
3317
  labelProps,
3318
3318
  labelKey = "label",
3319
+ valueKey = "value",
3319
3320
  ...props
3320
3321
  }) => {
3321
3322
  const NoOption = () => {
@@ -3335,13 +3336,7 @@ var Select = ({
3335
3336
  children
3336
3337
  );
3337
3338
  };
3338
- const Option = ({
3339
- children,
3340
- innerProps,
3341
- innerRef,
3342
- isFocused,
3343
- isSelected
3344
- }) => {
3339
+ const Option = ({ children, innerProps, innerRef, isFocused, isSelected }) => {
3345
3340
  return /* @__PURE__ */ import_react9.default.createElement(
3346
3341
  "div",
3347
3342
  {
@@ -3356,14 +3351,7 @@ var Select = ({
3356
3351
  children
3357
3352
  );
3358
3353
  };
3359
- const Menu = ({
3360
- cx,
3361
- children,
3362
- getStyles,
3363
- innerProps,
3364
- innerRef,
3365
- ...menuProps
3366
- }) => {
3354
+ const Menu = ({ cx, children, getStyles, innerProps, innerRef, ...menuProps }) => {
3367
3355
  const menuOpen = menuProps.selectProps.menuIsOpen;
3368
3356
  return /* @__PURE__ */ import_react9.default.createElement(
3369
3357
  "div",
@@ -3392,71 +3380,72 @@ var Select = ({
3392
3380
  )
3393
3381
  },
3394
3382
  props.label && /* @__PURE__ */ import_react9.default.createElement(Label, { ...labelProps }, props.label),
3395
- props.isLoading ? /* @__PURE__ */ import_react9.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? (
3396
- // TODO: enable keyboard to go to the next item in the list
3397
- /* @__PURE__ */ import_react9.default.createElement(
3398
- import_react_select.default,
3399
- {
3400
- noOptionsMessage: NoOption,
3401
- classNames: {
3402
- control: () => cn(
3403
- props.phoneCode && "hawa-rounded-r-none",
3404
- props.controlClassNames
3405
- ),
3406
- container: () => cn(
3407
- selectContainerStyles,
3408
- props.phoneCode && phoneCodeStyles,
3409
- props.isMulti && "hawa-ps-0 "
3410
- ),
3411
- placeholder: () => cn(
3412
- selectPlaceholderStyles,
3413
- props.disabled && "hawa-text-muted-foreground"
3414
- ),
3415
- valueContainer: () => "hawa-text-foreground hawa-px-1 ",
3416
- singleValue: () => cn(
3417
- props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
3418
- ),
3419
- indicatorsContainer: () => cn(
3420
- selectIndicatorContainerStyles,
3421
- props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
3422
- props.disabled && "hawa-opacity-30"
3423
- )
3424
- },
3425
- unstyled: true,
3426
- autoFocus: false,
3427
- components: props.hideIndicator ? { Option, Menu, IndicatorsContainer: () => null } : {
3383
+ props.isLoading ? /* @__PURE__ */ import_react9.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? /* @__PURE__ */ import_react9.default.createElement(
3384
+ import_react_select.default,
3385
+ {
3386
+ noOptionsMessage: NoOption,
3387
+ classNames: {
3388
+ control: () => cn(props.phoneCode && "hawa-rounded-r-none", props.controlClassNames),
3389
+ container: () => cn(
3390
+ selectContainerStyles,
3391
+ props.phoneCode && phoneCodeStyles,
3392
+ props.isMulti && "hawa-ps-0 "
3393
+ ),
3394
+ placeholder: () => cn(selectPlaceholderStyles, props.disabled && "hawa-text-muted-foreground"),
3395
+ valueContainer: () => "hawa-text-foreground hawa-px-1",
3396
+ singleValue: () => cn(
3397
+ props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
3398
+ ),
3399
+ indicatorsContainer: () => cn(
3400
+ selectIndicatorContainerStyles,
3401
+ props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
3402
+ props.disabled && "hawa-opacity-30"
3403
+ )
3404
+ },
3405
+ unstyled: true,
3406
+ autoFocus: false,
3407
+ components: props.hideIndicator ? {
3408
+ Option: (optionProps) => /* @__PURE__ */ import_react9.default.createElement(
3428
3409
  Option,
3429
- Menu,
3430
- ValueContainer: (e) => /* @__PURE__ */ import_react9.default.createElement(
3431
- "div",
3432
- {
3433
- className: cn(
3434
- e.className,
3435
- "hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-1"
3436
- ),
3437
- ...e
3438
- }
3439
- ),
3440
- MultiValueContainer: (e) => /* @__PURE__ */ import_react9.default.createElement(
3441
- "div",
3442
- {
3443
- className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
3444
- ...e
3445
- }
3446
- )
3447
- },
3448
- onChange: (newValue, action) => props.onChange(newValue, action),
3449
- options: props.options,
3450
- getOptionLabel: props.getOptionLabel,
3451
- defaultValue: props.defaultValue,
3452
- value: props.value,
3453
- placeholder: props.placeholder,
3454
- isDisabled: props.disabled,
3455
- isClearable: props.isClearable,
3456
- isMulti: props.isMulti,
3457
- isSearchable: props.isSearchable
3458
- }
3459
- )
3410
+ {
3411
+ ...optionProps,
3412
+ isSelected: optionProps.data[valueKey] === props.value[valueKey]
3413
+ }
3414
+ ),
3415
+ Menu,
3416
+ IndicatorsContainer: () => null
3417
+ } : {
3418
+ Option,
3419
+ Menu,
3420
+ ValueContainer: (e) => /* @__PURE__ */ import_react9.default.createElement(
3421
+ "div",
3422
+ {
3423
+ className: cn(
3424
+ e.className,
3425
+ "hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-2 hawa-w-full hawa-cursor-pointer"
3426
+ ),
3427
+ ...e
3428
+ }
3429
+ ),
3430
+ MultiValueContainer: (e) => /* @__PURE__ */ import_react9.default.createElement(
3431
+ "div",
3432
+ {
3433
+ className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
3434
+ ...e
3435
+ }
3436
+ )
3437
+ },
3438
+ onChange: (newValue, action) => props.onChange(newValue, action),
3439
+ options: props.options,
3440
+ getOptionLabel: props.getOptionLabel,
3441
+ defaultValue: props.defaultValue,
3442
+ value: props.value,
3443
+ placeholder: props.placeholder,
3444
+ isDisabled: props.disabled,
3445
+ isClearable: props.isClearable,
3446
+ isMulti: props.isMulti,
3447
+ isSearchable: props.isSearchable
3448
+ }
3460
3449
  ) : /* @__PURE__ */ import_react9.default.createElement(
3461
3450
  import_creatable.default,
3462
3451
  {
@@ -3498,11 +3487,13 @@ var PhoneInput = ({
3498
3487
  countryCodes,
3499
3488
  ...props
3500
3489
  }) => {
3490
+ var _a;
3501
3491
  const [phoneNumber, setPhoneNumber] = (0, import_react10.useState)("");
3502
- const [countryCode, setCountryCode] = (0, import_react10.useState)(props.preferredCountry);
3492
+ const [countryCode, setCountryCode] = (0, import_react10.useState)(
3493
+ props.preferredCountry || { label: "+966" }
3494
+ );
3503
3495
  const inputRef = (0, import_react10.useRef)(null);
3504
3496
  const handleInputChange = (e) => {
3505
- console.log("test e ", e.target.value);
3506
3497
  const validChars = /^[0-9-()]+$/;
3507
3498
  const input = e.target.value;
3508
3499
  if (input === "" || validChars.test(input)) {
@@ -3524,11 +3515,13 @@ var PhoneInput = ({
3524
3515
  isMulti: false,
3525
3516
  isSearchable: true,
3526
3517
  isClearable: false,
3527
- placeholder: "Code",
3518
+ placeholder: (_a = props.preferredCountry) == null ? void 0 : _a.label,
3528
3519
  options: countryCodes || countries_default,
3529
- onChange: setCountryCode,
3530
- value: countryCode == null ? void 0 : countryCode.label,
3531
- defaultValue: props.preferredCountry
3520
+ onChange: (e) => setCountryCode({ label: e.label, value: e.label }),
3521
+ valueKey: "label",
3522
+ labelKey: "label",
3523
+ value: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label },
3524
+ defaultValue: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label }
3532
3525
  }
3533
3526
  ), /* @__PURE__ */ import_react10.default.createElement("div", { className: "hawa-relative hawa-flex hawa-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0" }, /* @__PURE__ */ import_react10.default.createElement(
3534
3527
  "input",
@@ -4017,14 +4010,7 @@ var LoginForm = ({
4017
4010
  (texts == null ? void 0 : texts.loginText) || "Login"
4018
4011
  ),
4019
4012
  props.additionalButtons && props.additionalButtons,
4020
- props.allowRegister && /* @__PURE__ */ import_react14.default.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ import_react14.default.createElement(
4021
- "span",
4022
- {
4023
- onClick: props.onRouteToRegister,
4024
- className: "clickable-link"
4025
- },
4026
- (texts == null ? void 0 : texts.createAccount) || "Create Account"
4027
- ))
4013
+ props.allowRegister && /* @__PURE__ */ import_react14.default.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ import_react14.default.createElement("span", { onClick: props.onRouteToRegister, className: "clickable-link" }, (texts == null ? void 0 : texts.createAccount) || "Create Account"))
4028
4014
  )),
4029
4015
  props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react14.default.createElement(
4030
4016
  CardFooter,
@@ -4054,9 +4040,10 @@ var LoginForm = ({
4054
4040
  };
4055
4041
 
4056
4042
  // blocks/auth/RegisterForm.tsx
4057
- var import_react17 = __toESM(require("react"));
4043
+ var import_react37 = __toESM(require("react"));
4058
4044
  var import_react_hook_form2 = require("react-hook-form");
4059
4045
  var import_zod2 = require("@hookform/resolvers/zod");
4046
+ var import_libphonenumber_js2 = require("libphonenumber-js");
4060
4047
  var z2 = __toESM(require("zod"));
4061
4048
 
4062
4049
  // elements/checkbox/Checkbox.tsx
@@ -4204,2318 +4191,2438 @@ var StopPropagationWrapper = (props) => {
4204
4191
  return /* @__PURE__ */ import_react16.default.createElement("div", { onClick: handleClick }, props.children);
4205
4192
  };
4206
4193
 
4207
- // blocks/auth/RegisterForm.tsx
4208
- var RegisterForm = ({
4209
- texts,
4210
- registerFields = ["email"],
4211
- minPasswordLength = 8,
4212
- showTermsOption = false,
4213
- showNewsletterOption = false,
4214
- ...props
4215
- }) => {
4216
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4217
- const [passwordVisible, setPasswordVisible] = (0, import_react17.useState)(false);
4218
- const thirdPartyAuthTexts = {
4219
- continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
4220
- continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
4221
- continueWithApple: texts == null ? void 0 : texts.continueWithApple,
4222
- continueWithMicrosoft: texts == null ? void 0 : texts.continueWithMicrosoft,
4223
- continueWithGithub: texts == null ? void 0 : texts.continueWithGithub,
4224
- continueWithEmail: texts == null ? void 0 : texts.continueWithEmail,
4225
- continueWithPhone: texts == null ? void 0 : texts.continueWithPhone
4194
+ // elements/tabs/Tabs.tsx
4195
+ var React30 = __toESM(require("react"));
4196
+
4197
+ // hooks/useIsomorphicEffect.ts
4198
+ var import_react17 = require("react");
4199
+
4200
+ // hooks/useDiscloser.ts
4201
+ var import_react18 = require("react");
4202
+
4203
+ // hooks/useHover.ts
4204
+ var import_react19 = require("react");
4205
+
4206
+ // hooks/useToast.ts
4207
+ var React22 = __toESM(require("react"));
4208
+
4209
+ // hooks/useCarousel.ts
4210
+ var import_react20 = require("react");
4211
+
4212
+ // hooks/useDialogCarousel.ts
4213
+ var import_react21 = require("react");
4214
+ var import_embla_carousel_auto_height = __toESM(require("embla-carousel-auto-height"));
4215
+ var import_embla_carousel_react = __toESM(require("embla-carousel-react"));
4216
+
4217
+ // hooks/useDialogSteps.ts
4218
+ var import_react22 = require("react");
4219
+
4220
+ // hooks/useClipboard.ts
4221
+ var import_react23 = require("react");
4222
+
4223
+ // hooks/useBreakpoint.ts
4224
+ var import_react24 = require("react");
4225
+
4226
+ // hooks/useWindowSize.ts
4227
+ var import_react25 = require("react");
4228
+
4229
+ // hooks/useFocusWithin.ts
4230
+ var import_react26 = require("react");
4231
+
4232
+ // hooks/useMediaQuery.ts
4233
+ var import_react27 = require("react");
4234
+
4235
+ // hooks/useScrollPosition.ts
4236
+ var import_react28 = require("react");
4237
+
4238
+ // hooks/useTable.ts
4239
+ var import_react29 = require("react");
4240
+
4241
+ // hooks/useTabs.ts
4242
+ var import_react30 = require("react");
4243
+
4244
+ // hooks/useMeasureDirty.ts
4245
+ var import_react31 = require("react");
4246
+
4247
+ // hooks/useClickOutside.ts
4248
+ var import_react32 = require("react");
4249
+
4250
+ // hooks/useShortcuts.ts
4251
+ var import_react33 = require("react");
4252
+ function parseHotkey(hotkey) {
4253
+ const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
4254
+ const modifiers = {
4255
+ alt: keys.includes("alt"),
4256
+ ctrl: keys.includes("ctrl"),
4257
+ meta: keys.includes("meta"),
4258
+ mod: keys.includes("mod"),
4259
+ shift: keys.includes("shift")
4226
4260
  };
4227
- const methods = (0, import_react_hook_form2.useForm)();
4228
- let fieldSchemas = {};
4229
- registerFields.forEach((field) => {
4230
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
4231
- switch (field) {
4232
- case "fullname":
4233
- fieldSchemas["fullName"] = z2.string().optional();
4234
- break;
4235
- case "email":
4236
- fieldSchemas["email"] = z2.string({
4237
- required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
4238
- }).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" });
4239
- break;
4240
- case "username":
4241
- fieldSchemas["username"] = z2.string({
4242
- required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
4243
- }).min(1, {
4244
- message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
4245
- }).max(14, {
4246
- message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.tooLong) || "Username is too long"
4247
- }).refine(
4248
- (value) => {
4249
- const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
4250
- return isValid;
4251
- },
4252
- { message: ((_g2 = texts == null ? void 0 : texts.username) == null ? void 0 : _g2.invalid) || "Invalid username" }
4253
- );
4254
- break;
4261
+ const reservedKeys = ["alt", "ctrl", "meta", "shift", "mod"];
4262
+ const freeKey = keys.find((key) => !reservedKeys.includes(key));
4263
+ return {
4264
+ ...modifiers,
4265
+ key: freeKey
4266
+ };
4267
+ }
4268
+ function isExactHotkey(hotkey, event) {
4269
+ const { alt, ctrl, meta, mod, shift, key } = hotkey;
4270
+ const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey } = event;
4271
+ if (alt !== altKey) {
4272
+ return false;
4273
+ }
4274
+ if (mod) {
4275
+ if (!ctrlKey && !metaKey) {
4276
+ return false;
4255
4277
  }
4256
- });
4257
- const formSchema = z2.object({
4258
- ...fieldSchemas,
4259
- password: z2.string({
4260
- required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
4261
- }).min(minPasswordLength, {
4262
- message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
4263
- }).refine((value) => value !== "", {
4264
- message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
4265
- }),
4266
- confirm_password: z2.string({
4267
- required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
4268
- }).min(minPasswordLength, {
4269
- message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.tooShort) || "Password is too short"
4270
- }).refine((value) => value !== "", {
4271
- message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.required) || "Confirm password is required"
4272
- }),
4273
- refCode: z2.string().optional(),
4274
- reference: z2.string().optional(),
4275
- terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
4276
- message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
4277
- }),
4278
- newsletter_accepted: z2.boolean().optional()
4279
- }).refine((data) => data.password === data.confirm_password, {
4280
- message: ((_g = texts == null ? void 0 : texts.confirm) == null ? void 0 : _g.dontMatch) || "Passwords don't match",
4281
- path: ["confirm_password"]
4282
- });
4283
- const { handleSubmit, control, formState } = (0, import_react_hook_form2.useForm)({
4284
- resolver: (0, import_zod2.zodResolver)(formSchema)
4285
- });
4286
- return /* @__PURE__ */ import_react17.default.createElement(
4287
- "div",
4288
- {
4289
- className: cn(
4290
- "hawa-flex hawa-flex-col hawa-gap-4",
4291
- (_h = props.classNames) == null ? void 0 : _h.root
4292
- )
4293
- },
4294
- /* @__PURE__ */ import_react17.default.createElement(
4295
- Card,
4296
- {
4297
- dir: props.direction,
4298
- className: cn(
4299
- (_i = props.classNames) == null ? void 0 : _i.card,
4300
- props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
4301
- )
4302
- },
4303
- /* @__PURE__ */ import_react17.default.createElement(CardContent, { headless: true, noPadding: props.cardless }, /* @__PURE__ */ import_react17.default.createElement("div", null, props.showError && /* @__PURE__ */ import_react17.default.createElement(
4304
- Alert,
4305
- {
4306
- direction: props.direction,
4307
- title: props.errorTitle,
4308
- text: props.errorText,
4309
- severity: "error",
4310
- onAlertClosed: () => {
4311
- if (props.onErrorDismissed) {
4312
- props.onErrorDismissed();
4313
- }
4314
- }
4278
+ } else {
4279
+ if (ctrl !== ctrlKey) {
4280
+ return false;
4281
+ }
4282
+ if (meta !== metaKey) {
4283
+ return false;
4284
+ }
4285
+ }
4286
+ if (shift !== shiftKey) {
4287
+ return false;
4288
+ }
4289
+ if (key && (pressedKey.toLowerCase() === key.toLowerCase() || event.code.replace("Key", "").toLowerCase() === key.toLowerCase())) {
4290
+ return true;
4291
+ }
4292
+ return false;
4293
+ }
4294
+ function getHotkeyMatcher(hotkey) {
4295
+ return (event) => isExactHotkey(parseHotkey(hotkey), event);
4296
+ }
4297
+ function getHotkeyHandler(hotkeys) {
4298
+ return (event) => {
4299
+ const _event = "nativeEvent" in event ? event.nativeEvent : event;
4300
+ hotkeys.forEach(([hotkey, handler, options = { preventDefault: true }]) => {
4301
+ if (getHotkeyMatcher(hotkey)(_event)) {
4302
+ if (options.preventDefault) {
4303
+ event.preventDefault();
4315
4304
  }
4316
- ), /* @__PURE__ */ import_react17.default.createElement(import_react_hook_form2.FormProvider, { ...methods }, /* @__PURE__ */ import_react17.default.createElement(
4317
- "form",
4318
- {
4319
- noValidate: true,
4320
- onSubmit: handleSubmit((e) => {
4321
- if (props.onRegister) {
4322
- return props.onRegister(e);
4323
- } else {
4324
- console.log(
4325
- "Form is submitted but onRegister prop is missing"
4326
- );
4327
- }
4328
- }),
4329
- className: "hawa-flex hawa-flex-col hawa-gap-4"
4330
- },
4331
- /* @__PURE__ */ import_react17.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
4332
- if (fld === "fullname") {
4333
- return /* @__PURE__ */ import_react17.default.createElement(
4334
- import_react_hook_form2.Controller,
4335
- {
4336
- key: i,
4337
- control,
4338
- name: "fullName",
4339
- render: ({ field }) => {
4340
- var _a2, _b2, _c2;
4341
- return /* @__PURE__ */ import_react17.default.createElement(
4342
- Input,
4343
- {
4344
- width: "full",
4345
- label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
4346
- placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
4347
- helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
4348
- ...field
4349
- }
4350
- );
4351
- }
4352
- }
4353
- );
4354
- }
4355
- if (fld === "email") {
4356
- return /* @__PURE__ */ import_react17.default.createElement(
4357
- import_react_hook_form2.Controller,
4358
- {
4359
- key: i,
4360
- control,
4361
- name: "email",
4362
- render: ({ field }) => {
4363
- var _a2, _b2, _c2;
4364
- return /* @__PURE__ */ import_react17.default.createElement(
4365
- Input,
4366
- {
4367
- dir: "ltr",
4368
- inputProps: {
4369
- className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
4370
- },
4371
- width: "full",
4372
- autoComplete: "email",
4373
- label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
4374
- helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
4375
- placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
4376
- ...field,
4377
- onChange: (e) => {
4378
- field.onChange(
4379
- e.target.value.toLowerCase().trim()
4380
- );
4381
- }
4382
- }
4383
- );
4384
- }
4385
- }
4386
- );
4387
- }
4388
- if (fld === "username") {
4389
- return /* @__PURE__ */ import_react17.default.createElement(
4390
- import_react_hook_form2.Controller,
4391
- {
4392
- key: i,
4393
- control,
4394
- name: "username",
4395
- render: ({ field }) => {
4396
- var _a2, _b2, _c2, _d2;
4397
- return /* @__PURE__ */ import_react17.default.createElement(
4398
- Input,
4399
- {
4400
- width: "full",
4401
- autoComplete: "username",
4402
- label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
4403
- labelProps: {
4404
- ...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
4405
- },
4406
- helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
4407
- placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
4408
- ...field
4409
- }
4410
- );
4411
- }
4412
- }
4413
- );
4414
- }
4415
- })),
4416
- /* @__PURE__ */ import_react17.default.createElement(
4417
- import_react_hook_form2.Controller,
4418
- {
4419
- control,
4420
- name: "password",
4421
- render: ({ field }) => {
4422
- var _a2, _b2, _c2;
4423
- return /* @__PURE__ */ import_react17.default.createElement(
4424
- Input,
4425
- {
4426
- width: "full",
4427
- type: passwordVisible ? "text" : "password",
4428
- endIcon: /* @__PURE__ */ import_react17.default.createElement(
4429
- "div",
4430
- {
4431
- className: "hawa-cursor-pointer",
4432
- onClick: () => setPasswordVisible(!passwordVisible)
4433
- },
4434
- passwordVisible ? /* @__PURE__ */ import_react17.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react17.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
4435
- " "
4436
- ),
4437
- autoComplete: "new-password",
4438
- label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
4439
- placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
4440
- helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
4441
- ...field
4442
- }
4443
- );
4444
- }
4445
- }
4446
- ),
4447
- /* @__PURE__ */ import_react17.default.createElement(
4448
- import_react_hook_form2.Controller,
4449
- {
4450
- control,
4451
- name: "confirm_password",
4452
- render: ({ field }) => {
4453
- var _a2, _b2, _c2;
4454
- return /* @__PURE__ */ import_react17.default.createElement(
4455
- Input,
4456
- {
4457
- width: "full",
4458
- type: "password",
4459
- autoComplete: "new-password",
4460
- label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
4461
- placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
4462
- helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
4463
- ...field
4464
- }
4465
- );
4466
- }
4467
- }
4468
- ),
4469
- props.additionalInputs,
4470
- props.showRefCode && /* @__PURE__ */ import_react17.default.createElement(
4471
- import_react_hook_form2.Controller,
4472
- {
4473
- control,
4474
- name: "refCode",
4475
- render: ({ field }) => {
4476
- var _a2;
4477
- return /* @__PURE__ */ import_react17.default.createElement(
4478
- Input,
4479
- {
4480
- width: "full",
4481
- label: texts == null ? void 0 : texts.refCode,
4482
- placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
4483
- helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
4484
- ...field
4485
- }
4486
- );
4487
- }
4488
- }
4489
- ),
4490
- props.showUserSource && /* @__PURE__ */ import_react17.default.createElement(
4491
- import_react_hook_form2.Controller,
4492
- {
4493
- control,
4494
- name: "reference",
4495
- render: ({ field }) => {
4496
- var _a2, _b2;
4497
- return /* @__PURE__ */ import_react17.default.createElement(
4498
- Select,
4499
- {
4500
- label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
4501
- placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
4502
- isCreatable: false,
4503
- isMulti: false,
4504
- isSearchable: false,
4505
- isClearable: false,
4506
- options: props.userReferenceOptions || [],
4507
- onChange: (e) => field.onChange(e)
4508
- }
4509
- );
4510
- }
4511
- }
4512
- ),
4513
- showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react17.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react17.default.createElement(
4514
- import_react_hook_form2.Controller,
4515
- {
4516
- control,
4517
- name: "terms_accepted",
4518
- render: ({ field }) => {
4519
- var _a2, _b2;
4520
- return /* @__PURE__ */ import_react17.default.createElement(
4521
- Checkbox,
4522
- {
4523
- id: "terms_accepted",
4524
- helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
4525
- onCheckedChange: (e) => field.onChange(e),
4526
- label: /* @__PURE__ */ import_react17.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_react17.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react17.default.createElement(
4527
- "span",
4528
- {
4529
- onClick: (e) => {
4530
- e.preventDefault();
4531
- if (props.onRouteToTOS) {
4532
- props.onRouteToTOS();
4533
- }
4534
- },
4535
- className: "clickable-link"
4536
- },
4537
- (texts == null ? void 0 : texts.termsText) || "Terms of Service"
4538
- )))
4539
- }
4540
- );
4541
- }
4542
- }
4543
- ), showNewsletterOption && /* @__PURE__ */ import_react17.default.createElement(
4544
- import_react_hook_form2.Controller,
4545
- {
4546
- control,
4547
- name: "newsletter_accepted",
4548
- render: ({ field }) => /* @__PURE__ */ import_react17.default.createElement(
4549
- Checkbox,
4550
- {
4551
- id: "newsletter_accepted",
4552
- label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
4553
- onCheckedChange: field.onChange
4554
- }
4555
- )
4556
- }
4557
- )) : null,
4558
- /* @__PURE__ */ import_react17.default.createElement(
4559
- Button,
4560
- {
4561
- className: "hawa-w-full",
4562
- type: "submit",
4563
- isLoading: props.isLoading,
4564
- disabled: props.isLoading
4565
- },
4566
- (texts == null ? void 0 : texts.registerText) || "Register"
4567
- ),
4568
- props.additionalButtons
4569
- )), props.onRouteToLogin && /* @__PURE__ */ import_react17.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_react17.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react17.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))),
4570
- props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react17.default.createElement(
4571
- CardFooter,
4305
+ handler(_event);
4306
+ }
4307
+ });
4308
+ };
4309
+ }
4310
+
4311
+ // hooks/useWindowEvent.ts
4312
+ var import_react34 = require("react");
4313
+ function useWindowEvent(type, listener, options) {
4314
+ (0, import_react34.useEffect)(() => {
4315
+ window.addEventListener(type, listener, options);
4316
+ return () => window.removeEventListener(type, listener, options);
4317
+ }, [type, listener]);
4318
+ }
4319
+
4320
+ // hooks/useViewportSize.ts
4321
+ var import_react35 = require("react");
4322
+ var eventListerOptions = {
4323
+ passive: true
4324
+ };
4325
+ function useViewportSize() {
4326
+ const [windowSize, setWindowSize] = (0, import_react35.useState)({
4327
+ width: 0,
4328
+ height: 0
4329
+ });
4330
+ const setSize = (0, import_react35.useCallback)(() => {
4331
+ setWindowSize({
4332
+ width: window.innerWidth || 0,
4333
+ height: window.innerHeight || 0
4334
+ });
4335
+ }, []);
4336
+ useWindowEvent("resize", setSize, eventListerOptions);
4337
+ useWindowEvent("orientationchange", setSize, eventListerOptions);
4338
+ (0, import_react35.useEffect)(setSize, []);
4339
+ return windowSize;
4340
+ }
4341
+
4342
+ // elements/tabs/Tabs.tsx
4343
+ var Popover = __toESM(require("@radix-ui/react-popover"));
4344
+ var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"));
4345
+ var import_tailwind_variants = require("tailwind-variants");
4346
+
4347
+ // elements/chip/Chip.tsx
4348
+ var import_react36 = __toESM(require("react"));
4349
+ var Chip = import_react36.default.forwardRef(
4350
+ ({
4351
+ label,
4352
+ size = "normal",
4353
+ icon,
4354
+ color,
4355
+ radius = "inherit",
4356
+ dot,
4357
+ dotStatus = "none",
4358
+ ...rest
4359
+ }, ref) => {
4360
+ let defaultStyles = "hawa-flex hawa-flex-row hawa-w-fit hawa-gap-1 hawa-items-center hawa-px-2.5 hawa-py-1 hawa-font-bold ";
4361
+ let radiusStyles = {
4362
+ inherit: " hawa-rounded",
4363
+ full: "hawa-rounded-full",
4364
+ none: "hawa-rounded-none"
4365
+ };
4366
+ let sizeStyles = {
4367
+ small: "hawa-h-[15px] hawa-leading-4 hawa-px-0 hawa-py-0 hawa-text-[9px] hawa-gap-0.5 ",
4368
+ normal: "hawa-h-fit hawa-text-xs",
4369
+ large: "hawa-text-base"
4370
+ };
4371
+ let dotStyles = {
4372
+ small: "hawa-flex hawa-h-1 hawa-w-1 hawa-rounded-full",
4373
+ normal: "hawa-flex hawa-h-2 hawa-w-2 hawa-rounded-full",
4374
+ large: "hawa-flex hawa-h-3 hawa-w-3 hawa-rounded-full"
4375
+ };
4376
+ let dotStatusStyles = {
4377
+ none: "hawa-bg-gray-500 dark:hawa-bg-gray-800",
4378
+ available: "hawa-bg-green-500",
4379
+ unavailable: "hawa-bg-red-500"
4380
+ };
4381
+ let colorStyles = {
4382
+ green: "hawa-bg-green-200 hawa-text-green-700 dark:hawa-bg-green-700 dark:hawa-text-green-200",
4383
+ blue: "hawa-bg-blue-200 hawa-text-blue-700 dark:hawa-bg-blue-700 dark:hawa-text-blue-100",
4384
+ red: "hawa-bg-red-200 hawa-text-red-700 dark:hawa-bg-red-700 dark:hawa-text-red-100",
4385
+ yellow: "hawa-bg-yellow-200 hawa-text-yellow-700 dark:hawa-bg-yellow-600 dark:hawa-text-black",
4386
+ orange: "hawa-bg-orange-200 hawa-text-orange-700 dark:hawa-bg-orange-700 dark:hawa-text-orange-100",
4387
+ purple: "hawa-bg-purple-200 hawa-text-purple-700 dark:hawa-bg-purple-700 dark:hawa-text-purple-100",
4388
+ cyan: "hawa-bg-cyan-200 hawa-text-cyan-700 dark:hawa-bg-cyan-700 dark:hawa-text-cyan-100",
4389
+ hyper: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-tl hawa-from-pink-500 hawa-via-red-500 hawa-to-yellow-500 ",
4390
+ oceanic: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-bl hawa-from-green-300 hawa-via-blue-500 hawa-to-purple-600"
4391
+ };
4392
+ if (label) {
4393
+ return /* @__PURE__ */ import_react36.default.createElement(
4394
+ "span",
4572
4395
  {
4573
- noPadding: props.cardless,
4396
+ ...rest,
4397
+ ref,
4574
4398
  className: cn(
4575
- props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
4399
+ defaultStyles,
4400
+ sizeStyles[size],
4401
+ radiusStyles[radius],
4402
+ color ? colorStyles[color] : "hawa-border hawa-bg-none",
4403
+ rest.className
4576
4404
  )
4577
4405
  },
4578
- /* @__PURE__ */ import_react17.default.createElement(
4579
- AuthButtons,
4406
+ dot && /* @__PURE__ */ import_react36.default.createElement(
4407
+ "span",
4580
4408
  {
4581
- texts: thirdPartyAuthTexts,
4582
- viaGoogle: props.viaGoogle,
4583
- viaGithub: props.viaGithub,
4584
- viaTwitter: props.viaTwitter,
4585
- isGoogleLoading: props.isGoogleLoading,
4586
- isGithubLoading: props.isGithubLoading,
4587
- isTwitterLoading: props.isTwitterLoading,
4588
- handleGoogle: props.onGoogleRegister,
4589
- handleGithub: props.onGithubRegister,
4590
- handleTwitter: props.onTwitterRegister
4409
+ className: cn(dotStyles[size], dotStatusStyles[dotStatus])
4591
4410
  }
4592
- )
4593
- ) : null
4594
- )
4595
- );
4596
- };
4411
+ ),
4412
+ icon && icon,
4413
+ label
4414
+ );
4415
+ } else {
4416
+ return /* @__PURE__ */ import_react36.default.createElement(
4417
+ "span",
4418
+ {
4419
+ ...rest,
4420
+ ref,
4421
+ className: cn(
4422
+ "hawa-h-2 hawa-w-2 hawa-rounded-full",
4423
+ color ? colorStyles[color] : "hawa-border hawa-bg-none"
4424
+ )
4425
+ }
4426
+ );
4427
+ }
4428
+ }
4429
+ );
4597
4430
 
4598
- // blocks/auth/AppLanding.tsx
4599
- var import_react18 = __toESM(require("react"));
4600
- var AppLanding = ({ texts, ...props }) => {
4601
- const thirdPartyAuthTexts = {
4602
- continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
4603
- continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
4604
- continueWithApple: texts == null ? void 0 : texts.continueWithApple,
4605
- continueWithMicrosoft: texts == null ? void 0 : texts.continueWithMicrosoft,
4606
- continueWithGithub: texts == null ? void 0 : texts.continueWithGithub,
4607
- continueWithEmail: texts == null ? void 0 : texts.continueWithEmail,
4608
- continueWithPhone: texts == null ? void 0 : texts.continueWithPhone
4431
+ // elements/scrollArea/ScrollArea.tsx
4432
+ var React29 = __toESM(require("react"));
4433
+ var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"));
4434
+ var ScrollArea = React29.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
4435
+ const scrollAreaRef = React29.useRef(null);
4436
+ const isDragging = React29.useRef(false);
4437
+ const startPos = React29.useRef({ x: 0, y: 0 });
4438
+ const scrollPos = React29.useRef({ top: 0, left: 0 });
4439
+ const [showLeftFade, setShowLeftFade] = React29.useState(false);
4440
+ const [showRightFade, setShowRightFade] = React29.useState(false);
4441
+ const checkOverflow = () => {
4442
+ if (scrollAreaRef.current) {
4443
+ const { scrollLeft, scrollWidth, clientWidth } = scrollAreaRef.current;
4444
+ setShowLeftFade(scrollLeft > 0);
4445
+ setShowRightFade(scrollLeft + clientWidth < scrollWidth);
4446
+ }
4609
4447
  };
4610
- return /* @__PURE__ */ import_react18.default.createElement("div", { dir: props.direction }, /* @__PURE__ */ import_react18.default.createElement(Card, null, /* @__PURE__ */ import_react18.default.createElement(CardContent, { headless: true, className: "hawa-flex hawa-flex-col hawa-gap-6" }, /* @__PURE__ */ import_react18.default.createElement(
4611
- AuthButtons,
4612
- {
4613
- texts: thirdPartyAuthTexts,
4614
- viaApple: props.viaApple,
4615
- viaGoogle: props.viaGoogle,
4616
- viaEmail: props.viaEmail,
4617
- viaGithub: props.viaGithub,
4618
- viaMicrosoft: props.viaMicrosoft,
4619
- viaPhone: props.viaPhone,
4620
- viaTwitter: props.viaTwitter,
4621
- handleApple: props.handleApple,
4622
- handleGoogle: props.handleGoogle,
4623
- handleTwitter: props.handleTwitter,
4624
- handleMicrosoft: props.handleMicrosoft,
4625
- handleGithub: props.handleGithub,
4626
- handleEmail: props.handleEmail,
4627
- handlePhone: props.handlePhone
4448
+ const onMouseDown = (e) => {
4449
+ isDragging.current = true;
4450
+ startPos.current = { x: e.clientX, y: e.clientY };
4451
+ if (scrollAreaRef.current) {
4452
+ scrollPos.current = {
4453
+ top: scrollAreaRef.current.scrollTop,
4454
+ left: scrollAreaRef.current.scrollLeft
4455
+ };
4628
4456
  }
4629
- ), props.allowRegister && /* @__PURE__ */ import_react18.default.createElement("div", { className: "hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, texts == null ? void 0 : texts.newUserText, " ", /* @__PURE__ */ import_react18.default.createElement(
4630
- "span",
4631
- {
4632
- onClick: props.handleRouteToRegister,
4633
- className: "clickable-link"
4634
- },
4635
- texts == null ? void 0 : texts.createAccount
4636
- )))));
4637
- };
4638
-
4639
- // blocks/auth/CheckEmail.tsx
4640
- var import_react19 = __toESM(require("react"));
4641
- var CheckEmail = ({ texts, handleResend }) => {
4642
- return /* @__PURE__ */ import_react19.default.createElement(Card, null, /* @__PURE__ */ import_react19.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react19.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center hawa-text-center" }, /* @__PURE__ */ import_react19.default.createElement("div", { className: "hawa-flex hawa-h-16 hawa-w-16 hawa-flex-col hawa-items-center hawa-justify-center hawa-rounded-3xl hawa-bg-primary hawa-text-6xl hawa-font-bold hawa-text-primary-foreground" }, /* @__PURE__ */ import_react19.default.createElement(
4643
- "svg",
4644
- {
4645
- stroke: "currentColor",
4646
- fill: "none",
4647
- strokeWidth: "2",
4648
- viewBox: "0 0 24 24",
4649
- strokeLinecap: "round",
4650
- strokeLinejoin: "round",
4651
- height: "0.5em",
4652
- width: "0.5em",
4653
- xmlns: "http://www.w3.org/2000/svg"
4654
- },
4655
- /* @__PURE__ */ import_react19.default.createElement("path", { d: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" }),
4656
- /* @__PURE__ */ import_react19.default.createElement("polyline", { points: "22,6 12,13 2,6" })
4657
- )), /* @__PURE__ */ import_react19.default.createElement("div", { className: "hawa-m-2 hawa-text-xl hawa-font-bold" }, (texts == null ? void 0 : texts.checkEmail) || "Check your Email"), /* @__PURE__ */ import_react19.default.createElement("div", { className: "hawa-text-sm" }, (texts == null ? void 0 : texts.pleaseVerify) || "Thank you for signing up! To complete your registration, we've sent a verification email to the address you provided. Please check your inbox and follow the instructions in the email to activate your account."))), /* @__PURE__ */ import_react19.default.createElement(CardFooter, { className: "hawa-flex hawa-flex-col hawa-justify-center" }, /* @__PURE__ */ import_react19.default.createElement("span", { className: "clickable-link hawa-text-sm", onClick: handleResend }, (texts == null ? void 0 : texts.resendEmail) || "Resend Email")));
4658
- };
4659
-
4660
- // blocks/auth/NewPassword.tsx
4661
- var import_react20 = __toESM(require("react"));
4662
- var import_react_hook_form3 = require("react-hook-form");
4663
- var import_zod3 = require("@hookform/resolvers/zod");
4664
- var z3 = __toESM(require("zod"));
4665
- var NewPasswordForm = ({
4666
- texts,
4667
- isLoading,
4668
- ...props
4669
- }) => {
4670
- var _a, _b, _c, _d, _e, _f, _g, _h;
4671
- const formSchema = z3.object({
4672
- password: z3.string({ required_error: (_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.required }).min(8, { message: (_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.tooShort }),
4673
- confirm_password: z3.string({ required_error: (_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required }).refine((value) => value !== "", {
4674
- message: (_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required
4675
- })
4676
- }).refine((data) => data.password === data.confirm_password, {
4677
- message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
4678
- path: ["confirm_password"]
4679
- });
4680
- const { handleSubmit, control, formState } = (0, import_react_hook_form3.useForm)({
4681
- resolver: (0, import_zod3.zodResolver)(formSchema)
4682
- });
4683
- return /* @__PURE__ */ import_react20.default.createElement(Card, { dir: props.direction }, props.showSuccess ? /* @__PURE__ */ import_react20.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "hawa-text-center" }, texts == null ? void 0 : texts.passwordChanged)) : /* @__PURE__ */ import_react20.default.createElement(
4684
- "form",
4457
+ document.addEventListener("mousemove", onMouseMove);
4458
+ document.addEventListener("mouseup", onMouseUp);
4459
+ };
4460
+ const onMouseMove = (e) => {
4461
+ if (!isDragging.current || !scrollAreaRef.current) return;
4462
+ const dx = e.clientX - startPos.current.x;
4463
+ const dy = e.clientY - startPos.current.y;
4464
+ if (orientation === "vertical") {
4465
+ scrollAreaRef.current.scrollTop = scrollPos.current.top - dy;
4466
+ } else {
4467
+ scrollAreaRef.current.scrollLeft = scrollPos.current.left - dx;
4468
+ checkOverflow();
4469
+ }
4470
+ };
4471
+ const onMouseUp = () => {
4472
+ isDragging.current = false;
4473
+ document.removeEventListener("mousemove", onMouseMove);
4474
+ document.removeEventListener("mouseup", onMouseUp);
4475
+ };
4476
+ React29.useEffect(() => {
4477
+ checkOverflow();
4478
+ if (scrollAreaRef.current) {
4479
+ scrollAreaRef.current.addEventListener("scroll", checkOverflow);
4480
+ window.addEventListener("resize", checkOverflow);
4481
+ }
4482
+ return () => {
4483
+ if (scrollAreaRef.current) {
4484
+ scrollAreaRef.current.removeEventListener("scroll", checkOverflow);
4485
+ }
4486
+ window.removeEventListener("resize", checkOverflow);
4487
+ };
4488
+ }, []);
4489
+ return /* @__PURE__ */ React29.createElement(
4490
+ ScrollAreaPrimitive.Root,
4685
4491
  {
4686
- noValidate: true,
4687
- onSubmit: handleSubmit((e) => {
4688
- if (props.handleNewPassword) {
4689
- return props.handleNewPassword(e);
4690
- } else {
4691
- console.log(
4692
- "Form is submitted but handleSubmission prop is missing"
4693
- );
4694
- }
4695
- })
4492
+ ref,
4493
+ className: cn("hawa-relative hawa-overflow-hidden", className),
4494
+ ...props
4696
4495
  },
4697
- /* @__PURE__ */ import_react20.default.createElement(CardContent, { headless: true, className: "hawa-flex hawa-flex-col" }, props.showError && /* @__PURE__ */ import_react20.default.createElement(
4698
- Alert,
4699
- {
4700
- direction: props.direction,
4701
- title: props.errorTitle,
4702
- text: props.errorText,
4703
- severity: "error"
4704
- }
4705
- ), /* @__PURE__ */ import_react20.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4 hawa-mb-4" }, /* @__PURE__ */ import_react20.default.createElement(
4706
- import_react_hook_form3.Controller,
4496
+ /* @__PURE__ */ React29.createElement(
4497
+ "div",
4707
4498
  {
4708
- control,
4709
- name: "password",
4710
- render: ({ field }) => {
4711
- var _a2, _b2, _c2;
4712
- return /* @__PURE__ */ import_react20.default.createElement(
4713
- Input,
4714
- {
4715
- width: "full",
4716
- type: "password",
4717
- autoComplete: "new-password",
4718
- label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
4719
- placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
4720
- helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
4721
- ...field
4722
- }
4723
- );
4724
- }
4499
+ className: cn(
4500
+ "hawa-pointer-events-none hawa-absolute hawa-bg-background hawa-h-full hawa-w-[50px] hawa-z-10 hawa-start-0 hawa-mask-fade-right",
4501
+ showLeftFade ? "hawa-block" : "hawa-hidden"
4502
+ )
4725
4503
  }
4726
- ), /* @__PURE__ */ import_react20.default.createElement(
4727
- import_react_hook_form3.Controller,
4504
+ ),
4505
+ /* @__PURE__ */ React29.createElement(
4506
+ "div",
4728
4507
  {
4729
- control,
4730
- name: "confirm_password",
4731
- render: ({ field }) => {
4732
- var _a2, _b2, _c2;
4733
- return /* @__PURE__ */ import_react20.default.createElement(
4734
- Input,
4735
- {
4736
- width: "full",
4737
- type: "password",
4738
- autoComplete: "new-password",
4739
- label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
4740
- placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
4741
- helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
4742
- ...field
4743
- }
4744
- );
4745
- }
4508
+ className: cn(
4509
+ "hawa-pointer-events-none hawa-absolute hawa-bg-background hawa-mask-fade-left hawa-end-0 hawa-h-full hawa-w-[50px] hawa-z-10",
4510
+ showRightFade ? "hawa-block" : "hawa-hidden"
4511
+ )
4746
4512
  }
4747
- )), /* @__PURE__ */ import_react20.default.createElement(Button, { className: "hawa-w-full", type: "submit", isLoading }, texts == null ? void 0 : texts.updatePassword), props.allowRegister && /* @__PURE__ */ import_react20.default.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, (_g = texts == null ? void 0 : texts.dontHaveAccount) != null ? _g : "Don't have an account? ", /* @__PURE__ */ import_react20.default.createElement(
4748
- "span",
4513
+ ),
4514
+ /* @__PURE__ */ React29.createElement(
4515
+ ScrollAreaPrimitive.Viewport,
4749
4516
  {
4750
- className: "clickable-link",
4751
- onClick: props.handleRouteToRegister
4517
+ ref: scrollAreaRef,
4518
+ className: "hawa-h-full hawa-w-full hawa-rounded-[inherit]",
4519
+ onMouseDown
4752
4520
  },
4753
- (_h = texts == null ? void 0 : texts.registerText) != null ? _h : "Register"
4754
- )))
4755
- ));
4756
- };
4521
+ children
4522
+ ),
4523
+ /* @__PURE__ */ React29.createElement(ScrollBar, { orientation }),
4524
+ /* @__PURE__ */ React29.createElement(ScrollAreaPrimitive.Corner, null)
4525
+ );
4526
+ });
4527
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
4528
+ var ScrollBar = React29.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React29.createElement(
4529
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
4530
+ {
4531
+ ref,
4532
+ orientation,
4533
+ className: cn(
4534
+ "hawa-flex hawa-touch-none hawa-select-none hawa-transition-colors",
4535
+ orientation === "vertical" && "hawa-h-full hawa-w-2.5 hawa-border-l hawa-border-l-transparent hawa-p-[1px]",
4536
+ orientation === "horizontal" && "hawa-h-2.5 hawa-border-t hawa-border-t-transparent hawa-p-[1px]",
4537
+ className
4538
+ ),
4539
+ ...props
4540
+ },
4541
+ /* @__PURE__ */ React29.createElement(
4542
+ ScrollAreaPrimitive.ScrollAreaThumb,
4543
+ {
4544
+ className: cn(
4545
+ "hawa-relative hawa-rounded-full hawa-bg-border",
4546
+ orientation === "vertical" && "hawa-flex-1"
4547
+ )
4548
+ }
4549
+ )
4550
+ ));
4551
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
4757
4552
 
4758
- // blocks/auth/ResetPassword.tsx
4759
- var import_react21 = __toESM(require("react"));
4760
- var import_react_hook_form4 = require("react-hook-form");
4761
- var import_zod4 = require("@hookform/resolvers/zod");
4762
- var z4 = __toESM(require("zod"));
4763
- var ResetPasswordForm = ({
4764
- allowRegister = true,
4765
- isLoading,
4766
- ...props
4767
- }) => {
4768
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
4769
- const formSchema = z4.object({
4770
- email: z4.string({
4771
- required_error: ((_b = (_a = props.texts) == null ? void 0 : _a.email) == null ? void 0 : _b.required) || "Email is required"
4772
- }).email({ message: ((_d = (_c = props.texts) == null ? void 0 : _c.email) == null ? void 0 : _d.invalid) || "Invalid email" }).min(1, { message: ((_f = (_e = props.texts) == null ? void 0 : _e.email) == null ? void 0 : _f.required) || "Email is required" })
4773
- });
4774
- const { handleSubmit, control, formState } = (0, import_react_hook_form4.useForm)({
4775
- resolver: (0, import_zod4.zodResolver)(formSchema)
4776
- });
4777
- return /* @__PURE__ */ import_react21.default.createElement(Card, { dir: props.direction }, !props.sent ? /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, !props.headless && /* @__PURE__ */ import_react21.default.createElement(CardHeader, null, /* @__PURE__ */ import_react21.default.createElement(CardTitle, null, ((_g = props.texts) == null ? void 0 : _g.headTitle) || "Reset Password"), /* @__PURE__ */ import_react21.default.createElement(CardDescription, null, ((_h = props.texts) == null ? void 0 : _h.headDescription) || "Enter your email to reset your account password")), /* @__PURE__ */ import_react21.default.createElement(
4778
- "form",
4553
+ // elements/tabs/Tabs.tsx
4554
+ var tabsListVariant = (0, import_tailwind_variants.tv)({
4555
+ base: "",
4556
+ variants: {
4557
+ variant: {
4558
+ default: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-border hawa-bg-muted hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
4559
+ underlined: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
4560
+ underlined_tabs: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-text-muted-foreground"
4561
+ },
4562
+ orientation: { horizontal: "", vertical: "" }
4563
+ },
4564
+ compoundVariants: [
4779
4565
  {
4780
- noValidate: true,
4781
- onSubmit: handleSubmit((e) => {
4782
- if (props.handleResetPassword) {
4783
- return props.handleResetPassword(e);
4784
- } else {
4785
- console.log("handleResetPassword prop is missing");
4786
- }
4787
- })
4566
+ variant: "underlined_tabs",
4567
+ orientation: "vertical",
4568
+ class: "hawa-border-e-2 hawa-border-e-primary"
4788
4569
  },
4789
- /* @__PURE__ */ import_react21.default.createElement(CardContent, { headless: props.headless, className: "hawa-pb-4" }, props.showError && /* @__PURE__ */ import_react21.default.createElement(
4790
- Alert,
4791
- {
4792
- direction: props.direction,
4793
- title: props.errorTitle,
4794
- text: props.errorText,
4795
- severity: "error"
4796
- }
4797
- ), /* @__PURE__ */ import_react21.default.createElement(
4798
- import_react_hook_form4.Controller,
4799
- {
4800
- control,
4801
- name: "email",
4802
- render: ({ field }) => {
4803
- var _a2, _b2, _c2, _d2, _e2;
4804
- return /* @__PURE__ */ import_react21.default.createElement(
4805
- Input,
4806
- {
4807
- width: "full",
4808
- label: ((_b2 = (_a2 = props.texts) == null ? void 0 : _a2.email) == null ? void 0 : _b2.label) || "Email",
4809
- helperText: (_c2 = formState.errors.email) == null ? void 0 : _c2.message,
4810
- placeholder: (_e2 = (_d2 = props.texts) == null ? void 0 : _d2.email) == null ? void 0 : _e2.placeholder,
4811
- ...field,
4812
- onChange: (e) => {
4813
- field.onChange(e.target.value.toLowerCase().trim());
4814
- }
4815
- }
4816
- );
4817
- }
4818
- }
4819
- )),
4820
- /* @__PURE__ */ import_react21.default.createElement(CardFooter, { className: "hawa-flex hawa-flex-col" }, /* @__PURE__ */ import_react21.default.createElement(
4821
- Button,
4822
- {
4823
- type: "submit",
4824
- className: "hawa-w-full",
4825
- isLoading
4826
- },
4827
- ((_i = props.texts) == null ? void 0 : _i.resetPassword) || "Reset Password"
4828
- ), allowRegister && /* @__PURE__ */ import_react21.default.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, (_k = (_j = props.texts) == null ? void 0 : _j.dontHaveAccount) != null ? _k : "Don't have an account? ", /* @__PURE__ */ import_react21.default.createElement(
4829
- "span",
4570
+ {
4571
+ variant: "underlined_tabs",
4572
+ orientation: "horizontal",
4573
+ class: "hawa-border-b-2 hawa-border-b-primary"
4574
+ }
4575
+ ],
4576
+ defaultVariants: { variant: "default", orientation: "horizontal" }
4577
+ });
4578
+ var tabsTriggerVariant = (0, import_tailwind_variants.tv)({
4579
+ base: "",
4580
+ variants: {
4581
+ variant: {
4582
+ default: "hawa-inline-flex hawa-w-full hawa-flex-1 hawa-select-none hawa-items-center hawa-justify-center hawa-gap-2 hawa-whitespace-nowrap hawa-rounded hawa-border hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-all focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50 data-[state=active]:hawa-bg-primary data-[state=active]:hawa-text-primary-foreground data-[state=active]:hawa-shadow-sm dark:hawa-border-primary/10",
4583
+ underlined: "hawa-inline-flex hawa-w-full hawa-flex-1 hawa-select-none hawa-items-center hawa-justify-center hawa-gap-2 hawa-whitespace-nowrap hawa-rounded hawa-rounded-none hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-all focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50",
4584
+ underlined_tabs: "hawa-inline-flex hawa-w-full hawa-flex-1 hawa-select-none hawa-items-center hawa-justify-center hawa-gap-2 hawa-whitespace-nowrap hawa-rounded hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-all focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50 hawa-bg-primary/10 data-[state=active]:hawa-bg-primary data-[state=active]:hawa-text-primary-foreground dark:hawa-border-primary/10"
4585
+ },
4586
+ orientation: { horizontal: "", vertical: "" }
4587
+ },
4588
+ compoundVariants: [
4589
+ {
4590
+ variant: "underlined",
4591
+ orientation: "horizontal",
4592
+ class: "data-[state=active]:hawa-border-b-primary hawa-border-b hawa-border-b-2"
4593
+ },
4594
+ {
4595
+ variant: "underlined",
4596
+ orientation: "vertical",
4597
+ class: "data-[state=active]:hawa-border-e-primary hawa-border-e hawa-border-e-2"
4598
+ },
4599
+ {
4600
+ variant: "underlined_tabs",
4601
+ orientation: "horizontal",
4602
+ class: "hawa-rounded-b-none"
4603
+ },
4604
+ {
4605
+ variant: "underlined_tabs",
4606
+ orientation: "vertical",
4607
+ class: "hawa-rounded-e-none"
4608
+ }
4609
+ ],
4610
+ defaultVariants: { variant: "default", orientation: "horizontal" }
4611
+ });
4612
+ var TabsContext = React30.createContext({ orientation: "horizontal", variant: "default", scrollable: false });
4613
+ var Tabs = React30.forwardRef(
4614
+ ({ className, orientation, scrollable, variant = "default", ...props }, ref) => /* @__PURE__ */ React30.createElement(
4615
+ TabsPrimitive.Root,
4616
+ {
4617
+ ref,
4618
+ className: cn(
4619
+ "hawa-flex hawa-gap-2",
4620
+ orientation === "vertical" ? "hawa-flex-row" : "hawa-flex-col",
4621
+ className
4622
+ ),
4623
+ ...props
4624
+ },
4625
+ /* @__PURE__ */ React30.createElement(TabsContext.Provider, { value: { orientation, variant, scrollable } }, props.children)
4626
+ )
4627
+ );
4628
+ var TabsList = React30.forwardRef(({ className, classNames, ...props }, ref) => {
4629
+ const { orientation, variant, scrollable } = React30.useContext(TabsContext);
4630
+ const { width } = useViewportSize();
4631
+ if (scrollable && width < 768 && orientation === "horizontal") {
4632
+ return /* @__PURE__ */ React30.createElement(ScrollArea, { orientation: "horizontal", className: classNames == null ? void 0 : classNames.scrollArea }, /* @__PURE__ */ React30.createElement(
4633
+ TabsPrimitive.List,
4830
4634
  {
4831
- className: "clickable-link",
4832
- onClick: props.handleRouteToRegister
4833
- },
4834
- (_m = (_l = props.texts) == null ? void 0 : _l.registerText) != null ? _m : "Register"
4835
- )))
4836
- )) : /* @__PURE__ */ import_react21.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react21.default.createElement("div", { className: "hawa-text-center" }, ((_n = props.texts) == null ? void 0 : _n.emailSentText) || "An email has been sent with a link to set a new password")));
4837
- };
4838
-
4839
- // blocks/auth/CodeConfirmation.tsx
4840
- var import_react24 = __toESM(require("react"));
4841
- var import_react_hook_form5 = require("react-hook-form");
4842
- var import_zod5 = require("@hookform/resolvers/zod");
4843
- var z5 = __toESM(require("zod"));
4844
-
4845
- // elements/pinInput/PinInput.tsx
4846
- var React25 = __toESM(require("react"));
4847
- var import_input_otp = require("input-otp");
4848
-
4849
- // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
4850
- var import_react23 = require("react");
4851
-
4852
- // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
4853
- var toKebabCase = (string9) => string9.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4854
- var mergeClasses = (...classes) => classes.filter((className, index, array) => {
4855
- return Boolean(className) && array.indexOf(className) === index;
4856
- }).join(" ");
4857
-
4858
- // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
4859
- var import_react22 = require("react");
4860
-
4861
- // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
4862
- var defaultAttributes = {
4863
- xmlns: "http://www.w3.org/2000/svg",
4864
- width: 24,
4865
- height: 24,
4866
- viewBox: "0 0 24 24",
4867
- fill: "none",
4868
- stroke: "currentColor",
4869
- strokeWidth: 2,
4870
- strokeLinecap: "round",
4871
- strokeLinejoin: "round"
4872
- };
4873
-
4874
- // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
4875
- var Icon = (0, import_react22.forwardRef)(
4876
- ({
4877
- color = "currentColor",
4878
- size = 24,
4879
- strokeWidth = 2,
4880
- absoluteStrokeWidth,
4881
- className = "",
4882
- children,
4883
- iconNode,
4884
- ...rest
4885
- }, ref) => {
4886
- return (0, import_react22.createElement)(
4887
- "svg",
4635
+ ref,
4636
+ className: cn(
4637
+ tabsListVariant({ variant, orientation }),
4638
+ "hawa-flex-row hawa-flex-nowrap",
4639
+ className
4640
+ ),
4641
+ ...props
4642
+ }
4643
+ ));
4644
+ } else {
4645
+ return /* @__PURE__ */ React30.createElement(
4646
+ TabsPrimitive.List,
4888
4647
  {
4889
4648
  ref,
4890
- ...defaultAttributes,
4891
- width: size,
4892
- height: size,
4893
- stroke: color,
4894
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
4895
- className: mergeClasses("lucide", className),
4896
- ...rest
4897
- },
4898
- [
4899
- ...iconNode.map(([tag, attrs]) => (0, import_react22.createElement)(tag, attrs)),
4900
- ...Array.isArray(children) ? children : [children]
4901
- ]
4649
+ className: cn(
4650
+ tabsListVariant({ variant, orientation }),
4651
+ orientation === "vertical" ? "hawa-flex-col" : "hawa-flex-row",
4652
+ "hawa-flex-wrap",
4653
+ className
4654
+ ),
4655
+ ...props
4656
+ }
4902
4657
  );
4903
4658
  }
4659
+ });
4660
+ var TabsTrigger = React30.forwardRef(
4661
+ ({ className, chipProps, withPopover = false, onPopoverClick, ...props }, ref) => {
4662
+ const { orientation, variant } = React30.useContext(TabsContext);
4663
+ if (withPopover) {
4664
+ return /* @__PURE__ */ React30.createElement(Popover.Root, { open: props.showPopover }, /* @__PURE__ */ React30.createElement(Popover.Anchor, { asChild: true }, /* @__PURE__ */ React30.createElement(
4665
+ TabsPrimitive.Trigger,
4666
+ {
4667
+ className: cn(
4668
+ tabsTriggerVariant({ variant, orientation }),
4669
+ "hawa-relative",
4670
+ className
4671
+ ),
4672
+ ...props
4673
+ },
4674
+ props.children,
4675
+ chipProps && /* @__PURE__ */ React30.createElement(Chip, { ...chipProps })
4676
+ )), /* @__PURE__ */ React30.createElement(
4677
+ Popover.Content,
4678
+ {
4679
+ onClick: onPopoverClick,
4680
+ asChild: true,
4681
+ className: cn(
4682
+ "dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-bg-popover hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
4683
+ "hawa-arrow-default-top hawa-mt-2"
4684
+ )
4685
+ },
4686
+ /* @__PURE__ */ React30.createElement("div", { className: "hawa-p-2" }, " ", props.popoverContent)
4687
+ ));
4688
+ } else {
4689
+ return /* @__PURE__ */ React30.createElement(
4690
+ TabsPrimitive.Trigger,
4691
+ {
4692
+ className: cn(
4693
+ tabsTriggerVariant({ variant, orientation }),
4694
+ "hawa-relative",
4695
+ className
4696
+ ),
4697
+ ...props
4698
+ },
4699
+ props.children,
4700
+ chipProps && /* @__PURE__ */ React30.createElement(Chip, { ...chipProps })
4701
+ );
4702
+ }
4703
+ }
4904
4704
  );
4905
-
4906
- // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
4907
- var createLucideIcon = (iconName, iconNode) => {
4908
- const Component = (0, import_react23.forwardRef)(
4909
- ({ className, ...props }, ref) => (0, import_react23.createElement)(Icon, {
4910
- ref,
4911
- iconNode,
4912
- className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
4913
- ...props
4914
- })
4915
- );
4916
- Component.displayName = `${iconName}`;
4917
- return Component;
4918
- };
4919
-
4920
- // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
4921
- var Dot = createLucideIcon("Dot", [
4922
- ["circle", { cx: "12.1", cy: "12.1", r: "1", key: "18d7e5" }]
4923
- ]);
4924
-
4925
- // elements/pinInput/PinInput.tsx
4926
- var PinInputRoot = React25.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ React25.createElement(
4927
- import_input_otp.OTPInput,
4705
+ var TabsContent = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React30.createElement(
4706
+ TabsPrimitive.Content,
4928
4707
  {
4929
4708
  ref,
4930
- containerClassName: cn(
4931
- "hawa-flex hawa-items-center hawa-gap-2 has-[:disabled]:hawa-opacity-50",
4932
- containerClassName
4709
+ className: cn(
4710
+ "hawa-ring-offset-hawa-background hawa-w-full focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2",
4711
+ className
4933
4712
  ),
4934
- className: cn("disabled:hawa-cursor-not-allowed", className),
4935
4713
  ...props
4936
4714
  }
4937
4715
  ));
4938
- PinInputRoot.displayName = "PinInputRoot";
4939
- var PinInputGroup = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25.createElement(
4940
- "div",
4941
- {
4942
- ref,
4943
- className: cn("hawa-flex hawa-items-center", className),
4944
- ...props
4716
+ Tabs.displayName = TabsPrimitive.Root.displayName;
4717
+ TabsList.displayName = TabsPrimitive.List.displayName;
4718
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
4719
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
4720
+
4721
+ // blocks/auth/RegisterForm.tsx
4722
+ var RegisterForm = ({
4723
+ texts,
4724
+ registerFields = ["email"],
4725
+ minPasswordLength = 8,
4726
+ showTermsOption = false,
4727
+ showNewsletterOption = false,
4728
+ registerTypes,
4729
+ ...props
4730
+ }) => {
4731
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
4732
+ const [passwordVisible, setPasswordVisible] = (0, import_react37.useState)(false);
4733
+ const [selectedRegisterType, setSelectedRegisterType] = (0, import_react37.useState)({
4734
+ value: ((_a = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _a.value) || "password",
4735
+ label: ((_b = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _b.label) || "Password"
4736
+ });
4737
+ const thirdPartyAuthTexts = {
4738
+ continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
4739
+ continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
4740
+ continueWithApple: texts == null ? void 0 : texts.continueWithApple,
4741
+ continueWithMicrosoft: texts == null ? void 0 : texts.continueWithMicrosoft,
4742
+ continueWithGithub: texts == null ? void 0 : texts.continueWithGithub,
4743
+ continueWithEmail: texts == null ? void 0 : texts.continueWithEmail,
4744
+ continueWithPhone: texts == null ? void 0 : texts.continueWithPhone
4745
+ };
4746
+ const methods = (0, import_react_hook_form2.useForm)();
4747
+ let fieldSchemas = {};
4748
+ const hasPhoneType = registerTypes == null ? void 0 : registerTypes.some((type) => type.value === "phone");
4749
+ if (hasPhoneType && selectedRegisterType.value === "phone") {
4750
+ registerFields = ["phone"];
4945
4751
  }
4946
- ));
4947
- PinInputGroup.displayName = "PinInputGroup";
4948
- var PinInputSlot = React25.forwardRef(({ index, className, ...props }, ref) => {
4949
- const pinInputContext = React25.useContext(import_input_otp.OTPInputContext);
4950
- const { char, hasFakeCaret, isActive } = pinInputContext.slots[index];
4951
- return /* @__PURE__ */ React25.createElement(
4952
- "div",
4953
- {
4954
- ref,
4955
- className: cn(
4956
- "hawa-border-input hawa-relative hawa-flex hawa-h-10 hawa-w-10 hawa-items-center hawa-justify-center hawa-border-y hawa-border-r hawa-text-sm hawa-transition-all first:hawa-rounded-l-md first:hawa-border-l last:hawa-rounded-r-md",
4957
- isActive && "hawa-ring-ring hawa-ring-offset-background hawa-z-10 hawa-ring-2",
4958
- className
4959
- ),
4960
- ...props
4961
- },
4962
- char,
4963
- hasFakeCaret && /* @__PURE__ */ React25.createElement("div", { className: "hawa-pointer-events-none hawa-absolute hawa-inset-0 hawa-flex hawa-items-center hawa-justify-center" }, /* @__PURE__ */ React25.createElement("div", { className: "hawa-animate-caret-blink hawa-bg-foreground hawa-h-4 hawa-w-px hawa-duration-1000" }))
4964
- );
4965
- });
4966
- PinInputSlot.displayName = "PinInputSlot";
4967
- var PinInputSeperator = React25.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React25.createElement("div", { ref, role: "separator", ...props }, /* @__PURE__ */ React25.createElement(Dot, null)));
4968
- PinInputSeperator.displayName = "PinInputSeperator";
4969
- var PinInput = ({
4970
- separatorPosition = 0,
4971
- ...props
4972
- }) => {
4973
- const maxLength = props.maxLength || 6;
4974
- const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
4975
- const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
4976
- const secondGroupLength = maxLength - firstGroupLength;
4977
- return /* @__PURE__ */ React25.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, /* @__PURE__ */ React25.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React25.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React25.createElement(
4978
- PinInputSlot,
4979
- {
4980
- key: index,
4981
- index,
4982
- className: "hawa-w-full hawa-border"
4983
- }
4984
- ))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React25.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React25.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React25.createElement(
4985
- PinInputSlot,
4986
- {
4987
- key: index + firstGroupLength,
4988
- index: index + firstGroupLength,
4989
- className: "hawa-w-full hawa-border"
4752
+ registerFields.forEach((field) => {
4753
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
4754
+ switch (field) {
4755
+ case "fullname":
4756
+ fieldSchemas["fullName"] = z2.string().optional();
4757
+ break;
4758
+ case "email":
4759
+ fieldSchemas["email"] = z2.string({
4760
+ required_error: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.required) || "Email is required"
4761
+ }).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" });
4762
+ break;
4763
+ case "username":
4764
+ fieldSchemas["username"] = z2.string({
4765
+ required_error: ((_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.required) || "Username is required"
4766
+ }).min(1, {
4767
+ message: ((_e2 = texts == null ? void 0 : texts.username) == null ? void 0 : _e2.required) || "Username is required"
4768
+ }).max(14, {
4769
+ message: ((_f2 = texts == null ? void 0 : texts.username) == null ? void 0 : _f2.tooLong) || "Username is too long"
4770
+ }).refine(
4771
+ (value) => {
4772
+ const isValid = /^[a-zA-Z][a-zA-Z0-9_-]{2,14}$/.test(value);
4773
+ return isValid;
4774
+ },
4775
+ { message: ((_g2 = texts == null ? void 0 : texts.username) == null ? void 0 : _g2.invalid) || "Invalid username" }
4776
+ );
4777
+ break;
4778
+ case "phone":
4779
+ fieldSchemas["phone"] = z2.string({
4780
+ required_error: ((_h2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _h2.required) || "Phone Number Required"
4781
+ }).refine(
4782
+ (value) => {
4783
+ let isPhoneValid = (0, import_libphonenumber_js2.isPossiblePhoneNumber)(value) && (0, import_libphonenumber_js2.isValidPhoneNumber)(value) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(value) === void 0;
4784
+ return isPhoneValid;
4785
+ },
4786
+ { message: ((_i2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _i2.invalid) || "Phone Number Invalid" }
4787
+ );
4788
+ break;
4990
4789
  }
4991
- )))), /* @__PURE__ */ React25.createElement(HelperText, { helperText: props.helperText }));
4992
- };
4993
-
4994
- // blocks/auth/CodeConfirmation.tsx
4995
- var CodeConfirmation = ({
4996
- codeLength = 6,
4997
- ...props
4998
- }) => {
4999
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5000
- const formSchema = z5.object({
5001
- otp_code: z5.string({ required_error: (_a = props.texts) == null ? void 0 : _a.codeRequiredText }).min(codeLength, { message: (_b = props.texts) == null ? void 0 : _b.codeTooShort })
5002
4790
  });
5003
- const { handleSubmit, control, formState, setValue } = (0, import_react_hook_form5.useForm)({
5004
- resolver: (0, import_zod5.zodResolver)(formSchema)
4791
+ let formSchema;
4792
+ if (selectedRegisterType.value === "phone") {
4793
+ formSchema = z2.object({
4794
+ phone: z2.string({
4795
+ required_error: ((_c = texts == null ? void 0 : texts.phone) == null ? void 0 : _c.required) || "Phone Number Required"
4796
+ }).refine(
4797
+ (value) => {
4798
+ let isPhoneValid = (0, import_libphonenumber_js2.isPossiblePhoneNumber)(value) && (0, import_libphonenumber_js2.isValidPhoneNumber)(value) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(value) === void 0;
4799
+ return isPhoneValid;
4800
+ },
4801
+ { message: ((_d = texts == null ? void 0 : texts.phone) == null ? void 0 : _d.invalid) || "Phone Number Invalid" }
4802
+ ),
4803
+ refCode: z2.string().optional(),
4804
+ reference: z2.string().optional(),
4805
+ terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
4806
+ message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
4807
+ }),
4808
+ newsletter_accepted: z2.boolean().optional()
4809
+ });
4810
+ } else {
4811
+ formSchema = z2.object({
4812
+ ...fieldSchemas,
4813
+ password: z2.string({
4814
+ required_error: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password is required"
4815
+ }).min(minPasswordLength, {
4816
+ message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password is too short"
4817
+ }).refine((value) => value !== "", {
4818
+ message: ((_g = texts == null ? void 0 : texts.password) == null ? void 0 : _g.required) || "Password is required"
4819
+ }),
4820
+ confirm_password: z2.string({
4821
+ required_error: ((_h = texts == null ? void 0 : texts.confirm) == null ? void 0 : _h.required) || "Confirm password required"
4822
+ }).min(minPasswordLength, {
4823
+ message: ((_i = texts == null ? void 0 : texts.password) == null ? void 0 : _i.tooShort) || "Password is too short"
4824
+ }).refine((value) => value !== "", {
4825
+ message: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Confirm password is required"
4826
+ }),
4827
+ refCode: z2.string().optional(),
4828
+ reference: z2.string().optional(),
4829
+ terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
4830
+ message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
4831
+ }),
4832
+ newsletter_accepted: z2.boolean().optional()
4833
+ }).refine((data) => data.password === data.confirm_password, {
4834
+ message: ((_k = texts == null ? void 0 : texts.confirm) == null ? void 0 : _k.dontMatch) || "Passwords don't match",
4835
+ path: ["confirm_password"]
4836
+ });
4837
+ }
4838
+ const { handleSubmit, control, formState } = (0, import_react_hook_form2.useForm)({
4839
+ resolver: (0, import_zod2.zodResolver)(formSchema)
5005
4840
  });
5006
- const [resendTimer, setResendTimer] = (0, import_react24.useState)(null);
5007
- const [remainingTime, setRemainingTime] = (0, import_react24.useState)(0);
5008
- const [showResendTimer, setShowResendTimer] = (0, import_react24.useState)(false);
5009
- const startResendTimer = () => {
5010
- if (resendTimer !== null) {
5011
- clearInterval(resendTimer);
5012
- setResendTimer(null);
5013
- }
5014
- const timerDuration = 60;
5015
- setRemainingTime(timerDuration);
5016
- setShowResendTimer(true);
5017
- const newTimer = window.setInterval(() => {
5018
- setRemainingTime((prevTime) => {
5019
- if (prevTime > 0) {
5020
- return prevTime - 1;
5021
- } else {
5022
- clearInterval(newTimer);
5023
- setShowResendTimer(false);
5024
- return 0;
5025
- }
5026
- });
5027
- }, 1e3);
5028
- setResendTimer(newTimer);
5029
- };
5030
- (0, import_react24.useEffect)(() => {
5031
- return () => {
5032
- if (resendTimer !== null) {
5033
- clearInterval(resendTimer);
5034
- }
5035
- };
5036
- }, []);
5037
- return /* @__PURE__ */ import_react24.default.createElement(Card, null, /* @__PURE__ */ import_react24.default.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ import_react24.default.createElement(
5038
- Alert,
5039
- {
5040
- title: props.errorTitle,
5041
- text: props.errorText,
5042
- severity: "error"
5043
- }
5044
- ), /* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourPhone) || "Please check your phone"), /* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ import_react24.default.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ import_react24.default.createElement("span", null, props.phoneNumber))), /* @__PURE__ */ import_react24.default.createElement(
5045
- "form",
4841
+ return /* @__PURE__ */ import_react37.default.createElement("div", { className: cn("hawa-flex hawa-flex-col", (_l = props.classNames) == null ? void 0 : _l.root) }, /* @__PURE__ */ import_react37.default.createElement(
4842
+ Card,
5046
4843
  {
5047
- noValidate: true,
5048
- onSubmit: handleSubmit((e) => {
5049
- if (props.onConfirm) {
5050
- return props.onConfirm(e);
5051
- } else {
5052
- console.log("Form is submitted but onConfirm prop is missing");
5053
- }
5054
- })
4844
+ dir: props.direction,
4845
+ className: cn(
4846
+ (_m = props.classNames) == null ? void 0 : _m.card,
4847
+ props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
4848
+ )
5055
4849
  },
5056
- /* @__PURE__ */ import_react24.default.createElement(
5057
- import_react_hook_form5.Controller,
5058
- {
5059
- control,
5060
- name: "otp_code",
5061
- render: ({ field }) => {
5062
- var _a2;
5063
- return /* @__PURE__ */ import_react24.default.createElement(
5064
- PinInput,
5065
- {
5066
- maxLength: codeLength,
5067
- helperText: (_a2 = formState.errors.otp_code) == null ? void 0 : _a2.message,
5068
- ...field
5069
- }
5070
- );
5071
- }
5072
- }
5073
- ),
5074
- showResendTimer ? /* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, (_e = props.texts) == null ? void 0 : _e.resendCodeTimer, " ", /* @__PURE__ */ import_react24.default.createElement("strong", null, remainingTime), " ", (_f = props.texts) == null ? void 0 : _f.seconds) : /* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, /* @__PURE__ */ import_react24.default.createElement("span", null, (_h = (_g = props.texts) == null ? void 0 : _g.didntGetCode) != null ? _h : "Didn't get the code?"), " ", /* @__PURE__ */ import_react24.default.createElement(
5075
- "span",
4850
+ /* @__PURE__ */ import_react37.default.createElement(
4851
+ CardContent,
5076
4852
  {
5077
- className: "clickable-link",
5078
- onClick: () => {
5079
- startResendTimer();
5080
- props.onResend();
5081
- }
4853
+ headless: registerTypes ? registerTypes.length <= 1 : true,
4854
+ noPadding: props.cardless
5082
4855
  },
5083
- ((_i = props.texts) == null ? void 0 : _i.resendCode) || "Click to resend"
5084
- )),
5085
- /* @__PURE__ */ import_react24.default.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ import_react24.default.createElement(
5086
- Button,
5087
- {
5088
- type: "button",
5089
- onClick: () => {
5090
- if (props.onCancel) {
5091
- return props.onCancel();
5092
- } else {
5093
- console.log(
5094
- "Cancel button clicked but onCancel prop is missing"
5095
- );
4856
+ /* @__PURE__ */ import_react37.default.createElement("div", null, props.showError && /* @__PURE__ */ import_react37.default.createElement(
4857
+ Alert,
4858
+ {
4859
+ direction: props.direction,
4860
+ title: props.errorTitle,
4861
+ text: props.errorText,
4862
+ severity: "error",
4863
+ onAlertClosed: () => {
4864
+ if (props.onErrorDismissed) {
4865
+ props.onErrorDismissed();
4866
+ }
5096
4867
  }
4868
+ }
4869
+ ), /* @__PURE__ */ import_react37.default.createElement(import_react_hook_form2.FormProvider, { ...methods }, /* @__PURE__ */ import_react37.default.createElement(
4870
+ "form",
4871
+ {
4872
+ noValidate: true,
4873
+ onSubmit: handleSubmit((e) => {
4874
+ if (props.onRegister) {
4875
+ return props.onRegister(e);
4876
+ } else {
4877
+ console.log("Form is submitted but onRegister prop is missing");
4878
+ }
4879
+ }),
4880
+ className: "hawa-flex hawa-flex-col hawa-gap-4"
5097
4881
  },
5098
- variant: "outline"
5099
- },
5100
- ((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"
5101
- ), /* @__PURE__ */ import_react24.default.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
5102
- )));
5103
- };
5104
-
5105
- // blocks/feedback/UserReferralSource.tsx
5106
- var import_react26 = __toESM(require("react"));
5107
- var import_react_hook_form6 = require("react-hook-form");
5108
- var import_zod6 = require("@hookform/resolvers/zod");
5109
- var z6 = __toESM(require("zod"));
5110
-
5111
- // elements/radio/Radio.tsx
5112
- var import_react25 = __toESM(require("react"));
5113
- var import_react_tabs = require("@radix-ui/react-tabs");
5114
-
5115
- // elements/popover/Popover.tsx
5116
- var React27 = __toESM(require("react"));
5117
- var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
5118
- var PopoverContent = React27.forwardRef(
5119
- ({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ React27.createElement(PopoverPrimitive.Portal, { container }, /* @__PURE__ */ React27.createElement(
5120
- PopoverPrimitive.Content,
5121
- {
5122
- ref,
5123
- align,
5124
- sideOffset,
5125
- className: cn(
5126
- "dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-bg-popover hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
5127
- className
5128
- ),
5129
- ...props
5130
- }
5131
- ))
5132
- );
5133
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
5134
- var Popover = ({
5135
- trigger,
5136
- children,
5137
- className,
5138
- align = "center",
5139
- side,
5140
- sideOffset = 4,
5141
- open,
5142
- width = "default",
5143
- disableTrigger,
5144
- contentProps,
5145
- triggerProps,
5146
- ...props
5147
- }) => {
5148
- let widthStyles = {
5149
- trigger: "var(--radix-popover-trigger-width)",
5150
- default: "auto"
5151
- };
5152
- return /* @__PURE__ */ React27.createElement(PopoverPrimitive.Root, { open, ...props }, /* @__PURE__ */ React27.createElement(
5153
- PopoverPrimitive.Trigger,
5154
- {
5155
- className: "hawa-w-full",
5156
- disabled: disableTrigger,
5157
- ...triggerProps
5158
- },
5159
- trigger
5160
- ), /* @__PURE__ */ React27.createElement(
5161
- PopoverContent,
5162
- {
5163
- side,
5164
- className,
5165
- align,
5166
- sideOffset,
5167
- style: {
5168
- width: widthStyles[width],
5169
- maxWidth: "var(--radix-popover-content-available-width)",
5170
- maxHeight: "var(--radix-popover-content-available-height)"
5171
- },
5172
- ...contentProps
5173
- },
5174
- children
5175
- ));
5176
- };
5177
- var PopoverTrigger = PopoverPrimitive.Trigger;
5178
- var PopoverRoot = PopoverPrimitive.Root;
5179
-
5180
- // elements/radio/Radio.tsx
5181
- var Radio = (0, import_react25.forwardRef)(
5182
- ({
5183
- design = "default",
5184
- width = "default",
5185
- size = "default",
5186
- orientation = "horizontal",
5187
- name,
5188
- labelProps,
5189
- tabsContainerClassName,
5190
- forceHideHelperText = false,
5191
- onChange,
5192
- containerClassNames,
5193
- ...props
5194
- }, ref) => {
5195
- var _a, _b, _c;
5196
- let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
5197
- let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
5198
- ${props.disabled ? "" : "hover:hawa-bg-muted"}`;
5199
- let orientationStyle = {
5200
- horizontal: "hawa-flex hawa-flex-row",
5201
- vertical: "hawa-flex hawa-flex-col"
5202
- };
5203
- let tabSizeStyle = {
5204
- default: "hawa-py-2 hawa-px-4 hawa-text-sm",
5205
- lg: "hawa-py-2 hawa-px-4",
5206
- sm: "hawa-p-1.5 hawa-text-xs",
5207
- xs: "hawa-p-1 hawa-text-[10px]"
5208
- };
5209
- let widthStyle = {
5210
- none: "",
5211
- default: "hawa-max-w-fit",
5212
- full: "hawa-w-full"
5213
- };
5214
- const [parentDirection, setParentDirection] = import_react25.default.useState(
5215
- null
5216
- );
5217
- const [selectedOption, setSelectedOption] = (0, import_react25.useState)(
5218
- props.defaultValue || props.value
5219
- );
5220
- const [openTooltip, setOpenTooltip] = (0, import_react25.useState)(null);
5221
- const parentRef = (0, import_react25.useRef)(null);
5222
- (0, import_react25.useEffect)(() => {
5223
- var _a2;
5224
- const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
5225
- if (parentNode) {
5226
- const dir = window.getComputedStyle(parentNode).direction;
5227
- setParentDirection(dir);
5228
- }
5229
- });
5230
- const handleChange = (opt) => {
5231
- setSelectedOption(opt.value);
5232
- if (onChange) {
5233
- onChange(opt.value);
5234
- } else {
5235
- console.log("onChange was not provided");
5236
- }
5237
- };
5238
- const radio_option_tabs_styling = [
5239
- "hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
5240
- !props.disabled && "hawa-cursor-pointer",
5241
- orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
5242
- orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
5243
- orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
5244
- tabSizeStyle[size]
5245
- ];
5246
- switch (design) {
5247
- case "tabs":
5248
- return /* @__PURE__ */ import_react25.default.createElement(
5249
- "div",
4882
+ /* @__PURE__ */ import_react37.default.createElement(
4883
+ Tabs,
5250
4884
  {
5251
- className: cn(
5252
- "hawa-gap-2 hawa-flex hawa-flex-col",
5253
- containerClassNames == null ? void 0 : containerClassNames.tabs
4885
+ dir: props.direction,
4886
+ value: selectedRegisterType.value,
4887
+ onValueChange: (e) => setSelectedRegisterType(
4888
+ (registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
4889
+ label: "Password",
4890
+ value: "password"
4891
+ }
5254
4892
  )
5255
4893
  },
5256
- props.label && /* @__PURE__ */ import_react25.default.createElement(Label, { ...labelProps }, props.label),
5257
- /* @__PURE__ */ import_react25.default.createElement(import_react_tabs.Tabs, null, /* @__PURE__ */ import_react25.default.createElement(
5258
- import_react_tabs.TabsList,
4894
+ 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)))),
4895
+ /* @__PURE__ */ import_react37.default.createElement(
4896
+ TabsContent,
5259
4897
  {
5260
- role: "tablist",
5261
- ref: parentRef,
4898
+ value: "password",
5262
4899
  className: cn(
5263
- props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
5264
- "hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium hawa-h-[40px]",
5265
- orientationStyle[orientation],
5266
- widthStyle[width],
5267
- tabsContainerClassName,
5268
- props.direction === "rtl" ? "hawa-flex-row-reverse" : ""
5269
- )
4900
+ "hawa-flex hawa-flex-col hawa-gap-4",
4901
+ selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
4902
+ ),
4903
+ dir: props.direction
5270
4904
  },
5271
- (_b = props.options) == null ? void 0 : _b.map((opt, o) => {
5272
- return opt.tooltip ? /* @__PURE__ */ import_react25.default.createElement(
5273
- PopoverRoot,
5274
- {
5275
- key: o,
5276
- open: o === openTooltip,
5277
- onOpenChange: (bool) => setOpenTooltip(bool ? o : null)
5278
- },
5279
- /* @__PURE__ */ import_react25.default.createElement(
5280
- PopoverTrigger,
4905
+ /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
4906
+ if (fld === "fullname") {
4907
+ return /* @__PURE__ */ import_react37.default.createElement(
4908
+ import_react_hook_form2.Controller,
5281
4909
  {
5282
- onMouseEnter: () => setOpenTooltip(o),
5283
- onMouseLeave: () => setOpenTooltip(null),
5284
- asChild: true
5285
- },
5286
- /* @__PURE__ */ import_react25.default.createElement(
5287
- import_react_tabs.TabsTrigger,
4910
+ key: i,
4911
+ control,
4912
+ name: "fullName",
4913
+ render: ({ field }) => {
4914
+ var _a2, _b2, _c2;
4915
+ return /* @__PURE__ */ import_react37.default.createElement(
4916
+ Input,
4917
+ {
4918
+ width: "full",
4919
+ label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
4920
+ placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
4921
+ helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
4922
+ ...field
4923
+ }
4924
+ );
4925
+ }
4926
+ }
4927
+ );
4928
+ }
4929
+ if (fld === "email") {
4930
+ return /* @__PURE__ */ import_react37.default.createElement(
4931
+ import_react_hook_form2.Controller,
4932
+ {
4933
+ key: i,
4934
+ control,
4935
+ name: "email",
4936
+ render: ({ field }) => {
4937
+ var _a2, _b2, _c2;
4938
+ return /* @__PURE__ */ import_react37.default.createElement(
4939
+ Input,
4940
+ {
4941
+ dir: "ltr",
4942
+ inputProps: {
4943
+ className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
4944
+ },
4945
+ width: "full",
4946
+ autoComplete: "email",
4947
+ label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
4948
+ helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
4949
+ placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
4950
+ ...field,
4951
+ onChange: (e) => {
4952
+ field.onChange(e.target.value.toLowerCase().trim());
4953
+ }
4954
+ }
4955
+ );
4956
+ }
4957
+ }
4958
+ );
4959
+ }
4960
+ if (fld === "username") {
4961
+ return /* @__PURE__ */ import_react37.default.createElement(
4962
+ import_react_hook_form2.Controller,
4963
+ {
4964
+ key: i,
4965
+ control,
4966
+ name: "username",
4967
+ render: ({ field }) => {
4968
+ var _a2, _b2, _c2, _d2;
4969
+ return /* @__PURE__ */ import_react37.default.createElement(
4970
+ Input,
4971
+ {
4972
+ width: "full",
4973
+ autoComplete: "username",
4974
+ label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
4975
+ labelProps: {
4976
+ ...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
4977
+ },
4978
+ helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
4979
+ placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
4980
+ ...field
4981
+ }
4982
+ );
4983
+ }
4984
+ }
4985
+ );
4986
+ }
4987
+ })),
4988
+ /* @__PURE__ */ import_react37.default.createElement(
4989
+ import_react_hook_form2.Controller,
4990
+ {
4991
+ control,
4992
+ name: "password",
4993
+ render: ({ field }) => {
4994
+ var _a2, _b2, _c2;
4995
+ return /* @__PURE__ */ import_react37.default.createElement(
4996
+ Input,
5288
4997
  {
5289
- "aria-current": selectedOption === opt.value ? "page" : void 0,
5290
- value: opt.value,
5291
- role: "tab",
5292
- tabIndex: 0,
5293
- onClick: () => {
5294
- if (props.disabled || opt.disabled) return;
5295
- handleChange(opt);
5296
- },
5297
- className: cn(
5298
- ...radio_option_tabs_styling,
5299
- selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
5300
- )
5301
- },
5302
- opt.icon && opt.icon,
5303
- opt.label
5304
- )
5305
- ),
5306
- /* @__PURE__ */ import_react25.default.createElement(PopoverContent, { ...opt.tooltipContentProps }, opt.tooltip)
5307
- ) : /* @__PURE__ */ import_react25.default.createElement(
5308
- import_react_tabs.TabsTrigger,
5309
- {
5310
- key: o,
5311
- role: "tab",
5312
- tabIndex: 0,
5313
- "aria-current": selectedOption === opt.value ? "page" : void 0,
5314
- onClick: () => {
5315
- if (props.disabled || opt.disabled) return;
5316
- handleChange(opt);
5317
- },
5318
- className: cn(
5319
- ...radio_option_tabs_styling,
5320
- selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
5321
- ),
5322
- value: opt.value
5323
- },
5324
- opt.icon && opt.icon,
5325
- opt.label
5326
- );
5327
- })
5328
- )),
5329
- !forceHideHelperText && /* @__PURE__ */ import_react25.default.createElement(HelperText, { helperText: props.helperText })
5330
- );
5331
- case "bordered":
5332
- return /* @__PURE__ */ import_react25.default.createElement(
5333
- "div",
5334
- {
5335
- className: cn(
5336
- orientationStyle[orientation],
5337
- "hawa-gap-4",
5338
- containerClassNames == null ? void 0 : containerClassNames.bordered
4998
+ width: "full",
4999
+ type: passwordVisible ? "text" : "password",
5000
+ autoComplete: "new-password",
5001
+ label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
5002
+ placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
5003
+ helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
5004
+ endIcon: /* @__PURE__ */ import_react37.default.createElement(
5005
+ "div",
5006
+ {
5007
+ className: "hawa-cursor-pointer",
5008
+ onClick: () => setPasswordVisible(!passwordVisible)
5009
+ },
5010
+ passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
5011
+ " "
5012
+ ),
5013
+ ...field
5014
+ }
5015
+ );
5016
+ }
5017
+ }
5018
+ ),
5019
+ /* @__PURE__ */ import_react37.default.createElement(
5020
+ import_react_hook_form2.Controller,
5021
+ {
5022
+ control,
5023
+ name: "confirm_password",
5024
+ render: ({ field }) => {
5025
+ var _a2, _b2, _c2;
5026
+ return /* @__PURE__ */ import_react37.default.createElement(
5027
+ Input,
5028
+ {
5029
+ width: "full",
5030
+ type: passwordVisible ? "text" : "password",
5031
+ autoComplete: "new-password",
5032
+ label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
5033
+ placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
5034
+ helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
5035
+ endIcon: /* @__PURE__ */ import_react37.default.createElement(
5036
+ "div",
5037
+ {
5038
+ className: "hawa-cursor-pointer",
5039
+ onClick: () => setPasswordVisible(!passwordVisible)
5040
+ },
5041
+ passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
5042
+ " "
5043
+ ),
5044
+ ...field
5045
+ }
5046
+ );
5047
+ }
5048
+ }
5049
+ ),
5050
+ props.additionalInputs,
5051
+ props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
5052
+ import_react_hook_form2.Controller,
5053
+ {
5054
+ control,
5055
+ name: "refCode",
5056
+ render: ({ field }) => {
5057
+ var _a2;
5058
+ return /* @__PURE__ */ import_react37.default.createElement(
5059
+ Input,
5060
+ {
5061
+ width: "full",
5062
+ label: texts == null ? void 0 : texts.refCode,
5063
+ placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
5064
+ helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
5065
+ ...field
5066
+ }
5067
+ );
5068
+ }
5069
+ }
5070
+ ),
5071
+ props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
5072
+ import_react_hook_form2.Controller,
5073
+ {
5074
+ control,
5075
+ name: "reference",
5076
+ render: ({ field }) => {
5077
+ var _a2, _b2;
5078
+ return /* @__PURE__ */ import_react37.default.createElement(
5079
+ Select,
5080
+ {
5081
+ label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
5082
+ placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
5083
+ isCreatable: false,
5084
+ isMulti: false,
5085
+ isSearchable: false,
5086
+ isClearable: false,
5087
+ options: props.userReferenceOptions || [],
5088
+ onChange: (e) => field.onChange(e)
5089
+ }
5090
+ );
5091
+ }
5092
+ }
5339
5093
  )
5340
- },
5341
- props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react25.default.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ import_react25.default.createElement(
5342
- "div",
5094
+ ),
5095
+ /* @__PURE__ */ import_react37.default.createElement(
5096
+ TabsContent,
5343
5097
  {
5098
+ value: "phone",
5344
5099
  className: cn(
5345
- "radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
5346
- props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
5100
+ "hawa-flex hawa-flex-col hawa-gap-4",
5101
+ selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
5347
5102
  ),
5348
- key: i + 1
5103
+ dir: props.direction
5349
5104
  },
5350
- /* @__PURE__ */ import_react25.default.createElement(
5351
- "input",
5105
+ /* @__PURE__ */ import_react37.default.createElement(
5106
+ import_react_hook_form2.Controller,
5352
5107
  {
5353
- disabled: opt.disabled,
5354
- id: opt.value.toString(),
5355
- type: "radio",
5356
- value: opt.value,
5357
- name,
5358
- onChange: () => handleChange(opt)
5108
+ control,
5109
+ name: "phone",
5110
+ render: ({ field }) => {
5111
+ var _a2, _b2;
5112
+ return /* @__PURE__ */ import_react37.default.createElement(
5113
+ PhoneInput,
5114
+ {
5115
+ label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
5116
+ helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
5117
+ preferredCountry: { label: "+966" },
5118
+ ...props.phoneInputProps,
5119
+ handleChange: (e) => {
5120
+ if ((0, import_libphonenumber_js2.isValidPhoneNumber)(e) && (0, import_libphonenumber_js2.isPossiblePhoneNumber)(e) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(e) === void 0) {
5121
+ let parsed = (0, import_libphonenumber_js2.parsePhoneNumber)(e);
5122
+ field.onChange(parsed.number);
5123
+ } else {
5124
+ field.onChange(e);
5125
+ }
5126
+ }
5127
+ }
5128
+ );
5129
+ }
5359
5130
  }
5360
5131
  ),
5361
- /* @__PURE__ */ import_react25.default.createElement(
5362
- "label",
5132
+ props.additionalInputs,
5133
+ props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
5134
+ import_react_hook_form2.Controller,
5363
5135
  {
5364
- htmlFor: opt.value.toString(),
5365
- className: cn(
5366
- "hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium hawa-text-black dark:hawa-text-white",
5367
- opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
5368
- )
5369
- },
5370
- opt.label
5136
+ control,
5137
+ name: "refCode",
5138
+ render: ({ field }) => {
5139
+ var _a2;
5140
+ return /* @__PURE__ */ import_react37.default.createElement(
5141
+ Input,
5142
+ {
5143
+ width: "full",
5144
+ label: texts == null ? void 0 : texts.refCode,
5145
+ placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
5146
+ helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
5147
+ ...field
5148
+ }
5149
+ );
5150
+ }
5151
+ }
5152
+ ),
5153
+ props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
5154
+ import_react_hook_form2.Controller,
5155
+ {
5156
+ control,
5157
+ name: "reference",
5158
+ render: ({ field }) => {
5159
+ var _a2, _b2;
5160
+ return /* @__PURE__ */ import_react37.default.createElement(
5161
+ Select,
5162
+ {
5163
+ label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
5164
+ placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
5165
+ isCreatable: false,
5166
+ isMulti: false,
5167
+ isSearchable: false,
5168
+ isClearable: false,
5169
+ options: props.userReferenceOptions || [],
5170
+ onChange: (e) => field.onChange(e)
5171
+ }
5172
+ );
5173
+ }
5174
+ }
5371
5175
  )
5372
- )))
5373
- );
5374
- case "cards":
5375
- return /* @__PURE__ */ import_react25.default.createElement(
5376
- "ul",
5377
- {
5378
- className: cn(
5379
- orientationStyle[orientation],
5380
- "hawa-gap-4",
5381
- containerClassNames == null ? void 0 : containerClassNames.cards
5382
- )
5383
- },
5384
- (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react25.default.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ import_react25.default.createElement(
5385
- "input",
5176
+ ),
5177
+ 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(
5178
+ import_react_hook_form2.Controller,
5386
5179
  {
5387
- type: "radio",
5388
- id: opt.value.toString(),
5389
- name,
5390
- value: opt.value.toString(),
5391
- className: "hawa-peer hawa-hidden",
5392
- required: true,
5393
- disabled: opt.disabled
5180
+ control,
5181
+ name: "terms_accepted",
5182
+ render: ({ field }) => {
5183
+ var _a2, _b2;
5184
+ return /* @__PURE__ */ import_react37.default.createElement(
5185
+ Checkbox,
5186
+ {
5187
+ id: "terms_accepted",
5188
+ helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
5189
+ onCheckedChange: (e) => field.onChange(e),
5190
+ 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(
5191
+ "span",
5192
+ {
5193
+ onClick: (e) => {
5194
+ e.preventDefault();
5195
+ if (props.onRouteToTOS) {
5196
+ props.onRouteToTOS();
5197
+ }
5198
+ },
5199
+ className: "clickable-link"
5200
+ },
5201
+ (texts == null ? void 0 : texts.termsText) || "Terms of Service"
5202
+ )))
5203
+ }
5204
+ );
5205
+ }
5394
5206
  }
5395
- ), /* @__PURE__ */ import_react25.default.createElement(
5396
- "label",
5207
+ ), showNewsletterOption && /* @__PURE__ */ import_react37.default.createElement(
5208
+ import_react_hook_form2.Controller,
5397
5209
  {
5398
- htmlFor: opt.value.toString(),
5399
- className: cn(
5400
- "hawa-inline-flex hawa-h-full hawa-w-full hawa-transition-all hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-foreground/10 hawa-bg-background hawa-p-5 hawa-text-gray-500 peer-checked:hawa-border-primary peer-checked:hawa-text-primary dark:hawa-border-foreground/10 dark:hawa-bg-foreground/5 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
5401
- opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-foreground/10 hover:hawa-text-gray-600 dark:hover:hawa-bg-foreground/20 dark:hover:hawa-text-gray-300"
5210
+ control,
5211
+ name: "newsletter_accepted",
5212
+ render: ({ field }) => /* @__PURE__ */ import_react37.default.createElement(
5213
+ Checkbox,
5214
+ {
5215
+ id: "newsletter_accepted",
5216
+ label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
5217
+ onCheckedChange: field.onChange
5218
+ }
5402
5219
  )
5403
- },
5404
- /* @__PURE__ */ import_react25.default.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ import_react25.default.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ import_react25.default.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
5405
- )))
5406
- );
5407
- default:
5408
- return /* @__PURE__ */ import_react25.default.createElement(
5409
- "div",
5220
+ }
5221
+ )) : null
5222
+ ),
5223
+ /* @__PURE__ */ import_react37.default.createElement(
5224
+ Button,
5410
5225
  {
5411
- className: cn(
5412
- "hawa-flex hawa-flex-col hawa-gap-2",
5413
- containerClassNames == null ? void 0 : containerClassNames.default
5414
- )
5226
+ className: "hawa-w-full",
5227
+ type: "submit",
5228
+ isLoading: props.isLoading,
5229
+ disabled: props.isLoading
5415
5230
  },
5416
- props.label && /* @__PURE__ */ import_react25.default.createElement(Label, { ...labelProps }, props.label),
5417
- /* @__PURE__ */ import_react25.default.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react25.default.createElement(
5418
- "div",
5419
- {
5420
- className: cn(
5421
- "radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
5422
- props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
5423
- ),
5424
- key: i + 1
5425
- },
5426
- /* @__PURE__ */ import_react25.default.createElement(
5427
- "input",
5428
- {
5429
- disabled: opt.disabled,
5430
- id: opt.value.toString(),
5431
- type: "radio",
5432
- value: opt.value,
5433
- name,
5434
- onChange: () => handleChange(opt)
5435
- }
5436
- ),
5437
- /* @__PURE__ */ import_react25.default.createElement(
5438
- "label",
5439
- {
5440
- htmlFor: opt.value.toString(),
5441
- className: cn(
5442
- "hawa-text-sm hawa-font-medium dark:hawa-text-white",
5443
- opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
5444
- )
5445
- },
5446
- opt.label
5447
- )
5448
- ))),
5449
- /* @__PURE__ */ import_react25.default.createElement(HelperText, { helperText: props.helperText })
5450
- );
5451
- }
5452
- }
5453
- );
5454
-
5455
- // elements/textarea/Textarea.tsx
5456
- var React29 = __toESM(require("react"));
5457
- var Textarea = React29.forwardRef(
5458
- ({
5459
- className,
5460
- classNames,
5461
- labelProps,
5462
- showCount,
5463
- forceHideHelperText,
5464
- textareaProps,
5465
- countPosition = "bottom",
5466
- isLoading,
5467
- ...props
5468
- }, ref) => {
5469
- return /* @__PURE__ */ React29.createElement(
5470
- "div",
5231
+ (texts == null ? void 0 : texts.registerText) || "Register"
5232
+ ),
5233
+ props.additionalButtons
5234
+ )), 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")))
5235
+ ),
5236
+ props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react37.default.createElement(
5237
+ CardFooter,
5471
5238
  {
5239
+ noPadding: props.cardless,
5472
5240
  className: cn(
5473
- "textarea-main hawa-relative hawa-flex hawa-h-full hawa-w-full hawa-flex-col",
5474
- !forceHideHelperText && "hawa-gap-2",
5475
- className
5241
+ props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
5476
5242
  )
5477
5243
  },
5478
- /* @__PURE__ */ React29.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, props.label && /* @__PURE__ */ React29.createElement(Label, { ...labelProps }, props.label), showCount && countPosition === "top" && /* @__PURE__ */ React29.createElement(
5479
- "div",
5480
- {
5481
- className: "hawa-text-start hawa-text-xs hawa-transition-all hawa-leading-none"
5482
- },
5483
- (textareaProps == null ? void 0 : textareaProps.value) ? String(textareaProps == null ? void 0 : textareaProps.value).length : 0,
5484
- "/",
5485
- textareaProps == null ? void 0 : textareaProps.maxLength
5486
- )),
5487
- isLoading ? /* @__PURE__ */ React29.createElement(Skeleton, { style: { height: 40 } }) : /* @__PURE__ */ React29.createElement(
5488
- "textarea",
5244
+ /* @__PURE__ */ import_react37.default.createElement(
5245
+ AuthButtons,
5489
5246
  {
5490
- ...textareaProps,
5491
- className: cn(
5492
- "hawa-flex hawa-min-h-[40px] hawa-h-[40px] hawa-w-full hawa-rounded-md hawa-border hawa-border-input hawa-bg-background hawa-px-3 hawa-py-2 hawa-text-sm hawa-ring-offset-background placeholder:hawa-text-gray-400 placeholder:hawa-text-muted-foreground focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 disabled:hawa-cursor-not-allowed disabled:hawa-opacity-50",
5493
- classNames == null ? void 0 : classNames.textarea
5494
- ),
5495
- ref
5247
+ texts: thirdPartyAuthTexts,
5248
+ viaGoogle: props.viaGoogle,
5249
+ viaGithub: props.viaGithub,
5250
+ viaTwitter: props.viaTwitter,
5251
+ isGoogleLoading: props.isGoogleLoading,
5252
+ isGithubLoading: props.isGithubLoading,
5253
+ isTwitterLoading: props.isTwitterLoading,
5254
+ handleGoogle: props.onGoogleRegister,
5255
+ handleGithub: props.onGithubRegister,
5256
+ handleTwitter: props.onTwitterRegister
5496
5257
  }
5497
- ),
5498
- /* @__PURE__ */ React29.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, !forceHideHelperText && /* @__PURE__ */ React29.createElement(HelperText, { helperText: props.helperText }), showCount && countPosition === "bottom" && /* @__PURE__ */ React29.createElement("div", { className: "hawa-text-start hawa-text-xs hawa-transition-all" }, (textareaProps == null ? void 0 : textareaProps.value) ? String(textareaProps == null ? void 0 : textareaProps.value).length : 0, "/", textareaProps == null ? void 0 : textareaProps.maxLength))
5499
- );
5500
- }
5501
- );
5502
- Textarea.displayName = "Textarea";
5258
+ )
5259
+ ) : null
5260
+ ));
5261
+ };
5503
5262
 
5504
- // blocks/feedback/UserReferralSource.tsx
5505
- var UserReferralSource = ({
5506
- position = "bottom-right",
5507
- options = [],
5263
+ // blocks/auth/AppLanding.tsx
5264
+ var import_react38 = __toESM(require("react"));
5265
+ var AppLanding = ({ texts, ...props }) => {
5266
+ const thirdPartyAuthTexts = {
5267
+ continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
5268
+ continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
5269
+ continueWithApple: texts == null ? void 0 : texts.continueWithApple,
5270
+ continueWithMicrosoft: texts == null ? void 0 : texts.continueWithMicrosoft,
5271
+ continueWithGithub: texts == null ? void 0 : texts.continueWithGithub,
5272
+ continueWithEmail: texts == null ? void 0 : texts.continueWithEmail,
5273
+ continueWithPhone: texts == null ? void 0 : texts.continueWithPhone
5274
+ };
5275
+ return /* @__PURE__ */ import_react38.default.createElement("div", { dir: props.direction }, /* @__PURE__ */ import_react38.default.createElement(Card, null, /* @__PURE__ */ import_react38.default.createElement(CardContent, { headless: true, className: "hawa-flex hawa-flex-col hawa-gap-6" }, /* @__PURE__ */ import_react38.default.createElement(
5276
+ AuthButtons,
5277
+ {
5278
+ texts: thirdPartyAuthTexts,
5279
+ viaApple: props.viaApple,
5280
+ viaGoogle: props.viaGoogle,
5281
+ viaEmail: props.viaEmail,
5282
+ viaGithub: props.viaGithub,
5283
+ viaMicrosoft: props.viaMicrosoft,
5284
+ viaPhone: props.viaPhone,
5285
+ viaTwitter: props.viaTwitter,
5286
+ handleApple: props.handleApple,
5287
+ handleGoogle: props.handleGoogle,
5288
+ handleTwitter: props.handleTwitter,
5289
+ handleMicrosoft: props.handleMicrosoft,
5290
+ handleGithub: props.handleGithub,
5291
+ handleEmail: props.handleEmail,
5292
+ handlePhone: props.handlePhone
5293
+ }
5294
+ ), props.allowRegister && /* @__PURE__ */ import_react38.default.createElement("div", { className: "hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, texts == null ? void 0 : texts.newUserText, " ", /* @__PURE__ */ import_react38.default.createElement(
5295
+ "span",
5296
+ {
5297
+ onClick: props.handleRouteToRegister,
5298
+ className: "clickable-link"
5299
+ },
5300
+ texts == null ? void 0 : texts.createAccount
5301
+ )))));
5302
+ };
5303
+
5304
+ // blocks/auth/CheckEmail.tsx
5305
+ var import_react39 = __toESM(require("react"));
5306
+ var CheckEmail = ({ texts, handleResend }) => {
5307
+ return /* @__PURE__ */ import_react39.default.createElement(Card, null, /* @__PURE__ */ import_react39.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center hawa-text-center" }, /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-flex hawa-h-16 hawa-w-16 hawa-flex-col hawa-items-center hawa-justify-center hawa-rounded-3xl hawa-bg-primary hawa-text-6xl hawa-font-bold hawa-text-primary-foreground" }, /* @__PURE__ */ import_react39.default.createElement(
5308
+ "svg",
5309
+ {
5310
+ stroke: "currentColor",
5311
+ fill: "none",
5312
+ strokeWidth: "2",
5313
+ viewBox: "0 0 24 24",
5314
+ strokeLinecap: "round",
5315
+ strokeLinejoin: "round",
5316
+ height: "0.5em",
5317
+ width: "0.5em",
5318
+ xmlns: "http://www.w3.org/2000/svg"
5319
+ },
5320
+ /* @__PURE__ */ import_react39.default.createElement("path", { d: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" }),
5321
+ /* @__PURE__ */ import_react39.default.createElement("polyline", { points: "22,6 12,13 2,6" })
5322
+ )), /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-m-2 hawa-text-xl hawa-font-bold" }, (texts == null ? void 0 : texts.checkEmail) || "Check your Email"), /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-text-sm" }, (texts == null ? void 0 : texts.pleaseVerify) || "Thank you for signing up! To complete your registration, we've sent a verification email to the address you provided. Please check your inbox and follow the instructions in the email to activate your account."))), /* @__PURE__ */ import_react39.default.createElement(CardFooter, { className: "hawa-flex hawa-flex-col hawa-justify-center" }, /* @__PURE__ */ import_react39.default.createElement("span", { className: "clickable-link hawa-text-sm", onClick: handleResend }, (texts == null ? void 0 : texts.resendEmail) || "Resend Email")));
5323
+ };
5324
+
5325
+ // blocks/auth/NewPassword.tsx
5326
+ var import_react40 = __toESM(require("react"));
5327
+ var import_react_hook_form3 = require("react-hook-form");
5328
+ var import_zod3 = require("@hookform/resolvers/zod");
5329
+ var z3 = __toESM(require("zod"));
5330
+ var NewPasswordForm = ({
5331
+ texts,
5332
+ isLoading,
5508
5333
  ...props
5509
5334
  }) => {
5510
- var _a, _b;
5511
- const [closed, setClosed] = (0, import_react26.useState)(false);
5512
- const popUpRef = (0, import_react26.useRef)(null);
5513
- const formSchema = z6.object({
5514
- source: z6.string({ required_error: (_a = props.texts) == null ? void 0 : _a.pleaseSelectOption }),
5515
- feedback: z6.string().optional()
5335
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5336
+ const formSchema = z3.object({
5337
+ password: z3.string({ required_error: (_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.required }).min(8, { message: (_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.tooShort }),
5338
+ confirm_password: z3.string({ required_error: (_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required }).refine((value) => value !== "", {
5339
+ message: (_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required
5340
+ })
5341
+ }).refine((data) => data.password === data.confirm_password, {
5342
+ message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
5343
+ path: ["confirm_password"]
5516
5344
  });
5517
- const { handleSubmit, control, formState, watch } = (0, import_react_hook_form6.useForm)({
5518
- resolver: (0, import_zod6.zodResolver)(formSchema)
5345
+ const { handleSubmit, control, formState } = (0, import_react_hook_form3.useForm)({
5346
+ resolver: (0, import_zod3.zodResolver)(formSchema)
5519
5347
  });
5520
- const selectedSource = watch("source");
5521
- const boxPosition = {
5522
- "bottom-right": "hawa-right-4",
5523
- "bottom-left": "hawa-left-4"
5524
- };
5525
- const optionsWithOther = [
5526
- ...options,
5527
- {
5528
- value: "other",
5529
- label: "Other"
5530
- }
5531
- ];
5532
- return /* @__PURE__ */ import_react26.default.createElement(
5533
- "div",
5348
+ return /* @__PURE__ */ import_react40.default.createElement(Card, { dir: props.direction }, props.showSuccess ? /* @__PURE__ */ import_react40.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react40.default.createElement("div", { className: "hawa-text-center" }, texts == null ? void 0 : texts.passwordChanged)) : /* @__PURE__ */ import_react40.default.createElement(
5349
+ "form",
5534
5350
  {
5535
- className: cn(
5536
- "hawa-transition-all",
5537
- closed ? "hawa-opacity-0" : "hawa-opacity-100"
5538
- ),
5539
- ref: popUpRef
5351
+ noValidate: true,
5352
+ onSubmit: handleSubmit((e) => {
5353
+ if (props.handleNewPassword) {
5354
+ return props.handleNewPassword(e);
5355
+ } else {
5356
+ console.log(
5357
+ "Form is submitted but handleSubmission prop is missing"
5358
+ );
5359
+ }
5360
+ })
5540
5361
  },
5541
- /* @__PURE__ */ import_react26.default.createElement(
5542
- Card,
5362
+ /* @__PURE__ */ import_react40.default.createElement(CardContent, { headless: true, className: "hawa-flex hawa-flex-col" }, props.showError && /* @__PURE__ */ import_react40.default.createElement(
5363
+ Alert,
5543
5364
  {
5544
- className: cn(
5545
- "hawa-fixed hawa-bottom-4 hawa-p-0 ",
5546
- boxPosition[position]
5547
- ),
5548
- dir: props.direction
5549
- },
5550
- /* @__PURE__ */ import_react26.default.createElement(
5551
- "button",
5552
- {
5553
- type: "button",
5554
- className: cn(
5555
- props.direction === "rtl" ? "hawa-left-2" : "hawa-right-2",
5556
- "hawa-absolute hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white"
5557
- ),
5558
- "data-dismiss-target": "#toast-default",
5559
- "aria-label": "Close",
5560
- onClick: () => {
5561
- setClosed(true);
5562
- setTimeout(() => {
5563
- if (popUpRef == null ? void 0 : popUpRef.current) {
5564
- popUpRef == null ? void 0 : popUpRef.current.removeChild(popUpRef == null ? void 0 : popUpRef.current.children[0]);
5565
- }
5566
- }, 200);
5567
- }
5568
- },
5569
- /* @__PURE__ */ import_react26.default.createElement(
5570
- "svg",
5571
- {
5572
- "aria-hidden": "true",
5573
- className: "hawa-h-5 hawa-w-5",
5574
- fill: "currentColor",
5575
- viewBox: "0 0 20 20"
5576
- },
5577
- /* @__PURE__ */ import_react26.default.createElement(
5578
- "path",
5579
- {
5580
- fillRule: "evenodd",
5581
- d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
5582
- clipRule: "evenodd"
5583
- }
5584
- )
5585
- )
5586
- ),
5587
- /* @__PURE__ */ import_react26.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react26.default.createElement(
5588
- "form",
5589
- {
5590
- noValidate: true,
5591
- onSubmit: handleSubmit((e) => {
5592
- if (props.onSubmitForm) {
5593
- props.onSubmitForm(e);
5594
- } else {
5595
- console.log("onSubmitForm was not provided");
5596
- }
5597
- })
5598
- },
5599
- /* @__PURE__ */ import_react26.default.createElement(
5600
- "div",
5601
- {
5602
- className: cn(
5603
- "hawa-flex hawa-flex-col hawa-gap-4 hawa-transition-all",
5604
- closed ? "hawa-opacity-0" : "hawa-opacity-100"
5605
- )
5606
- },
5607
- /* @__PURE__ */ import_react26.default.createElement("div", { className: "hawa-mt-4 hawa-font-bold" }, props.question),
5608
- /* @__PURE__ */ import_react26.default.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded " }, /* @__PURE__ */ import_react26.default.createElement(
5609
- import_react_hook_form6.Controller,
5365
+ direction: props.direction,
5366
+ title: props.errorTitle,
5367
+ text: props.errorText,
5368
+ severity: "error"
5369
+ }
5370
+ ), /* @__PURE__ */ import_react40.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4 hawa-mb-4" }, /* @__PURE__ */ import_react40.default.createElement(
5371
+ import_react_hook_form3.Controller,
5372
+ {
5373
+ control,
5374
+ name: "password",
5375
+ render: ({ field }) => {
5376
+ var _a2, _b2, _c2;
5377
+ return /* @__PURE__ */ import_react40.default.createElement(
5378
+ Input,
5610
5379
  {
5611
- control,
5612
- name: "source",
5613
- render: ({ field }) => {
5614
- var _a2, _b2;
5615
- return /* @__PURE__ */ import_react26.default.createElement(
5616
- Radio,
5617
- {
5618
- name: "source",
5619
- direction: props.direction,
5620
- orientation: "vertical",
5621
- options: optionsWithOther,
5622
- defaultValue: field.value,
5623
- onChange: (e) => field.onChange(e),
5624
- helperText: (_b2 = (_a2 = formState.errors.source) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
5625
- }
5626
- );
5627
- }
5380
+ width: "full",
5381
+ type: "password",
5382
+ autoComplete: "new-password",
5383
+ label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
5384
+ placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
5385
+ helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
5386
+ ...field
5628
5387
  }
5629
- )),
5630
- /* @__PURE__ */ import_react26.default.createElement("div", null, /* @__PURE__ */ import_react26.default.createElement(
5631
- import_react_hook_form6.Controller,
5388
+ );
5389
+ }
5390
+ }
5391
+ ), /* @__PURE__ */ import_react40.default.createElement(
5392
+ import_react_hook_form3.Controller,
5393
+ {
5394
+ control,
5395
+ name: "confirm_password",
5396
+ render: ({ field }) => {
5397
+ var _a2, _b2, _c2;
5398
+ return /* @__PURE__ */ import_react40.default.createElement(
5399
+ Input,
5632
5400
  {
5633
- control,
5634
- name: "feedback",
5635
- render: ({ field }) => {
5636
- var _a2, _b2;
5637
- return /* @__PURE__ */ import_react26.default.createElement(
5638
- Textarea,
5639
- {
5640
- ...field,
5641
- textareaProps: {
5642
- onChange: (e) => field.onChange(e.target.value),
5643
- disabled: selectedSource !== "other"
5644
- },
5645
- helperText: (_b2 = (_a2 = formState.errors.feedback) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
5646
- }
5647
- );
5648
- }
5401
+ width: "full",
5402
+ type: "password",
5403
+ autoComplete: "new-password",
5404
+ label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
5405
+ placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
5406
+ helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
5407
+ ...field
5649
5408
  }
5650
- ))
5651
- ),
5652
- /* @__PURE__ */ import_react26.default.createElement(Button, { type: "submit", className: "hawa-mt-4 hawa-w-full" }, ((_b = props.texts) == null ? void 0 : _b.submit) || "Submit")
5653
- ))
5654
- )
5655
- );
5409
+ );
5410
+ }
5411
+ }
5412
+ )), /* @__PURE__ */ import_react40.default.createElement(Button, { className: "hawa-w-full", type: "submit", isLoading }, texts == null ? void 0 : texts.updatePassword), props.allowRegister && /* @__PURE__ */ import_react40.default.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, (_g = texts == null ? void 0 : texts.dontHaveAccount) != null ? _g : "Don't have an account? ", /* @__PURE__ */ import_react40.default.createElement(
5413
+ "span",
5414
+ {
5415
+ className: "clickable-link",
5416
+ onClick: props.handleRouteToRegister
5417
+ },
5418
+ (_h = texts == null ? void 0 : texts.registerText) != null ? _h : "Register"
5419
+ )))
5420
+ ));
5656
5421
  };
5657
5422
 
5658
- // blocks/feedback/FeedbackRating.tsx
5659
- var import_react27 = __toESM(require("react"));
5660
- var FeedbackRating = ({
5661
- position = "bottom-right",
5423
+ // blocks/auth/ResetPassword.tsx
5424
+ var import_react41 = __toESM(require("react"));
5425
+ var import_react_hook_form4 = require("react-hook-form");
5426
+ var import_zod4 = require("@hookform/resolvers/zod");
5427
+ var z4 = __toESM(require("zod"));
5428
+ var ResetPasswordForm = ({
5429
+ allowRegister = true,
5430
+ isLoading,
5662
5431
  ...props
5663
5432
  }) => {
5664
- const [closed, setClosed] = (0, import_react27.useState)(false);
5665
- const [answered, setAnswered] = (0, import_react27.useState)(false);
5666
- const [clickedOption, setClickedOption] = (0, import_react27.useState)(null);
5667
- const [closingTimer, setClosingTimer] = (0, import_react27.useState)(5);
5668
- const popUpRef = (0, import_react27.useRef)(null);
5669
- const boxPosition = {
5670
- "bottom-right": "hawa-right-4",
5671
- "bottom-left": "hawa-left-4"
5672
- };
5673
- (0, import_react27.useEffect)(() => {
5674
- const timeoutHide = setTimeout(() => {
5675
- if (closingTimer >= 0) {
5676
- setClosingTimer(closingTimer - 1);
5677
- }
5678
- }, 1e3);
5679
- return () => {
5680
- clearTimeout(timeoutHide);
5681
- };
5682
- }, [closingTimer]);
5683
- const slowClose = () => {
5684
- setClosed(true);
5685
- setTimeout(() => {
5686
- if (popUpRef.current) {
5687
- popUpRef.current.removeChild(popUpRef.current.children[0]);
5688
- }
5689
- }, 200);
5690
- };
5691
- return /* @__PURE__ */ import_react27.default.createElement(
5692
- "div",
5433
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
5434
+ const formSchema = z4.object({
5435
+ email: z4.string({
5436
+ required_error: ((_b = (_a = props.texts) == null ? void 0 : _a.email) == null ? void 0 : _b.required) || "Email is required"
5437
+ }).email({ message: ((_d = (_c = props.texts) == null ? void 0 : _c.email) == null ? void 0 : _d.invalid) || "Invalid email" }).min(1, { message: ((_f = (_e = props.texts) == null ? void 0 : _e.email) == null ? void 0 : _f.required) || "Email is required" })
5438
+ });
5439
+ const { handleSubmit, control, formState } = (0, import_react_hook_form4.useForm)({
5440
+ resolver: (0, import_zod4.zodResolver)(formSchema)
5441
+ });
5442
+ return /* @__PURE__ */ import_react41.default.createElement(Card, { dir: props.direction }, !props.sent ? /* @__PURE__ */ import_react41.default.createElement(import_react41.default.Fragment, null, !props.headless && /* @__PURE__ */ import_react41.default.createElement(CardHeader, null, /* @__PURE__ */ import_react41.default.createElement(CardTitle, null, ((_g = props.texts) == null ? void 0 : _g.headTitle) || "Reset Password"), /* @__PURE__ */ import_react41.default.createElement(CardDescription, null, ((_h = props.texts) == null ? void 0 : _h.headDescription) || "Enter your email to reset your account password")), /* @__PURE__ */ import_react41.default.createElement(
5443
+ "form",
5693
5444
  {
5694
- ref: popUpRef,
5695
- className: cn(
5696
- props.banner ? "hawa-fixed hawa-bottom-0 hawa-left-0 hawa-w-full hawa-px-0 md:hawa-px-4" : "hawa-fixed hawa-bottom-4",
5697
- boxPosition[position]
5698
- )
5445
+ noValidate: true,
5446
+ onSubmit: handleSubmit((e) => {
5447
+ if (props.handleResetPassword) {
5448
+ return props.handleResetPassword(e);
5449
+ } else {
5450
+ console.log("handleResetPassword prop is missing");
5451
+ }
5452
+ })
5699
5453
  },
5700
- /* @__PURE__ */ import_react27.default.createElement(
5701
- "div",
5454
+ /* @__PURE__ */ import_react41.default.createElement(CardContent, { headless: props.headless, className: "hawa-pb-4" }, props.showError && /* @__PURE__ */ import_react41.default.createElement(
5455
+ Alert,
5702
5456
  {
5703
- className: cn(
5704
- "hawa-relative hawa-flex hawa-w-full hawa-flex-col hawa-gap-2 hawa-rounded hawa-border hawa-bg-background hawa-p-4 hawa-shadow-md hawa-transition-all",
5705
- closed ? "hawa-opacity-0" : "hawa-opacity-100",
5706
- props.banner && "hawa-rounded-none hawa-px-4 md:hawa-rounded-t md:hawa-px-64"
5707
- )
5708
- },
5709
- /* @__PURE__ */ import_react27.default.createElement("div", { className: "hawa-absolute hawa-left-2 hawa-top-2 hawa-p-1.5 hawa-text-sm" }, props.title),
5710
- /* @__PURE__ */ import_react27.default.createElement(
5711
- "button",
5712
- {
5713
- type: "button",
5714
- className: "hawa-absolute hawa-right-2 hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white",
5715
- "data-dismiss-target": "#toast-default",
5716
- "aria-label": "Close",
5717
- onClick: () => slowClose()
5718
- },
5719
- /* @__PURE__ */ import_react27.default.createElement(
5720
- "svg",
5721
- {
5722
- "aria-hidden": "true",
5723
- className: "hawa-h-5 hawa-w-5",
5724
- fill: "currentColor",
5725
- viewBox: "0 0 20 20"
5726
- },
5727
- /* @__PURE__ */ import_react27.default.createElement(
5728
- "path",
5457
+ direction: props.direction,
5458
+ title: props.errorTitle,
5459
+ text: props.errorText,
5460
+ severity: "error"
5461
+ }
5462
+ ), /* @__PURE__ */ import_react41.default.createElement(
5463
+ import_react_hook_form4.Controller,
5464
+ {
5465
+ control,
5466
+ name: "email",
5467
+ render: ({ field }) => {
5468
+ var _a2, _b2, _c2, _d2, _e2;
5469
+ return /* @__PURE__ */ import_react41.default.createElement(
5470
+ Input,
5729
5471
  {
5730
- fillRule: "evenodd",
5731
- d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
5732
- clipRule: "evenodd"
5733
- }
5734
- )
5735
- )
5736
- ),
5737
- /* @__PURE__ */ import_react27.default.createElement("div", { className: "hawa-mt-8" }, props.question),
5738
- /* @__PURE__ */ import_react27.default.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded" }, props.options && props.options.map((op, i) => /* @__PURE__ */ import_react27.default.createElement(
5739
- "span",
5740
- {
5741
- key: i,
5742
- onClick: () => {
5743
- if (props.onOptionClicked) {
5744
- props.onOptionClicked(op);
5472
+ width: "full",
5473
+ label: ((_b2 = (_a2 = props.texts) == null ? void 0 : _a2.email) == null ? void 0 : _b2.label) || "Email",
5474
+ helperText: (_c2 = formState.errors.email) == null ? void 0 : _c2.message,
5475
+ placeholder: (_e2 = (_d2 = props.texts) == null ? void 0 : _d2.email) == null ? void 0 : _e2.placeholder,
5476
+ ...field,
5477
+ onChange: (e) => {
5478
+ field.onChange(e.target.value.toLowerCase().trim());
5479
+ }
5745
5480
  }
5746
- setClickedOption(op);
5747
- setAnswered(true);
5748
- const timeoutDestroy = setTimeout(() => {
5749
- setClosed(true);
5750
- }, 4800);
5751
- setTimeout(() => {
5752
- var _a, _b;
5753
- (_b = popUpRef.current) == null ? void 0 : _b.removeChild(
5754
- (_a = popUpRef.current) == null ? void 0 : _a.children[0]
5755
- );
5756
- clearTimeout(timeoutDestroy);
5757
- }, 5300);
5758
- },
5759
- className: cn(
5760
- "hawa-w-full hawa-cursor-pointer hawa-rounded hawa-border hawa-p-4 hawa-text-center hawa-transition-all",
5761
- clickedOption === op ? "hawa-bg-gray-500 hawa-text-white" : "hawa-border hawa-bg-background hover:hawa-bg-gray-300 dark:hover:hawa-bg-gray-700"
5762
- )
5763
- },
5764
- op
5765
- ))),
5766
- props.texts && /* @__PURE__ */ import_react27.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between hawa-text-xs" }, /* @__PURE__ */ import_react27.default.createElement("span", null, props.texts.least), /* @__PURE__ */ import_react27.default.createElement("span", null, props.texts.most)),
5767
- answered && /* @__PURE__ */ import_react27.default.createElement("div", { className: "hawa-absolute hawa-left-0 hawa-top-0 hawa-flex hawa-h-full hawa-w-full hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-rounded hawa-bg-black hawa-bg-opacity-80 hawa-p-4 hawa-text-center hawa-transition-all" }, /* @__PURE__ */ import_react27.default.createElement("span", { className: "hawa-font-bold hawa-text-white" }, "Thank you for your answer. This box will disappear in", " " + closingTimer, " seconds"), /* @__PURE__ */ import_react27.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-2" }, /* @__PURE__ */ import_react27.default.createElement(Button, { variant: "secondary", onClick: () => slowClose() }, "Close")))
5768
- )
5769
- );
5770
- };
5771
-
5772
- // blocks/feedback/FeedbackEmoji.tsx
5773
- var import_react28 = __toESM(require("react"));
5774
- var FeedbackEmoji = (props) => {
5775
- const [selectedEmoji, setSelectedEmoji] = (0, import_react28.useState)(null);
5776
- const [loadingSubmit, setLoadingSubmit] = (0, import_react28.useState)(false);
5777
- const [feedbackText, setFeedbackText] = (0, import_react28.useState)("");
5778
- const [helperText, setHelperText] = (0, import_react28.useState)(false);
5779
- let emojis = [
5780
- { icon: /* @__PURE__ */ import_react28.default.createElement(VeryGoodEmoji, null), value: "very-good" },
5781
- { icon: /* @__PURE__ */ import_react28.default.createElement(GoodEmoji, null), value: "good" },
5782
- { icon: /* @__PURE__ */ import_react28.default.createElement(BadEmoji, null), value: "bad" },
5783
- { icon: /* @__PURE__ */ import_react28.default.createElement(VeryBadEmoji, null), value: "very-bad" }
5784
- ];
5785
- const onFeedbackSubmit = async () => {
5786
- if (feedbackText) {
5787
- setLoadingSubmit(true);
5788
- try {
5789
- await props.handleSubmit({
5790
- choice: selectedEmoji,
5791
- feedback: feedbackText
5792
- });
5793
- } catch (error) {
5794
- console.error("Error during submission:", error);
5795
- setLoadingSubmit(false);
5481
+ );
5482
+ }
5796
5483
  }
5797
- await setLoadingSubmit(false);
5798
- } else {
5799
- setLoadingSubmit(false);
5800
- setHelperText(true);
5801
- }
5802
- };
5803
- return /* @__PURE__ */ import_react28.default.createElement(
5804
- "div",
5805
- {
5806
- className: cn(
5807
- "hawa-flex hawa-flex-col hawa-rounded hawa-border hawa-p-2 hawa-transition-all",
5808
- selectedEmoji ? "hawa-h-[189px] hawa-min-w-fit" : "hawa-h-[44px]"
5809
- )
5810
- },
5811
- /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2" }, /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-0.5" }, emojis.map((emoji, i) => /* @__PURE__ */ import_react28.default.createElement(
5484
+ )),
5485
+ /* @__PURE__ */ import_react41.default.createElement(CardFooter, { className: "hawa-flex hawa-flex-col" }, /* @__PURE__ */ import_react41.default.createElement(
5812
5486
  Button,
5813
5487
  {
5814
- key: i,
5815
- onClick: () => {
5816
- if (selectedEmoji === emoji.value) {
5817
- setSelectedEmoji("");
5818
- } else {
5819
- setSelectedEmoji(emoji.value);
5820
- }
5821
- },
5822
- variant: "ghost",
5823
- size: "smallIcon",
5824
- className: cn(
5825
- selectedEmoji === emoji.value ? "hawa-bg-primary/10 hover:hawa-bg-primary/10" : "hawa-text-[#666666]"
5826
- )
5488
+ type: "submit",
5489
+ className: "hawa-w-full",
5490
+ isLoading
5827
5491
  },
5828
- emoji.icon
5829
- )))),
5830
- /* @__PURE__ */ import_react28.default.createElement(
5831
- "div",
5492
+ ((_i = props.texts) == null ? void 0 : _i.resetPassword) || "Reset Password"
5493
+ ), allowRegister && /* @__PURE__ */ import_react41.default.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, (_k = (_j = props.texts) == null ? void 0 : _j.dontHaveAccount) != null ? _k : "Don't have an account? ", /* @__PURE__ */ import_react41.default.createElement(
5494
+ "span",
5832
5495
  {
5833
- className: cn(
5834
- "hawa-flex hawa-flex-col hawa-overflow-clip hawa-transition-all hawa-duration-500 hawa-ease-in-out",
5835
- selectedEmoji ? "hawa-visible hawa-opacity-100" : "hawa-invisible hawa-opacity-0"
5836
- )
5496
+ className: "clickable-link",
5497
+ onClick: props.handleRouteToRegister
5837
5498
  },
5838
- props.showSuccess ? /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-flex hawa-h-full hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-pt-4" }, /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-rounded hawa-bg-primary hawa-p-2 hawa-text-primary-foreground" }, /* @__PURE__ */ import_react28.default.createElement(
5839
- "svg",
5840
- {
5841
- stroke: "currentColor",
5842
- fill: "currentColor",
5843
- strokeWidth: "0",
5844
- viewBox: "0 0 512 512",
5845
- height: "0.5em",
5846
- width: "0.5em"
5847
- },
5848
- /* @__PURE__ */ import_react28.default.createElement("path", { d: "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" })
5849
- )), /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-text-center hawa-text-sm" }, /* @__PURE__ */ import_react28.default.createElement("span", null, "Your feedback has been received!"), /* @__PURE__ */ import_react28.default.createElement("span", null, "Thank you for your help"))) : /* @__PURE__ */ import_react28.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-1 hawa-p-1" }, /* @__PURE__ */ import_react28.default.createElement(
5850
- Popover,
5851
- {
5852
- className: "hawa-select-none hawa-p-1 hawa-text-xs",
5853
- open: helperText,
5854
- trigger: /* @__PURE__ */ import_react28.default.createElement(
5855
- Textarea,
5856
- {
5857
- classNames: {
5858
- textarea: "hawa-mt-2 hawa-h-full hawa-resize-none"
5859
- },
5860
- textareaProps: {
5861
- placeholder: "Your feedback",
5862
- onChange: (e) => {
5863
- if (e.target.value) {
5864
- setHelperText(false);
5865
- }
5866
- setFeedbackText(e.target.value);
5867
- }
5868
- }
5869
- }
5870
- )
5871
- },
5872
- /* @__PURE__ */ import_react28.default.createElement("span", { className: "hawa-m-0" }, "Please enter your feedback")
5873
- ), /* @__PURE__ */ import_react28.default.createElement(
5874
- Button,
5875
- {
5876
- isLoading: loadingSubmit,
5877
- onClick: onFeedbackSubmit,
5878
- className: "hawa-w-full",
5879
- size: "sm"
5880
- },
5881
- "Submit"
5882
- ))
5883
- )
5499
+ (_m = (_l = props.texts) == null ? void 0 : _l.registerText) != null ? _m : "Register"
5500
+ )))
5501
+ )) : /* @__PURE__ */ import_react41.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react41.default.createElement("div", { className: "hawa-text-center" }, ((_n = props.texts) == null ? void 0 : _n.emailSentText) || "An email has been sent with a link to set a new password")));
5502
+ };
5503
+
5504
+ // blocks/auth/CodeConfirmation.tsx
5505
+ var import_react44 = __toESM(require("react"));
5506
+ var import_react_hook_form5 = require("react-hook-form");
5507
+ var import_zod5 = require("@hookform/resolvers/zod");
5508
+ var z5 = __toESM(require("zod"));
5509
+
5510
+ // elements/pinInput/PinInput.tsx
5511
+ var React36 = __toESM(require("react"));
5512
+ var import_input_otp = require("input-otp");
5513
+
5514
+ // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
5515
+ var import_react43 = require("react");
5516
+
5517
+ // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
5518
+ var toKebabCase = (string9) => string9.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
5519
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
5520
+ return Boolean(className) && array.indexOf(className) === index;
5521
+ }).join(" ");
5522
+
5523
+ // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
5524
+ var import_react42 = require("react");
5525
+
5526
+ // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
5527
+ var defaultAttributes = {
5528
+ xmlns: "http://www.w3.org/2000/svg",
5529
+ width: 24,
5530
+ height: 24,
5531
+ viewBox: "0 0 24 24",
5532
+ fill: "none",
5533
+ stroke: "currentColor",
5534
+ strokeWidth: 2,
5535
+ strokeLinecap: "round",
5536
+ strokeLinejoin: "round"
5537
+ };
5538
+
5539
+ // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
5540
+ var Icon = (0, import_react42.forwardRef)(
5541
+ ({
5542
+ color = "currentColor",
5543
+ size = 24,
5544
+ strokeWidth = 2,
5545
+ absoluteStrokeWidth,
5546
+ className = "",
5547
+ children,
5548
+ iconNode,
5549
+ ...rest
5550
+ }, ref) => {
5551
+ return (0, import_react42.createElement)(
5552
+ "svg",
5553
+ {
5554
+ ref,
5555
+ ...defaultAttributes,
5556
+ width: size,
5557
+ height: size,
5558
+ stroke: color,
5559
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
5560
+ className: mergeClasses("lucide", className),
5561
+ ...rest
5562
+ },
5563
+ [
5564
+ ...iconNode.map(([tag, attrs]) => (0, import_react42.createElement)(tag, attrs)),
5565
+ ...Array.isArray(children) ? children : [children]
5566
+ ]
5567
+ );
5568
+ }
5569
+ );
5570
+
5571
+ // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
5572
+ var createLucideIcon = (iconName, iconNode) => {
5573
+ const Component = (0, import_react43.forwardRef)(
5574
+ ({ className, ...props }, ref) => (0, import_react43.createElement)(Icon, {
5575
+ ref,
5576
+ iconNode,
5577
+ className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
5578
+ ...props
5579
+ })
5884
5580
  );
5581
+ Component.displayName = `${iconName}`;
5582
+ return Component;
5885
5583
  };
5886
5584
 
5887
- // blocks/feedback/FeedbackForm.tsx
5888
- var import_react29 = __toESM(require("react"));
5889
- var import_react_hook_form7 = require("react-hook-form");
5890
- var import_zod7 = require("@hookform/resolvers/zod");
5891
- var z7 = __toESM(require("zod"));
5892
- var FeedbackForm = (props) => {
5893
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
5894
- const formSchema = z7.object({
5895
- requestType: z7.string({ required_error: (_b = (_a = props.texts) == null ? void 0 : _a.requestType) == null ? void 0 : _b.required }).min(1, { message: (_d = (_c = props.texts) == null ? void 0 : _c.requestType) == null ? void 0 : _d.required }),
5896
- description: z7.string({ required_error: (_f = (_e = props.texts) == null ? void 0 : _e.description) == null ? void 0 : _f.required }).min(10, { message: (_h = (_g = props.texts) == null ? void 0 : _g.description) == null ? void 0 : _h.tooShort })
5897
- });
5898
- const { handleSubmit, control, formState, reset } = (0, import_react_hook_form7.useForm)({
5899
- resolver: (0, import_zod7.zodResolver)(formSchema),
5900
- defaultValues: { requestType: "", description: "" }
5901
- });
5902
- return /* @__PURE__ */ import_react29.default.createElement(
5903
- Card,
5585
+ // ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
5586
+ var Dot = createLucideIcon("Dot", [
5587
+ ["circle", { cx: "12.1", cy: "12.1", r: "1", key: "18d7e5" }]
5588
+ ]);
5589
+
5590
+ // elements/pinInput/PinInput.tsx
5591
+ var PinInputRoot = React36.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ React36.createElement(
5592
+ import_input_otp.OTPInput,
5593
+ {
5594
+ ref,
5595
+ containerClassName: cn(
5596
+ "hawa-flex hawa-items-center hawa-gap-2 has-[:disabled]:hawa-opacity-50",
5597
+ containerClassName
5598
+ ),
5599
+ className: cn("disabled:hawa-cursor-not-allowed", className),
5600
+ ...props
5601
+ }
5602
+ ));
5603
+ PinInputRoot.displayName = "PinInputRoot";
5604
+ var PinInputGroup = React36.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React36.createElement("div", { ref, className: cn("hawa-flex hawa-items-center", className), ...props }));
5605
+ PinInputGroup.displayName = "PinInputGroup";
5606
+ var PinInputSlot = React36.forwardRef(({ index, className, ...props }, ref) => {
5607
+ const pinInputContext = React36.useContext(import_input_otp.OTPInputContext);
5608
+ const { char, hasFakeCaret, isActive } = pinInputContext.slots[index];
5609
+ return /* @__PURE__ */ React36.createElement(
5610
+ "div",
5904
5611
  {
5612
+ ref,
5905
5613
  className: cn(
5906
- props.cardless ? "hawa-border-none hawa-bg-transparent hawa-shadow-none" : ""
5614
+ "hawa-border-input hawa-relative hawa-flex hawa-h-10 hawa-w-10 hawa-items-center hawa-justify-center hawa-border-y hawa-border-r hawa-text-sm hawa-transition-all first:hawa-rounded-l-md first:hawa-border-l last:hawa-rounded-r-md",
5615
+ isActive && "hawa-ring-ring hawa-ring-offset-background hawa-z-10 hawa-ring-2",
5616
+ className
5907
5617
  ),
5908
- style: props.cardless ? { boxShadow: "none" } : void 0
5618
+ ...props
5909
5619
  },
5910
- /* @__PURE__ */ import_react29.default.createElement(CardContent, { headless: true, className: props.cardless ? "!hawa-p-0" : "" }, props.sent ? /* @__PURE__ */ import_react29.default.createElement("div", { className: "hawa-text-center hawa-min-h-[200px] hawa-flex hawa-flex-col hawa-justify-center" }, /* @__PURE__ */ import_react29.default.createElement("div", { className: "hawa-font-bold hawa-text-lg" }, props.texts.sentTitle || "Form submitted"), /* @__PURE__ */ import_react29.default.createElement("div", { className: "hawa-text-md" }, props.texts.sentSubtitle || "Thank you for your submission")) : /* @__PURE__ */ import_react29.default.createElement(
5911
- "form",
5912
- {
5913
- noValidate: true,
5914
- onSubmit: handleSubmit((e) => {
5915
- if (props.onSubmit) {
5916
- return props.onSubmit(e);
5917
- } else {
5918
- console.log("Form is submitted but onSubmit prop is missing");
5919
- }
5920
- }),
5921
- className: "hawa-flex hawa-flex-col hawa-gap-4"
5922
- },
5923
- /* @__PURE__ */ import_react29.default.createElement(
5924
- import_react_hook_form7.Controller,
5925
- {
5926
- name: "requestType",
5927
- control,
5928
- render: ({ field }) => {
5929
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
5930
- return /* @__PURE__ */ import_react29.default.createElement(
5931
- Select,
5932
- {
5933
- ...field,
5934
- ...props.selectProps,
5935
- label: (_b2 = (_a2 = props.texts) == null ? void 0 : _a2.requestType) == null ? void 0 : _b2.label,
5936
- onChange: (option) => field.onChange(option.value),
5937
- options: props.requestTypes,
5938
- helperText: (_d2 = (_c2 = formState.errors.requestType) == null ? void 0 : _c2.message) == null ? void 0 : _d2.toString(),
5939
- placeholder: (_f2 = (_e2 = props.texts) == null ? void 0 : _e2.requestType) == null ? void 0 : _f2.placeholder,
5940
- texts: {
5941
- noOptions: (_h2 = (_g2 = props.texts) == null ? void 0 : _g2.requestType) == null ? void 0 : _h2.noOptions
5942
- }
5943
- }
5944
- );
5945
- }
5946
- }
5947
- ),
5948
- /* @__PURE__ */ import_react29.default.createElement(
5949
- import_react_hook_form7.Controller,
5950
- {
5951
- name: "description",
5952
- control,
5953
- render: ({ field }) => {
5954
- var _a2, _b2, _c2, _d2, _e2, _f2;
5955
- return /* @__PURE__ */ import_react29.default.createElement(
5956
- Textarea,
5957
- {
5958
- helperText: formState.errors.description && ((_b2 = (_a2 = formState.errors.description) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()),
5959
- classNames: { textarea: "hawa-h-full hawa-min-h-20" },
5960
- label: (_d2 = (_c2 = props.texts) == null ? void 0 : _c2.description) == null ? void 0 : _d2.label,
5961
- textareaProps: {
5962
- onChange: (e) => {
5963
- field.onChange(e.target.value);
5964
- },
5965
- value: field.value,
5966
- placeholder: (_f2 = (_e2 = props.texts) == null ? void 0 : _e2.description) == null ? void 0 : _f2.placeholder
5967
- }
5968
- }
5969
- );
5970
- }
5971
- }
5972
- ),
5973
- /* @__PURE__ */ import_react29.default.createElement(Button, { isLoading: props.loadingSubmission, type: "submit" }, (_i = props.texts) == null ? void 0 : _i.submit)
5974
- ))
5620
+ char,
5621
+ hasFakeCaret && /* @__PURE__ */ React36.createElement("div", { className: "hawa-pointer-events-none hawa-absolute hawa-inset-0 hawa-flex hawa-items-center hawa-justify-center" }, /* @__PURE__ */ React36.createElement("div", { className: "hawa-animate-caret-blink hawa-bg-foreground hawa-h-4 hawa-w-px hawa-duration-1000" }))
5975
5622
  );
5623
+ });
5624
+ PinInputSlot.displayName = "PinInputSlot";
5625
+ var PinInputSeperator = React36.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React36.createElement("div", { ref, role: "separator", ...props }, /* @__PURE__ */ React36.createElement(Dot, null)));
5626
+ PinInputSeperator.displayName = "PinInputSeperator";
5627
+ var PinInput = ({ separatorPosition = 0, ...props }) => {
5628
+ const maxLength = props.maxLength || 6;
5629
+ const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
5630
+ const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
5631
+ const secondGroupLength = maxLength - firstGroupLength;
5632
+ return /* @__PURE__ */ React36.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2", dir: "ltr" }, /* @__PURE__ */ React36.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React36.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React36.createElement(PinInputSlot, { key: index, index, className: "hawa-w-full hawa-border" }))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React36.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React36.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React36.createElement(
5633
+ PinInputSlot,
5634
+ {
5635
+ key: index + firstGroupLength,
5636
+ index: index + firstGroupLength,
5637
+ className: "hawa-w-full hawa-border"
5638
+ }
5639
+ )))), /* @__PURE__ */ React36.createElement(HelperText, { helperText: props.helperText }));
5976
5640
  };
5977
5641
 
5978
- // blocks/misc/LegalTexts.tsx
5979
- var import_react50 = __toESM(require("react"));
5980
-
5981
- // elements/scrollArea/ScrollArea.tsx
5982
- var React34 = __toESM(require("react"));
5983
- var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"));
5984
- var ScrollArea = React34.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
5985
- const scrollAreaRef = React34.useRef(null);
5986
- const isDragging = React34.useRef(false);
5987
- const startPos = React34.useRef({ x: 0, y: 0 });
5988
- const scrollPos = React34.useRef({ top: 0, left: 0 });
5989
- const [showLeftFade, setShowLeftFade] = React34.useState(false);
5990
- const [showRightFade, setShowRightFade] = React34.useState(false);
5991
- const checkOverflow = () => {
5992
- if (scrollAreaRef.current) {
5993
- const { scrollLeft, scrollWidth, clientWidth } = scrollAreaRef.current;
5994
- setShowLeftFade(scrollLeft > 0);
5995
- setShowRightFade(scrollLeft + clientWidth < scrollWidth);
5996
- }
5997
- };
5998
- const onMouseDown = (e) => {
5999
- isDragging.current = true;
6000
- startPos.current = { x: e.clientX, y: e.clientY };
6001
- if (scrollAreaRef.current) {
6002
- scrollPos.current = {
6003
- top: scrollAreaRef.current.scrollTop,
6004
- left: scrollAreaRef.current.scrollLeft
6005
- };
6006
- }
6007
- document.addEventListener("mousemove", onMouseMove);
6008
- document.addEventListener("mouseup", onMouseUp);
6009
- };
6010
- const onMouseMove = (e) => {
6011
- if (!isDragging.current || !scrollAreaRef.current) return;
6012
- const dx = e.clientX - startPos.current.x;
6013
- const dy = e.clientY - startPos.current.y;
6014
- if (orientation === "vertical") {
6015
- scrollAreaRef.current.scrollTop = scrollPos.current.top - dy;
6016
- } else {
6017
- scrollAreaRef.current.scrollLeft = scrollPos.current.left - dx;
6018
- checkOverflow();
5642
+ // blocks/auth/CodeConfirmation.tsx
5643
+ var CodeConfirmation = ({ codeLength = 6, ...props }) => {
5644
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5645
+ const formSchema = z5.object({
5646
+ otp_code: z5.string({ required_error: (_a = props.texts) == null ? void 0 : _a.codeRequiredText }).min(codeLength, { message: (_b = props.texts) == null ? void 0 : _b.codeTooShort })
5647
+ });
5648
+ const { handleSubmit, control, formState, setValue } = (0, import_react_hook_form5.useForm)({
5649
+ resolver: (0, import_zod5.zodResolver)(formSchema)
5650
+ });
5651
+ const [resendTimer, setResendTimer] = (0, import_react44.useState)(null);
5652
+ const [remainingTime, setRemainingTime] = (0, import_react44.useState)(0);
5653
+ const [showResendTimer, setShowResendTimer] = (0, import_react44.useState)(false);
5654
+ const startResendTimer = () => {
5655
+ if (resendTimer !== null) {
5656
+ clearInterval(resendTimer);
5657
+ setResendTimer(null);
6019
5658
  }
5659
+ const timerDuration = 60;
5660
+ setRemainingTime(timerDuration);
5661
+ setShowResendTimer(true);
5662
+ const newTimer = window.setInterval(() => {
5663
+ setRemainingTime((prevTime) => {
5664
+ if (prevTime > 0) {
5665
+ return prevTime - 1;
5666
+ } else {
5667
+ clearInterval(newTimer);
5668
+ setShowResendTimer(false);
5669
+ return 0;
5670
+ }
5671
+ });
5672
+ }, 1e3);
5673
+ setResendTimer(newTimer);
6020
5674
  };
6021
- const onMouseUp = () => {
6022
- isDragging.current = false;
6023
- document.removeEventListener("mousemove", onMouseMove);
6024
- document.removeEventListener("mouseup", onMouseUp);
6025
- };
6026
- React34.useEffect(() => {
6027
- checkOverflow();
6028
- if (scrollAreaRef.current) {
6029
- scrollAreaRef.current.addEventListener("scroll", checkOverflow);
6030
- window.addEventListener("resize", checkOverflow);
6031
- }
5675
+ (0, import_react44.useEffect)(() => {
6032
5676
  return () => {
6033
- if (scrollAreaRef.current) {
6034
- scrollAreaRef.current.removeEventListener("scroll", checkOverflow);
5677
+ if (resendTimer !== null) {
5678
+ clearInterval(resendTimer);
6035
5679
  }
6036
- window.removeEventListener("resize", checkOverflow);
6037
5680
  };
6038
5681
  }, []);
6039
- return /* @__PURE__ */ React34.createElement(
6040
- ScrollAreaPrimitive.Root,
5682
+ return /* @__PURE__ */ import_react44.default.createElement(Card, null, /* @__PURE__ */ import_react44.default.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ import_react44.default.createElement(Alert, { title: props.errorTitle, text: props.errorText, severity: "error" }), /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourIdentifier) || "Please check your phone"), /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ import_react44.default.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ import_react44.default.createElement("span", null, props.identifier))), /* @__PURE__ */ import_react44.default.createElement(
5683
+ "form",
6041
5684
  {
6042
- ref,
6043
- className: cn("hawa-relative hawa-overflow-hidden", className),
6044
- ...props
5685
+ noValidate: true,
5686
+ onSubmit: handleSubmit((e) => {
5687
+ if (props.onConfirm) {
5688
+ return props.onConfirm(e);
5689
+ } else {
5690
+ console.log("Form is submitted but onConfirm prop is missing");
5691
+ }
5692
+ })
6045
5693
  },
6046
- /* @__PURE__ */ React34.createElement(
6047
- "div",
5694
+ /* @__PURE__ */ import_react44.default.createElement(
5695
+ import_react_hook_form5.Controller,
6048
5696
  {
6049
- className: cn(
6050
- "hawa-pointer-events-none hawa-absolute hawa-bg-background hawa-h-full hawa-w-[50px] hawa-z-10 hawa-start-0 hawa-mask-fade-right",
6051
- showLeftFade ? "hawa-block" : "hawa-hidden"
6052
- )
5697
+ control,
5698
+ name: "otp_code",
5699
+ render: ({ field }) => {
5700
+ var _a2;
5701
+ return /* @__PURE__ */ import_react44.default.createElement(
5702
+ PinInput,
5703
+ {
5704
+ maxLength: codeLength,
5705
+ helperText: (_a2 = formState.errors.otp_code) == null ? void 0 : _a2.message,
5706
+ ...field
5707
+ }
5708
+ );
5709
+ }
6053
5710
  }
6054
5711
  ),
6055
- /* @__PURE__ */ React34.createElement(
6056
- "div",
5712
+ showResendTimer ? /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, (_e = props.texts) == null ? void 0 : _e.resendCodeTimer, " ", /* @__PURE__ */ import_react44.default.createElement("strong", null, remainingTime), " ", (_f = props.texts) == null ? void 0 : _f.seconds) : /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, /* @__PURE__ */ import_react44.default.createElement("span", null, (_h = (_g = props.texts) == null ? void 0 : _g.didntGetCode) != null ? _h : "Didn't get the code?"), " ", /* @__PURE__ */ import_react44.default.createElement(
5713
+ "span",
6057
5714
  {
6058
- className: cn(
6059
- "hawa-pointer-events-none hawa-absolute hawa-bg-background hawa-mask-fade-left hawa-end-0 hawa-h-full hawa-w-[50px] hawa-z-10",
6060
- showRightFade ? "hawa-block" : "hawa-hidden"
6061
- )
6062
- }
6063
- ),
6064
- /* @__PURE__ */ React34.createElement(
6065
- ScrollAreaPrimitive.Viewport,
5715
+ className: "clickable-link",
5716
+ onClick: () => {
5717
+ startResendTimer();
5718
+ props.onResend();
5719
+ }
5720
+ },
5721
+ ((_i = props.texts) == null ? void 0 : _i.resendCode) || "Click to resend"
5722
+ )),
5723
+ /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ import_react44.default.createElement(
5724
+ Button,
6066
5725
  {
6067
- ref: scrollAreaRef,
6068
- className: "hawa-h-full hawa-w-full hawa-rounded-[inherit]",
6069
- onMouseDown
5726
+ type: "button",
5727
+ onClick: () => {
5728
+ if (props.onCancel) {
5729
+ return props.onCancel();
5730
+ } else {
5731
+ console.log("Cancel button clicked but onCancel prop is missing");
5732
+ }
5733
+ },
5734
+ variant: "outline"
6070
5735
  },
6071
- children
6072
- ),
6073
- /* @__PURE__ */ React34.createElement(ScrollBar, { orientation }),
6074
- /* @__PURE__ */ React34.createElement(ScrollAreaPrimitive.Corner, null)
6075
- );
6076
- });
6077
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
6078
- var ScrollBar = React34.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React34.createElement(
6079
- ScrollAreaPrimitive.ScrollAreaScrollbar,
6080
- {
6081
- ref,
6082
- orientation,
6083
- className: cn(
6084
- "hawa-flex hawa-touch-none hawa-select-none hawa-transition-colors",
6085
- orientation === "vertical" && "hawa-h-full hawa-w-2.5 hawa-border-l hawa-border-l-transparent hawa-p-[1px]",
6086
- orientation === "horizontal" && "hawa-h-2.5 hawa-border-t hawa-border-t-transparent hawa-p-[1px]",
6087
- className
6088
- ),
6089
- ...props
6090
- },
6091
- /* @__PURE__ */ React34.createElement(
6092
- ScrollAreaPrimitive.ScrollAreaThumb,
6093
- {
6094
- className: cn(
6095
- "hawa-relative hawa-rounded-full hawa-bg-border",
6096
- orientation === "vertical" && "hawa-flex-1"
6097
- )
6098
- }
6099
- )
6100
- ));
6101
- ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
6102
-
6103
- // elements/tabs/Tabs.tsx
6104
- var React44 = __toESM(require("react"));
6105
-
6106
- // hooks/useIsomorphicEffect.ts
6107
- var import_react30 = require("react");
6108
-
6109
- // hooks/useDiscloser.ts
6110
- var import_react31 = require("react");
6111
-
6112
- // hooks/useHover.ts
6113
- var import_react32 = require("react");
6114
-
6115
- // hooks/useToast.ts
6116
- var React37 = __toESM(require("react"));
6117
-
6118
- // hooks/useCarousel.ts
6119
- var import_react33 = require("react");
6120
-
6121
- // hooks/useDialogCarousel.ts
6122
- var import_react34 = require("react");
6123
- var import_embla_carousel_auto_height = __toESM(require("embla-carousel-auto-height"));
6124
- var import_embla_carousel_react = __toESM(require("embla-carousel-react"));
6125
-
6126
- // hooks/useDialogSteps.ts
6127
- var import_react35 = require("react");
6128
-
6129
- // hooks/useClipboard.ts
6130
- var import_react36 = require("react");
6131
-
6132
- // hooks/useBreakpoint.ts
6133
- var import_react37 = require("react");
5736
+ ((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"
5737
+ ), /* @__PURE__ */ import_react44.default.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
5738
+ )));
5739
+ };
6134
5740
 
6135
- // hooks/useWindowSize.ts
6136
- var import_react38 = require("react");
5741
+ // blocks/feedback/UserReferralSource.tsx
5742
+ var import_react46 = __toESM(require("react"));
5743
+ var import_react_hook_form6 = require("react-hook-form");
5744
+ var import_zod6 = require("@hookform/resolvers/zod");
5745
+ var z6 = __toESM(require("zod"));
6137
5746
 
6138
- // hooks/useFocusWithin.ts
6139
- var import_react39 = require("react");
5747
+ // elements/radio/Radio.tsx
5748
+ var import_react45 = __toESM(require("react"));
5749
+ var import_react_tabs = require("@radix-ui/react-tabs");
6140
5750
 
6141
- // hooks/useMediaQuery.ts
6142
- var import_react40 = require("react");
6143
-
6144
- // hooks/useScrollPosition.ts
6145
- var import_react41 = require("react");
6146
-
6147
- // hooks/useTable.ts
6148
- var import_react42 = require("react");
6149
-
6150
- // hooks/useTabs.ts
6151
- var import_react43 = require("react");
6152
-
6153
- // hooks/useMeasureDirty.ts
6154
- var import_react44 = require("react");
6155
-
6156
- // hooks/useClickOutside.ts
6157
- var import_react45 = require("react");
6158
-
6159
- // hooks/useShortcuts.ts
6160
- var import_react46 = require("react");
6161
- function parseHotkey(hotkey) {
6162
- const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
6163
- const modifiers = {
6164
- alt: keys.includes("alt"),
6165
- ctrl: keys.includes("ctrl"),
6166
- meta: keys.includes("meta"),
6167
- mod: keys.includes("mod"),
6168
- shift: keys.includes("shift")
6169
- };
6170
- const reservedKeys = ["alt", "ctrl", "meta", "shift", "mod"];
6171
- const freeKey = keys.find((key) => !reservedKeys.includes(key));
6172
- return {
6173
- ...modifiers,
6174
- key: freeKey
6175
- };
6176
- }
6177
- function isExactHotkey(hotkey, event) {
6178
- const { alt, ctrl, meta, mod, shift, key } = hotkey;
6179
- const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey } = event;
6180
- if (alt !== altKey) {
6181
- return false;
6182
- }
6183
- if (mod) {
6184
- if (!ctrlKey && !metaKey) {
6185
- return false;
6186
- }
6187
- } else {
6188
- if (ctrl !== ctrlKey) {
6189
- return false;
6190
- }
6191
- if (meta !== metaKey) {
6192
- return false;
5751
+ // elements/popover/Popover.tsx
5752
+ var React38 = __toESM(require("react"));
5753
+ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
5754
+ var PopoverContent = React38.forwardRef(
5755
+ ({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ React38.createElement(PopoverPrimitive.Portal, { container }, /* @__PURE__ */ React38.createElement(
5756
+ PopoverPrimitive.Content,
5757
+ {
5758
+ ref,
5759
+ align,
5760
+ sideOffset,
5761
+ className: cn(
5762
+ "dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-bg-popover hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
5763
+ className
5764
+ ),
5765
+ ...props
6193
5766
  }
6194
- }
6195
- if (shift !== shiftKey) {
6196
- return false;
6197
- }
6198
- if (key && (pressedKey.toLowerCase() === key.toLowerCase() || event.code.replace("Key", "").toLowerCase() === key.toLowerCase())) {
6199
- return true;
6200
- }
6201
- return false;
6202
- }
6203
- function getHotkeyMatcher(hotkey) {
6204
- return (event) => isExactHotkey(parseHotkey(hotkey), event);
6205
- }
6206
- function getHotkeyHandler(hotkeys) {
6207
- return (event) => {
6208
- const _event = "nativeEvent" in event ? event.nativeEvent : event;
6209
- hotkeys.forEach(([hotkey, handler, options = { preventDefault: true }]) => {
6210
- if (getHotkeyMatcher(hotkey)(_event)) {
6211
- if (options.preventDefault) {
6212
- event.preventDefault();
6213
- }
6214
- handler(_event);
6215
- }
6216
- });
5767
+ ))
5768
+ );
5769
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
5770
+ var Popover2 = ({
5771
+ trigger,
5772
+ children,
5773
+ className,
5774
+ align = "center",
5775
+ side,
5776
+ sideOffset = 4,
5777
+ open,
5778
+ width = "default",
5779
+ disableTrigger,
5780
+ contentProps,
5781
+ triggerProps,
5782
+ ...props
5783
+ }) => {
5784
+ let widthStyles = {
5785
+ trigger: "var(--radix-popover-trigger-width)",
5786
+ default: "auto"
6217
5787
  };
6218
- }
6219
-
6220
- // hooks/useWindowEvent.ts
6221
- var import_react47 = require("react");
6222
- function useWindowEvent(type, listener, options) {
6223
- (0, import_react47.useEffect)(() => {
6224
- window.addEventListener(type, listener, options);
6225
- return () => window.removeEventListener(type, listener, options);
6226
- }, [type, listener]);
6227
- }
6228
-
6229
- // hooks/useViewportSize.ts
6230
- var import_react48 = require("react");
6231
- var eventListerOptions = {
6232
- passive: true
5788
+ return /* @__PURE__ */ React38.createElement(PopoverPrimitive.Root, { open, ...props }, /* @__PURE__ */ React38.createElement(
5789
+ PopoverPrimitive.Trigger,
5790
+ {
5791
+ className: "hawa-w-full",
5792
+ disabled: disableTrigger,
5793
+ ...triggerProps
5794
+ },
5795
+ trigger
5796
+ ), /* @__PURE__ */ React38.createElement(
5797
+ PopoverContent,
5798
+ {
5799
+ side,
5800
+ className,
5801
+ align,
5802
+ sideOffset,
5803
+ style: {
5804
+ width: widthStyles[width],
5805
+ maxWidth: "var(--radix-popover-content-available-width)",
5806
+ maxHeight: "var(--radix-popover-content-available-height)"
5807
+ },
5808
+ ...contentProps
5809
+ },
5810
+ children
5811
+ ));
6233
5812
  };
6234
- function useViewportSize() {
6235
- const [windowSize, setWindowSize] = (0, import_react48.useState)({
6236
- width: 0,
6237
- height: 0
6238
- });
6239
- const setSize = (0, import_react48.useCallback)(() => {
6240
- setWindowSize({
6241
- width: window.innerWidth || 0,
6242
- height: window.innerHeight || 0
6243
- });
6244
- }, []);
6245
- useWindowEvent("resize", setSize, eventListerOptions);
6246
- useWindowEvent("orientationchange", setSize, eventListerOptions);
6247
- (0, import_react48.useEffect)(setSize, []);
6248
- return windowSize;
6249
- }
6250
-
6251
- // elements/tabs/Tabs.tsx
6252
- var Popover2 = __toESM(require("@radix-ui/react-popover"));
6253
- var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"));
6254
- var import_tailwind_variants = require("tailwind-variants");
5813
+ var PopoverTrigger = PopoverPrimitive.Trigger;
5814
+ var PopoverRoot = PopoverPrimitive.Root;
6255
5815
 
6256
- // elements/chip/Chip.tsx
6257
- var import_react49 = __toESM(require("react"));
6258
- var Chip = import_react49.default.forwardRef(
5816
+ // elements/radio/Radio.tsx
5817
+ var Radio = (0, import_react45.forwardRef)(
6259
5818
  ({
6260
- label,
6261
- size = "normal",
6262
- icon,
6263
- color,
6264
- radius = "inherit",
6265
- dot,
6266
- dotStatus = "none",
6267
- ...rest
5819
+ design = "default",
5820
+ width = "default",
5821
+ size = "default",
5822
+ orientation = "horizontal",
5823
+ name,
5824
+ labelProps,
5825
+ tabsContainerClassName,
5826
+ forceHideHelperText = false,
5827
+ onChange,
5828
+ containerClassNames,
5829
+ ...props
6268
5830
  }, ref) => {
6269
- let defaultStyles = "hawa-flex hawa-flex-row hawa-w-fit hawa-gap-1 hawa-items-center hawa-px-2.5 hawa-py-1 hawa-font-bold ";
6270
- let radiusStyles = {
6271
- inherit: " hawa-rounded",
6272
- full: "hawa-rounded-full",
6273
- none: "hawa-rounded-none"
6274
- };
6275
- let sizeStyles = {
6276
- small: "hawa-h-[15px] hawa-leading-4 hawa-px-0 hawa-py-0 hawa-text-[9px] hawa-gap-0.5 ",
6277
- normal: "hawa-h-fit hawa-text-xs",
6278
- large: "hawa-text-base"
5831
+ var _a, _b, _c;
5832
+ let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
5833
+ let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
5834
+ ${props.disabled ? "" : "hover:hawa-bg-muted"}`;
5835
+ let orientationStyle = {
5836
+ horizontal: "hawa-flex hawa-flex-row",
5837
+ vertical: "hawa-flex hawa-flex-col"
6279
5838
  };
6280
- let dotStyles = {
6281
- small: "hawa-flex hawa-h-1 hawa-w-1 hawa-rounded-full",
6282
- normal: "hawa-flex hawa-h-2 hawa-w-2 hawa-rounded-full",
6283
- large: "hawa-flex hawa-h-3 hawa-w-3 hawa-rounded-full"
5839
+ let tabSizeStyle = {
5840
+ default: "hawa-py-2 hawa-px-4 hawa-text-sm",
5841
+ lg: "hawa-py-2 hawa-px-4",
5842
+ sm: "hawa-p-1.5 hawa-text-xs",
5843
+ xs: "hawa-p-1 hawa-text-[10px]"
6284
5844
  };
6285
- let dotStatusStyles = {
6286
- none: "hawa-bg-gray-500 dark:hawa-bg-gray-800",
6287
- available: "hawa-bg-green-500",
6288
- unavailable: "hawa-bg-red-500"
5845
+ let widthStyle = {
5846
+ none: "",
5847
+ default: "hawa-max-w-fit",
5848
+ full: "hawa-w-full"
6289
5849
  };
6290
- let colorStyles = {
6291
- green: "hawa-bg-green-200 hawa-text-green-700 dark:hawa-bg-green-700 dark:hawa-text-green-200",
6292
- blue: "hawa-bg-blue-200 hawa-text-blue-700 dark:hawa-bg-blue-700 dark:hawa-text-blue-100",
6293
- red: "hawa-bg-red-200 hawa-text-red-700 dark:hawa-bg-red-700 dark:hawa-text-red-100",
6294
- yellow: "hawa-bg-yellow-200 hawa-text-yellow-700 dark:hawa-bg-yellow-600 dark:hawa-text-black",
6295
- orange: "hawa-bg-orange-200 hawa-text-orange-700 dark:hawa-bg-orange-700 dark:hawa-text-orange-100",
6296
- purple: "hawa-bg-purple-200 hawa-text-purple-700 dark:hawa-bg-purple-700 dark:hawa-text-purple-100",
6297
- cyan: "hawa-bg-cyan-200 hawa-text-cyan-700 dark:hawa-bg-cyan-700 dark:hawa-text-cyan-100",
6298
- hyper: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-tl hawa-from-pink-500 hawa-via-red-500 hawa-to-yellow-500 ",
6299
- oceanic: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-bl hawa-from-green-300 hawa-via-blue-500 hawa-to-purple-600"
5850
+ const [parentDirection, setParentDirection] = import_react45.default.useState(
5851
+ null
5852
+ );
5853
+ const [selectedOption, setSelectedOption] = (0, import_react45.useState)(
5854
+ props.defaultValue || props.value
5855
+ );
5856
+ const [openTooltip, setOpenTooltip] = (0, import_react45.useState)(null);
5857
+ const parentRef = (0, import_react45.useRef)(null);
5858
+ (0, import_react45.useEffect)(() => {
5859
+ var _a2;
5860
+ const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
5861
+ if (parentNode) {
5862
+ const dir = window.getComputedStyle(parentNode).direction;
5863
+ setParentDirection(dir);
5864
+ }
5865
+ });
5866
+ const handleChange = (opt) => {
5867
+ setSelectedOption(opt.value);
5868
+ if (onChange) {
5869
+ onChange(opt.value);
5870
+ } else {
5871
+ console.log("onChange was not provided");
5872
+ }
6300
5873
  };
6301
- if (label) {
6302
- return /* @__PURE__ */ import_react49.default.createElement(
6303
- "span",
5874
+ const radio_option_tabs_styling = [
5875
+ "hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
5876
+ !props.disabled && "hawa-cursor-pointer",
5877
+ orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
5878
+ orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
5879
+ orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
5880
+ tabSizeStyle[size]
5881
+ ];
5882
+ switch (design) {
5883
+ case "tabs":
5884
+ return /* @__PURE__ */ import_react45.default.createElement(
5885
+ "div",
5886
+ {
5887
+ className: cn(
5888
+ "hawa-gap-2 hawa-flex hawa-flex-col",
5889
+ containerClassNames == null ? void 0 : containerClassNames.tabs
5890
+ )
5891
+ },
5892
+ props.label && /* @__PURE__ */ import_react45.default.createElement(Label, { ...labelProps }, props.label),
5893
+ /* @__PURE__ */ import_react45.default.createElement(import_react_tabs.Tabs, null, /* @__PURE__ */ import_react45.default.createElement(
5894
+ import_react_tabs.TabsList,
5895
+ {
5896
+ role: "tablist",
5897
+ ref: parentRef,
5898
+ className: cn(
5899
+ props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
5900
+ "hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium hawa-h-[40px]",
5901
+ orientationStyle[orientation],
5902
+ widthStyle[width],
5903
+ tabsContainerClassName,
5904
+ props.direction === "rtl" ? "hawa-flex-row-reverse" : ""
5905
+ )
5906
+ },
5907
+ (_b = props.options) == null ? void 0 : _b.map((opt, o) => {
5908
+ return opt.tooltip ? /* @__PURE__ */ import_react45.default.createElement(
5909
+ PopoverRoot,
5910
+ {
5911
+ key: o,
5912
+ open: o === openTooltip,
5913
+ onOpenChange: (bool) => setOpenTooltip(bool ? o : null)
5914
+ },
5915
+ /* @__PURE__ */ import_react45.default.createElement(
5916
+ PopoverTrigger,
5917
+ {
5918
+ onMouseEnter: () => setOpenTooltip(o),
5919
+ onMouseLeave: () => setOpenTooltip(null),
5920
+ asChild: true
5921
+ },
5922
+ /* @__PURE__ */ import_react45.default.createElement(
5923
+ import_react_tabs.TabsTrigger,
5924
+ {
5925
+ "aria-current": selectedOption === opt.value ? "page" : void 0,
5926
+ value: opt.value,
5927
+ role: "tab",
5928
+ tabIndex: 0,
5929
+ onClick: () => {
5930
+ if (props.disabled || opt.disabled) return;
5931
+ handleChange(opt);
5932
+ },
5933
+ className: cn(
5934
+ ...radio_option_tabs_styling,
5935
+ selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
5936
+ )
5937
+ },
5938
+ opt.icon && opt.icon,
5939
+ opt.label
5940
+ )
5941
+ ),
5942
+ /* @__PURE__ */ import_react45.default.createElement(PopoverContent, { ...opt.tooltipContentProps }, opt.tooltip)
5943
+ ) : /* @__PURE__ */ import_react45.default.createElement(
5944
+ import_react_tabs.TabsTrigger,
5945
+ {
5946
+ key: o,
5947
+ role: "tab",
5948
+ tabIndex: 0,
5949
+ "aria-current": selectedOption === opt.value ? "page" : void 0,
5950
+ onClick: () => {
5951
+ if (props.disabled || opt.disabled) return;
5952
+ handleChange(opt);
5953
+ },
5954
+ className: cn(
5955
+ ...radio_option_tabs_styling,
5956
+ selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
5957
+ ),
5958
+ value: opt.value
5959
+ },
5960
+ opt.icon && opt.icon,
5961
+ opt.label
5962
+ );
5963
+ })
5964
+ )),
5965
+ !forceHideHelperText && /* @__PURE__ */ import_react45.default.createElement(HelperText, { helperText: props.helperText })
5966
+ );
5967
+ case "bordered":
5968
+ return /* @__PURE__ */ import_react45.default.createElement(
5969
+ "div",
5970
+ {
5971
+ className: cn(
5972
+ orientationStyle[orientation],
5973
+ "hawa-gap-4",
5974
+ containerClassNames == null ? void 0 : containerClassNames.bordered
5975
+ )
5976
+ },
5977
+ props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react45.default.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ import_react45.default.createElement(
5978
+ "div",
5979
+ {
5980
+ className: cn(
5981
+ "radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
5982
+ props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
5983
+ ),
5984
+ key: i + 1
5985
+ },
5986
+ /* @__PURE__ */ import_react45.default.createElement(
5987
+ "input",
5988
+ {
5989
+ disabled: opt.disabled,
5990
+ id: opt.value.toString(),
5991
+ type: "radio",
5992
+ value: opt.value,
5993
+ name,
5994
+ onChange: () => handleChange(opt)
5995
+ }
5996
+ ),
5997
+ /* @__PURE__ */ import_react45.default.createElement(
5998
+ "label",
5999
+ {
6000
+ htmlFor: opt.value.toString(),
6001
+ className: cn(
6002
+ "hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium hawa-text-black dark:hawa-text-white",
6003
+ opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
6004
+ )
6005
+ },
6006
+ opt.label
6007
+ )
6008
+ )))
6009
+ );
6010
+ case "cards":
6011
+ return /* @__PURE__ */ import_react45.default.createElement(
6012
+ "ul",
6013
+ {
6014
+ className: cn(
6015
+ orientationStyle[orientation],
6016
+ "hawa-gap-4",
6017
+ containerClassNames == null ? void 0 : containerClassNames.cards
6018
+ )
6019
+ },
6020
+ (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react45.default.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ import_react45.default.createElement(
6021
+ "input",
6022
+ {
6023
+ type: "radio",
6024
+ id: opt.value.toString(),
6025
+ name,
6026
+ value: opt.value.toString(),
6027
+ className: "hawa-peer hawa-hidden",
6028
+ required: true,
6029
+ disabled: opt.disabled
6030
+ }
6031
+ ), /* @__PURE__ */ import_react45.default.createElement(
6032
+ "label",
6033
+ {
6034
+ htmlFor: opt.value.toString(),
6035
+ className: cn(
6036
+ "hawa-inline-flex hawa-h-full hawa-w-full hawa-transition-all hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-foreground/10 hawa-bg-background hawa-p-5 hawa-text-gray-500 peer-checked:hawa-border-primary peer-checked:hawa-text-primary dark:hawa-border-foreground/10 dark:hawa-bg-foreground/5 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
6037
+ opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-foreground/10 hover:hawa-text-gray-600 dark:hover:hawa-bg-foreground/20 dark:hover:hawa-text-gray-300"
6038
+ )
6039
+ },
6040
+ /* @__PURE__ */ import_react45.default.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ import_react45.default.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ import_react45.default.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
6041
+ )))
6042
+ );
6043
+ default:
6044
+ return /* @__PURE__ */ import_react45.default.createElement(
6045
+ "div",
6046
+ {
6047
+ className: cn(
6048
+ "hawa-flex hawa-flex-col hawa-gap-2",
6049
+ containerClassNames == null ? void 0 : containerClassNames.default
6050
+ )
6051
+ },
6052
+ props.label && /* @__PURE__ */ import_react45.default.createElement(Label, { ...labelProps }, props.label),
6053
+ /* @__PURE__ */ import_react45.default.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react45.default.createElement(
6054
+ "div",
6055
+ {
6056
+ className: cn(
6057
+ "radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
6058
+ props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
6059
+ ),
6060
+ key: i + 1
6061
+ },
6062
+ /* @__PURE__ */ import_react45.default.createElement(
6063
+ "input",
6064
+ {
6065
+ disabled: opt.disabled,
6066
+ id: opt.value.toString(),
6067
+ type: "radio",
6068
+ value: opt.value,
6069
+ name,
6070
+ onChange: () => handleChange(opt)
6071
+ }
6072
+ ),
6073
+ /* @__PURE__ */ import_react45.default.createElement(
6074
+ "label",
6075
+ {
6076
+ htmlFor: opt.value.toString(),
6077
+ className: cn(
6078
+ "hawa-text-sm hawa-font-medium dark:hawa-text-white",
6079
+ opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
6080
+ )
6081
+ },
6082
+ opt.label
6083
+ )
6084
+ ))),
6085
+ /* @__PURE__ */ import_react45.default.createElement(HelperText, { helperText: props.helperText })
6086
+ );
6087
+ }
6088
+ }
6089
+ );
6090
+
6091
+ // elements/textarea/Textarea.tsx
6092
+ var React40 = __toESM(require("react"));
6093
+ var Textarea = React40.forwardRef(
6094
+ ({
6095
+ className,
6096
+ classNames,
6097
+ labelProps,
6098
+ showCount,
6099
+ forceHideHelperText,
6100
+ textareaProps,
6101
+ countPosition = "bottom",
6102
+ isLoading,
6103
+ ...props
6104
+ }, ref) => {
6105
+ return /* @__PURE__ */ React40.createElement(
6106
+ "div",
6107
+ {
6108
+ className: cn(
6109
+ "textarea-main hawa-relative hawa-flex hawa-h-full hawa-w-full hawa-flex-col",
6110
+ !forceHideHelperText && "hawa-gap-2",
6111
+ className
6112
+ )
6113
+ },
6114
+ /* @__PURE__ */ React40.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, props.label && /* @__PURE__ */ React40.createElement(Label, { ...labelProps }, props.label), showCount && countPosition === "top" && /* @__PURE__ */ React40.createElement(
6115
+ "div",
6116
+ {
6117
+ className: "hawa-text-start hawa-text-xs hawa-transition-all hawa-leading-none"
6118
+ },
6119
+ (textareaProps == null ? void 0 : textareaProps.value) ? String(textareaProps == null ? void 0 : textareaProps.value).length : 0,
6120
+ "/",
6121
+ textareaProps == null ? void 0 : textareaProps.maxLength
6122
+ )),
6123
+ isLoading ? /* @__PURE__ */ React40.createElement(Skeleton, { style: { height: 40 } }) : /* @__PURE__ */ React40.createElement(
6124
+ "textarea",
6125
+ {
6126
+ ...textareaProps,
6127
+ className: cn(
6128
+ "hawa-flex hawa-min-h-[40px] hawa-h-[40px] hawa-w-full hawa-rounded-md hawa-border hawa-border-input hawa-bg-background hawa-px-3 hawa-py-2 hawa-text-sm hawa-ring-offset-background placeholder:hawa-text-gray-400 placeholder:hawa-text-muted-foreground focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 disabled:hawa-cursor-not-allowed disabled:hawa-opacity-50",
6129
+ classNames == null ? void 0 : classNames.textarea
6130
+ ),
6131
+ ref
6132
+ }
6133
+ ),
6134
+ /* @__PURE__ */ React40.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, !forceHideHelperText && /* @__PURE__ */ React40.createElement(HelperText, { helperText: props.helperText }), showCount && countPosition === "bottom" && /* @__PURE__ */ React40.createElement("div", { className: "hawa-text-start hawa-text-xs hawa-transition-all" }, (textareaProps == null ? void 0 : textareaProps.value) ? String(textareaProps == null ? void 0 : textareaProps.value).length : 0, "/", textareaProps == null ? void 0 : textareaProps.maxLength))
6135
+ );
6136
+ }
6137
+ );
6138
+ Textarea.displayName = "Textarea";
6139
+
6140
+ // blocks/feedback/UserReferralSource.tsx
6141
+ var UserReferralSource = ({
6142
+ position = "bottom-right",
6143
+ options = [],
6144
+ ...props
6145
+ }) => {
6146
+ var _a, _b;
6147
+ const [closed, setClosed] = (0, import_react46.useState)(false);
6148
+ const popUpRef = (0, import_react46.useRef)(null);
6149
+ const formSchema = z6.object({
6150
+ source: z6.string({ required_error: (_a = props.texts) == null ? void 0 : _a.pleaseSelectOption }),
6151
+ feedback: z6.string().optional()
6152
+ });
6153
+ const { handleSubmit, control, formState, watch } = (0, import_react_hook_form6.useForm)({
6154
+ resolver: (0, import_zod6.zodResolver)(formSchema)
6155
+ });
6156
+ const selectedSource = watch("source");
6157
+ const boxPosition = {
6158
+ "bottom-right": "hawa-right-4",
6159
+ "bottom-left": "hawa-left-4"
6160
+ };
6161
+ const optionsWithOther = [
6162
+ ...options,
6163
+ {
6164
+ value: "other",
6165
+ label: "Other"
6166
+ }
6167
+ ];
6168
+ return /* @__PURE__ */ import_react46.default.createElement(
6169
+ "div",
6170
+ {
6171
+ className: cn(
6172
+ "hawa-transition-all",
6173
+ closed ? "hawa-opacity-0" : "hawa-opacity-100"
6174
+ ),
6175
+ ref: popUpRef
6176
+ },
6177
+ /* @__PURE__ */ import_react46.default.createElement(
6178
+ Card,
6179
+ {
6180
+ className: cn(
6181
+ "hawa-fixed hawa-bottom-4 hawa-p-0 ",
6182
+ boxPosition[position]
6183
+ ),
6184
+ dir: props.direction
6185
+ },
6186
+ /* @__PURE__ */ import_react46.default.createElement(
6187
+ "button",
6304
6188
  {
6305
- ...rest,
6306
- ref,
6189
+ type: "button",
6307
6190
  className: cn(
6308
- defaultStyles,
6309
- sizeStyles[size],
6310
- radiusStyles[radius],
6311
- color ? colorStyles[color] : "hawa-border hawa-bg-none",
6312
- rest.className
6191
+ props.direction === "rtl" ? "hawa-left-2" : "hawa-right-2",
6192
+ "hawa-absolute hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white"
6193
+ ),
6194
+ "data-dismiss-target": "#toast-default",
6195
+ "aria-label": "Close",
6196
+ onClick: () => {
6197
+ setClosed(true);
6198
+ setTimeout(() => {
6199
+ if (popUpRef == null ? void 0 : popUpRef.current) {
6200
+ popUpRef == null ? void 0 : popUpRef.current.removeChild(popUpRef == null ? void 0 : popUpRef.current.children[0]);
6201
+ }
6202
+ }, 200);
6203
+ }
6204
+ },
6205
+ /* @__PURE__ */ import_react46.default.createElement(
6206
+ "svg",
6207
+ {
6208
+ "aria-hidden": "true",
6209
+ className: "hawa-h-5 hawa-w-5",
6210
+ fill: "currentColor",
6211
+ viewBox: "0 0 20 20"
6212
+ },
6213
+ /* @__PURE__ */ import_react46.default.createElement(
6214
+ "path",
6215
+ {
6216
+ fillRule: "evenodd",
6217
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
6218
+ clipRule: "evenodd"
6219
+ }
6313
6220
  )
6221
+ )
6222
+ ),
6223
+ /* @__PURE__ */ import_react46.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react46.default.createElement(
6224
+ "form",
6225
+ {
6226
+ noValidate: true,
6227
+ onSubmit: handleSubmit((e) => {
6228
+ if (props.onSubmitForm) {
6229
+ props.onSubmitForm(e);
6230
+ } else {
6231
+ console.log("onSubmitForm was not provided");
6232
+ }
6233
+ })
6314
6234
  },
6315
- dot && /* @__PURE__ */ import_react49.default.createElement(
6316
- "span",
6235
+ /* @__PURE__ */ import_react46.default.createElement(
6236
+ "div",
6317
6237
  {
6318
- className: cn(dotStyles[size], dotStatusStyles[dotStatus])
6319
- }
6238
+ className: cn(
6239
+ "hawa-flex hawa-flex-col hawa-gap-4 hawa-transition-all",
6240
+ closed ? "hawa-opacity-0" : "hawa-opacity-100"
6241
+ )
6242
+ },
6243
+ /* @__PURE__ */ import_react46.default.createElement("div", { className: "hawa-mt-4 hawa-font-bold" }, props.question),
6244
+ /* @__PURE__ */ import_react46.default.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded " }, /* @__PURE__ */ import_react46.default.createElement(
6245
+ import_react_hook_form6.Controller,
6246
+ {
6247
+ control,
6248
+ name: "source",
6249
+ render: ({ field }) => {
6250
+ var _a2, _b2;
6251
+ return /* @__PURE__ */ import_react46.default.createElement(
6252
+ Radio,
6253
+ {
6254
+ name: "source",
6255
+ direction: props.direction,
6256
+ orientation: "vertical",
6257
+ options: optionsWithOther,
6258
+ defaultValue: field.value,
6259
+ onChange: (e) => field.onChange(e),
6260
+ helperText: (_b2 = (_a2 = formState.errors.source) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
6261
+ }
6262
+ );
6263
+ }
6264
+ }
6265
+ )),
6266
+ /* @__PURE__ */ import_react46.default.createElement("div", null, /* @__PURE__ */ import_react46.default.createElement(
6267
+ import_react_hook_form6.Controller,
6268
+ {
6269
+ control,
6270
+ name: "feedback",
6271
+ render: ({ field }) => {
6272
+ var _a2, _b2;
6273
+ return /* @__PURE__ */ import_react46.default.createElement(
6274
+ Textarea,
6275
+ {
6276
+ ...field,
6277
+ textareaProps: {
6278
+ onChange: (e) => field.onChange(e.target.value),
6279
+ disabled: selectedSource !== "other"
6280
+ },
6281
+ helperText: (_b2 = (_a2 = formState.errors.feedback) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
6282
+ }
6283
+ );
6284
+ }
6285
+ }
6286
+ ))
6320
6287
  ),
6321
- icon && icon,
6322
- label
6323
- );
6324
- } else {
6325
- return /* @__PURE__ */ import_react49.default.createElement(
6326
- "span",
6327
- {
6328
- ...rest,
6329
- ref,
6330
- className: cn(
6331
- "hawa-h-2 hawa-w-2 hawa-rounded-full",
6332
- color ? colorStyles[color] : "hawa-border hawa-bg-none"
6333
- )
6334
- }
6335
- );
6336
- }
6337
- }
6338
- );
6288
+ /* @__PURE__ */ import_react46.default.createElement(Button, { type: "submit", className: "hawa-mt-4 hawa-w-full" }, ((_b = props.texts) == null ? void 0 : _b.submit) || "Submit")
6289
+ ))
6290
+ )
6291
+ );
6292
+ };
6339
6293
 
6340
- // elements/tabs/Tabs.tsx
6341
- var tabsListVariant = (0, import_tailwind_variants.tv)({
6342
- base: "",
6343
- variants: {
6344
- variant: {
6345
- default: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-border hawa-bg-muted hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
6346
- underlined: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-rounded hawa-p-1 hawa-text-muted-foreground dark:hawa-border-primary/10",
6347
- underlined_tabs: "hawa-flex hawa-w-fit hawa-items-center hawa-justify-start hawa-gap-1 hawa-text-muted-foreground"
6348
- },
6349
- orientation: { horizontal: "", vertical: "" }
6350
- },
6351
- compoundVariants: [
6352
- {
6353
- variant: "underlined_tabs",
6354
- orientation: "vertical",
6355
- class: "hawa-border-e-2 hawa-border-e-primary"
6356
- },
6357
- {
6358
- variant: "underlined_tabs",
6359
- orientation: "horizontal",
6360
- class: "hawa-border-b-2 hawa-border-b-primary"
6361
- }
6362
- ],
6363
- defaultVariants: { variant: "default", orientation: "horizontal" }
6364
- });
6365
- var tabsTriggerVariant = (0, import_tailwind_variants.tv)({
6366
- base: "",
6367
- variants: {
6368
- variant: {
6369
- default: "hawa-inline-flex hawa-w-full hawa-flex-1 hawa-select-none hawa-items-center hawa-justify-center hawa-gap-2 hawa-whitespace-nowrap hawa-rounded hawa-border hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-all focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50 data-[state=active]:hawa-bg-primary data-[state=active]:hawa-text-primary-foreground data-[state=active]:hawa-shadow-sm dark:hawa-border-primary/10",
6370
- underlined: "hawa-inline-flex hawa-w-full hawa-flex-1 hawa-select-none hawa-items-center hawa-justify-center hawa-gap-2 hawa-whitespace-nowrap hawa-rounded hawa-rounded-none hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-all focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50",
6371
- underlined_tabs: "hawa-inline-flex hawa-w-full hawa-flex-1 hawa-select-none hawa-items-center hawa-justify-center hawa-gap-2 hawa-whitespace-nowrap hawa-rounded hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-all focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50 hawa-bg-primary/10 data-[state=active]:hawa-bg-primary data-[state=active]:hawa-text-primary-foreground dark:hawa-border-primary/10"
6372
- },
6373
- orientation: { horizontal: "", vertical: "" }
6374
- },
6375
- compoundVariants: [
6376
- {
6377
- variant: "underlined",
6378
- orientation: "horizontal",
6379
- class: "data-[state=active]:hawa-border-b-primary hawa-border-b hawa-border-b-2"
6380
- },
6381
- {
6382
- variant: "underlined",
6383
- orientation: "vertical",
6384
- class: "data-[state=active]:hawa-border-e-primary hawa-border-e hawa-border-e-2"
6385
- },
6294
+ // blocks/feedback/FeedbackRating.tsx
6295
+ var import_react47 = __toESM(require("react"));
6296
+ var FeedbackRating = ({
6297
+ position = "bottom-right",
6298
+ ...props
6299
+ }) => {
6300
+ const [closed, setClosed] = (0, import_react47.useState)(false);
6301
+ const [answered, setAnswered] = (0, import_react47.useState)(false);
6302
+ const [clickedOption, setClickedOption] = (0, import_react47.useState)(null);
6303
+ const [closingTimer, setClosingTimer] = (0, import_react47.useState)(5);
6304
+ const popUpRef = (0, import_react47.useRef)(null);
6305
+ const boxPosition = {
6306
+ "bottom-right": "hawa-right-4",
6307
+ "bottom-left": "hawa-left-4"
6308
+ };
6309
+ (0, import_react47.useEffect)(() => {
6310
+ const timeoutHide = setTimeout(() => {
6311
+ if (closingTimer >= 0) {
6312
+ setClosingTimer(closingTimer - 1);
6313
+ }
6314
+ }, 1e3);
6315
+ return () => {
6316
+ clearTimeout(timeoutHide);
6317
+ };
6318
+ }, [closingTimer]);
6319
+ const slowClose = () => {
6320
+ setClosed(true);
6321
+ setTimeout(() => {
6322
+ if (popUpRef.current) {
6323
+ popUpRef.current.removeChild(popUpRef.current.children[0]);
6324
+ }
6325
+ }, 200);
6326
+ };
6327
+ return /* @__PURE__ */ import_react47.default.createElement(
6328
+ "div",
6386
6329
  {
6387
- variant: "underlined_tabs",
6388
- orientation: "horizontal",
6389
- class: "hawa-rounded-b-none"
6330
+ ref: popUpRef,
6331
+ className: cn(
6332
+ props.banner ? "hawa-fixed hawa-bottom-0 hawa-left-0 hawa-w-full hawa-px-0 md:hawa-px-4" : "hawa-fixed hawa-bottom-4",
6333
+ boxPosition[position]
6334
+ )
6390
6335
  },
6391
- {
6392
- variant: "underlined_tabs",
6393
- orientation: "vertical",
6394
- class: "hawa-rounded-e-none"
6336
+ /* @__PURE__ */ import_react47.default.createElement(
6337
+ "div",
6338
+ {
6339
+ className: cn(
6340
+ "hawa-relative hawa-flex hawa-w-full hawa-flex-col hawa-gap-2 hawa-rounded hawa-border hawa-bg-background hawa-p-4 hawa-shadow-md hawa-transition-all",
6341
+ closed ? "hawa-opacity-0" : "hawa-opacity-100",
6342
+ props.banner && "hawa-rounded-none hawa-px-4 md:hawa-rounded-t md:hawa-px-64"
6343
+ )
6344
+ },
6345
+ /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-absolute hawa-left-2 hawa-top-2 hawa-p-1.5 hawa-text-sm" }, props.title),
6346
+ /* @__PURE__ */ import_react47.default.createElement(
6347
+ "button",
6348
+ {
6349
+ type: "button",
6350
+ className: "hawa-absolute hawa-right-2 hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white",
6351
+ "data-dismiss-target": "#toast-default",
6352
+ "aria-label": "Close",
6353
+ onClick: () => slowClose()
6354
+ },
6355
+ /* @__PURE__ */ import_react47.default.createElement(
6356
+ "svg",
6357
+ {
6358
+ "aria-hidden": "true",
6359
+ className: "hawa-h-5 hawa-w-5",
6360
+ fill: "currentColor",
6361
+ viewBox: "0 0 20 20"
6362
+ },
6363
+ /* @__PURE__ */ import_react47.default.createElement(
6364
+ "path",
6365
+ {
6366
+ fillRule: "evenodd",
6367
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
6368
+ clipRule: "evenodd"
6369
+ }
6370
+ )
6371
+ )
6372
+ ),
6373
+ /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-mt-8" }, props.question),
6374
+ /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded" }, props.options && props.options.map((op, i) => /* @__PURE__ */ import_react47.default.createElement(
6375
+ "span",
6376
+ {
6377
+ key: i,
6378
+ onClick: () => {
6379
+ if (props.onOptionClicked) {
6380
+ props.onOptionClicked(op);
6381
+ }
6382
+ setClickedOption(op);
6383
+ setAnswered(true);
6384
+ const timeoutDestroy = setTimeout(() => {
6385
+ setClosed(true);
6386
+ }, 4800);
6387
+ setTimeout(() => {
6388
+ var _a, _b;
6389
+ (_b = popUpRef.current) == null ? void 0 : _b.removeChild(
6390
+ (_a = popUpRef.current) == null ? void 0 : _a.children[0]
6391
+ );
6392
+ clearTimeout(timeoutDestroy);
6393
+ }, 5300);
6394
+ },
6395
+ className: cn(
6396
+ "hawa-w-full hawa-cursor-pointer hawa-rounded hawa-border hawa-p-4 hawa-text-center hawa-transition-all",
6397
+ clickedOption === op ? "hawa-bg-gray-500 hawa-text-white" : "hawa-border hawa-bg-background hover:hawa-bg-gray-300 dark:hover:hawa-bg-gray-700"
6398
+ )
6399
+ },
6400
+ op
6401
+ ))),
6402
+ props.texts && /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between hawa-text-xs" }, /* @__PURE__ */ import_react47.default.createElement("span", null, props.texts.least), /* @__PURE__ */ import_react47.default.createElement("span", null, props.texts.most)),
6403
+ answered && /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-absolute hawa-left-0 hawa-top-0 hawa-flex hawa-h-full hawa-w-full hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-rounded hawa-bg-black hawa-bg-opacity-80 hawa-p-4 hawa-text-center hawa-transition-all" }, /* @__PURE__ */ import_react47.default.createElement("span", { className: "hawa-font-bold hawa-text-white" }, "Thank you for your answer. This box will disappear in", " " + closingTimer, " seconds"), /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-2" }, /* @__PURE__ */ import_react47.default.createElement(Button, { variant: "secondary", onClick: () => slowClose() }, "Close")))
6404
+ )
6405
+ );
6406
+ };
6407
+
6408
+ // blocks/feedback/FeedbackEmoji.tsx
6409
+ var import_react48 = __toESM(require("react"));
6410
+ var FeedbackEmoji = (props) => {
6411
+ const [selectedEmoji, setSelectedEmoji] = (0, import_react48.useState)(null);
6412
+ const [loadingSubmit, setLoadingSubmit] = (0, import_react48.useState)(false);
6413
+ const [feedbackText, setFeedbackText] = (0, import_react48.useState)("");
6414
+ const [helperText, setHelperText] = (0, import_react48.useState)(false);
6415
+ let emojis = [
6416
+ { icon: /* @__PURE__ */ import_react48.default.createElement(VeryGoodEmoji, null), value: "very-good" },
6417
+ { icon: /* @__PURE__ */ import_react48.default.createElement(GoodEmoji, null), value: "good" },
6418
+ { icon: /* @__PURE__ */ import_react48.default.createElement(BadEmoji, null), value: "bad" },
6419
+ { icon: /* @__PURE__ */ import_react48.default.createElement(VeryBadEmoji, null), value: "very-bad" }
6420
+ ];
6421
+ const onFeedbackSubmit = async () => {
6422
+ if (feedbackText) {
6423
+ setLoadingSubmit(true);
6424
+ try {
6425
+ await props.handleSubmit({
6426
+ choice: selectedEmoji,
6427
+ feedback: feedbackText
6428
+ });
6429
+ } catch (error) {
6430
+ console.error("Error during submission:", error);
6431
+ setLoadingSubmit(false);
6432
+ }
6433
+ await setLoadingSubmit(false);
6434
+ } else {
6435
+ setLoadingSubmit(false);
6436
+ setHelperText(true);
6395
6437
  }
6396
- ],
6397
- defaultVariants: { variant: "default", orientation: "horizontal" }
6398
- });
6399
- var TabsContext = React44.createContext({ orientation: "horizontal", variant: "default", scrollable: false });
6400
- var Tabs2 = React44.forwardRef(
6401
- ({ className, orientation, scrollable, variant = "default", ...props }, ref) => /* @__PURE__ */ React44.createElement(
6402
- TabsPrimitive.Root,
6438
+ };
6439
+ return /* @__PURE__ */ import_react48.default.createElement(
6440
+ "div",
6403
6441
  {
6404
- ref,
6405
6442
  className: cn(
6406
- "hawa-flex hawa-gap-2",
6407
- orientation === "vertical" ? "hawa-flex-row" : "hawa-flex-col",
6408
- className
6409
- ),
6410
- ...props
6443
+ "hawa-flex hawa-flex-col hawa-rounded hawa-border hawa-p-2 hawa-transition-all",
6444
+ selectedEmoji ? "hawa-h-[189px] hawa-min-w-fit" : "hawa-h-[44px]"
6445
+ )
6411
6446
  },
6412
- /* @__PURE__ */ React44.createElement(TabsContext.Provider, { value: { orientation, variant, scrollable } }, props.children)
6413
- )
6414
- );
6415
- var TabsList2 = React44.forwardRef(({ className, classNames, ...props }, ref) => {
6416
- const { orientation, variant, scrollable } = React44.useContext(TabsContext);
6417
- const { width } = useViewportSize();
6418
- if (scrollable && width < 768 && orientation === "horizontal") {
6419
- return /* @__PURE__ */ React44.createElement(ScrollArea, { orientation: "horizontal", className: classNames == null ? void 0 : classNames.scrollArea }, /* @__PURE__ */ React44.createElement(
6420
- TabsPrimitive.List,
6447
+ /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2" }, /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-0.5" }, emojis.map((emoji, i) => /* @__PURE__ */ import_react48.default.createElement(
6448
+ Button,
6421
6449
  {
6422
- ref,
6450
+ key: i,
6451
+ onClick: () => {
6452
+ if (selectedEmoji === emoji.value) {
6453
+ setSelectedEmoji("");
6454
+ } else {
6455
+ setSelectedEmoji(emoji.value);
6456
+ }
6457
+ },
6458
+ variant: "ghost",
6459
+ size: "smallIcon",
6423
6460
  className: cn(
6424
- tabsListVariant({ variant, orientation }),
6425
- "hawa-flex-row hawa-flex-nowrap",
6426
- className
6427
- ),
6428
- ...props
6429
- }
6430
- ));
6431
- } else {
6432
- return /* @__PURE__ */ React44.createElement(
6433
- TabsPrimitive.List,
6461
+ selectedEmoji === emoji.value ? "hawa-bg-primary/10 hover:hawa-bg-primary/10" : "hawa-text-[#666666]"
6462
+ )
6463
+ },
6464
+ emoji.icon
6465
+ )))),
6466
+ /* @__PURE__ */ import_react48.default.createElement(
6467
+ "div",
6434
6468
  {
6435
- ref,
6436
6469
  className: cn(
6437
- tabsListVariant({ variant, orientation }),
6438
- orientation === "vertical" ? "hawa-flex-col" : "hawa-flex-row",
6439
- "hawa-flex-wrap",
6440
- className
6441
- ),
6442
- ...props
6443
- }
6444
- );
6445
- }
6446
- });
6447
- var TabsTrigger2 = React44.forwardRef(
6448
- ({ className, chipProps, withPopover = false, onPopoverClick, ...props }, ref) => {
6449
- const { orientation, variant } = React44.useContext(TabsContext);
6450
- if (withPopover) {
6451
- return /* @__PURE__ */ React44.createElement(Popover2.Root, { open: props.showPopover }, /* @__PURE__ */ React44.createElement(Popover2.Anchor, { asChild: true }, /* @__PURE__ */ React44.createElement(
6452
- TabsPrimitive.Trigger,
6470
+ "hawa-flex hawa-flex-col hawa-overflow-clip hawa-transition-all hawa-duration-500 hawa-ease-in-out",
6471
+ selectedEmoji ? "hawa-visible hawa-opacity-100" : "hawa-invisible hawa-opacity-0"
6472
+ )
6473
+ },
6474
+ props.showSuccess ? /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-h-full hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-pt-4" }, /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-rounded hawa-bg-primary hawa-p-2 hawa-text-primary-foreground" }, /* @__PURE__ */ import_react48.default.createElement(
6475
+ "svg",
6453
6476
  {
6454
- className: cn(
6455
- tabsTriggerVariant({ variant, orientation }),
6456
- "hawa-relative",
6457
- className
6458
- ),
6459
- ...props
6477
+ stroke: "currentColor",
6478
+ fill: "currentColor",
6479
+ strokeWidth: "0",
6480
+ viewBox: "0 0 512 512",
6481
+ height: "0.5em",
6482
+ width: "0.5em"
6460
6483
  },
6461
- props.children,
6462
- chipProps && /* @__PURE__ */ React44.createElement(Chip, { ...chipProps })
6463
- )), /* @__PURE__ */ React44.createElement(
6464
- Popover2.Content,
6484
+ /* @__PURE__ */ import_react48.default.createElement("path", { d: "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" })
6485
+ )), /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-text-center hawa-text-sm" }, /* @__PURE__ */ import_react48.default.createElement("span", null, "Your feedback has been received!"), /* @__PURE__ */ import_react48.default.createElement("span", null, "Thank you for your help"))) : /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-1 hawa-p-1" }, /* @__PURE__ */ import_react48.default.createElement(
6486
+ Popover2,
6465
6487
  {
6466
- onClick: onPopoverClick,
6467
- asChild: true,
6468
- className: cn(
6469
- "dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-bg-popover hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
6470
- "hawa-arrow-default-top hawa-mt-2"
6488
+ className: "hawa-select-none hawa-p-1 hawa-text-xs",
6489
+ open: helperText,
6490
+ trigger: /* @__PURE__ */ import_react48.default.createElement(
6491
+ Textarea,
6492
+ {
6493
+ classNames: {
6494
+ textarea: "hawa-mt-2 hawa-h-full hawa-resize-none"
6495
+ },
6496
+ textareaProps: {
6497
+ placeholder: "Your feedback",
6498
+ onChange: (e) => {
6499
+ if (e.target.value) {
6500
+ setHelperText(false);
6501
+ }
6502
+ setFeedbackText(e.target.value);
6503
+ }
6504
+ }
6505
+ }
6471
6506
  )
6472
6507
  },
6473
- /* @__PURE__ */ React44.createElement("div", { className: "hawa-p-2" }, " ", props.popoverContent)
6474
- ));
6475
- } else {
6476
- return /* @__PURE__ */ React44.createElement(
6477
- TabsPrimitive.Trigger,
6508
+ /* @__PURE__ */ import_react48.default.createElement("span", { className: "hawa-m-0" }, "Please enter your feedback")
6509
+ ), /* @__PURE__ */ import_react48.default.createElement(
6510
+ Button,
6478
6511
  {
6479
- className: cn(
6480
- tabsTriggerVariant({ variant, orientation }),
6481
- "hawa-relative",
6482
- className
6483
- ),
6484
- ...props
6512
+ isLoading: loadingSubmit,
6513
+ onClick: onFeedbackSubmit,
6514
+ className: "hawa-w-full",
6515
+ size: "sm"
6485
6516
  },
6486
- props.children,
6487
- chipProps && /* @__PURE__ */ React44.createElement(Chip, { ...chipProps })
6488
- );
6489
- }
6490
- }
6491
- );
6492
- var TabsContent = React44.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React44.createElement(
6493
- TabsPrimitive.Content,
6494
- {
6495
- ref,
6496
- className: cn(
6497
- "hawa-ring-offset-hawa-background hawa-w-full focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2",
6498
- className
6499
- ),
6500
- ...props
6501
- }
6502
- ));
6503
- Tabs2.displayName = TabsPrimitive.Root.displayName;
6504
- TabsList2.displayName = TabsPrimitive.List.displayName;
6505
- TabsTrigger2.displayName = TabsPrimitive.Trigger.displayName;
6506
- TabsContent.displayName = TabsPrimitive.Content.displayName;
6517
+ "Submit"
6518
+ ))
6519
+ )
6520
+ );
6521
+ };
6522
+
6523
+ // blocks/feedback/FeedbackForm.tsx
6524
+ var import_react49 = __toESM(require("react"));
6525
+ var import_react_hook_form7 = require("react-hook-form");
6526
+ var import_zod7 = require("@hookform/resolvers/zod");
6527
+ var z7 = __toESM(require("zod"));
6528
+ var FeedbackForm = (props) => {
6529
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
6530
+ const formSchema = z7.object({
6531
+ requestType: z7.string({ required_error: (_b = (_a = props.texts) == null ? void 0 : _a.requestType) == null ? void 0 : _b.required }).min(1, { message: (_d = (_c = props.texts) == null ? void 0 : _c.requestType) == null ? void 0 : _d.required }),
6532
+ description: z7.string({ required_error: (_f = (_e = props.texts) == null ? void 0 : _e.description) == null ? void 0 : _f.required }).min(10, { message: (_h = (_g = props.texts) == null ? void 0 : _g.description) == null ? void 0 : _h.tooShort })
6533
+ });
6534
+ const { handleSubmit, control, formState, reset } = (0, import_react_hook_form7.useForm)({
6535
+ resolver: (0, import_zod7.zodResolver)(formSchema),
6536
+ defaultValues: { requestType: "", description: "" }
6537
+ });
6538
+ return /* @__PURE__ */ import_react49.default.createElement(
6539
+ Card,
6540
+ {
6541
+ className: cn(
6542
+ props.cardless ? "hawa-border-none hawa-bg-transparent hawa-shadow-none" : ""
6543
+ ),
6544
+ style: props.cardless ? { boxShadow: "none" } : void 0
6545
+ },
6546
+ /* @__PURE__ */ import_react49.default.createElement(CardContent, { headless: true, className: props.cardless ? "!hawa-p-0" : "" }, props.sent ? /* @__PURE__ */ import_react49.default.createElement("div", { className: "hawa-text-center hawa-min-h-[200px] hawa-flex hawa-flex-col hawa-justify-center" }, /* @__PURE__ */ import_react49.default.createElement("div", { className: "hawa-font-bold hawa-text-lg" }, props.texts.sentTitle || "Form submitted"), /* @__PURE__ */ import_react49.default.createElement("div", { className: "hawa-text-md" }, props.texts.sentSubtitle || "Thank you for your submission")) : /* @__PURE__ */ import_react49.default.createElement(
6547
+ "form",
6548
+ {
6549
+ noValidate: true,
6550
+ onSubmit: handleSubmit((e) => {
6551
+ if (props.onSubmit) {
6552
+ return props.onSubmit(e);
6553
+ } else {
6554
+ console.log("Form is submitted but onSubmit prop is missing");
6555
+ }
6556
+ }),
6557
+ className: "hawa-flex hawa-flex-col hawa-gap-4"
6558
+ },
6559
+ /* @__PURE__ */ import_react49.default.createElement(
6560
+ import_react_hook_form7.Controller,
6561
+ {
6562
+ name: "requestType",
6563
+ control,
6564
+ render: ({ field }) => {
6565
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
6566
+ return /* @__PURE__ */ import_react49.default.createElement(
6567
+ Select,
6568
+ {
6569
+ ...field,
6570
+ ...props.selectProps,
6571
+ label: (_b2 = (_a2 = props.texts) == null ? void 0 : _a2.requestType) == null ? void 0 : _b2.label,
6572
+ onChange: (option) => field.onChange(option.value),
6573
+ options: props.requestTypes,
6574
+ helperText: (_d2 = (_c2 = formState.errors.requestType) == null ? void 0 : _c2.message) == null ? void 0 : _d2.toString(),
6575
+ placeholder: (_f2 = (_e2 = props.texts) == null ? void 0 : _e2.requestType) == null ? void 0 : _f2.placeholder,
6576
+ texts: {
6577
+ noOptions: (_h2 = (_g2 = props.texts) == null ? void 0 : _g2.requestType) == null ? void 0 : _h2.noOptions
6578
+ }
6579
+ }
6580
+ );
6581
+ }
6582
+ }
6583
+ ),
6584
+ /* @__PURE__ */ import_react49.default.createElement(
6585
+ import_react_hook_form7.Controller,
6586
+ {
6587
+ name: "description",
6588
+ control,
6589
+ render: ({ field }) => {
6590
+ var _a2, _b2, _c2, _d2, _e2, _f2;
6591
+ return /* @__PURE__ */ import_react49.default.createElement(
6592
+ Textarea,
6593
+ {
6594
+ helperText: formState.errors.description && ((_b2 = (_a2 = formState.errors.description) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()),
6595
+ classNames: { textarea: "hawa-h-full hawa-min-h-20" },
6596
+ label: (_d2 = (_c2 = props.texts) == null ? void 0 : _c2.description) == null ? void 0 : _d2.label,
6597
+ textareaProps: {
6598
+ onChange: (e) => {
6599
+ field.onChange(e.target.value);
6600
+ },
6601
+ value: field.value,
6602
+ placeholder: (_f2 = (_e2 = props.texts) == null ? void 0 : _e2.description) == null ? void 0 : _f2.placeholder
6603
+ }
6604
+ }
6605
+ );
6606
+ }
6607
+ }
6608
+ ),
6609
+ /* @__PURE__ */ import_react49.default.createElement(Button, { isLoading: props.loadingSubmission, type: "submit" }, (_i = props.texts) == null ? void 0 : _i.submit)
6610
+ ))
6611
+ );
6612
+ };
6507
6613
 
6508
6614
  // blocks/misc/LegalTexts.tsx
6615
+ var import_react50 = __toESM(require("react"));
6509
6616
  var LegalTexts = ({ tabs, ...props }) => {
6510
6617
  return /* @__PURE__ */ import_react50.default.createElement(
6511
- Tabs2,
6618
+ Tabs,
6512
6619
  {
6513
6620
  value: props.activeTab,
6514
6621
  onValueChange: props.handleTabChange,
6515
6622
  defaultValue: props.defaultTab || tabs[0].value,
6516
6623
  dir: props.direction
6517
6624
  },
6518
- /* @__PURE__ */ import_react50.default.createElement(TabsList2, { className: "hawa-w-full" }, tabs.map((tab, index) => /* @__PURE__ */ import_react50.default.createElement(TabsTrigger2, { key: index, value: tab.value }, tab.title))),
6625
+ /* @__PURE__ */ import_react50.default.createElement(TabsList, { className: "hawa-w-full" }, tabs.map((tab, index) => /* @__PURE__ */ import_react50.default.createElement(TabsTrigger, { key: index, value: tab.value }, tab.title))),
6519
6626
  tabs.map((tab, index) => /* @__PURE__ */ import_react50.default.createElement(TabsContent, { key: index, value: tab.value }, /* @__PURE__ */ import_react50.default.createElement(
6520
6627
  ScrollArea,
6521
6628
  {