@sikka/hawa 0.47.0-next → 0.48.0-next
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/auth/index.d.mts +26 -9
- package/dist/blocks/auth/index.d.ts +26 -9
- package/dist/blocks/auth/index.js +926 -305
- package/dist/blocks/auth/index.mjs +409 -247
- package/dist/blocks/feedback/index.d.mts +1 -1
- package/dist/blocks/feedback/index.d.ts +1 -1
- package/dist/blocks/index.d.mts +25 -8
- package/dist/blocks/index.d.ts +25 -8
- package/dist/blocks/index.js +2264 -2114
- package/dist/blocks/index.mjs +403 -246
- package/dist/blocks/misc/index.d.mts +1 -1
- package/dist/blocks/misc/index.d.ts +1 -1
- package/dist/blocks/misc/index.mjs +49 -366
- package/dist/blocks/pricing/index.d.mts +1 -1
- package/dist/blocks/pricing/index.d.ts +1 -1
- package/dist/blocks/pricing/index.mjs +1 -1
- package/dist/{chunk-342KIV4R.mjs → chunk-GBLWUEYN.mjs} +471 -471
- package/dist/chunk-JFWD2ICY.mjs +511 -0
- package/dist/elements/index.mjs +1 -1
- package/dist/index.css +7 -0
- package/dist/index.d.mts +26 -8
- package/dist/index.d.ts +26 -8
- package/dist/index.js +397 -245
- package/dist/index.mjs +402 -245
- package/dist/{textTypes-DXLtO2fL.d.mts → textTypes-CYQYIsFt.d.mts} +1 -0
- package/dist/{textTypes-DXLtO2fL.d.ts → textTypes-CYQYIsFt.d.ts} +1 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunk-EOH6A3GR.mjs +0 -183
package/dist/blocks/index.js
CHANGED
@@ -4040,9 +4040,10 @@ var LoginForm = ({
|
|
4040
4040
|
};
|
4041
4041
|
|
4042
4042
|
// blocks/auth/RegisterForm.tsx
|
4043
|
-
var
|
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,2438 @@ var StopPropagationWrapper = (props) => {
|
|
4190
4191
|
return /* @__PURE__ */ import_react16.default.createElement("div", { onClick: handleClick }, props.children);
|
4191
4192
|
};
|
4192
4193
|
|
4193
|
-
//
|
4194
|
-
var
|
4195
|
-
|
4196
|
-
|
4197
|
-
|
4198
|
-
|
4199
|
-
|
4200
|
-
|
4201
|
-
|
4202
|
-
|
4203
|
-
|
4204
|
-
|
4205
|
-
|
4206
|
-
|
4207
|
-
|
4208
|
-
|
4209
|
-
|
4210
|
-
|
4211
|
-
|
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
|
4214
|
-
|
4215
|
-
|
4216
|
-
|
4217
|
-
|
4218
|
-
|
4219
|
-
|
4220
|
-
|
4221
|
-
|
4222
|
-
|
4223
|
-
|
4224
|
-
|
4225
|
-
|
4226
|
-
|
4227
|
-
|
4228
|
-
|
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
|
}
|
4242
|
-
}
|
4243
|
-
|
4244
|
-
|
4245
|
-
|
4246
|
-
|
4247
|
-
|
4248
|
-
|
4249
|
-
|
4250
|
-
|
4251
|
-
|
4252
|
-
|
4253
|
-
|
4254
|
-
|
4255
|
-
|
4256
|
-
|
4257
|
-
|
4258
|
-
|
4259
|
-
|
4260
|
-
|
4261
|
-
|
4262
|
-
|
4263
|
-
|
4264
|
-
|
4265
|
-
|
4266
|
-
|
4267
|
-
|
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,
|
4291
|
-
{
|
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
|
-
}
|
4300
|
-
}
|
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();
|
4301
4304
|
}
|
4302
|
-
|
4303
|
-
|
4305
|
+
handler(_event);
|
4306
|
+
}
|
4307
|
+
});
|
4308
|
+
};
|
4309
|
+
}
|
4310
|
+
|
4311
|
+
// hooks/useWindowEvent.ts
|
4312
|
+
var import_react34 = require("react");
|
4313
|
+
function useWindowEvent(type, listener, options) {
|
4314
|
+
(0, import_react34.useEffect)(() => {
|
4315
|
+
window.addEventListener(type, listener, options);
|
4316
|
+
return () => window.removeEventListener(type, listener, options);
|
4317
|
+
}, [type, listener]);
|
4318
|
+
}
|
4319
|
+
|
4320
|
+
// hooks/useViewportSize.ts
|
4321
|
+
var import_react35 = require("react");
|
4322
|
+
var eventListerOptions = {
|
4323
|
+
passive: true
|
4324
|
+
};
|
4325
|
+
function useViewportSize() {
|
4326
|
+
const [windowSize, setWindowSize] = (0, import_react35.useState)({
|
4327
|
+
width: 0,
|
4328
|
+
height: 0
|
4329
|
+
});
|
4330
|
+
const setSize = (0, import_react35.useCallback)(() => {
|
4331
|
+
setWindowSize({
|
4332
|
+
width: window.innerWidth || 0,
|
4333
|
+
height: window.innerHeight || 0
|
4334
|
+
});
|
4335
|
+
}, []);
|
4336
|
+
useWindowEvent("resize", setSize, eventListerOptions);
|
4337
|
+
useWindowEvent("orientationchange", setSize, eventListerOptions);
|
4338
|
+
(0, import_react35.useEffect)(setSize, []);
|
4339
|
+
return windowSize;
|
4340
|
+
}
|
4341
|
+
|
4342
|
+
// elements/tabs/Tabs.tsx
|
4343
|
+
var Popover = __toESM(require("@radix-ui/react-popover"));
|
4344
|
+
var TabsPrimitive = __toESM(require("@radix-ui/react-tabs"));
|
4345
|
+
var import_tailwind_variants = require("tailwind-variants");
|
4346
|
+
|
4347
|
+
// elements/chip/Chip.tsx
|
4348
|
+
var import_react36 = __toESM(require("react"));
|
4349
|
+
var Chip = import_react36.default.forwardRef(
|
4350
|
+
({
|
4351
|
+
label,
|
4352
|
+
size = "normal",
|
4353
|
+
icon,
|
4354
|
+
color,
|
4355
|
+
radius = "inherit",
|
4356
|
+
dot,
|
4357
|
+
dotStatus = "none",
|
4358
|
+
...rest
|
4359
|
+
}, ref) => {
|
4360
|
+
let defaultStyles = "hawa-flex hawa-flex-row hawa-w-fit hawa-gap-1 hawa-items-center hawa-px-2.5 hawa-py-1 hawa-font-bold ";
|
4361
|
+
let radiusStyles = {
|
4362
|
+
inherit: " hawa-rounded",
|
4363
|
+
full: "hawa-rounded-full",
|
4364
|
+
none: "hawa-rounded-none"
|
4365
|
+
};
|
4366
|
+
let sizeStyles = {
|
4367
|
+
small: "hawa-h-[15px] hawa-leading-4 hawa-px-0 hawa-py-0 hawa-text-[9px] hawa-gap-0.5 ",
|
4368
|
+
normal: "hawa-h-fit hawa-text-xs",
|
4369
|
+
large: "hawa-text-base"
|
4370
|
+
};
|
4371
|
+
let dotStyles = {
|
4372
|
+
small: "hawa-flex hawa-h-1 hawa-w-1 hawa-rounded-full",
|
4373
|
+
normal: "hawa-flex hawa-h-2 hawa-w-2 hawa-rounded-full",
|
4374
|
+
large: "hawa-flex hawa-h-3 hawa-w-3 hawa-rounded-full"
|
4375
|
+
};
|
4376
|
+
let dotStatusStyles = {
|
4377
|
+
none: "hawa-bg-gray-500 dark:hawa-bg-gray-800",
|
4378
|
+
available: "hawa-bg-green-500",
|
4379
|
+
unavailable: "hawa-bg-red-500"
|
4380
|
+
};
|
4381
|
+
let colorStyles = {
|
4382
|
+
green: "hawa-bg-green-200 hawa-text-green-700 dark:hawa-bg-green-700 dark:hawa-text-green-200",
|
4383
|
+
blue: "hawa-bg-blue-200 hawa-text-blue-700 dark:hawa-bg-blue-700 dark:hawa-text-blue-100",
|
4384
|
+
red: "hawa-bg-red-200 hawa-text-red-700 dark:hawa-bg-red-700 dark:hawa-text-red-100",
|
4385
|
+
yellow: "hawa-bg-yellow-200 hawa-text-yellow-700 dark:hawa-bg-yellow-600 dark:hawa-text-black",
|
4386
|
+
orange: "hawa-bg-orange-200 hawa-text-orange-700 dark:hawa-bg-orange-700 dark:hawa-text-orange-100",
|
4387
|
+
purple: "hawa-bg-purple-200 hawa-text-purple-700 dark:hawa-bg-purple-700 dark:hawa-text-purple-100",
|
4388
|
+
cyan: "hawa-bg-cyan-200 hawa-text-cyan-700 dark:hawa-bg-cyan-700 dark:hawa-text-cyan-100",
|
4389
|
+
hyper: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-tl hawa-from-pink-500 hawa-via-red-500 hawa-to-yellow-500 ",
|
4390
|
+
oceanic: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-bl hawa-from-green-300 hawa-via-blue-500 hawa-to-purple-600"
|
4391
|
+
};
|
4392
|
+
if (label) {
|
4393
|
+
return /* @__PURE__ */ import_react36.default.createElement(
|
4394
|
+
"span",
|
4304
4395
|
{
|
4305
|
-
|
4306
|
-
|
4307
|
-
|
4308
|
-
|
4309
|
-
|
4310
|
-
|
4311
|
-
|
4312
|
-
|
4313
|
-
|
4314
|
-
}),
|
4315
|
-
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
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
|
+
)
|
4316
4405
|
},
|
4317
|
-
/* @__PURE__ */
|
4318
|
-
|
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,
|
4406
|
+
dot && /* @__PURE__ */ import_react36.default.createElement(
|
4407
|
+
"span",
|
4531
4408
|
{
|
4532
|
-
|
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
|
-
)
|
4409
|
+
className: cn(dotStyles[size], dotStatusStyles[dotStatus])
|
4542
4410
|
}
|
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
|
-
|
4555
|
-
|
4556
|
-
|
4557
|
-
|
4412
|
+
icon && icon,
|
4413
|
+
label
|
4414
|
+
);
|
4415
|
+
} else {
|
4416
|
+
return /* @__PURE__ */ import_react36.default.createElement(
|
4417
|
+
"span",
|
4558
4418
|
{
|
4559
|
-
|
4419
|
+
...rest,
|
4420
|
+
ref,
|
4560
4421
|
className: cn(
|
4561
|
-
|
4422
|
+
"hawa-h-2 hawa-w-2 hawa-rounded-full",
|
4423
|
+
color ? colorStyles[color] : "hawa-border hawa-bg-none"
|
4562
4424
|
)
|
4563
|
-
}
|
4564
|
-
|
4565
|
-
|
4566
|
-
|
4567
|
-
|
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
|
-
//
|
4585
|
-
var
|
4586
|
-
var
|
4587
|
-
|
4588
|
-
|
4589
|
-
|
4590
|
-
|
4591
|
-
|
4592
|
-
|
4593
|
-
|
4594
|
-
|
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
|
-
|
4597
|
-
|
4598
|
-
{
|
4599
|
-
|
4600
|
-
|
4601
|
-
|
4602
|
-
|
4603
|
-
|
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
|
-
|
4616
|
-
"
|
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,
|
4617
4491
|
{
|
4618
|
-
|
4619
|
-
className: "
|
4492
|
+
ref,
|
4493
|
+
className: cn("hawa-relative hawa-overflow-hidden", className),
|
4494
|
+
...props
|
4620
4495
|
},
|
4621
|
-
|
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",
|
4630
|
-
{
|
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"
|
4640
|
-
},
|
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
|
-
|
4695
|
-
|
4696
|
-
|
4697
|
-
|
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
|
-
),
|
4713
|
-
|
4504
|
+
),
|
4505
|
+
/* @__PURE__ */ React29.createElement(
|
4506
|
+
"div",
|
4714
4507
|
{
|
4715
|
-
|
4716
|
-
|
4717
|
-
|
4718
|
-
|
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
|
-
)
|
4734
|
-
|
4513
|
+
),
|
4514
|
+
/* @__PURE__ */ React29.createElement(
|
4515
|
+
ScrollAreaPrimitive.Viewport,
|
4735
4516
|
{
|
4736
|
-
|
4737
|
-
|
4517
|
+
ref: scrollAreaRef,
|
4518
|
+
className: "hawa-h-full hawa-w-full hawa-rounded-[inherit]",
|
4519
|
+
onMouseDown
|
4738
4520
|
},
|
4739
|
-
|
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
|
-
//
|
4745
|
-
var
|
4746
|
-
|
4747
|
-
|
4748
|
-
|
4749
|
-
|
4750
|
-
|
4751
|
-
|
4752
|
-
|
4753
|
-
|
4754
|
-
|
4755
|
-
|
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
|
-
|
4767
|
-
|
4768
|
-
|
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
|
-
|
4776
|
-
|
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
|
-
|
4779
|
-
|
4780
|
-
|
4781
|
-
|
4635
|
+
ref,
|
4636
|
+
className: cn(
|
4637
|
+
tabsListVariant({ variant, orientation }),
|
4638
|
+
"hawa-flex-row hawa-flex-nowrap",
|
4639
|
+
className
|
4640
|
+
),
|
4641
|
+
...props
|
4782
4642
|
}
|
4783
|
-
)
|
4784
|
-
|
4785
|
-
|
4786
|
-
|
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
|
-
|
4877
|
-
|
4878
|
-
|
4879
|
-
|
4880
|
-
|
4881
|
-
|
4882
|
-
...
|
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
|
-
|
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
|
-
|
4917
|
-
"hawa-
|
4918
|
-
|
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
|
-
|
4925
|
-
|
4926
|
-
|
4927
|
-
|
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/
|
4964
|
-
var
|
4965
|
-
|
4966
|
-
|
4967
|
-
|
4968
|
-
|
4969
|
-
|
4970
|
-
|
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
|
4973
|
-
|
4974
|
-
|
4975
|
-
|
4976
|
-
|
4977
|
-
|
4978
|
-
|
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,
|
4997
|
-
|
4998
|
-
|
4999
|
-
|
5000
|
-
|
5001
|
-
|
5002
|
-
|
5003
|
-
|
5004
|
-
|
5005
|
-
|
5006
|
-
|
5007
|
-
|
5008
|
-
|
5009
|
-
|
5010
|
-
|
5011
|
-
|
5012
|
-
|
5013
|
-
|
5014
|
-
|
5015
|
-
|
5016
|
-
|
5017
|
-
|
5018
|
-
|
5019
|
-
|
5020
|
-
|
5021
|
-
|
5022
|
-
|
5023
|
-
|
5024
|
-
|
5025
|
-
|
5026
|
-
|
5027
|
-
|
5028
|
-
|
5029
|
-
|
5030
|
-
|
5031
|
-
|
5032
|
-
|
5033
|
-
|
5034
|
-
|
5035
|
-
|
5036
|
-
|
5037
|
-
|
5038
|
-
|
5039
|
-
|
5040
|
-
|
5041
|
-
|
5042
|
-
|
5043
|
-
|
5044
|
-
|
5045
|
-
|
5046
|
-
|
5047
|
-
|
5048
|
-
|
5049
|
-
|
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
|
-
|
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
|
-
|
5087
|
-
|
5088
|
-
|
5089
|
-
)
|
5090
|
-
|
5091
|
-
|
5092
|
-
|
5093
|
-
|
5094
|
-
|
5095
|
-
|
5096
|
-
|
5097
|
-
|
5098
|
-
|
5099
|
-
|
5100
|
-
|
5101
|
-
|
5102
|
-
|
5103
|
-
|
5104
|
-
|
5105
|
-
|
5106
|
-
|
5107
|
-
|
5108
|
-
|
5109
|
-
|
5110
|
-
|
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
|
-
|
5113
|
-
|
5114
|
-
|
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
|
-
|
5117
|
-
|
5118
|
-
|
5119
|
-
|
5120
|
-
|
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
|
-
|
5130
|
-
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5134
|
-
|
5135
|
-
|
5136
|
-
|
5137
|
-
|
5138
|
-
|
5139
|
-
|
5140
|
-
|
5141
|
-
|
5142
|
-
|
5143
|
-
|
5144
|
-
|
5145
|
-
|
5146
|
-
|
5147
|
-
|
5148
|
-
|
5149
|
-
|
5150
|
-
|
5151
|
-
|
5152
|
-
|
5153
|
-
|
5154
|
-
|
5155
|
-
|
5156
|
-
|
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("div", null, props.showError && /* @__PURE__ */ import_react37.default.createElement(
|
4857
|
+
Alert,
|
4858
|
+
{
|
4859
|
+
direction: props.direction,
|
4860
|
+
title: props.errorTitle,
|
4861
|
+
text: props.errorText,
|
4862
|
+
severity: "error",
|
4863
|
+
onAlertClosed: () => {
|
4864
|
+
if (props.onErrorDismissed) {
|
4865
|
+
props.onErrorDismissed();
|
4866
|
+
}
|
4867
|
+
}
|
4868
|
+
}
|
4869
|
+
), /* @__PURE__ */ import_react37.default.createElement(import_react_hook_form2.FormProvider, { ...methods }, /* @__PURE__ */ import_react37.default.createElement(
|
4870
|
+
"form",
|
4871
|
+
{
|
4872
|
+
noValidate: true,
|
4873
|
+
onSubmit: handleSubmit((e) => {
|
4874
|
+
if (props.onRegister) {
|
4875
|
+
return props.onRegister(e);
|
4876
|
+
} else {
|
4877
|
+
console.log("Form is submitted but onRegister prop is missing");
|
4878
|
+
}
|
4879
|
+
}),
|
4880
|
+
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
4881
|
+
},
|
4882
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
4883
|
+
Tabs,
|
5207
4884
|
{
|
5208
|
-
|
5209
|
-
|
5210
|
-
|
4885
|
+
dir: props.direction,
|
4886
|
+
value: selectedRegisterType.value,
|
4887
|
+
onValueChange: (e) => setSelectedRegisterType(
|
4888
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
4889
|
+
label: "Password",
|
4890
|
+
value: "password"
|
4891
|
+
}
|
5211
4892
|
)
|
5212
4893
|
},
|
5213
|
-
|
5214
|
-
/* @__PURE__ */
|
5215
|
-
|
4894
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ import_react37.default.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-my-4 hawa-mt-6" }, /* @__PURE__ */ import_react37.default.createElement(TabsList, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ import_react37.default.createElement(TabsTrigger, { value: registerType.value }, registerType.label)))),
|
4895
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
4896
|
+
TabsContent,
|
5216
4897
|
{
|
5217
|
-
|
5218
|
-
ref: parentRef,
|
4898
|
+
value: "password",
|
5219
4899
|
className: cn(
|
5220
|
-
|
5221
|
-
|
5222
|
-
|
5223
|
-
|
5224
|
-
tabsContainerClassName,
|
5225
|
-
props.direction === "rtl" ? "hawa-flex-row-reverse" : ""
|
5226
|
-
)
|
4900
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
4901
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
4902
|
+
),
|
4903
|
+
dir: props.direction
|
5227
4904
|
},
|
5228
|
-
|
5229
|
-
|
5230
|
-
|
5231
|
-
|
5232
|
-
key: o,
|
5233
|
-
open: o === openTooltip,
|
5234
|
-
onOpenChange: (bool) => setOpenTooltip(bool ? o : null)
|
5235
|
-
},
|
5236
|
-
/* @__PURE__ */ import_react25.default.createElement(
|
5237
|
-
PopoverTrigger,
|
4905
|
+
/* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
4906
|
+
if (fld === "fullname") {
|
4907
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
4908
|
+
import_react_hook_form2.Controller,
|
5238
4909
|
{
|
5239
|
-
|
5240
|
-
|
5241
|
-
|
5242
|
-
|
5243
|
-
|
5244
|
-
|
4910
|
+
key: i,
|
4911
|
+
control,
|
4912
|
+
name: "fullName",
|
4913
|
+
render: ({ field }) => {
|
4914
|
+
var _a2, _b2, _c2;
|
4915
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
4916
|
+
Input,
|
4917
|
+
{
|
4918
|
+
width: "full",
|
4919
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
4920
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
4921
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
4922
|
+
...field
|
4923
|
+
}
|
4924
|
+
);
|
4925
|
+
}
|
4926
|
+
}
|
4927
|
+
);
|
4928
|
+
}
|
4929
|
+
if (fld === "email") {
|
4930
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
4931
|
+
import_react_hook_form2.Controller,
|
4932
|
+
{
|
4933
|
+
key: i,
|
4934
|
+
control,
|
4935
|
+
name: "email",
|
4936
|
+
render: ({ field }) => {
|
4937
|
+
var _a2, _b2, _c2;
|
4938
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
4939
|
+
Input,
|
4940
|
+
{
|
4941
|
+
dir: "ltr",
|
4942
|
+
inputProps: {
|
4943
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
4944
|
+
},
|
4945
|
+
width: "full",
|
4946
|
+
autoComplete: "email",
|
4947
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
4948
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
4949
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
4950
|
+
...field,
|
4951
|
+
onChange: (e) => {
|
4952
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
4953
|
+
}
|
4954
|
+
}
|
4955
|
+
);
|
4956
|
+
}
|
4957
|
+
}
|
4958
|
+
);
|
4959
|
+
}
|
4960
|
+
if (fld === "username") {
|
4961
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
4962
|
+
import_react_hook_form2.Controller,
|
4963
|
+
{
|
4964
|
+
key: i,
|
4965
|
+
control,
|
4966
|
+
name: "username",
|
4967
|
+
render: ({ field }) => {
|
4968
|
+
var _a2, _b2, _c2, _d2;
|
4969
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
4970
|
+
Input,
|
4971
|
+
{
|
4972
|
+
width: "full",
|
4973
|
+
autoComplete: "username",
|
4974
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
4975
|
+
labelProps: {
|
4976
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
4977
|
+
},
|
4978
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
4979
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
4980
|
+
...field
|
4981
|
+
}
|
4982
|
+
);
|
4983
|
+
}
|
4984
|
+
}
|
4985
|
+
);
|
4986
|
+
}
|
4987
|
+
})),
|
4988
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
4989
|
+
import_react_hook_form2.Controller,
|
4990
|
+
{
|
4991
|
+
control,
|
4992
|
+
name: "password",
|
4993
|
+
render: ({ field }) => {
|
4994
|
+
var _a2, _b2, _c2;
|
4995
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
4996
|
+
Input,
|
5245
4997
|
{
|
5246
|
-
|
5247
|
-
|
5248
|
-
|
5249
|
-
|
5250
|
-
|
5251
|
-
|
5252
|
-
|
5253
|
-
|
5254
|
-
|
5255
|
-
|
5256
|
-
|
5257
|
-
|
5258
|
-
|
5259
|
-
|
5260
|
-
|
5261
|
-
|
5262
|
-
|
5263
|
-
|
5264
|
-
|
5265
|
-
|
5266
|
-
|
5267
|
-
|
5268
|
-
|
5269
|
-
|
5270
|
-
|
5271
|
-
|
5272
|
-
|
5273
|
-
|
5274
|
-
|
5275
|
-
|
5276
|
-
|
5277
|
-
|
5278
|
-
|
5279
|
-
|
5280
|
-
|
5281
|
-
|
5282
|
-
|
5283
|
-
|
5284
|
-
|
5285
|
-
|
5286
|
-
|
5287
|
-
|
5288
|
-
|
5289
|
-
|
5290
|
-
|
5291
|
-
|
5292
|
-
|
5293
|
-
|
5294
|
-
|
5295
|
-
|
4998
|
+
width: "full",
|
4999
|
+
type: passwordVisible ? "text" : "password",
|
5000
|
+
autoComplete: "new-password",
|
5001
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
5002
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
5003
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
5004
|
+
endIcon: /* @__PURE__ */ import_react37.default.createElement(
|
5005
|
+
"div",
|
5006
|
+
{
|
5007
|
+
className: "hawa-cursor-pointer",
|
5008
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
5009
|
+
},
|
5010
|
+
passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
5011
|
+
" "
|
5012
|
+
),
|
5013
|
+
...field
|
5014
|
+
}
|
5015
|
+
);
|
5016
|
+
}
|
5017
|
+
}
|
5018
|
+
),
|
5019
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
5020
|
+
import_react_hook_form2.Controller,
|
5021
|
+
{
|
5022
|
+
control,
|
5023
|
+
name: "confirm_password",
|
5024
|
+
render: ({ field }) => {
|
5025
|
+
var _a2, _b2, _c2;
|
5026
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
5027
|
+
Input,
|
5028
|
+
{
|
5029
|
+
width: "full",
|
5030
|
+
type: passwordVisible ? "text" : "password",
|
5031
|
+
autoComplete: "new-password",
|
5032
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
5033
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
5034
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
5035
|
+
endIcon: /* @__PURE__ */ import_react37.default.createElement(
|
5036
|
+
"div",
|
5037
|
+
{
|
5038
|
+
className: "hawa-cursor-pointer",
|
5039
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
5040
|
+
},
|
5041
|
+
passwordVisible ? /* @__PURE__ */ import_react37.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react37.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
5042
|
+
" "
|
5043
|
+
),
|
5044
|
+
...field
|
5045
|
+
}
|
5046
|
+
);
|
5047
|
+
}
|
5048
|
+
}
|
5049
|
+
),
|
5050
|
+
props.additionalInputs,
|
5051
|
+
props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
|
5052
|
+
import_react_hook_form2.Controller,
|
5053
|
+
{
|
5054
|
+
control,
|
5055
|
+
name: "refCode",
|
5056
|
+
render: ({ field }) => {
|
5057
|
+
var _a2;
|
5058
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
5059
|
+
Input,
|
5060
|
+
{
|
5061
|
+
width: "full",
|
5062
|
+
label: texts == null ? void 0 : texts.refCode,
|
5063
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
5064
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
5065
|
+
...field
|
5066
|
+
}
|
5067
|
+
);
|
5068
|
+
}
|
5069
|
+
}
|
5070
|
+
),
|
5071
|
+
props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
|
5072
|
+
import_react_hook_form2.Controller,
|
5073
|
+
{
|
5074
|
+
control,
|
5075
|
+
name: "reference",
|
5076
|
+
render: ({ field }) => {
|
5077
|
+
var _a2, _b2;
|
5078
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
5079
|
+
Select,
|
5080
|
+
{
|
5081
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
5082
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
5083
|
+
isCreatable: false,
|
5084
|
+
isMulti: false,
|
5085
|
+
isSearchable: false,
|
5086
|
+
isClearable: false,
|
5087
|
+
options: props.userReferenceOptions || [],
|
5088
|
+
onChange: (e) => field.onChange(e)
|
5089
|
+
}
|
5090
|
+
);
|
5091
|
+
}
|
5092
|
+
}
|
5296
5093
|
)
|
5297
|
-
|
5298
|
-
|
5299
|
-
|
5094
|
+
),
|
5095
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
5096
|
+
TabsContent,
|
5300
5097
|
{
|
5098
|
+
value: "phone",
|
5301
5099
|
className: cn(
|
5302
|
-
"
|
5303
|
-
|
5100
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
5101
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
5304
5102
|
),
|
5305
|
-
|
5103
|
+
dir: props.direction
|
5306
5104
|
},
|
5307
|
-
/* @__PURE__ */
|
5308
|
-
|
5105
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
5106
|
+
import_react_hook_form2.Controller,
|
5309
5107
|
{
|
5310
|
-
|
5311
|
-
|
5312
|
-
|
5313
|
-
|
5314
|
-
|
5315
|
-
|
5108
|
+
control,
|
5109
|
+
name: "phone",
|
5110
|
+
render: ({ field }) => {
|
5111
|
+
var _a2, _b2;
|
5112
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
5113
|
+
PhoneInput,
|
5114
|
+
{
|
5115
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
5116
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
5117
|
+
preferredCountry: { label: "+966" },
|
5118
|
+
...props.phoneInputProps,
|
5119
|
+
handleChange: (e) => {
|
5120
|
+
if ((0, import_libphonenumber_js2.isValidPhoneNumber)(e) && (0, import_libphonenumber_js2.isPossiblePhoneNumber)(e) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(e) === void 0) {
|
5121
|
+
let parsed = (0, import_libphonenumber_js2.parsePhoneNumber)(e);
|
5122
|
+
field.onChange(parsed.number);
|
5123
|
+
} else {
|
5124
|
+
field.onChange(e);
|
5125
|
+
}
|
5126
|
+
}
|
5127
|
+
}
|
5128
|
+
);
|
5129
|
+
}
|
5316
5130
|
}
|
5317
5131
|
),
|
5318
|
-
|
5319
|
-
|
5132
|
+
props.additionalInputs,
|
5133
|
+
props.showRefCode && /* @__PURE__ */ import_react37.default.createElement(
|
5134
|
+
import_react_hook_form2.Controller,
|
5320
5135
|
{
|
5321
|
-
|
5322
|
-
|
5323
|
-
|
5324
|
-
|
5325
|
-
|
5326
|
-
|
5327
|
-
|
5328
|
-
|
5329
|
-
|
5330
|
-
|
5331
|
-
|
5332
|
-
|
5333
|
-
|
5334
|
-
|
5335
|
-
|
5336
|
-
|
5337
|
-
|
5338
|
-
|
5136
|
+
control,
|
5137
|
+
name: "refCode",
|
5138
|
+
render: ({ field }) => {
|
5139
|
+
var _a2;
|
5140
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
5141
|
+
Input,
|
5142
|
+
{
|
5143
|
+
width: "full",
|
5144
|
+
label: texts == null ? void 0 : texts.refCode,
|
5145
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
5146
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
5147
|
+
...field
|
5148
|
+
}
|
5149
|
+
);
|
5150
|
+
}
|
5151
|
+
}
|
5152
|
+
),
|
5153
|
+
props.showUserSource && /* @__PURE__ */ import_react37.default.createElement(
|
5154
|
+
import_react_hook_form2.Controller,
|
5155
|
+
{
|
5156
|
+
control,
|
5157
|
+
name: "reference",
|
5158
|
+
render: ({ field }) => {
|
5159
|
+
var _a2, _b2;
|
5160
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
5161
|
+
Select,
|
5162
|
+
{
|
5163
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
5164
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
5165
|
+
isCreatable: false,
|
5166
|
+
isMulti: false,
|
5167
|
+
isSearchable: false,
|
5168
|
+
isClearable: false,
|
5169
|
+
options: props.userReferenceOptions || [],
|
5170
|
+
onChange: (e) => field.onChange(e)
|
5171
|
+
}
|
5172
|
+
);
|
5173
|
+
}
|
5174
|
+
}
|
5339
5175
|
)
|
5340
|
-
|
5341
|
-
|
5342
|
-
|
5176
|
+
),
|
5177
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react37.default.createElement(
|
5178
|
+
import_react_hook_form2.Controller,
|
5343
5179
|
{
|
5344
|
-
|
5345
|
-
|
5346
|
-
|
5347
|
-
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5180
|
+
control,
|
5181
|
+
name: "terms_accepted",
|
5182
|
+
render: ({ field }) => {
|
5183
|
+
var _a2, _b2;
|
5184
|
+
return /* @__PURE__ */ import_react37.default.createElement(
|
5185
|
+
Checkbox,
|
5186
|
+
{
|
5187
|
+
id: "terms_accepted",
|
5188
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
5189
|
+
onCheckedChange: (e) => field.onChange(e),
|
5190
|
+
label: /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5 hawa-whitespace-nowrap hawa-flex-wrap" }, (texts == null ? void 0 : texts.iAcceptText) || "I accept the", " ", /* @__PURE__ */ import_react37.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react37.default.createElement(
|
5191
|
+
"span",
|
5192
|
+
{
|
5193
|
+
onClick: (e) => {
|
5194
|
+
e.preventDefault();
|
5195
|
+
if (props.onRouteToTOS) {
|
5196
|
+
props.onRouteToTOS();
|
5197
|
+
}
|
5198
|
+
},
|
5199
|
+
className: "clickable-link"
|
5200
|
+
},
|
5201
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
5202
|
+
)))
|
5203
|
+
}
|
5204
|
+
);
|
5205
|
+
}
|
5351
5206
|
}
|
5352
|
-
), /* @__PURE__ */
|
5353
|
-
|
5207
|
+
), showNewsletterOption && /* @__PURE__ */ import_react37.default.createElement(
|
5208
|
+
import_react_hook_form2.Controller,
|
5354
5209
|
{
|
5355
|
-
|
5356
|
-
|
5357
|
-
|
5358
|
-
|
5210
|
+
control,
|
5211
|
+
name: "newsletter_accepted",
|
5212
|
+
render: ({ field }) => /* @__PURE__ */ import_react37.default.createElement(
|
5213
|
+
Checkbox,
|
5214
|
+
{
|
5215
|
+
id: "newsletter_accepted",
|
5216
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
5217
|
+
onCheckedChange: field.onChange
|
5218
|
+
}
|
5359
5219
|
)
|
5360
|
-
}
|
5361
|
-
|
5362
|
-
|
5363
|
-
|
5364
|
-
|
5365
|
-
return /* @__PURE__ */ import_react25.default.createElement(
|
5366
|
-
"div",
|
5220
|
+
}
|
5221
|
+
)) : null
|
5222
|
+
),
|
5223
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
5224
|
+
Button,
|
5367
5225
|
{
|
5368
|
-
className:
|
5369
|
-
|
5370
|
-
|
5371
|
-
|
5226
|
+
className: "hawa-w-full",
|
5227
|
+
type: "submit",
|
5228
|
+
isLoading: props.isLoading,
|
5229
|
+
disabled: props.isLoading
|
5372
5230
|
},
|
5373
|
-
|
5374
|
-
|
5375
|
-
|
5376
|
-
|
5377
|
-
|
5378
|
-
|
5379
|
-
|
5380
|
-
),
|
5381
|
-
key: i + 1
|
5382
|
-
},
|
5383
|
-
/* @__PURE__ */ import_react25.default.createElement(
|
5384
|
-
"input",
|
5385
|
-
{
|
5386
|
-
disabled: opt.disabled,
|
5387
|
-
id: opt.value.toString(),
|
5388
|
-
type: "radio",
|
5389
|
-
value: opt.value,
|
5390
|
-
name,
|
5391
|
-
onChange: () => handleChange(opt)
|
5392
|
-
}
|
5393
|
-
),
|
5394
|
-
/* @__PURE__ */ import_react25.default.createElement(
|
5395
|
-
"label",
|
5396
|
-
{
|
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"
|
5401
|
-
)
|
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
|
+
(texts == null ? void 0 : texts.registerText) || "Register"
|
5232
|
+
),
|
5233
|
+
props.additionalButtons
|
5234
|
+
)), props.onRouteToLogin && /* @__PURE__ */ import_react37.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react37.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react37.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
5235
|
+
),
|
5236
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react37.default.createElement(
|
5237
|
+
CardFooter,
|
5428
5238
|
{
|
5239
|
+
noPadding: props.cardless,
|
5429
5240
|
className: cn(
|
5430
|
-
"
|
5431
|
-
!forceHideHelperText && "hawa-gap-2",
|
5432
|
-
className
|
5241
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
5433
5242
|
)
|
5434
5243
|
},
|
5435
|
-
/* @__PURE__ */
|
5436
|
-
|
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",
|
5244
|
+
/* @__PURE__ */ import_react37.default.createElement(
|
5245
|
+
AuthButtons,
|
5446
5246
|
{
|
5447
|
-
|
5448
|
-
|
5449
|
-
|
5450
|
-
|
5451
|
-
|
5452
|
-
|
5247
|
+
texts: thirdPartyAuthTexts,
|
5248
|
+
viaGoogle: props.viaGoogle,
|
5249
|
+
viaGithub: props.viaGithub,
|
5250
|
+
viaTwitter: props.viaTwitter,
|
5251
|
+
isGoogleLoading: props.isGoogleLoading,
|
5252
|
+
isGithubLoading: props.isGithubLoading,
|
5253
|
+
isTwitterLoading: props.isTwitterLoading,
|
5254
|
+
handleGoogle: props.onGoogleRegister,
|
5255
|
+
handleGithub: props.onGithubRegister,
|
5256
|
+
handleTwitter: props.onTwitterRegister
|
5453
5257
|
}
|
5454
|
-
)
|
5455
|
-
|
5456
|
-
|
5457
|
-
|
5458
|
-
);
|
5459
|
-
Textarea.displayName = "Textarea";
|
5258
|
+
)
|
5259
|
+
) : null
|
5260
|
+
));
|
5261
|
+
};
|
5460
5262
|
|
5461
|
-
// blocks/
|
5462
|
-
var
|
5463
|
-
|
5464
|
-
|
5263
|
+
// blocks/auth/AppLanding.tsx
|
5264
|
+
var import_react38 = __toESM(require("react"));
|
5265
|
+
var AppLanding = ({ texts, ...props }) => {
|
5266
|
+
const thirdPartyAuthTexts = {
|
5267
|
+
continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
|
5268
|
+
continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
|
5269
|
+
continueWithApple: texts == null ? void 0 : texts.continueWithApple,
|
5270
|
+
continueWithMicrosoft: texts == null ? void 0 : texts.continueWithMicrosoft,
|
5271
|
+
continueWithGithub: texts == null ? void 0 : texts.continueWithGithub,
|
5272
|
+
continueWithEmail: texts == null ? void 0 : texts.continueWithEmail,
|
5273
|
+
continueWithPhone: texts == null ? void 0 : texts.continueWithPhone
|
5274
|
+
};
|
5275
|
+
return /* @__PURE__ */ import_react38.default.createElement("div", { dir: props.direction }, /* @__PURE__ */ import_react38.default.createElement(Card, null, /* @__PURE__ */ import_react38.default.createElement(CardContent, { headless: true, className: "hawa-flex hawa-flex-col hawa-gap-6" }, /* @__PURE__ */ import_react38.default.createElement(
|
5276
|
+
AuthButtons,
|
5277
|
+
{
|
5278
|
+
texts: thirdPartyAuthTexts,
|
5279
|
+
viaApple: props.viaApple,
|
5280
|
+
viaGoogle: props.viaGoogle,
|
5281
|
+
viaEmail: props.viaEmail,
|
5282
|
+
viaGithub: props.viaGithub,
|
5283
|
+
viaMicrosoft: props.viaMicrosoft,
|
5284
|
+
viaPhone: props.viaPhone,
|
5285
|
+
viaTwitter: props.viaTwitter,
|
5286
|
+
handleApple: props.handleApple,
|
5287
|
+
handleGoogle: props.handleGoogle,
|
5288
|
+
handleTwitter: props.handleTwitter,
|
5289
|
+
handleMicrosoft: props.handleMicrosoft,
|
5290
|
+
handleGithub: props.handleGithub,
|
5291
|
+
handleEmail: props.handleEmail,
|
5292
|
+
handlePhone: props.handlePhone
|
5293
|
+
}
|
5294
|
+
), props.allowRegister && /* @__PURE__ */ import_react38.default.createElement("div", { className: "hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, texts == null ? void 0 : texts.newUserText, " ", /* @__PURE__ */ import_react38.default.createElement(
|
5295
|
+
"span",
|
5296
|
+
{
|
5297
|
+
onClick: props.handleRouteToRegister,
|
5298
|
+
className: "clickable-link"
|
5299
|
+
},
|
5300
|
+
texts == null ? void 0 : texts.createAccount
|
5301
|
+
)))));
|
5302
|
+
};
|
5303
|
+
|
5304
|
+
// blocks/auth/CheckEmail.tsx
|
5305
|
+
var import_react39 = __toESM(require("react"));
|
5306
|
+
var CheckEmail = ({ texts, handleResend }) => {
|
5307
|
+
return /* @__PURE__ */ import_react39.default.createElement(Card, null, /* @__PURE__ */ import_react39.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center hawa-text-center" }, /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-flex hawa-h-16 hawa-w-16 hawa-flex-col hawa-items-center hawa-justify-center hawa-rounded-3xl hawa-bg-primary hawa-text-6xl hawa-font-bold hawa-text-primary-foreground" }, /* @__PURE__ */ import_react39.default.createElement(
|
5308
|
+
"svg",
|
5309
|
+
{
|
5310
|
+
stroke: "currentColor",
|
5311
|
+
fill: "none",
|
5312
|
+
strokeWidth: "2",
|
5313
|
+
viewBox: "0 0 24 24",
|
5314
|
+
strokeLinecap: "round",
|
5315
|
+
strokeLinejoin: "round",
|
5316
|
+
height: "0.5em",
|
5317
|
+
width: "0.5em",
|
5318
|
+
xmlns: "http://www.w3.org/2000/svg"
|
5319
|
+
},
|
5320
|
+
/* @__PURE__ */ import_react39.default.createElement("path", { d: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" }),
|
5321
|
+
/* @__PURE__ */ import_react39.default.createElement("polyline", { points: "22,6 12,13 2,6" })
|
5322
|
+
)), /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-m-2 hawa-text-xl hawa-font-bold" }, (texts == null ? void 0 : texts.checkEmail) || "Check your Email"), /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-text-sm" }, (texts == null ? void 0 : texts.pleaseVerify) || "Thank you for signing up! To complete your registration, we've sent a verification email to the address you provided. Please check your inbox and follow the instructions in the email to activate your account."))), /* @__PURE__ */ import_react39.default.createElement(CardFooter, { className: "hawa-flex hawa-flex-col hawa-justify-center" }, /* @__PURE__ */ import_react39.default.createElement("span", { className: "clickable-link hawa-text-sm", onClick: handleResend }, (texts == null ? void 0 : texts.resendEmail) || "Resend Email")));
|
5323
|
+
};
|
5324
|
+
|
5325
|
+
// blocks/auth/NewPassword.tsx
|
5326
|
+
var import_react40 = __toESM(require("react"));
|
5327
|
+
var import_react_hook_form3 = require("react-hook-form");
|
5328
|
+
var import_zod3 = require("@hookform/resolvers/zod");
|
5329
|
+
var z3 = __toESM(require("zod"));
|
5330
|
+
var NewPasswordForm = ({
|
5331
|
+
texts,
|
5332
|
+
isLoading,
|
5465
5333
|
...props
|
5466
5334
|
}) => {
|
5467
|
-
var _a, _b;
|
5468
|
-
const
|
5469
|
-
|
5470
|
-
|
5471
|
-
|
5472
|
-
|
5335
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
5336
|
+
const formSchema = z3.object({
|
5337
|
+
password: z3.string({ required_error: (_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.required }).min(8, { message: (_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.tooShort }),
|
5338
|
+
confirm_password: z3.string({ required_error: (_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required }).refine((value) => value !== "", {
|
5339
|
+
message: (_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required
|
5340
|
+
})
|
5341
|
+
}).refine((data) => data.password === data.confirm_password, {
|
5342
|
+
message: (_f = texts == null ? void 0 : texts.confirm) == null ? void 0 : _f.dontMatch,
|
5343
|
+
path: ["confirm_password"]
|
5473
5344
|
});
|
5474
|
-
const { handleSubmit, control, formState
|
5475
|
-
resolver: (0,
|
5345
|
+
const { handleSubmit, control, formState } = (0, import_react_hook_form3.useForm)({
|
5346
|
+
resolver: (0, import_zod3.zodResolver)(formSchema)
|
5476
5347
|
});
|
5477
|
-
|
5478
|
-
|
5479
|
-
"bottom-right": "hawa-right-4",
|
5480
|
-
"bottom-left": "hawa-left-4"
|
5481
|
-
};
|
5482
|
-
const optionsWithOther = [
|
5483
|
-
...options,
|
5484
|
-
{
|
5485
|
-
value: "other",
|
5486
|
-
label: "Other"
|
5487
|
-
}
|
5488
|
-
];
|
5489
|
-
return /* @__PURE__ */ import_react26.default.createElement(
|
5490
|
-
"div",
|
5348
|
+
return /* @__PURE__ */ import_react40.default.createElement(Card, { dir: props.direction }, props.showSuccess ? /* @__PURE__ */ import_react40.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react40.default.createElement("div", { className: "hawa-text-center" }, texts == null ? void 0 : texts.passwordChanged)) : /* @__PURE__ */ import_react40.default.createElement(
|
5349
|
+
"form",
|
5491
5350
|
{
|
5492
|
-
|
5493
|
-
|
5494
|
-
|
5495
|
-
|
5496
|
-
|
5351
|
+
noValidate: true,
|
5352
|
+
onSubmit: handleSubmit((e) => {
|
5353
|
+
if (props.handleNewPassword) {
|
5354
|
+
return props.handleNewPassword(e);
|
5355
|
+
} else {
|
5356
|
+
console.log(
|
5357
|
+
"Form is submitted but handleSubmission prop is missing"
|
5358
|
+
);
|
5359
|
+
}
|
5360
|
+
})
|
5497
5361
|
},
|
5498
|
-
/* @__PURE__ */
|
5499
|
-
|
5362
|
+
/* @__PURE__ */ import_react40.default.createElement(CardContent, { headless: true, className: "hawa-flex hawa-flex-col" }, props.showError && /* @__PURE__ */ import_react40.default.createElement(
|
5363
|
+
Alert,
|
5500
5364
|
{
|
5501
|
-
|
5502
|
-
|
5503
|
-
|
5504
|
-
|
5505
|
-
|
5506
|
-
|
5507
|
-
|
5508
|
-
|
5509
|
-
|
5510
|
-
|
5511
|
-
|
5512
|
-
|
5513
|
-
|
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",
|
5365
|
+
direction: props.direction,
|
5366
|
+
title: props.errorTitle,
|
5367
|
+
text: props.errorText,
|
5368
|
+
severity: "error"
|
5369
|
+
}
|
5370
|
+
), /* @__PURE__ */ import_react40.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4 hawa-mb-4" }, /* @__PURE__ */ import_react40.default.createElement(
|
5371
|
+
import_react_hook_form3.Controller,
|
5372
|
+
{
|
5373
|
+
control,
|
5374
|
+
name: "password",
|
5375
|
+
render: ({ field }) => {
|
5376
|
+
var _a2, _b2, _c2;
|
5377
|
+
return /* @__PURE__ */ import_react40.default.createElement(
|
5378
|
+
Input,
|
5536
5379
|
{
|
5537
|
-
|
5538
|
-
|
5539
|
-
|
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");
|
5380
|
+
width: "full",
|
5381
|
+
type: "password",
|
5382
|
+
autoComplete: "new-password",
|
5383
|
+
label: (_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label,
|
5384
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
5385
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
5386
|
+
...field
|
5553
5387
|
}
|
5554
|
-
|
5555
|
-
}
|
5556
|
-
|
5557
|
-
|
5558
|
-
|
5559
|
-
|
5560
|
-
|
5561
|
-
|
5562
|
-
|
5563
|
-
|
5564
|
-
/* @__PURE__ */
|
5565
|
-
|
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,
|
5388
|
+
);
|
5389
|
+
}
|
5390
|
+
}
|
5391
|
+
), /* @__PURE__ */ import_react40.default.createElement(
|
5392
|
+
import_react_hook_form3.Controller,
|
5393
|
+
{
|
5394
|
+
control,
|
5395
|
+
name: "confirm_password",
|
5396
|
+
render: ({ field }) => {
|
5397
|
+
var _a2, _b2, _c2;
|
5398
|
+
return /* @__PURE__ */ import_react40.default.createElement(
|
5399
|
+
Input,
|
5589
5400
|
{
|
5590
|
-
|
5591
|
-
|
5592
|
-
|
5593
|
-
|
5594
|
-
|
5595
|
-
|
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
|
-
}
|
5401
|
+
width: "full",
|
5402
|
+
type: "password",
|
5403
|
+
autoComplete: "new-password",
|
5404
|
+
label: (_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label,
|
5405
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder,
|
5406
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
5407
|
+
...field
|
5606
5408
|
}
|
5607
|
-
)
|
5608
|
-
|
5609
|
-
|
5610
|
-
|
5611
|
-
|
5612
|
-
|
5409
|
+
);
|
5410
|
+
}
|
5411
|
+
}
|
5412
|
+
)), /* @__PURE__ */ import_react40.default.createElement(Button, { className: "hawa-w-full", type: "submit", isLoading }, texts == null ? void 0 : texts.updatePassword), props.allowRegister && /* @__PURE__ */ import_react40.default.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, (_g = texts == null ? void 0 : texts.dontHaveAccount) != null ? _g : "Don't have an account? ", /* @__PURE__ */ import_react40.default.createElement(
|
5413
|
+
"span",
|
5414
|
+
{
|
5415
|
+
className: "clickable-link",
|
5416
|
+
onClick: props.handleRouteToRegister
|
5417
|
+
},
|
5418
|
+
(_h = texts == null ? void 0 : texts.registerText) != null ? _h : "Register"
|
5419
|
+
)))
|
5420
|
+
));
|
5613
5421
|
};
|
5614
5422
|
|
5615
|
-
// blocks/
|
5616
|
-
var
|
5617
|
-
var
|
5618
|
-
|
5423
|
+
// blocks/auth/ResetPassword.tsx
|
5424
|
+
var import_react41 = __toESM(require("react"));
|
5425
|
+
var import_react_hook_form4 = require("react-hook-form");
|
5426
|
+
var import_zod4 = require("@hookform/resolvers/zod");
|
5427
|
+
var z4 = __toESM(require("zod"));
|
5428
|
+
var ResetPasswordForm = ({
|
5429
|
+
allowRegister = true,
|
5430
|
+
isLoading,
|
5619
5431
|
...props
|
5620
5432
|
}) => {
|
5621
|
-
|
5622
|
-
const
|
5623
|
-
|
5624
|
-
|
5625
|
-
|
5626
|
-
|
5627
|
-
|
5628
|
-
|
5629
|
-
};
|
5630
|
-
(0,
|
5631
|
-
|
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",
|
5433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
5434
|
+
const formSchema = z4.object({
|
5435
|
+
email: z4.string({
|
5436
|
+
required_error: ((_b = (_a = props.texts) == null ? void 0 : _a.email) == null ? void 0 : _b.required) || "Email is required"
|
5437
|
+
}).email({ message: ((_d = (_c = props.texts) == null ? void 0 : _c.email) == null ? void 0 : _d.invalid) || "Invalid email" }).min(1, { message: ((_f = (_e = props.texts) == null ? void 0 : _e.email) == null ? void 0 : _f.required) || "Email is required" })
|
5438
|
+
});
|
5439
|
+
const { handleSubmit, control, formState } = (0, import_react_hook_form4.useForm)({
|
5440
|
+
resolver: (0, import_zod4.zodResolver)(formSchema)
|
5441
|
+
});
|
5442
|
+
return /* @__PURE__ */ import_react41.default.createElement(Card, { dir: props.direction }, !props.sent ? /* @__PURE__ */ import_react41.default.createElement(import_react41.default.Fragment, null, !props.headless && /* @__PURE__ */ import_react41.default.createElement(CardHeader, null, /* @__PURE__ */ import_react41.default.createElement(CardTitle, null, ((_g = props.texts) == null ? void 0 : _g.headTitle) || "Reset Password"), /* @__PURE__ */ import_react41.default.createElement(CardDescription, null, ((_h = props.texts) == null ? void 0 : _h.headDescription) || "Enter your email to reset your account password")), /* @__PURE__ */ import_react41.default.createElement(
|
5443
|
+
"form",
|
5650
5444
|
{
|
5651
|
-
|
5652
|
-
|
5653
|
-
props.
|
5654
|
-
|
5655
|
-
|
5445
|
+
noValidate: true,
|
5446
|
+
onSubmit: handleSubmit((e) => {
|
5447
|
+
if (props.handleResetPassword) {
|
5448
|
+
return props.handleResetPassword(e);
|
5449
|
+
} else {
|
5450
|
+
console.log("handleResetPassword prop is missing");
|
5451
|
+
}
|
5452
|
+
})
|
5656
5453
|
},
|
5657
|
-
/* @__PURE__ */
|
5658
|
-
|
5454
|
+
/* @__PURE__ */ import_react41.default.createElement(CardContent, { headless: props.headless, className: "hawa-pb-4" }, props.showError && /* @__PURE__ */ import_react41.default.createElement(
|
5455
|
+
Alert,
|
5659
5456
|
{
|
5660
|
-
|
5661
|
-
|
5662
|
-
|
5663
|
-
|
5664
|
-
|
5665
|
-
|
5666
|
-
|
5667
|
-
|
5668
|
-
|
5669
|
-
|
5670
|
-
|
5671
|
-
|
5672
|
-
|
5673
|
-
|
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",
|
5457
|
+
direction: props.direction,
|
5458
|
+
title: props.errorTitle,
|
5459
|
+
text: props.errorText,
|
5460
|
+
severity: "error"
|
5461
|
+
}
|
5462
|
+
), /* @__PURE__ */ import_react41.default.createElement(
|
5463
|
+
import_react_hook_form4.Controller,
|
5464
|
+
{
|
5465
|
+
control,
|
5466
|
+
name: "email",
|
5467
|
+
render: ({ field }) => {
|
5468
|
+
var _a2, _b2, _c2, _d2, _e2;
|
5469
|
+
return /* @__PURE__ */ import_react41.default.createElement(
|
5470
|
+
Input,
|
5686
5471
|
{
|
5687
|
-
|
5688
|
-
|
5689
|
-
|
5690
|
-
|
5691
|
-
|
5692
|
-
|
5693
|
-
|
5694
|
-
|
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);
|
5472
|
+
width: "full",
|
5473
|
+
label: ((_b2 = (_a2 = props.texts) == null ? void 0 : _a2.email) == null ? void 0 : _b2.label) || "Email",
|
5474
|
+
helperText: (_c2 = formState.errors.email) == null ? void 0 : _c2.message,
|
5475
|
+
placeholder: (_e2 = (_d2 = props.texts) == null ? void 0 : _d2.email) == null ? void 0 : _e2.placeholder,
|
5476
|
+
...field,
|
5477
|
+
onChange: (e) => {
|
5478
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
5479
|
+
}
|
5702
5480
|
}
|
5703
|
-
|
5704
|
-
|
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
|
-
);
|
5727
|
-
};
|
5728
|
-
|
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);
|
5481
|
+
);
|
5482
|
+
}
|
5753
5483
|
}
|
5754
|
-
|
5755
|
-
}
|
5756
|
-
setLoadingSubmit(false);
|
5757
|
-
setHelperText(true);
|
5758
|
-
}
|
5759
|
-
};
|
5760
|
-
return /* @__PURE__ */ import_react28.default.createElement(
|
5761
|
-
"div",
|
5762
|
-
{
|
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
|
-
)
|
5767
|
-
},
|
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(
|
5484
|
+
)),
|
5485
|
+
/* @__PURE__ */ import_react41.default.createElement(CardFooter, { className: "hawa-flex hawa-flex-col" }, /* @__PURE__ */ import_react41.default.createElement(
|
5769
5486
|
Button,
|
5770
5487
|
{
|
5771
|
-
|
5772
|
-
|
5773
|
-
|
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
|
-
)
|
5488
|
+
type: "submit",
|
5489
|
+
className: "hawa-w-full",
|
5490
|
+
isLoading
|
5784
5491
|
},
|
5785
|
-
|
5786
|
-
)))
|
5787
|
-
|
5788
|
-
"div",
|
5492
|
+
((_i = props.texts) == null ? void 0 : _i.resetPassword) || "Reset Password"
|
5493
|
+
), allowRegister && /* @__PURE__ */ import_react41.default.createElement("div", { className: "hawa-mt-4 hawa-pb-0 hawa-text-center hawa-text-sm dark:hawa-text-gray-300" }, (_k = (_j = props.texts) == null ? void 0 : _j.dontHaveAccount) != null ? _k : "Don't have an account? ", /* @__PURE__ */ import_react41.default.createElement(
|
5494
|
+
"span",
|
5789
5495
|
{
|
5790
|
-
className:
|
5791
|
-
|
5792
|
-
selectedEmoji ? "hawa-visible hawa-opacity-100" : "hawa-invisible hawa-opacity-0"
|
5793
|
-
)
|
5496
|
+
className: "clickable-link",
|
5497
|
+
onClick: props.handleRouteToRegister
|
5794
5498
|
},
|
5795
|
-
|
5796
|
-
|
5797
|
-
|
5798
|
-
|
5799
|
-
|
5800
|
-
|
5801
|
-
|
5802
|
-
|
5803
|
-
|
5804
|
-
|
5805
|
-
|
5806
|
-
|
5807
|
-
|
5808
|
-
|
5809
|
-
|
5810
|
-
|
5811
|
-
|
5812
|
-
|
5813
|
-
|
5814
|
-
|
5815
|
-
|
5816
|
-
|
5817
|
-
|
5818
|
-
|
5819
|
-
|
5820
|
-
|
5821
|
-
|
5822
|
-
|
5823
|
-
|
5824
|
-
|
5825
|
-
|
5826
|
-
|
5827
|
-
|
5828
|
-
|
5829
|
-
|
5830
|
-
|
5831
|
-
|
5832
|
-
|
5833
|
-
|
5834
|
-
|
5835
|
-
|
5836
|
-
|
5837
|
-
|
5838
|
-
|
5839
|
-
|
5840
|
-
|
5499
|
+
(_m = (_l = props.texts) == null ? void 0 : _l.registerText) != null ? _m : "Register"
|
5500
|
+
)))
|
5501
|
+
)) : /* @__PURE__ */ import_react41.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react41.default.createElement("div", { className: "hawa-text-center" }, ((_n = props.texts) == null ? void 0 : _n.emailSentText) || "An email has been sent with a link to set a new password")));
|
5502
|
+
};
|
5503
|
+
|
5504
|
+
// blocks/auth/CodeConfirmation.tsx
|
5505
|
+
var import_react44 = __toESM(require("react"));
|
5506
|
+
var import_react_hook_form5 = require("react-hook-form");
|
5507
|
+
var import_zod5 = require("@hookform/resolvers/zod");
|
5508
|
+
var z5 = __toESM(require("zod"));
|
5509
|
+
|
5510
|
+
// elements/pinInput/PinInput.tsx
|
5511
|
+
var React36 = __toESM(require("react"));
|
5512
|
+
var import_input_otp = require("input-otp");
|
5513
|
+
|
5514
|
+
// ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
5515
|
+
var import_react43 = require("react");
|
5516
|
+
|
5517
|
+
// ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
|
5518
|
+
var toKebabCase = (string9) => string9.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
5519
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
5520
|
+
return Boolean(className) && array.indexOf(className) === index;
|
5521
|
+
}).join(" ");
|
5522
|
+
|
5523
|
+
// ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
|
5524
|
+
var import_react42 = require("react");
|
5525
|
+
|
5526
|
+
// ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
|
5527
|
+
var defaultAttributes = {
|
5528
|
+
xmlns: "http://www.w3.org/2000/svg",
|
5529
|
+
width: 24,
|
5530
|
+
height: 24,
|
5531
|
+
viewBox: "0 0 24 24",
|
5532
|
+
fill: "none",
|
5533
|
+
stroke: "currentColor",
|
5534
|
+
strokeWidth: 2,
|
5535
|
+
strokeLinecap: "round",
|
5536
|
+
strokeLinejoin: "round"
|
5537
|
+
};
|
5538
|
+
|
5539
|
+
// ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
|
5540
|
+
var Icon = (0, import_react42.forwardRef)(
|
5541
|
+
({
|
5542
|
+
color = "currentColor",
|
5543
|
+
size = 24,
|
5544
|
+
strokeWidth = 2,
|
5545
|
+
absoluteStrokeWidth,
|
5546
|
+
className = "",
|
5547
|
+
children,
|
5548
|
+
iconNode,
|
5549
|
+
...rest
|
5550
|
+
}, ref) => {
|
5551
|
+
return (0, import_react42.createElement)(
|
5552
|
+
"svg",
|
5553
|
+
{
|
5554
|
+
ref,
|
5555
|
+
...defaultAttributes,
|
5556
|
+
width: size,
|
5557
|
+
height: size,
|
5558
|
+
stroke: color,
|
5559
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
5560
|
+
className: mergeClasses("lucide", className),
|
5561
|
+
...rest
|
5562
|
+
},
|
5563
|
+
[
|
5564
|
+
...iconNode.map(([tag, attrs]) => (0, import_react42.createElement)(tag, attrs)),
|
5565
|
+
...Array.isArray(children) ? children : [children]
|
5566
|
+
]
|
5567
|
+
);
|
5568
|
+
}
|
5569
|
+
);
|
5570
|
+
|
5571
|
+
// ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
5572
|
+
var createLucideIcon = (iconName, iconNode) => {
|
5573
|
+
const Component = (0, import_react43.forwardRef)(
|
5574
|
+
({ className, ...props }, ref) => (0, import_react43.createElement)(Icon, {
|
5575
|
+
ref,
|
5576
|
+
iconNode,
|
5577
|
+
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
|
5578
|
+
...props
|
5579
|
+
})
|
5841
5580
|
);
|
5581
|
+
Component.displayName = `${iconName}`;
|
5582
|
+
return Component;
|
5842
5583
|
};
|
5843
5584
|
|
5844
|
-
//
|
5845
|
-
var
|
5846
|
-
|
5847
|
-
|
5848
|
-
|
5849
|
-
|
5850
|
-
|
5851
|
-
|
5852
|
-
|
5853
|
-
|
5854
|
-
|
5855
|
-
|
5856
|
-
|
5857
|
-
|
5858
|
-
|
5859
|
-
|
5860
|
-
|
5585
|
+
// ../../node_modules/.pnpm/lucide-react@0.427.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/dot.js
|
5586
|
+
var Dot = createLucideIcon("Dot", [
|
5587
|
+
["circle", { cx: "12.1", cy: "12.1", r: "1", key: "18d7e5" }]
|
5588
|
+
]);
|
5589
|
+
|
5590
|
+
// elements/pinInput/PinInput.tsx
|
5591
|
+
var PinInputRoot = React36.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ React36.createElement(
|
5592
|
+
import_input_otp.OTPInput,
|
5593
|
+
{
|
5594
|
+
ref,
|
5595
|
+
containerClassName: cn(
|
5596
|
+
"hawa-flex hawa-items-center hawa-gap-2 has-[:disabled]:hawa-opacity-50",
|
5597
|
+
containerClassName
|
5598
|
+
),
|
5599
|
+
className: cn("disabled:hawa-cursor-not-allowed", className),
|
5600
|
+
...props
|
5601
|
+
}
|
5602
|
+
));
|
5603
|
+
PinInputRoot.displayName = "PinInputRoot";
|
5604
|
+
var PinInputGroup = React36.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React36.createElement("div", { ref, className: cn("hawa-flex hawa-items-center", className), ...props }));
|
5605
|
+
PinInputGroup.displayName = "PinInputGroup";
|
5606
|
+
var PinInputSlot = React36.forwardRef(({ index, className, ...props }, ref) => {
|
5607
|
+
const pinInputContext = React36.useContext(import_input_otp.OTPInputContext);
|
5608
|
+
const { char, hasFakeCaret, isActive } = pinInputContext.slots[index];
|
5609
|
+
return /* @__PURE__ */ React36.createElement(
|
5610
|
+
"div",
|
5861
5611
|
{
|
5612
|
+
ref,
|
5862
5613
|
className: cn(
|
5863
|
-
|
5614
|
+
"hawa-border-input hawa-relative hawa-flex hawa-h-10 hawa-w-10 hawa-items-center hawa-justify-center hawa-border-y hawa-border-r hawa-text-sm hawa-transition-all first:hawa-rounded-l-md first:hawa-border-l last:hawa-rounded-r-md",
|
5615
|
+
isActive && "hawa-ring-ring hawa-ring-offset-background hawa-z-10 hawa-ring-2",
|
5616
|
+
className
|
5864
5617
|
),
|
5865
|
-
|
5618
|
+
...props
|
5866
5619
|
},
|
5867
|
-
|
5868
|
-
|
5869
|
-
{
|
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"
|
5879
|
-
},
|
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
|
-
))
|
5620
|
+
char,
|
5621
|
+
hasFakeCaret && /* @__PURE__ */ React36.createElement("div", { className: "hawa-pointer-events-none hawa-absolute hawa-inset-0 hawa-flex hawa-items-center hawa-justify-center" }, /* @__PURE__ */ React36.createElement("div", { className: "hawa-animate-caret-blink hawa-bg-foreground hawa-h-4 hawa-w-px hawa-duration-1000" }))
|
5932
5622
|
);
|
5623
|
+
});
|
5624
|
+
PinInputSlot.displayName = "PinInputSlot";
|
5625
|
+
var PinInputSeperator = React36.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React36.createElement("div", { ref, role: "separator", ...props }, /* @__PURE__ */ React36.createElement(Dot, null)));
|
5626
|
+
PinInputSeperator.displayName = "PinInputSeperator";
|
5627
|
+
var PinInput = ({ separatorPosition = 0, ...props }) => {
|
5628
|
+
const maxLength = props.maxLength || 6;
|
5629
|
+
const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
|
5630
|
+
const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
|
5631
|
+
const secondGroupLength = maxLength - firstGroupLength;
|
5632
|
+
return /* @__PURE__ */ React36.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2", dir: "ltr" }, /* @__PURE__ */ React36.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React36.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React36.createElement(PinInputSlot, { key: index, index, className: "hawa-w-full hawa-border" }))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React36.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React36.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React36.createElement(
|
5633
|
+
PinInputSlot,
|
5634
|
+
{
|
5635
|
+
key: index + firstGroupLength,
|
5636
|
+
index: index + firstGroupLength,
|
5637
|
+
className: "hawa-w-full hawa-border"
|
5638
|
+
}
|
5639
|
+
)))), /* @__PURE__ */ React36.createElement(HelperText, { helperText: props.helperText }));
|
5933
5640
|
};
|
5934
5641
|
|
5935
|
-
// blocks/
|
5936
|
-
var
|
5937
|
-
|
5938
|
-
|
5939
|
-
|
5940
|
-
|
5941
|
-
|
5942
|
-
|
5943
|
-
|
5944
|
-
const
|
5945
|
-
const
|
5946
|
-
const [
|
5947
|
-
const
|
5948
|
-
|
5949
|
-
|
5950
|
-
|
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
|
-
};
|
5963
|
-
}
|
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();
|
5642
|
+
// blocks/auth/CodeConfirmation.tsx
|
5643
|
+
var CodeConfirmation = ({ codeLength = 6, ...props }) => {
|
5644
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
5645
|
+
const formSchema = z5.object({
|
5646
|
+
otp_code: z5.string({ required_error: (_a = props.texts) == null ? void 0 : _a.codeRequiredText }).min(codeLength, { message: (_b = props.texts) == null ? void 0 : _b.codeTooShort })
|
5647
|
+
});
|
5648
|
+
const { handleSubmit, control, formState, setValue } = (0, import_react_hook_form5.useForm)({
|
5649
|
+
resolver: (0, import_zod5.zodResolver)(formSchema)
|
5650
|
+
});
|
5651
|
+
const [resendTimer, setResendTimer] = (0, import_react44.useState)(null);
|
5652
|
+
const [remainingTime, setRemainingTime] = (0, import_react44.useState)(0);
|
5653
|
+
const [showResendTimer, setShowResendTimer] = (0, import_react44.useState)(false);
|
5654
|
+
const startResendTimer = () => {
|
5655
|
+
if (resendTimer !== null) {
|
5656
|
+
clearInterval(resendTimer);
|
5657
|
+
setResendTimer(null);
|
5976
5658
|
}
|
5659
|
+
const timerDuration = 60;
|
5660
|
+
setRemainingTime(timerDuration);
|
5661
|
+
setShowResendTimer(true);
|
5662
|
+
const newTimer = window.setInterval(() => {
|
5663
|
+
setRemainingTime((prevTime) => {
|
5664
|
+
if (prevTime > 0) {
|
5665
|
+
return prevTime - 1;
|
5666
|
+
} else {
|
5667
|
+
clearInterval(newTimer);
|
5668
|
+
setShowResendTimer(false);
|
5669
|
+
return 0;
|
5670
|
+
}
|
5671
|
+
});
|
5672
|
+
}, 1e3);
|
5673
|
+
setResendTimer(newTimer);
|
5977
5674
|
};
|
5978
|
-
|
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
|
-
}
|
5675
|
+
(0, import_react44.useEffect)(() => {
|
5989
5676
|
return () => {
|
5990
|
-
if (
|
5991
|
-
|
5677
|
+
if (resendTimer !== null) {
|
5678
|
+
clearInterval(resendTimer);
|
5992
5679
|
}
|
5993
|
-
window.removeEventListener("resize", checkOverflow);
|
5994
5680
|
};
|
5995
5681
|
}, []);
|
5996
|
-
return /* @__PURE__ */
|
5997
|
-
|
5682
|
+
return /* @__PURE__ */ import_react44.default.createElement(Card, null, /* @__PURE__ */ import_react44.default.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ import_react44.default.createElement(Alert, { title: props.errorTitle, text: props.errorText, severity: "error" }), /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourIdentifier) || "Please check your phone"), /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ import_react44.default.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ import_react44.default.createElement("span", null, props.identifier))), /* @__PURE__ */ import_react44.default.createElement(
|
5683
|
+
"form",
|
5998
5684
|
{
|
5999
|
-
|
6000
|
-
|
6001
|
-
|
5685
|
+
noValidate: true,
|
5686
|
+
onSubmit: handleSubmit((e) => {
|
5687
|
+
if (props.onConfirm) {
|
5688
|
+
return props.onConfirm(e);
|
5689
|
+
} else {
|
5690
|
+
console.log("Form is submitted but onConfirm prop is missing");
|
5691
|
+
}
|
5692
|
+
})
|
6002
5693
|
},
|
6003
|
-
/* @__PURE__ */
|
6004
|
-
|
5694
|
+
/* @__PURE__ */ import_react44.default.createElement(
|
5695
|
+
import_react_hook_form5.Controller,
|
6005
5696
|
{
|
6006
|
-
|
6007
|
-
|
6008
|
-
|
6009
|
-
|
5697
|
+
control,
|
5698
|
+
name: "otp_code",
|
5699
|
+
render: ({ field }) => {
|
5700
|
+
var _a2;
|
5701
|
+
return /* @__PURE__ */ import_react44.default.createElement(
|
5702
|
+
PinInput,
|
5703
|
+
{
|
5704
|
+
maxLength: codeLength,
|
5705
|
+
helperText: (_a2 = formState.errors.otp_code) == null ? void 0 : _a2.message,
|
5706
|
+
...field
|
5707
|
+
}
|
5708
|
+
);
|
5709
|
+
}
|
6010
5710
|
}
|
6011
5711
|
),
|
6012
|
-
/* @__PURE__ */
|
6013
|
-
"
|
5712
|
+
showResendTimer ? /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, (_e = props.texts) == null ? void 0 : _e.resendCodeTimer, " ", /* @__PURE__ */ import_react44.default.createElement("strong", null, remainingTime), " ", (_f = props.texts) == null ? void 0 : _f.seconds) : /* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-py-2 hawa-text-center hawa-text-xs hawa-text-muted-foreground" }, /* @__PURE__ */ import_react44.default.createElement("span", null, (_h = (_g = props.texts) == null ? void 0 : _g.didntGetCode) != null ? _h : "Didn't get the code?"), " ", /* @__PURE__ */ import_react44.default.createElement(
|
5713
|
+
"span",
|
6014
5714
|
{
|
6015
|
-
className:
|
6016
|
-
|
6017
|
-
|
6018
|
-
|
6019
|
-
|
6020
|
-
|
6021
|
-
|
6022
|
-
|
5715
|
+
className: "clickable-link",
|
5716
|
+
onClick: () => {
|
5717
|
+
startResendTimer();
|
5718
|
+
props.onResend();
|
5719
|
+
}
|
5720
|
+
},
|
5721
|
+
((_i = props.texts) == null ? void 0 : _i.resendCode) || "Click to resend"
|
5722
|
+
)),
|
5723
|
+
/* @__PURE__ */ import_react44.default.createElement("div", { className: "hawa-mt-4 hawa-grid hawa-grid-cols-2 hawa-gap-2" }, /* @__PURE__ */ import_react44.default.createElement(
|
5724
|
+
Button,
|
6023
5725
|
{
|
6024
|
-
|
6025
|
-
|
6026
|
-
|
5726
|
+
type: "button",
|
5727
|
+
onClick: () => {
|
5728
|
+
if (props.onCancel) {
|
5729
|
+
return props.onCancel();
|
5730
|
+
} else {
|
5731
|
+
console.log("Cancel button clicked but onCancel prop is missing");
|
5732
|
+
}
|
5733
|
+
},
|
5734
|
+
variant: "outline"
|
6027
5735
|
},
|
6028
|
-
|
6029
|
-
),
|
6030
|
-
|
6031
|
-
|
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");
|
5736
|
+
((_j = props.texts) == null ? void 0 : _j.cancel) || "Cancel"
|
5737
|
+
), /* @__PURE__ */ import_react44.default.createElement(Button, { isLoading: props.confirmLoading }, ((_k = props.texts) == null ? void 0 : _k.confirm) || "Confirm"))
|
5738
|
+
)));
|
5739
|
+
};
|
6109
5740
|
|
6110
|
-
//
|
6111
|
-
var
|
5741
|
+
// blocks/feedback/UserReferralSource.tsx
|
5742
|
+
var import_react46 = __toESM(require("react"));
|
5743
|
+
var import_react_hook_form6 = require("react-hook-form");
|
5744
|
+
var import_zod6 = require("@hookform/resolvers/zod");
|
5745
|
+
var z6 = __toESM(require("zod"));
|
6112
5746
|
|
6113
|
-
//
|
6114
|
-
var import_react45 = require("react");
|
5747
|
+
// elements/radio/Radio.tsx
|
5748
|
+
var import_react45 = __toESM(require("react"));
|
5749
|
+
var import_react_tabs = require("@radix-ui/react-tabs");
|
6115
5750
|
|
6116
|
-
//
|
6117
|
-
var
|
6118
|
-
|
6119
|
-
|
6120
|
-
|
6121
|
-
|
6122
|
-
|
6123
|
-
|
6124
|
-
|
6125
|
-
|
6126
|
-
|
6127
|
-
|
6128
|
-
|
6129
|
-
|
6130
|
-
|
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;
|
5751
|
+
// elements/popover/Popover.tsx
|
5752
|
+
var React38 = __toESM(require("react"));
|
5753
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
5754
|
+
var PopoverContent = React38.forwardRef(
|
5755
|
+
({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ React38.createElement(PopoverPrimitive.Portal, { container }, /* @__PURE__ */ React38.createElement(
|
5756
|
+
PopoverPrimitive.Content,
|
5757
|
+
{
|
5758
|
+
ref,
|
5759
|
+
align,
|
5760
|
+
sideOffset,
|
5761
|
+
className: cn(
|
5762
|
+
"dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-bg-popover hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
|
5763
|
+
className
|
5764
|
+
),
|
5765
|
+
...props
|
6147
5766
|
}
|
6148
|
-
|
6149
|
-
|
5767
|
+
))
|
5768
|
+
);
|
5769
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
5770
|
+
var Popover2 = ({
|
5771
|
+
trigger,
|
5772
|
+
children,
|
5773
|
+
className,
|
5774
|
+
align = "center",
|
5775
|
+
side,
|
5776
|
+
sideOffset = 4,
|
5777
|
+
open,
|
5778
|
+
width = "default",
|
5779
|
+
disableTrigger,
|
5780
|
+
contentProps,
|
5781
|
+
triggerProps,
|
5782
|
+
...props
|
5783
|
+
}) => {
|
5784
|
+
let widthStyles = {
|
5785
|
+
trigger: "var(--radix-popover-trigger-width)",
|
5786
|
+
default: "auto"
|
5787
|
+
};
|
5788
|
+
return /* @__PURE__ */ React38.createElement(PopoverPrimitive.Root, { open, ...props }, /* @__PURE__ */ React38.createElement(
|
5789
|
+
PopoverPrimitive.Trigger,
|
5790
|
+
{
|
5791
|
+
className: "hawa-w-full",
|
5792
|
+
disabled: disableTrigger,
|
5793
|
+
...triggerProps
|
5794
|
+
},
|
5795
|
+
trigger
|
5796
|
+
), /* @__PURE__ */ React38.createElement(
|
5797
|
+
PopoverContent,
|
5798
|
+
{
|
5799
|
+
side,
|
5800
|
+
className,
|
5801
|
+
align,
|
5802
|
+
sideOffset,
|
5803
|
+
style: {
|
5804
|
+
width: widthStyles[width],
|
5805
|
+
maxWidth: "var(--radix-popover-content-available-width)",
|
5806
|
+
maxHeight: "var(--radix-popover-content-available-height)"
|
5807
|
+
},
|
5808
|
+
...contentProps
|
5809
|
+
},
|
5810
|
+
children
|
5811
|
+
));
|
5812
|
+
};
|
5813
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
5814
|
+
var PopoverRoot = PopoverPrimitive.Root;
|
5815
|
+
|
5816
|
+
// elements/radio/Radio.tsx
|
5817
|
+
var Radio = (0, import_react45.forwardRef)(
|
5818
|
+
({
|
5819
|
+
design = "default",
|
5820
|
+
width = "default",
|
5821
|
+
size = "default",
|
5822
|
+
orientation = "horizontal",
|
5823
|
+
name,
|
5824
|
+
labelProps,
|
5825
|
+
tabsContainerClassName,
|
5826
|
+
forceHideHelperText = false,
|
5827
|
+
onChange,
|
5828
|
+
containerClassNames,
|
5829
|
+
...props
|
5830
|
+
}, ref) => {
|
5831
|
+
var _a, _b, _c;
|
5832
|
+
let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
|
5833
|
+
let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
|
5834
|
+
${props.disabled ? "" : "hover:hawa-bg-muted"}`;
|
5835
|
+
let orientationStyle = {
|
5836
|
+
horizontal: "hawa-flex hawa-flex-row",
|
5837
|
+
vertical: "hawa-flex hawa-flex-col"
|
5838
|
+
};
|
5839
|
+
let tabSizeStyle = {
|
5840
|
+
default: "hawa-py-2 hawa-px-4 hawa-text-sm",
|
5841
|
+
lg: "hawa-py-2 hawa-px-4",
|
5842
|
+
sm: "hawa-p-1.5 hawa-text-xs",
|
5843
|
+
xs: "hawa-p-1 hawa-text-[10px]"
|
5844
|
+
};
|
5845
|
+
let widthStyle = {
|
5846
|
+
none: "",
|
5847
|
+
default: "hawa-max-w-fit",
|
5848
|
+
full: "hawa-w-full"
|
5849
|
+
};
|
5850
|
+
const [parentDirection, setParentDirection] = import_react45.default.useState(
|
5851
|
+
null
|
5852
|
+
);
|
5853
|
+
const [selectedOption, setSelectedOption] = (0, import_react45.useState)(
|
5854
|
+
props.defaultValue || props.value
|
5855
|
+
);
|
5856
|
+
const [openTooltip, setOpenTooltip] = (0, import_react45.useState)(null);
|
5857
|
+
const parentRef = (0, import_react45.useRef)(null);
|
5858
|
+
(0, import_react45.useEffect)(() => {
|
5859
|
+
var _a2;
|
5860
|
+
const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
|
5861
|
+
if (parentNode) {
|
5862
|
+
const dir = window.getComputedStyle(parentNode).direction;
|
5863
|
+
setParentDirection(dir);
|
5864
|
+
}
|
5865
|
+
});
|
5866
|
+
const handleChange = (opt) => {
|
5867
|
+
setSelectedOption(opt.value);
|
5868
|
+
if (onChange) {
|
5869
|
+
onChange(opt.value);
|
5870
|
+
} else {
|
5871
|
+
console.log("onChange was not provided");
|
5872
|
+
}
|
5873
|
+
};
|
5874
|
+
const radio_option_tabs_styling = [
|
5875
|
+
"hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
|
5876
|
+
!props.disabled && "hawa-cursor-pointer",
|
5877
|
+
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
5878
|
+
orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
|
5879
|
+
orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
|
5880
|
+
tabSizeStyle[size]
|
5881
|
+
];
|
5882
|
+
switch (design) {
|
5883
|
+
case "tabs":
|
5884
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
5885
|
+
"div",
|
5886
|
+
{
|
5887
|
+
className: cn(
|
5888
|
+
"hawa-gap-2 hawa-flex hawa-flex-col",
|
5889
|
+
containerClassNames == null ? void 0 : containerClassNames.tabs
|
5890
|
+
)
|
5891
|
+
},
|
5892
|
+
props.label && /* @__PURE__ */ import_react45.default.createElement(Label, { ...labelProps }, props.label),
|
5893
|
+
/* @__PURE__ */ import_react45.default.createElement(import_react_tabs.Tabs, null, /* @__PURE__ */ import_react45.default.createElement(
|
5894
|
+
import_react_tabs.TabsList,
|
5895
|
+
{
|
5896
|
+
role: "tablist",
|
5897
|
+
ref: parentRef,
|
5898
|
+
className: cn(
|
5899
|
+
props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
|
5900
|
+
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium hawa-h-[40px]",
|
5901
|
+
orientationStyle[orientation],
|
5902
|
+
widthStyle[width],
|
5903
|
+
tabsContainerClassName,
|
5904
|
+
props.direction === "rtl" ? "hawa-flex-row-reverse" : ""
|
5905
|
+
)
|
5906
|
+
},
|
5907
|
+
(_b = props.options) == null ? void 0 : _b.map((opt, o) => {
|
5908
|
+
return opt.tooltip ? /* @__PURE__ */ import_react45.default.createElement(
|
5909
|
+
PopoverRoot,
|
5910
|
+
{
|
5911
|
+
key: o,
|
5912
|
+
open: o === openTooltip,
|
5913
|
+
onOpenChange: (bool) => setOpenTooltip(bool ? o : null)
|
5914
|
+
},
|
5915
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
5916
|
+
PopoverTrigger,
|
5917
|
+
{
|
5918
|
+
onMouseEnter: () => setOpenTooltip(o),
|
5919
|
+
onMouseLeave: () => setOpenTooltip(null),
|
5920
|
+
asChild: true
|
5921
|
+
},
|
5922
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
5923
|
+
import_react_tabs.TabsTrigger,
|
5924
|
+
{
|
5925
|
+
"aria-current": selectedOption === opt.value ? "page" : void 0,
|
5926
|
+
value: opt.value,
|
5927
|
+
role: "tab",
|
5928
|
+
tabIndex: 0,
|
5929
|
+
onClick: () => {
|
5930
|
+
if (props.disabled || opt.disabled) return;
|
5931
|
+
handleChange(opt);
|
5932
|
+
},
|
5933
|
+
className: cn(
|
5934
|
+
...radio_option_tabs_styling,
|
5935
|
+
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
5936
|
+
)
|
5937
|
+
},
|
5938
|
+
opt.icon && opt.icon,
|
5939
|
+
opt.label
|
5940
|
+
)
|
5941
|
+
),
|
5942
|
+
/* @__PURE__ */ import_react45.default.createElement(PopoverContent, { ...opt.tooltipContentProps }, opt.tooltip)
|
5943
|
+
) : /* @__PURE__ */ import_react45.default.createElement(
|
5944
|
+
import_react_tabs.TabsTrigger,
|
5945
|
+
{
|
5946
|
+
key: o,
|
5947
|
+
role: "tab",
|
5948
|
+
tabIndex: 0,
|
5949
|
+
"aria-current": selectedOption === opt.value ? "page" : void 0,
|
5950
|
+
onClick: () => {
|
5951
|
+
if (props.disabled || opt.disabled) return;
|
5952
|
+
handleChange(opt);
|
5953
|
+
},
|
5954
|
+
className: cn(
|
5955
|
+
...radio_option_tabs_styling,
|
5956
|
+
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
5957
|
+
),
|
5958
|
+
value: opt.value
|
5959
|
+
},
|
5960
|
+
opt.icon && opt.icon,
|
5961
|
+
opt.label
|
5962
|
+
);
|
5963
|
+
})
|
5964
|
+
)),
|
5965
|
+
!forceHideHelperText && /* @__PURE__ */ import_react45.default.createElement(HelperText, { helperText: props.helperText })
|
5966
|
+
);
|
5967
|
+
case "bordered":
|
5968
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
5969
|
+
"div",
|
5970
|
+
{
|
5971
|
+
className: cn(
|
5972
|
+
orientationStyle[orientation],
|
5973
|
+
"hawa-gap-4",
|
5974
|
+
containerClassNames == null ? void 0 : containerClassNames.bordered
|
5975
|
+
)
|
5976
|
+
},
|
5977
|
+
props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react45.default.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ import_react45.default.createElement(
|
5978
|
+
"div",
|
5979
|
+
{
|
5980
|
+
className: cn(
|
5981
|
+
"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
|
5982
|
+
props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
|
5983
|
+
),
|
5984
|
+
key: i + 1
|
5985
|
+
},
|
5986
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
5987
|
+
"input",
|
5988
|
+
{
|
5989
|
+
disabled: opt.disabled,
|
5990
|
+
id: opt.value.toString(),
|
5991
|
+
type: "radio",
|
5992
|
+
value: opt.value,
|
5993
|
+
name,
|
5994
|
+
onChange: () => handleChange(opt)
|
5995
|
+
}
|
5996
|
+
),
|
5997
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
5998
|
+
"label",
|
5999
|
+
{
|
6000
|
+
htmlFor: opt.value.toString(),
|
6001
|
+
className: cn(
|
6002
|
+
"hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium hawa-text-black dark:hawa-text-white",
|
6003
|
+
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
6004
|
+
)
|
6005
|
+
},
|
6006
|
+
opt.label
|
6007
|
+
)
|
6008
|
+
)))
|
6009
|
+
);
|
6010
|
+
case "cards":
|
6011
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
6012
|
+
"ul",
|
6013
|
+
{
|
6014
|
+
className: cn(
|
6015
|
+
orientationStyle[orientation],
|
6016
|
+
"hawa-gap-4",
|
6017
|
+
containerClassNames == null ? void 0 : containerClassNames.cards
|
6018
|
+
)
|
6019
|
+
},
|
6020
|
+
(_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react45.default.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ import_react45.default.createElement(
|
6021
|
+
"input",
|
6022
|
+
{
|
6023
|
+
type: "radio",
|
6024
|
+
id: opt.value.toString(),
|
6025
|
+
name,
|
6026
|
+
value: opt.value.toString(),
|
6027
|
+
className: "hawa-peer hawa-hidden",
|
6028
|
+
required: true,
|
6029
|
+
disabled: opt.disabled
|
6030
|
+
}
|
6031
|
+
), /* @__PURE__ */ import_react45.default.createElement(
|
6032
|
+
"label",
|
6033
|
+
{
|
6034
|
+
htmlFor: opt.value.toString(),
|
6035
|
+
className: cn(
|
6036
|
+
"hawa-inline-flex hawa-h-full hawa-w-full hawa-transition-all hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-foreground/10 hawa-bg-background hawa-p-5 hawa-text-gray-500 peer-checked:hawa-border-primary peer-checked:hawa-text-primary dark:hawa-border-foreground/10 dark:hawa-bg-foreground/5 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
|
6037
|
+
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-foreground/10 hover:hawa-text-gray-600 dark:hover:hawa-bg-foreground/20 dark:hover:hawa-text-gray-300"
|
6038
|
+
)
|
6039
|
+
},
|
6040
|
+
/* @__PURE__ */ import_react45.default.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ import_react45.default.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ import_react45.default.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
|
6041
|
+
)))
|
6042
|
+
);
|
6043
|
+
default:
|
6044
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
6045
|
+
"div",
|
6046
|
+
{
|
6047
|
+
className: cn(
|
6048
|
+
"hawa-flex hawa-flex-col hawa-gap-2",
|
6049
|
+
containerClassNames == null ? void 0 : containerClassNames.default
|
6050
|
+
)
|
6051
|
+
},
|
6052
|
+
props.label && /* @__PURE__ */ import_react45.default.createElement(Label, { ...labelProps }, props.label),
|
6053
|
+
/* @__PURE__ */ import_react45.default.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react45.default.createElement(
|
6054
|
+
"div",
|
6055
|
+
{
|
6056
|
+
className: cn(
|
6057
|
+
"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
|
6058
|
+
props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
|
6059
|
+
),
|
6060
|
+
key: i + 1
|
6061
|
+
},
|
6062
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
6063
|
+
"input",
|
6064
|
+
{
|
6065
|
+
disabled: opt.disabled,
|
6066
|
+
id: opt.value.toString(),
|
6067
|
+
type: "radio",
|
6068
|
+
value: opt.value,
|
6069
|
+
name,
|
6070
|
+
onChange: () => handleChange(opt)
|
6071
|
+
}
|
6072
|
+
),
|
6073
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
6074
|
+
"label",
|
6075
|
+
{
|
6076
|
+
htmlFor: opt.value.toString(),
|
6077
|
+
className: cn(
|
6078
|
+
"hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
6079
|
+
opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
|
6080
|
+
)
|
6081
|
+
},
|
6082
|
+
opt.label
|
6083
|
+
)
|
6084
|
+
))),
|
6085
|
+
/* @__PURE__ */ import_react45.default.createElement(HelperText, { helperText: props.helperText })
|
6086
|
+
);
|
6150
6087
|
}
|
6151
6088
|
}
|
6152
|
-
|
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");
|
6089
|
+
);
|
6212
6090
|
|
6213
|
-
// elements/
|
6214
|
-
var
|
6215
|
-
var
|
6091
|
+
// elements/textarea/Textarea.tsx
|
6092
|
+
var React40 = __toESM(require("react"));
|
6093
|
+
var Textarea = React40.forwardRef(
|
6216
6094
|
({
|
6217
|
-
|
6218
|
-
|
6219
|
-
|
6220
|
-
|
6221
|
-
|
6222
|
-
|
6223
|
-
|
6224
|
-
|
6095
|
+
className,
|
6096
|
+
classNames,
|
6097
|
+
labelProps,
|
6098
|
+
showCount,
|
6099
|
+
forceHideHelperText,
|
6100
|
+
textareaProps,
|
6101
|
+
countPosition = "bottom",
|
6102
|
+
isLoading,
|
6103
|
+
...props
|
6225
6104
|
}, ref) => {
|
6226
|
-
|
6227
|
-
|
6228
|
-
|
6229
|
-
|
6230
|
-
|
6231
|
-
|
6232
|
-
|
6233
|
-
|
6234
|
-
|
6235
|
-
|
6236
|
-
|
6237
|
-
|
6238
|
-
|
6239
|
-
|
6240
|
-
|
6241
|
-
|
6242
|
-
|
6243
|
-
|
6244
|
-
|
6245
|
-
|
6246
|
-
|
6247
|
-
|
6248
|
-
|
6249
|
-
|
6250
|
-
|
6251
|
-
|
6252
|
-
|
6253
|
-
|
6254
|
-
|
6255
|
-
|
6256
|
-
|
6257
|
-
|
6258
|
-
|
6259
|
-
|
6260
|
-
|
6105
|
+
return /* @__PURE__ */ React40.createElement(
|
6106
|
+
"div",
|
6107
|
+
{
|
6108
|
+
className: cn(
|
6109
|
+
"textarea-main hawa-relative hawa-flex hawa-h-full hawa-w-full hawa-flex-col",
|
6110
|
+
!forceHideHelperText && "hawa-gap-2",
|
6111
|
+
className
|
6112
|
+
)
|
6113
|
+
},
|
6114
|
+
/* @__PURE__ */ React40.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, props.label && /* @__PURE__ */ React40.createElement(Label, { ...labelProps }, props.label), showCount && countPosition === "top" && /* @__PURE__ */ React40.createElement(
|
6115
|
+
"div",
|
6116
|
+
{
|
6117
|
+
className: "hawa-text-start hawa-text-xs hawa-transition-all hawa-leading-none"
|
6118
|
+
},
|
6119
|
+
(textareaProps == null ? void 0 : textareaProps.value) ? String(textareaProps == null ? void 0 : textareaProps.value).length : 0,
|
6120
|
+
"/",
|
6121
|
+
textareaProps == null ? void 0 : textareaProps.maxLength
|
6122
|
+
)),
|
6123
|
+
isLoading ? /* @__PURE__ */ React40.createElement(Skeleton, { style: { height: 40 } }) : /* @__PURE__ */ React40.createElement(
|
6124
|
+
"textarea",
|
6125
|
+
{
|
6126
|
+
...textareaProps,
|
6127
|
+
className: cn(
|
6128
|
+
"hawa-flex hawa-min-h-[40px] hawa-h-[40px] hawa-w-full hawa-rounded-md hawa-border hawa-border-input hawa-bg-background hawa-px-3 hawa-py-2 hawa-text-sm hawa-ring-offset-background placeholder:hawa-text-gray-400 placeholder:hawa-text-muted-foreground focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 disabled:hawa-cursor-not-allowed disabled:hawa-opacity-50",
|
6129
|
+
classNames == null ? void 0 : classNames.textarea
|
6130
|
+
),
|
6131
|
+
ref
|
6132
|
+
}
|
6133
|
+
),
|
6134
|
+
/* @__PURE__ */ React40.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, !forceHideHelperText && /* @__PURE__ */ React40.createElement(HelperText, { helperText: props.helperText }), showCount && countPosition === "bottom" && /* @__PURE__ */ React40.createElement("div", { className: "hawa-text-start hawa-text-xs hawa-transition-all" }, (textareaProps == null ? void 0 : textareaProps.value) ? String(textareaProps == null ? void 0 : textareaProps.value).length : 0, "/", textareaProps == null ? void 0 : textareaProps.maxLength))
|
6135
|
+
);
|
6136
|
+
}
|
6137
|
+
);
|
6138
|
+
Textarea.displayName = "Textarea";
|
6139
|
+
|
6140
|
+
// blocks/feedback/UserReferralSource.tsx
|
6141
|
+
var UserReferralSource = ({
|
6142
|
+
position = "bottom-right",
|
6143
|
+
options = [],
|
6144
|
+
...props
|
6145
|
+
}) => {
|
6146
|
+
var _a, _b;
|
6147
|
+
const [closed, setClosed] = (0, import_react46.useState)(false);
|
6148
|
+
const popUpRef = (0, import_react46.useRef)(null);
|
6149
|
+
const formSchema = z6.object({
|
6150
|
+
source: z6.string({ required_error: (_a = props.texts) == null ? void 0 : _a.pleaseSelectOption }),
|
6151
|
+
feedback: z6.string().optional()
|
6152
|
+
});
|
6153
|
+
const { handleSubmit, control, formState, watch } = (0, import_react_hook_form6.useForm)({
|
6154
|
+
resolver: (0, import_zod6.zodResolver)(formSchema)
|
6155
|
+
});
|
6156
|
+
const selectedSource = watch("source");
|
6157
|
+
const boxPosition = {
|
6158
|
+
"bottom-right": "hawa-right-4",
|
6159
|
+
"bottom-left": "hawa-left-4"
|
6160
|
+
};
|
6161
|
+
const optionsWithOther = [
|
6162
|
+
...options,
|
6163
|
+
{
|
6164
|
+
value: "other",
|
6165
|
+
label: "Other"
|
6166
|
+
}
|
6167
|
+
];
|
6168
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
6169
|
+
"div",
|
6170
|
+
{
|
6171
|
+
className: cn(
|
6172
|
+
"hawa-transition-all",
|
6173
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100"
|
6174
|
+
),
|
6175
|
+
ref: popUpRef
|
6176
|
+
},
|
6177
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
6178
|
+
Card,
|
6179
|
+
{
|
6180
|
+
className: cn(
|
6181
|
+
"hawa-fixed hawa-bottom-4 hawa-p-0 ",
|
6182
|
+
boxPosition[position]
|
6183
|
+
),
|
6184
|
+
dir: props.direction
|
6185
|
+
},
|
6186
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
6187
|
+
"button",
|
6261
6188
|
{
|
6262
|
-
|
6263
|
-
ref,
|
6189
|
+
type: "button",
|
6264
6190
|
className: cn(
|
6265
|
-
|
6266
|
-
|
6267
|
-
|
6268
|
-
|
6269
|
-
|
6191
|
+
props.direction === "rtl" ? "hawa-left-2" : "hawa-right-2",
|
6192
|
+
"hawa-absolute hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white"
|
6193
|
+
),
|
6194
|
+
"data-dismiss-target": "#toast-default",
|
6195
|
+
"aria-label": "Close",
|
6196
|
+
onClick: () => {
|
6197
|
+
setClosed(true);
|
6198
|
+
setTimeout(() => {
|
6199
|
+
if (popUpRef == null ? void 0 : popUpRef.current) {
|
6200
|
+
popUpRef == null ? void 0 : popUpRef.current.removeChild(popUpRef == null ? void 0 : popUpRef.current.children[0]);
|
6201
|
+
}
|
6202
|
+
}, 200);
|
6203
|
+
}
|
6204
|
+
},
|
6205
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
6206
|
+
"svg",
|
6207
|
+
{
|
6208
|
+
"aria-hidden": "true",
|
6209
|
+
className: "hawa-h-5 hawa-w-5",
|
6210
|
+
fill: "currentColor",
|
6211
|
+
viewBox: "0 0 20 20"
|
6212
|
+
},
|
6213
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
6214
|
+
"path",
|
6215
|
+
{
|
6216
|
+
fillRule: "evenodd",
|
6217
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
6218
|
+
clipRule: "evenodd"
|
6219
|
+
}
|
6270
6220
|
)
|
6221
|
+
)
|
6222
|
+
),
|
6223
|
+
/* @__PURE__ */ import_react46.default.createElement(CardContent, { headless: true }, /* @__PURE__ */ import_react46.default.createElement(
|
6224
|
+
"form",
|
6225
|
+
{
|
6226
|
+
noValidate: true,
|
6227
|
+
onSubmit: handleSubmit((e) => {
|
6228
|
+
if (props.onSubmitForm) {
|
6229
|
+
props.onSubmitForm(e);
|
6230
|
+
} else {
|
6231
|
+
console.log("onSubmitForm was not provided");
|
6232
|
+
}
|
6233
|
+
})
|
6271
6234
|
},
|
6272
|
-
|
6273
|
-
"
|
6235
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
6236
|
+
"div",
|
6274
6237
|
{
|
6275
|
-
className: cn(
|
6276
|
-
|
6238
|
+
className: cn(
|
6239
|
+
"hawa-flex hawa-flex-col hawa-gap-4 hawa-transition-all",
|
6240
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100"
|
6241
|
+
)
|
6242
|
+
},
|
6243
|
+
/* @__PURE__ */ import_react46.default.createElement("div", { className: "hawa-mt-4 hawa-font-bold" }, props.question),
|
6244
|
+
/* @__PURE__ */ import_react46.default.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded " }, /* @__PURE__ */ import_react46.default.createElement(
|
6245
|
+
import_react_hook_form6.Controller,
|
6246
|
+
{
|
6247
|
+
control,
|
6248
|
+
name: "source",
|
6249
|
+
render: ({ field }) => {
|
6250
|
+
var _a2, _b2;
|
6251
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
6252
|
+
Radio,
|
6253
|
+
{
|
6254
|
+
name: "source",
|
6255
|
+
direction: props.direction,
|
6256
|
+
orientation: "vertical",
|
6257
|
+
options: optionsWithOther,
|
6258
|
+
defaultValue: field.value,
|
6259
|
+
onChange: (e) => field.onChange(e),
|
6260
|
+
helperText: (_b2 = (_a2 = formState.errors.source) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
|
6261
|
+
}
|
6262
|
+
);
|
6263
|
+
}
|
6264
|
+
}
|
6265
|
+
)),
|
6266
|
+
/* @__PURE__ */ import_react46.default.createElement("div", null, /* @__PURE__ */ import_react46.default.createElement(
|
6267
|
+
import_react_hook_form6.Controller,
|
6268
|
+
{
|
6269
|
+
control,
|
6270
|
+
name: "feedback",
|
6271
|
+
render: ({ field }) => {
|
6272
|
+
var _a2, _b2;
|
6273
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
6274
|
+
Textarea,
|
6275
|
+
{
|
6276
|
+
...field,
|
6277
|
+
textareaProps: {
|
6278
|
+
onChange: (e) => field.onChange(e.target.value),
|
6279
|
+
disabled: selectedSource !== "other"
|
6280
|
+
},
|
6281
|
+
helperText: (_b2 = (_a2 = formState.errors.feedback) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
|
6282
|
+
}
|
6283
|
+
);
|
6284
|
+
}
|
6285
|
+
}
|
6286
|
+
))
|
6277
6287
|
),
|
6278
|
-
|
6279
|
-
|
6280
|
-
|
6281
|
-
|
6282
|
-
|
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
|
-
);
|
6288
|
+
/* @__PURE__ */ import_react46.default.createElement(Button, { type: "submit", className: "hawa-mt-4 hawa-w-full" }, ((_b = props.texts) == null ? void 0 : _b.submit) || "Submit")
|
6289
|
+
))
|
6290
|
+
)
|
6291
|
+
);
|
6292
|
+
};
|
6296
6293
|
|
6297
|
-
//
|
6298
|
-
var
|
6299
|
-
|
6300
|
-
|
6301
|
-
|
6302
|
-
|
6303
|
-
|
6304
|
-
|
6305
|
-
|
6306
|
-
|
6307
|
-
|
6308
|
-
|
6309
|
-
|
6310
|
-
|
6311
|
-
|
6312
|
-
|
6313
|
-
|
6314
|
-
|
6315
|
-
|
6316
|
-
|
6317
|
-
|
6318
|
-
|
6319
|
-
|
6320
|
-
|
6321
|
-
});
|
6322
|
-
|
6323
|
-
|
6324
|
-
|
6325
|
-
|
6326
|
-
|
6327
|
-
|
6328
|
-
|
6329
|
-
|
6330
|
-
|
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
|
-
},
|
6294
|
+
// blocks/feedback/FeedbackRating.tsx
|
6295
|
+
var import_react47 = __toESM(require("react"));
|
6296
|
+
var FeedbackRating = ({
|
6297
|
+
position = "bottom-right",
|
6298
|
+
...props
|
6299
|
+
}) => {
|
6300
|
+
const [closed, setClosed] = (0, import_react47.useState)(false);
|
6301
|
+
const [answered, setAnswered] = (0, import_react47.useState)(false);
|
6302
|
+
const [clickedOption, setClickedOption] = (0, import_react47.useState)(null);
|
6303
|
+
const [closingTimer, setClosingTimer] = (0, import_react47.useState)(5);
|
6304
|
+
const popUpRef = (0, import_react47.useRef)(null);
|
6305
|
+
const boxPosition = {
|
6306
|
+
"bottom-right": "hawa-right-4",
|
6307
|
+
"bottom-left": "hawa-left-4"
|
6308
|
+
};
|
6309
|
+
(0, import_react47.useEffect)(() => {
|
6310
|
+
const timeoutHide = setTimeout(() => {
|
6311
|
+
if (closingTimer >= 0) {
|
6312
|
+
setClosingTimer(closingTimer - 1);
|
6313
|
+
}
|
6314
|
+
}, 1e3);
|
6315
|
+
return () => {
|
6316
|
+
clearTimeout(timeoutHide);
|
6317
|
+
};
|
6318
|
+
}, [closingTimer]);
|
6319
|
+
const slowClose = () => {
|
6320
|
+
setClosed(true);
|
6321
|
+
setTimeout(() => {
|
6322
|
+
if (popUpRef.current) {
|
6323
|
+
popUpRef.current.removeChild(popUpRef.current.children[0]);
|
6324
|
+
}
|
6325
|
+
}, 200);
|
6326
|
+
};
|
6327
|
+
return /* @__PURE__ */ import_react47.default.createElement(
|
6328
|
+
"div",
|
6343
6329
|
{
|
6344
|
-
|
6345
|
-
|
6346
|
-
|
6330
|
+
ref: popUpRef,
|
6331
|
+
className: cn(
|
6332
|
+
props.banner ? "hawa-fixed hawa-bottom-0 hawa-left-0 hawa-w-full hawa-px-0 md:hawa-px-4" : "hawa-fixed hawa-bottom-4",
|
6333
|
+
boxPosition[position]
|
6334
|
+
)
|
6347
6335
|
},
|
6348
|
-
|
6349
|
-
|
6350
|
-
|
6351
|
-
|
6336
|
+
/* @__PURE__ */ import_react47.default.createElement(
|
6337
|
+
"div",
|
6338
|
+
{
|
6339
|
+
className: cn(
|
6340
|
+
"hawa-relative hawa-flex hawa-w-full hawa-flex-col hawa-gap-2 hawa-rounded hawa-border hawa-bg-background hawa-p-4 hawa-shadow-md hawa-transition-all",
|
6341
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100",
|
6342
|
+
props.banner && "hawa-rounded-none hawa-px-4 md:hawa-rounded-t md:hawa-px-64"
|
6343
|
+
)
|
6344
|
+
},
|
6345
|
+
/* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-absolute hawa-left-2 hawa-top-2 hawa-p-1.5 hawa-text-sm" }, props.title),
|
6346
|
+
/* @__PURE__ */ import_react47.default.createElement(
|
6347
|
+
"button",
|
6348
|
+
{
|
6349
|
+
type: "button",
|
6350
|
+
className: "hawa-absolute hawa-right-2 hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white",
|
6351
|
+
"data-dismiss-target": "#toast-default",
|
6352
|
+
"aria-label": "Close",
|
6353
|
+
onClick: () => slowClose()
|
6354
|
+
},
|
6355
|
+
/* @__PURE__ */ import_react47.default.createElement(
|
6356
|
+
"svg",
|
6357
|
+
{
|
6358
|
+
"aria-hidden": "true",
|
6359
|
+
className: "hawa-h-5 hawa-w-5",
|
6360
|
+
fill: "currentColor",
|
6361
|
+
viewBox: "0 0 20 20"
|
6362
|
+
},
|
6363
|
+
/* @__PURE__ */ import_react47.default.createElement(
|
6364
|
+
"path",
|
6365
|
+
{
|
6366
|
+
fillRule: "evenodd",
|
6367
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
6368
|
+
clipRule: "evenodd"
|
6369
|
+
}
|
6370
|
+
)
|
6371
|
+
)
|
6372
|
+
),
|
6373
|
+
/* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-mt-8" }, props.question),
|
6374
|
+
/* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded" }, props.options && props.options.map((op, i) => /* @__PURE__ */ import_react47.default.createElement(
|
6375
|
+
"span",
|
6376
|
+
{
|
6377
|
+
key: i,
|
6378
|
+
onClick: () => {
|
6379
|
+
if (props.onOptionClicked) {
|
6380
|
+
props.onOptionClicked(op);
|
6381
|
+
}
|
6382
|
+
setClickedOption(op);
|
6383
|
+
setAnswered(true);
|
6384
|
+
const timeoutDestroy = setTimeout(() => {
|
6385
|
+
setClosed(true);
|
6386
|
+
}, 4800);
|
6387
|
+
setTimeout(() => {
|
6388
|
+
var _a, _b;
|
6389
|
+
(_b = popUpRef.current) == null ? void 0 : _b.removeChild(
|
6390
|
+
(_a = popUpRef.current) == null ? void 0 : _a.children[0]
|
6391
|
+
);
|
6392
|
+
clearTimeout(timeoutDestroy);
|
6393
|
+
}, 5300);
|
6394
|
+
},
|
6395
|
+
className: cn(
|
6396
|
+
"hawa-w-full hawa-cursor-pointer hawa-rounded hawa-border hawa-p-4 hawa-text-center hawa-transition-all",
|
6397
|
+
clickedOption === op ? "hawa-bg-gray-500 hawa-text-white" : "hawa-border hawa-bg-background hover:hawa-bg-gray-300 dark:hover:hawa-bg-gray-700"
|
6398
|
+
)
|
6399
|
+
},
|
6400
|
+
op
|
6401
|
+
))),
|
6402
|
+
props.texts && /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between hawa-text-xs" }, /* @__PURE__ */ import_react47.default.createElement("span", null, props.texts.least), /* @__PURE__ */ import_react47.default.createElement("span", null, props.texts.most)),
|
6403
|
+
answered && /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-absolute hawa-left-0 hawa-top-0 hawa-flex hawa-h-full hawa-w-full hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-rounded hawa-bg-black hawa-bg-opacity-80 hawa-p-4 hawa-text-center hawa-transition-all" }, /* @__PURE__ */ import_react47.default.createElement("span", { className: "hawa-font-bold hawa-text-white" }, "Thank you for your answer. This box will disappear in", " " + closingTimer, " seconds"), /* @__PURE__ */ import_react47.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-2" }, /* @__PURE__ */ import_react47.default.createElement(Button, { variant: "secondary", onClick: () => slowClose() }, "Close")))
|
6404
|
+
)
|
6405
|
+
);
|
6406
|
+
};
|
6407
|
+
|
6408
|
+
// blocks/feedback/FeedbackEmoji.tsx
|
6409
|
+
var import_react48 = __toESM(require("react"));
|
6410
|
+
var FeedbackEmoji = (props) => {
|
6411
|
+
const [selectedEmoji, setSelectedEmoji] = (0, import_react48.useState)(null);
|
6412
|
+
const [loadingSubmit, setLoadingSubmit] = (0, import_react48.useState)(false);
|
6413
|
+
const [feedbackText, setFeedbackText] = (0, import_react48.useState)("");
|
6414
|
+
const [helperText, setHelperText] = (0, import_react48.useState)(false);
|
6415
|
+
let emojis = [
|
6416
|
+
{ icon: /* @__PURE__ */ import_react48.default.createElement(VeryGoodEmoji, null), value: "very-good" },
|
6417
|
+
{ icon: /* @__PURE__ */ import_react48.default.createElement(GoodEmoji, null), value: "good" },
|
6418
|
+
{ icon: /* @__PURE__ */ import_react48.default.createElement(BadEmoji, null), value: "bad" },
|
6419
|
+
{ icon: /* @__PURE__ */ import_react48.default.createElement(VeryBadEmoji, null), value: "very-bad" }
|
6420
|
+
];
|
6421
|
+
const onFeedbackSubmit = async () => {
|
6422
|
+
if (feedbackText) {
|
6423
|
+
setLoadingSubmit(true);
|
6424
|
+
try {
|
6425
|
+
await props.handleSubmit({
|
6426
|
+
choice: selectedEmoji,
|
6427
|
+
feedback: feedbackText
|
6428
|
+
});
|
6429
|
+
} catch (error) {
|
6430
|
+
console.error("Error during submission:", error);
|
6431
|
+
setLoadingSubmit(false);
|
6432
|
+
}
|
6433
|
+
await setLoadingSubmit(false);
|
6434
|
+
} else {
|
6435
|
+
setLoadingSubmit(false);
|
6436
|
+
setHelperText(true);
|
6352
6437
|
}
|
6353
|
-
|
6354
|
-
|
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,
|
6438
|
+
};
|
6439
|
+
return /* @__PURE__ */ import_react48.default.createElement(
|
6440
|
+
"div",
|
6360
6441
|
{
|
6361
|
-
ref,
|
6362
6442
|
className: cn(
|
6363
|
-
"hawa-flex hawa-
|
6364
|
-
|
6365
|
-
|
6366
|
-
),
|
6367
|
-
...props
|
6443
|
+
"hawa-flex hawa-flex-col hawa-rounded hawa-border hawa-p-2 hawa-transition-all",
|
6444
|
+
selectedEmoji ? "hawa-h-[189px] hawa-min-w-fit" : "hawa-h-[44px]"
|
6445
|
+
)
|
6368
6446
|
},
|
6369
|
-
/* @__PURE__ */
|
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,
|
6447
|
+
/* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2" }, /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-0.5" }, emojis.map((emoji, i) => /* @__PURE__ */ import_react48.default.createElement(
|
6448
|
+
Button,
|
6378
6449
|
{
|
6379
|
-
|
6450
|
+
key: i,
|
6451
|
+
onClick: () => {
|
6452
|
+
if (selectedEmoji === emoji.value) {
|
6453
|
+
setSelectedEmoji("");
|
6454
|
+
} else {
|
6455
|
+
setSelectedEmoji(emoji.value);
|
6456
|
+
}
|
6457
|
+
},
|
6458
|
+
variant: "ghost",
|
6459
|
+
size: "smallIcon",
|
6380
6460
|
className: cn(
|
6381
|
-
|
6382
|
-
|
6383
|
-
|
6384
|
-
|
6385
|
-
|
6386
|
-
|
6387
|
-
|
6388
|
-
} else {
|
6389
|
-
return /* @__PURE__ */ React44.createElement(
|
6390
|
-
TabsPrimitive.List,
|
6461
|
+
selectedEmoji === emoji.value ? "hawa-bg-primary/10 hover:hawa-bg-primary/10" : "hawa-text-[#666666]"
|
6462
|
+
)
|
6463
|
+
},
|
6464
|
+
emoji.icon
|
6465
|
+
)))),
|
6466
|
+
/* @__PURE__ */ import_react48.default.createElement(
|
6467
|
+
"div",
|
6391
6468
|
{
|
6392
|
-
ref,
|
6393
6469
|
className: cn(
|
6394
|
-
|
6395
|
-
|
6396
|
-
|
6397
|
-
|
6398
|
-
|
6399
|
-
|
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,
|
6470
|
+
"hawa-flex hawa-flex-col hawa-overflow-clip hawa-transition-all hawa-duration-500 hawa-ease-in-out",
|
6471
|
+
selectedEmoji ? "hawa-visible hawa-opacity-100" : "hawa-invisible hawa-opacity-0"
|
6472
|
+
)
|
6473
|
+
},
|
6474
|
+
props.showSuccess ? /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-h-full hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-pt-4" }, /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-rounded hawa-bg-primary hawa-p-2 hawa-text-primary-foreground" }, /* @__PURE__ */ import_react48.default.createElement(
|
6475
|
+
"svg",
|
6410
6476
|
{
|
6411
|
-
|
6412
|
-
|
6413
|
-
|
6414
|
-
|
6415
|
-
|
6416
|
-
|
6477
|
+
stroke: "currentColor",
|
6478
|
+
fill: "currentColor",
|
6479
|
+
strokeWidth: "0",
|
6480
|
+
viewBox: "0 0 512 512",
|
6481
|
+
height: "0.5em",
|
6482
|
+
width: "0.5em"
|
6417
6483
|
},
|
6418
|
-
|
6419
|
-
|
6420
|
-
|
6421
|
-
Popover2.Content,
|
6484
|
+
/* @__PURE__ */ import_react48.default.createElement("path", { d: "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" })
|
6485
|
+
)), /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-text-center hawa-text-sm" }, /* @__PURE__ */ import_react48.default.createElement("span", null, "Your feedback has been received!"), /* @__PURE__ */ import_react48.default.createElement("span", null, "Thank you for your help"))) : /* @__PURE__ */ import_react48.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-1 hawa-p-1" }, /* @__PURE__ */ import_react48.default.createElement(
|
6486
|
+
Popover2,
|
6422
6487
|
{
|
6423
|
-
|
6424
|
-
|
6425
|
-
|
6426
|
-
|
6427
|
-
|
6488
|
+
className: "hawa-select-none hawa-p-1 hawa-text-xs",
|
6489
|
+
open: helperText,
|
6490
|
+
trigger: /* @__PURE__ */ import_react48.default.createElement(
|
6491
|
+
Textarea,
|
6492
|
+
{
|
6493
|
+
classNames: {
|
6494
|
+
textarea: "hawa-mt-2 hawa-h-full hawa-resize-none"
|
6495
|
+
},
|
6496
|
+
textareaProps: {
|
6497
|
+
placeholder: "Your feedback",
|
6498
|
+
onChange: (e) => {
|
6499
|
+
if (e.target.value) {
|
6500
|
+
setHelperText(false);
|
6501
|
+
}
|
6502
|
+
setFeedbackText(e.target.value);
|
6503
|
+
}
|
6504
|
+
}
|
6505
|
+
}
|
6428
6506
|
)
|
6429
6507
|
},
|
6430
|
-
/* @__PURE__ */
|
6431
|
-
)
|
6432
|
-
|
6433
|
-
return /* @__PURE__ */ React44.createElement(
|
6434
|
-
TabsPrimitive.Trigger,
|
6508
|
+
/* @__PURE__ */ import_react48.default.createElement("span", { className: "hawa-m-0" }, "Please enter your feedback")
|
6509
|
+
), /* @__PURE__ */ import_react48.default.createElement(
|
6510
|
+
Button,
|
6435
6511
|
{
|
6436
|
-
|
6437
|
-
|
6438
|
-
|
6439
|
-
|
6440
|
-
),
|
6441
|
-
...props
|
6512
|
+
isLoading: loadingSubmit,
|
6513
|
+
onClick: onFeedbackSubmit,
|
6514
|
+
className: "hawa-w-full",
|
6515
|
+
size: "sm"
|
6442
6516
|
},
|
6443
|
-
|
6444
|
-
|
6445
|
-
|
6446
|
-
|
6447
|
-
|
6448
|
-
|
6449
|
-
|
6450
|
-
|
6451
|
-
|
6452
|
-
|
6453
|
-
|
6454
|
-
|
6455
|
-
|
6456
|
-
|
6457
|
-
|
6458
|
-
|
6459
|
-
)
|
6460
|
-
|
6461
|
-
|
6462
|
-
|
6463
|
-
|
6517
|
+
"Submit"
|
6518
|
+
))
|
6519
|
+
)
|
6520
|
+
);
|
6521
|
+
};
|
6522
|
+
|
6523
|
+
// blocks/feedback/FeedbackForm.tsx
|
6524
|
+
var import_react49 = __toESM(require("react"));
|
6525
|
+
var import_react_hook_form7 = require("react-hook-form");
|
6526
|
+
var import_zod7 = require("@hookform/resolvers/zod");
|
6527
|
+
var z7 = __toESM(require("zod"));
|
6528
|
+
var FeedbackForm = (props) => {
|
6529
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
6530
|
+
const formSchema = z7.object({
|
6531
|
+
requestType: z7.string({ required_error: (_b = (_a = props.texts) == null ? void 0 : _a.requestType) == null ? void 0 : _b.required }).min(1, { message: (_d = (_c = props.texts) == null ? void 0 : _c.requestType) == null ? void 0 : _d.required }),
|
6532
|
+
description: z7.string({ required_error: (_f = (_e = props.texts) == null ? void 0 : _e.description) == null ? void 0 : _f.required }).min(10, { message: (_h = (_g = props.texts) == null ? void 0 : _g.description) == null ? void 0 : _h.tooShort })
|
6533
|
+
});
|
6534
|
+
const { handleSubmit, control, formState, reset } = (0, import_react_hook_form7.useForm)({
|
6535
|
+
resolver: (0, import_zod7.zodResolver)(formSchema),
|
6536
|
+
defaultValues: { requestType: "", description: "" }
|
6537
|
+
});
|
6538
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
6539
|
+
Card,
|
6540
|
+
{
|
6541
|
+
className: cn(
|
6542
|
+
props.cardless ? "hawa-border-none hawa-bg-transparent hawa-shadow-none" : ""
|
6543
|
+
),
|
6544
|
+
style: props.cardless ? { boxShadow: "none" } : void 0
|
6545
|
+
},
|
6546
|
+
/* @__PURE__ */ import_react49.default.createElement(CardContent, { headless: true, className: props.cardless ? "!hawa-p-0" : "" }, props.sent ? /* @__PURE__ */ import_react49.default.createElement("div", { className: "hawa-text-center hawa-min-h-[200px] hawa-flex hawa-flex-col hawa-justify-center" }, /* @__PURE__ */ import_react49.default.createElement("div", { className: "hawa-font-bold hawa-text-lg" }, props.texts.sentTitle || "Form submitted"), /* @__PURE__ */ import_react49.default.createElement("div", { className: "hawa-text-md" }, props.texts.sentSubtitle || "Thank you for your submission")) : /* @__PURE__ */ import_react49.default.createElement(
|
6547
|
+
"form",
|
6548
|
+
{
|
6549
|
+
noValidate: true,
|
6550
|
+
onSubmit: handleSubmit((e) => {
|
6551
|
+
if (props.onSubmit) {
|
6552
|
+
return props.onSubmit(e);
|
6553
|
+
} else {
|
6554
|
+
console.log("Form is submitted but onSubmit prop is missing");
|
6555
|
+
}
|
6556
|
+
}),
|
6557
|
+
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
6558
|
+
},
|
6559
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
6560
|
+
import_react_hook_form7.Controller,
|
6561
|
+
{
|
6562
|
+
name: "requestType",
|
6563
|
+
control,
|
6564
|
+
render: ({ field }) => {
|
6565
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
6566
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
6567
|
+
Select,
|
6568
|
+
{
|
6569
|
+
...field,
|
6570
|
+
...props.selectProps,
|
6571
|
+
label: (_b2 = (_a2 = props.texts) == null ? void 0 : _a2.requestType) == null ? void 0 : _b2.label,
|
6572
|
+
onChange: (option) => field.onChange(option.value),
|
6573
|
+
options: props.requestTypes,
|
6574
|
+
helperText: (_d2 = (_c2 = formState.errors.requestType) == null ? void 0 : _c2.message) == null ? void 0 : _d2.toString(),
|
6575
|
+
placeholder: (_f2 = (_e2 = props.texts) == null ? void 0 : _e2.requestType) == null ? void 0 : _f2.placeholder,
|
6576
|
+
texts: {
|
6577
|
+
noOptions: (_h2 = (_g2 = props.texts) == null ? void 0 : _g2.requestType) == null ? void 0 : _h2.noOptions
|
6578
|
+
}
|
6579
|
+
}
|
6580
|
+
);
|
6581
|
+
}
|
6582
|
+
}
|
6583
|
+
),
|
6584
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
6585
|
+
import_react_hook_form7.Controller,
|
6586
|
+
{
|
6587
|
+
name: "description",
|
6588
|
+
control,
|
6589
|
+
render: ({ field }) => {
|
6590
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
6591
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
6592
|
+
Textarea,
|
6593
|
+
{
|
6594
|
+
helperText: formState.errors.description && ((_b2 = (_a2 = formState.errors.description) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()),
|
6595
|
+
classNames: { textarea: "hawa-h-full hawa-min-h-20" },
|
6596
|
+
label: (_d2 = (_c2 = props.texts) == null ? void 0 : _c2.description) == null ? void 0 : _d2.label,
|
6597
|
+
textareaProps: {
|
6598
|
+
onChange: (e) => {
|
6599
|
+
field.onChange(e.target.value);
|
6600
|
+
},
|
6601
|
+
value: field.value,
|
6602
|
+
placeholder: (_f2 = (_e2 = props.texts) == null ? void 0 : _e2.description) == null ? void 0 : _f2.placeholder
|
6603
|
+
}
|
6604
|
+
}
|
6605
|
+
);
|
6606
|
+
}
|
6607
|
+
}
|
6608
|
+
),
|
6609
|
+
/* @__PURE__ */ import_react49.default.createElement(Button, { isLoading: props.loadingSubmission, type: "submit" }, (_i = props.texts) == null ? void 0 : _i.submit)
|
6610
|
+
))
|
6611
|
+
);
|
6612
|
+
};
|
6464
6613
|
|
6465
6614
|
// blocks/misc/LegalTexts.tsx
|
6615
|
+
var import_react50 = __toESM(require("react"));
|
6466
6616
|
var LegalTexts = ({ tabs, ...props }) => {
|
6467
6617
|
return /* @__PURE__ */ import_react50.default.createElement(
|
6468
|
-
|
6618
|
+
Tabs,
|
6469
6619
|
{
|
6470
6620
|
value: props.activeTab,
|
6471
6621
|
onValueChange: props.handleTabChange,
|
6472
6622
|
defaultValue: props.defaultTab || tabs[0].value,
|
6473
6623
|
dir: props.direction
|
6474
6624
|
},
|
6475
|
-
/* @__PURE__ */ import_react50.default.createElement(
|
6625
|
+
/* @__PURE__ */ import_react50.default.createElement(TabsList, { className: "hawa-w-full" }, tabs.map((tab, index) => /* @__PURE__ */ import_react50.default.createElement(TabsTrigger, { key: index, value: tab.value }, tab.title))),
|
6476
6626
|
tabs.map((tab, index) => /* @__PURE__ */ import_react50.default.createElement(TabsContent, { key: index, value: tab.value }, /* @__PURE__ */ import_react50.default.createElement(
|
6477
6627
|
ScrollArea,
|
6478
6628
|
{
|