@sikka/hawa 0.23.8-next → 0.23.10-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/DropdownMenu-jh4puuXw.d.ts +95 -0
- package/dist/DropdownMenu-vm2kRAhL.d.mts +95 -0
- package/dist/Radio-2ZwcMDWt.d.ts +74 -0
- package/dist/Radio-5ZANA8Vh.d.mts +74 -0
- package/dist/SimpleTable-EE4ejgUR.d.mts +97 -0
- package/dist/SimpleTable-vY1ziD-2.d.ts +97 -0
- package/dist/Toast-jAb16JQg.d.mts +23 -0
- package/dist/Toast-xcELwcIX.d.ts +23 -0
- package/dist/blocks/auth/index.d.mts +202 -0
- package/dist/blocks/auth/index.d.ts +202 -0
- package/dist/blocks/auth/index.js +4182 -0
- package/dist/blocks/auth/index.mjs +1057 -0
- package/dist/blocks/feedback/index.d.mts +74 -0
- package/dist/blocks/feedback/index.d.ts +74 -0
- package/dist/blocks/feedback/index.js +1531 -0
- package/dist/blocks/feedback/index.mjs +493 -0
- package/dist/blocks/index.d.mts +480 -0
- package/dist/blocks/index.d.ts +480 -0
- package/dist/blocks/index.js +8119 -0
- package/dist/blocks/index.mjs +2535 -0
- package/dist/blocks/misc/index.d.mts +90 -0
- package/dist/blocks/misc/index.d.ts +90 -0
- package/dist/blocks/misc/index.js +1163 -0
- package/dist/blocks/misc/index.mjs +322 -0
- package/dist/blocks/pricing/index.d.mts +93 -0
- package/dist/blocks/pricing/index.d.ts +93 -0
- package/dist/blocks/pricing/index.js +3320 -0
- package/dist/blocks/pricing/index.mjs +2161 -0
- package/dist/chunk-2R2QPJT7.mjs +7519 -0
- package/dist/chunk-343SRWR4.mjs +146 -0
- package/dist/chunk-677VOLD4.mjs +464 -0
- package/dist/chunk-A25EXELT.mjs +131 -0
- package/dist/chunk-F6TKEDDP.mjs +57 -0
- package/dist/chunk-FNVYY7ND.mjs +22 -0
- package/dist/chunk-P2O6R3S6.mjs +268 -0
- package/dist/chunk-QGKW5R5F.mjs +196 -0
- package/dist/chunk-TR56G3NM.mjs +2350 -0
- package/dist/chunk-UAVBFK53.mjs +346 -0
- package/dist/commonTypes-CKtkuNFH.d.mts +11 -0
- package/dist/commonTypes-CKtkuNFH.d.ts +11 -0
- package/dist/commonTypes-MxCJyrHv.d.mts +8 -0
- package/dist/commonTypes-MxCJyrHv.d.ts +8 -0
- package/dist/elements/index.d.mts +715 -0
- package/dist/elements/index.d.ts +715 -0
- package/dist/elements/index.js +7719 -0
- package/dist/elements/index.mjs +285 -0
- package/dist/hooks/index.d.mts +107 -0
- package/dist/hooks/index.d.ts +107 -0
- package/dist/hooks/index.js +451 -0
- package/dist/hooks/index.mjs +254 -0
- package/dist/index.d.mts +1905 -0
- package/dist/index.d.ts +1905 -0
- package/dist/index.js +11987 -0
- package/dist/index.mjs +11760 -0
- package/dist/layout/index.d.mts +249 -0
- package/dist/layout/index.d.ts +249 -0
- package/dist/layout/index.js +4373 -0
- package/dist/layout/index.mjs +1381 -0
- package/dist/textTypes-559CaoOV.d.mts +88 -0
- package/dist/textTypes-559CaoOV.d.ts +88 -0
- package/dist/types/index.d.mts +115 -0
- package/dist/types/index.d.ts +115 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.mjs +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Popover,
|
|
3
|
+
Radio
|
|
4
|
+
} from "../../chunk-P2O6R3S6.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Textarea
|
|
7
|
+
} from "../../chunk-F6TKEDDP.mjs";
|
|
8
|
+
import {
|
|
9
|
+
BadEmoji,
|
|
10
|
+
GoodEmoji,
|
|
11
|
+
Select,
|
|
12
|
+
VeryBadEmoji,
|
|
13
|
+
VeryGoodEmoji
|
|
14
|
+
} from "../../chunk-UAVBFK53.mjs";
|
|
15
|
+
import {
|
|
16
|
+
Button,
|
|
17
|
+
Card,
|
|
18
|
+
CardContent,
|
|
19
|
+
Label,
|
|
20
|
+
cn
|
|
21
|
+
} from "../../chunk-677VOLD4.mjs";
|
|
22
|
+
|
|
23
|
+
// components/blocks/feedback/UserReferralSource.tsx
|
|
24
|
+
import React, { useRef, useState } from "react";
|
|
25
|
+
import { Controller, useForm } from "react-hook-form";
|
|
26
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
27
|
+
import * as z from "zod";
|
|
28
|
+
var UserReferralSource = ({
|
|
29
|
+
position = "bottom-right",
|
|
30
|
+
options = [],
|
|
31
|
+
...props
|
|
32
|
+
}) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const [closed, setClosed] = useState(false);
|
|
35
|
+
const popUpRef = useRef(null);
|
|
36
|
+
const formSchema = z.object({
|
|
37
|
+
source: z.string({ required_error: (_a = props.texts) == null ? void 0 : _a.pleaseSelectOption }),
|
|
38
|
+
feedback: z.string().optional()
|
|
39
|
+
});
|
|
40
|
+
const { handleSubmit, control, formState, watch } = useForm({
|
|
41
|
+
resolver: zodResolver(formSchema)
|
|
42
|
+
});
|
|
43
|
+
const selectedSource = watch("source");
|
|
44
|
+
const boxPosition = {
|
|
45
|
+
"bottom-right": "hawa-right-4",
|
|
46
|
+
"bottom-left": "hawa-left-4"
|
|
47
|
+
};
|
|
48
|
+
const optionsWithOther = [
|
|
49
|
+
...options,
|
|
50
|
+
{
|
|
51
|
+
value: "other",
|
|
52
|
+
label: "Other"
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
return /* @__PURE__ */ React.createElement(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: cn(
|
|
59
|
+
"hawa-transition-all",
|
|
60
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100"
|
|
61
|
+
),
|
|
62
|
+
ref: popUpRef
|
|
63
|
+
},
|
|
64
|
+
/* @__PURE__ */ React.createElement(
|
|
65
|
+
Card,
|
|
66
|
+
{
|
|
67
|
+
className: cn(
|
|
68
|
+
"hawa-fixed hawa-bottom-4 hawa-p-0 ",
|
|
69
|
+
boxPosition[position]
|
|
70
|
+
),
|
|
71
|
+
dir: props.direction
|
|
72
|
+
},
|
|
73
|
+
/* @__PURE__ */ React.createElement(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
type: "button",
|
|
77
|
+
className: cn(
|
|
78
|
+
props.direction === "rtl" ? "hawa-left-2" : "hawa-right-2",
|
|
79
|
+
"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"
|
|
80
|
+
),
|
|
81
|
+
"data-dismiss-target": "#toast-default",
|
|
82
|
+
"aria-label": "Close",
|
|
83
|
+
onClick: () => {
|
|
84
|
+
setClosed(true);
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
if (popUpRef == null ? void 0 : popUpRef.current) {
|
|
87
|
+
popUpRef == null ? void 0 : popUpRef.current.removeChild(popUpRef == null ? void 0 : popUpRef.current.children[0]);
|
|
88
|
+
}
|
|
89
|
+
}, 200);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
/* @__PURE__ */ React.createElement(
|
|
93
|
+
"svg",
|
|
94
|
+
{
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
className: "hawa-h-5 hawa-w-5",
|
|
97
|
+
fill: "currentColor",
|
|
98
|
+
viewBox: "0 0 20 20"
|
|
99
|
+
},
|
|
100
|
+
/* @__PURE__ */ React.createElement(
|
|
101
|
+
"path",
|
|
102
|
+
{
|
|
103
|
+
fillRule: "evenodd",
|
|
104
|
+
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",
|
|
105
|
+
clipRule: "evenodd"
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ React.createElement(CardContent, { headless: true }, /* @__PURE__ */ React.createElement(
|
|
111
|
+
"form",
|
|
112
|
+
{
|
|
113
|
+
noValidate: true,
|
|
114
|
+
onSubmit: handleSubmit((e) => {
|
|
115
|
+
if (props.onSubmitForm) {
|
|
116
|
+
props.onSubmitForm(e);
|
|
117
|
+
} else {
|
|
118
|
+
console.log("onSubmitForm was not provided");
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
},
|
|
122
|
+
/* @__PURE__ */ React.createElement(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: cn(
|
|
126
|
+
"hawa-flex hawa-flex-col hawa-gap-4 hawa-transition-all",
|
|
127
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100"
|
|
128
|
+
)
|
|
129
|
+
},
|
|
130
|
+
/* @__PURE__ */ React.createElement("div", { className: "hawa-mt-4 hawa-font-bold" }, props.question),
|
|
131
|
+
/* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded " }, /* @__PURE__ */ React.createElement(
|
|
132
|
+
Controller,
|
|
133
|
+
{
|
|
134
|
+
control,
|
|
135
|
+
name: "source",
|
|
136
|
+
render: ({ field }) => {
|
|
137
|
+
var _a2, _b2;
|
|
138
|
+
return /* @__PURE__ */ React.createElement(
|
|
139
|
+
Radio,
|
|
140
|
+
{
|
|
141
|
+
direction: props.direction,
|
|
142
|
+
orientation: "vertical",
|
|
143
|
+
options: optionsWithOther,
|
|
144
|
+
defaultValue: field.value,
|
|
145
|
+
onChangeTab: (e) => field.onChange(e.value),
|
|
146
|
+
helperText: (_b2 = (_a2 = formState.errors.source) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
)),
|
|
152
|
+
/* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
153
|
+
Controller,
|
|
154
|
+
{
|
|
155
|
+
control,
|
|
156
|
+
name: "feedback",
|
|
157
|
+
render: ({ field }) => {
|
|
158
|
+
var _a2, _b2;
|
|
159
|
+
return /* @__PURE__ */ React.createElement(
|
|
160
|
+
Textarea,
|
|
161
|
+
{
|
|
162
|
+
...field,
|
|
163
|
+
textareaProps: {
|
|
164
|
+
onChange: (e) => field.onChange(e.target.value),
|
|
165
|
+
disabled: selectedSource !== "other"
|
|
166
|
+
},
|
|
167
|
+
helperText: (_b2 = (_a2 = formState.errors.feedback) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
))
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ React.createElement(Button, { type: "submit", className: "hawa-mt-4 hawa-w-full" }, ((_b = props.texts) == null ? void 0 : _b.submit) || "Submit")
|
|
175
|
+
))
|
|
176
|
+
)
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// components/blocks/feedback/FeedbackRating.tsx
|
|
181
|
+
import React2, { useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
182
|
+
var FeedbackRating = ({
|
|
183
|
+
position = "bottom-right",
|
|
184
|
+
...props
|
|
185
|
+
}) => {
|
|
186
|
+
const [closed, setClosed] = useState2(false);
|
|
187
|
+
const [answered, setAnswered] = useState2(false);
|
|
188
|
+
const [clickedOption, setClickedOption] = useState2(null);
|
|
189
|
+
const [closingTimer, setClosingTimer] = useState2(5);
|
|
190
|
+
const popUpRef = useRef2(null);
|
|
191
|
+
const boxPosition = {
|
|
192
|
+
"bottom-right": "hawa-right-4",
|
|
193
|
+
"bottom-left": "hawa-left-4"
|
|
194
|
+
};
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
const timeoutHide = setTimeout(() => {
|
|
197
|
+
if (closingTimer >= 0) {
|
|
198
|
+
setClosingTimer(closingTimer - 1);
|
|
199
|
+
}
|
|
200
|
+
}, 1e3);
|
|
201
|
+
return () => {
|
|
202
|
+
clearTimeout(timeoutHide);
|
|
203
|
+
};
|
|
204
|
+
}, [closingTimer]);
|
|
205
|
+
const slowClose = () => {
|
|
206
|
+
setClosed(true);
|
|
207
|
+
setTimeout(() => {
|
|
208
|
+
if (popUpRef.current) {
|
|
209
|
+
popUpRef.current.removeChild(popUpRef.current.children[0]);
|
|
210
|
+
}
|
|
211
|
+
}, 200);
|
|
212
|
+
};
|
|
213
|
+
return /* @__PURE__ */ React2.createElement(
|
|
214
|
+
"div",
|
|
215
|
+
{
|
|
216
|
+
ref: popUpRef,
|
|
217
|
+
className: cn(
|
|
218
|
+
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 ",
|
|
219
|
+
boxPosition[position]
|
|
220
|
+
)
|
|
221
|
+
},
|
|
222
|
+
/* @__PURE__ */ React2.createElement(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
className: cn(
|
|
226
|
+
"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",
|
|
227
|
+
closed ? "hawa-opacity-0" : "hawa-opacity-100",
|
|
228
|
+
props.banner && "hawa-rounded-none hawa-px-4 md:hawa-rounded-t md:hawa-px-64"
|
|
229
|
+
)
|
|
230
|
+
},
|
|
231
|
+
/* @__PURE__ */ React2.createElement("div", { className: "hawa-absolute hawa-left-2 hawa-top-2 hawa-p-1.5 hawa-text-sm" }, props.title),
|
|
232
|
+
/* @__PURE__ */ React2.createElement(
|
|
233
|
+
"button",
|
|
234
|
+
{
|
|
235
|
+
type: "button",
|
|
236
|
+
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",
|
|
237
|
+
"data-dismiss-target": "#toast-default",
|
|
238
|
+
"aria-label": "Close",
|
|
239
|
+
onClick: () => slowClose()
|
|
240
|
+
},
|
|
241
|
+
/* @__PURE__ */ React2.createElement(
|
|
242
|
+
"svg",
|
|
243
|
+
{
|
|
244
|
+
"aria-hidden": "true",
|
|
245
|
+
className: "hawa-h-5 hawa-w-5",
|
|
246
|
+
fill: "currentColor",
|
|
247
|
+
viewBox: "0 0 20 20"
|
|
248
|
+
},
|
|
249
|
+
/* @__PURE__ */ React2.createElement(
|
|
250
|
+
"path",
|
|
251
|
+
{
|
|
252
|
+
fillRule: "evenodd",
|
|
253
|
+
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",
|
|
254
|
+
clipRule: "evenodd"
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
)
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ React2.createElement("div", { className: "hawa-mt-8" }, props.question),
|
|
260
|
+
/* @__PURE__ */ React2.createElement("div", { className: "hawa-flex hawa-w-full hawa-flex-row hawa-gap-1 hawa-rounded" }, props.options && props.options.map((op, i) => /* @__PURE__ */ React2.createElement(
|
|
261
|
+
"span",
|
|
262
|
+
{
|
|
263
|
+
key: i,
|
|
264
|
+
onClick: () => {
|
|
265
|
+
if (props.onOptionClicked) {
|
|
266
|
+
props.onOptionClicked(op);
|
|
267
|
+
}
|
|
268
|
+
setClickedOption(op);
|
|
269
|
+
setAnswered(true);
|
|
270
|
+
const timeoutDestroy = setTimeout(() => {
|
|
271
|
+
setClosed(true);
|
|
272
|
+
}, 4800);
|
|
273
|
+
setTimeout(() => {
|
|
274
|
+
var _a, _b;
|
|
275
|
+
(_b = popUpRef.current) == null ? void 0 : _b.removeChild(
|
|
276
|
+
(_a = popUpRef.current) == null ? void 0 : _a.children[0]
|
|
277
|
+
);
|
|
278
|
+
clearTimeout(timeoutDestroy);
|
|
279
|
+
}, 5300);
|
|
280
|
+
},
|
|
281
|
+
className: cn(
|
|
282
|
+
"hawa-w-full hawa-cursor-pointer hawa-rounded hawa-border hawa-p-4 hawa-text-center hawa-transition-all ",
|
|
283
|
+
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"
|
|
284
|
+
)
|
|
285
|
+
},
|
|
286
|
+
op
|
|
287
|
+
))),
|
|
288
|
+
props.texts && /* @__PURE__ */ React2.createElement("div", { className: " hawa-flex hawa-flex-row hawa-justify-between hawa-text-xs" }, /* @__PURE__ */ React2.createElement("span", null, props.texts.least), /* @__PURE__ */ React2.createElement("span", null, props.texts.most)),
|
|
289
|
+
answered && /* @__PURE__ */ React2.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__ */ React2.createElement("span", { className: "hawa-font-bold hawa-text-white" }, "Thank you for your answer. This box will disappear in", " " + closingTimer, " seconds"), /* @__PURE__ */ React2.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-2" }, /* @__PURE__ */ React2.createElement(Button, { variant: "secondary", onClick: () => slowClose() }, "Close")))
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// components/blocks/feedback/FeedbackEmoji.tsx
|
|
295
|
+
import React3, { useState as useState3 } from "react";
|
|
296
|
+
var FeedbackEmoji = (props) => {
|
|
297
|
+
const [selectedEmoji, setSelectedEmoji] = useState3(null);
|
|
298
|
+
const [loadingSubmit, setLoadingSubmit] = useState3(false);
|
|
299
|
+
const [feedbackText, setFeedbackText] = useState3("");
|
|
300
|
+
const [helperText, setHelperText] = useState3(false);
|
|
301
|
+
let emojis = [
|
|
302
|
+
{ icon: /* @__PURE__ */ React3.createElement(VeryGoodEmoji, null), value: "very-good" },
|
|
303
|
+
{ icon: /* @__PURE__ */ React3.createElement(GoodEmoji, null), value: "good" },
|
|
304
|
+
{ icon: /* @__PURE__ */ React3.createElement(BadEmoji, null), value: "bad" },
|
|
305
|
+
{ icon: /* @__PURE__ */ React3.createElement(VeryBadEmoji, null), value: "very-bad" }
|
|
306
|
+
];
|
|
307
|
+
const onFeedbackSubmit = async () => {
|
|
308
|
+
if (feedbackText) {
|
|
309
|
+
setLoadingSubmit(true);
|
|
310
|
+
try {
|
|
311
|
+
await props.handleSubmit({
|
|
312
|
+
choice: selectedEmoji,
|
|
313
|
+
feedback: feedbackText
|
|
314
|
+
});
|
|
315
|
+
} catch (error) {
|
|
316
|
+
console.error("Error during submission:", error);
|
|
317
|
+
setLoadingSubmit(false);
|
|
318
|
+
}
|
|
319
|
+
await setLoadingSubmit(false);
|
|
320
|
+
} else {
|
|
321
|
+
setLoadingSubmit(false);
|
|
322
|
+
setHelperText(true);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
return /* @__PURE__ */ React3.createElement(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
className: cn(
|
|
329
|
+
"hawa-flex hawa-flex-col hawa-rounded hawa-border hawa-p-2 hawa-transition-all",
|
|
330
|
+
selectedEmoji ? "hawa-h-[189px] hawa-min-w-fit" : "hawa-h-[44px] "
|
|
331
|
+
)
|
|
332
|
+
},
|
|
333
|
+
/* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 " }, /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-0.5 " }, emojis.map((emoji, i) => /* @__PURE__ */ React3.createElement(
|
|
334
|
+
Button,
|
|
335
|
+
{
|
|
336
|
+
key: i,
|
|
337
|
+
onClick: () => {
|
|
338
|
+
if (selectedEmoji === emoji.value) {
|
|
339
|
+
setSelectedEmoji("");
|
|
340
|
+
} else {
|
|
341
|
+
setSelectedEmoji(emoji.value);
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
variant: "ghost",
|
|
345
|
+
size: "smallIcon",
|
|
346
|
+
className: cn(
|
|
347
|
+
selectedEmoji === emoji.value ? "hawa-bg-primary/10 hover:hawa-bg-primary/10 " : "hawa-text-[#666666]"
|
|
348
|
+
)
|
|
349
|
+
},
|
|
350
|
+
emoji.icon
|
|
351
|
+
)))),
|
|
352
|
+
/* @__PURE__ */ React3.createElement(
|
|
353
|
+
"div",
|
|
354
|
+
{
|
|
355
|
+
className: cn(
|
|
356
|
+
"hawa-flex hawa-flex-col hawa-overflow-clip hawa-transition-all hawa-duration-500 hawa-ease-in-out ",
|
|
357
|
+
selectedEmoji ? "hawa-visible hawa-opacity-100" : "hawa-invisible hawa-opacity-0 "
|
|
358
|
+
)
|
|
359
|
+
},
|
|
360
|
+
props.showSuccess ? /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-h-full hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-pt-4" }, /* @__PURE__ */ React3.createElement("div", { className: "hawa-rounded hawa-bg-primary hawa-p-2 hawa-text-primary-foreground" }, /* @__PURE__ */ React3.createElement(
|
|
361
|
+
"svg",
|
|
362
|
+
{
|
|
363
|
+
stroke: "currentColor",
|
|
364
|
+
fill: "currentColor",
|
|
365
|
+
strokeWidth: "0",
|
|
366
|
+
viewBox: "0 0 512 512",
|
|
367
|
+
height: "0.5em",
|
|
368
|
+
width: "0.5em"
|
|
369
|
+
},
|
|
370
|
+
/* @__PURE__ */ React3.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" })
|
|
371
|
+
)), /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-text-center hawa-text-sm" }, /* @__PURE__ */ React3.createElement("span", null, "Your feedback has been received!"), /* @__PURE__ */ React3.createElement("span", null, "Thank you for your help"))) : /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-1 hawa-p-1" }, /* @__PURE__ */ React3.createElement(
|
|
372
|
+
Popover,
|
|
373
|
+
{
|
|
374
|
+
className: "hawa-select-none hawa-p-1 hawa-text-xs ",
|
|
375
|
+
open: helperText,
|
|
376
|
+
trigger: /* @__PURE__ */ React3.createElement(
|
|
377
|
+
Textarea,
|
|
378
|
+
{
|
|
379
|
+
className: cn("hawa-mt-2 hawa-h-full hawa-resize-none"),
|
|
380
|
+
placeholder: "Your feedback",
|
|
381
|
+
onChange: (e) => {
|
|
382
|
+
if (e.target.value) {
|
|
383
|
+
setHelperText(false);
|
|
384
|
+
}
|
|
385
|
+
setFeedbackText(e.target.value);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
},
|
|
390
|
+
/* @__PURE__ */ React3.createElement("span", { className: "hawa-m-0" }, "Please enter your feedback")
|
|
391
|
+
), /* @__PURE__ */ React3.createElement(
|
|
392
|
+
Button,
|
|
393
|
+
{
|
|
394
|
+
isLoading: loadingSubmit,
|
|
395
|
+
onClick: onFeedbackSubmit,
|
|
396
|
+
className: "hawa-w-full",
|
|
397
|
+
size: "sm"
|
|
398
|
+
},
|
|
399
|
+
"Submit"
|
|
400
|
+
))
|
|
401
|
+
)
|
|
402
|
+
);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// components/blocks/feedback/FeedbackForm.tsx
|
|
406
|
+
import React4 from "react";
|
|
407
|
+
import { useForm as useForm2, Controller as Controller2 } from "react-hook-form";
|
|
408
|
+
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
|
409
|
+
import * as z2 from "zod";
|
|
410
|
+
var FeedbackForm = (props) => {
|
|
411
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
412
|
+
const formSchema = z2.object({
|
|
413
|
+
requestType: z2.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 }),
|
|
414
|
+
description: z2.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 })
|
|
415
|
+
});
|
|
416
|
+
const { handleSubmit, control, formState } = useForm2({
|
|
417
|
+
resolver: zodResolver2(formSchema)
|
|
418
|
+
});
|
|
419
|
+
return /* @__PURE__ */ React4.createElement(
|
|
420
|
+
Card,
|
|
421
|
+
{
|
|
422
|
+
className: cn(
|
|
423
|
+
props.cardless ? "hawa-border-none hawa-bg-transparent hawa-shadow-none" : ""
|
|
424
|
+
),
|
|
425
|
+
style: props.cardless ? { boxShadow: "none" } : void 0
|
|
426
|
+
},
|
|
427
|
+
/* @__PURE__ */ React4.createElement(CardContent, { headless: true }, /* @__PURE__ */ React4.createElement(
|
|
428
|
+
"form",
|
|
429
|
+
{
|
|
430
|
+
noValidate: true,
|
|
431
|
+
onSubmit: handleSubmit((e) => {
|
|
432
|
+
if (props.onSubmit) {
|
|
433
|
+
return props.onSubmit(e);
|
|
434
|
+
} else {
|
|
435
|
+
console.log("Form is submitted but onSubmit prop is missing");
|
|
436
|
+
}
|
|
437
|
+
}),
|
|
438
|
+
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
|
439
|
+
},
|
|
440
|
+
/* @__PURE__ */ React4.createElement(Label, null, (_j = (_i = props.texts) == null ? void 0 : _i.requestType) == null ? void 0 : _j.label),
|
|
441
|
+
/* @__PURE__ */ React4.createElement(
|
|
442
|
+
Controller2,
|
|
443
|
+
{
|
|
444
|
+
name: "requestType",
|
|
445
|
+
control,
|
|
446
|
+
render: ({ field }) => {
|
|
447
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
448
|
+
return /* @__PURE__ */ React4.createElement(
|
|
449
|
+
Select,
|
|
450
|
+
{
|
|
451
|
+
...field,
|
|
452
|
+
...props.selectProps,
|
|
453
|
+
onChange: (option) => field.onChange(option.value),
|
|
454
|
+
options: props.requestTypes,
|
|
455
|
+
helperText: (_b2 = (_a2 = formState.errors.requestType) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
|
456
|
+
placeholder: (_d2 = (_c2 = props.texts) == null ? void 0 : _c2.requestType) == null ? void 0 : _d2.placeholder,
|
|
457
|
+
texts: {
|
|
458
|
+
noOptions: (_f2 = (_e2 = props.texts) == null ? void 0 : _e2.requestType) == null ? void 0 : _f2.noOptions
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
/* @__PURE__ */ React4.createElement(Label, null, (_l = (_k = props.texts) == null ? void 0 : _k.description) == null ? void 0 : _l.label),
|
|
466
|
+
/* @__PURE__ */ React4.createElement(
|
|
467
|
+
Controller2,
|
|
468
|
+
{
|
|
469
|
+
name: "description",
|
|
470
|
+
control,
|
|
471
|
+
render: ({ field }) => {
|
|
472
|
+
var _a2, _b2, _c2, _d2;
|
|
473
|
+
return /* @__PURE__ */ React4.createElement(
|
|
474
|
+
Textarea,
|
|
475
|
+
{
|
|
476
|
+
...field,
|
|
477
|
+
helperText: formState.errors.description && ((_b2 = (_a2 = formState.errors.description) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()),
|
|
478
|
+
placeholder: (_d2 = (_c2 = props.texts) == null ? void 0 : _c2.description) == null ? void 0 : _d2.placeholder
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
/* @__PURE__ */ React4.createElement(Button, { type: "submit" }, (_m = props.texts) == null ? void 0 : _m.submit)
|
|
485
|
+
))
|
|
486
|
+
);
|
|
487
|
+
};
|
|
488
|
+
export {
|
|
489
|
+
FeedbackEmoji,
|
|
490
|
+
FeedbackForm,
|
|
491
|
+
FeedbackRating,
|
|
492
|
+
UserReferralSource
|
|
493
|
+
};
|