@sikka/hawa 0.47.0-next → 0.48.1-next

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