@mahatisystems/mahati-ui-components 6.0.2 → 6.1.0
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/index.css +20 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +53 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.mjs
CHANGED
|
@@ -13122,7 +13122,7 @@ var MahatiNotificationCard = function MahatiNotificationCard(param) {
|
|
|
13122
13122
|
};
|
|
13123
13123
|
// src/components/AdvancedFeedbackModal.tsx
|
|
13124
13124
|
import { useEffect as useEffect16, useState as useState19 } from "react";
|
|
13125
|
-
import { CheckCircle2, Angry, Frown, Meh, Smile, Laugh } from "lucide-react";
|
|
13125
|
+
import { CheckCircle2, Angry, Frown, Meh, Smile, Laugh, ArrowLeft } from "lucide-react";
|
|
13126
13126
|
import { Fragment as Fragment13, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
13127
13127
|
var ratings = [
|
|
13128
13128
|
{
|
|
@@ -13162,7 +13162,7 @@ var ratings = [
|
|
|
13162
13162
|
}
|
|
13163
13163
|
];
|
|
13164
13164
|
function AdvancedFeedbackModal(param) {
|
|
13165
|
-
var isOpen = param.isOpen, onClose = param.onClose, onSubmit = param.onSubmit, _param_maxChars = param.maxChars, maxChars = _param_maxChars === void 0 ? 200 : _param_maxChars, _param_title = param.title, title = _param_title === void 0 ? "Share Your Feedback" : _param_title, _param_ratingType = param.ratingType, ratingType = _param_ratingType === void 0 ? "emoji" : _param_ratingType, _param_optionalRating = param.optionalRating, optionalRating = _param_optionalRating === void 0 ? false : _param_optionalRating;
|
|
13165
|
+
var isOpen = param.isOpen, onClose = param.onClose, onSubmit = param.onSubmit, _param_maxChars = param.maxChars, maxChars = _param_maxChars === void 0 ? 200 : _param_maxChars, _param_title = param.title, title = _param_title === void 0 ? "Share Your Feedback" : _param_title, _param_ratingType = param.ratingType, ratingType = _param_ratingType === void 0 ? "emoji" : _param_ratingType, _param_optionalRating = param.optionalRating, optionalRating = _param_optionalRating === void 0 ? false : _param_optionalRating, sessionData = param.sessionData;
|
|
13166
13166
|
var _useState19 = _sliced_to_array(useState19("rating"), 2), step = _useState19[0], setStep = _useState19[1];
|
|
13167
13167
|
var _useState191 = _sliced_to_array(useState19(null), 2), rating = _useState191[0], setRating = _useState191[1];
|
|
13168
13168
|
var _useState192 = _sliced_to_array(useState19(""), 2), message = _useState192[0], setMessage = _useState192[1];
|
|
@@ -13170,11 +13170,12 @@ function AdvancedFeedbackModal(param) {
|
|
|
13170
13170
|
var _useState194 = _sliced_to_array(useState19(false), 2), showForm = _useState194[0], setShowForm = _useState194[1];
|
|
13171
13171
|
var _useState195 = _sliced_to_array(useState19(null), 2), emojiRating = _useState195[0], setEmojiRating = _useState195[1];
|
|
13172
13172
|
var remaining = maxChars - message.length;
|
|
13173
|
-
var isValid = optionalRating ? message.trim().length > 0 : rating !== null && message.trim().length > 0;
|
|
13173
|
+
var isValid = optionalRating ? message.trim().length > 0 : (rating !== null || emojiRating !== null) && message.trim().length > 0;
|
|
13174
13174
|
var handleSubmit = function handleSubmit() {
|
|
13175
|
-
|
|
13175
|
+
var _ref;
|
|
13176
|
+
if (!optionalRating && !(rating || emojiRating)) return;
|
|
13176
13177
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit({
|
|
13177
|
-
rating: rating !== null && rating !== void 0 ? rating : 0,
|
|
13178
|
+
rating: (_ref = rating !== null && rating !== void 0 ? rating : emojiRating) !== null && _ref !== void 0 ? _ref : 0,
|
|
13178
13179
|
feedback: message
|
|
13179
13180
|
});
|
|
13180
13181
|
setStep("success");
|
|
@@ -13182,6 +13183,9 @@ function AdvancedFeedbackModal(param) {
|
|
|
13182
13183
|
var resetAndClose = function resetAndClose() {
|
|
13183
13184
|
setStep("rating");
|
|
13184
13185
|
setRating(null);
|
|
13186
|
+
setEmojiRating(null);
|
|
13187
|
+
setShowConfirm(false);
|
|
13188
|
+
setShowForm(false);
|
|
13185
13189
|
setMessage("");
|
|
13186
13190
|
onClose();
|
|
13187
13191
|
};
|
|
@@ -13230,6 +13234,25 @@ function AdvancedFeedbackModal(param) {
|
|
|
13230
13234
|
className: "absolute top-4 right-4 text-gray-500 hover:text-black z-10",
|
|
13231
13235
|
children: "\u2715"
|
|
13232
13236
|
}),
|
|
13237
|
+
step !== "rating" && step !== "success" && /* @__PURE__ */ jsx34("button", {
|
|
13238
|
+
onClick: function onClick() {
|
|
13239
|
+
if (step === "form") {
|
|
13240
|
+
setStep("confirm");
|
|
13241
|
+
setShowForm(false);
|
|
13242
|
+
} else if (step === "confirm") {
|
|
13243
|
+
setStep("emoji");
|
|
13244
|
+
setShowConfirm(false);
|
|
13245
|
+
} else if (step === "emoji") {
|
|
13246
|
+
setStep("rating");
|
|
13247
|
+
setEmojiRating(null);
|
|
13248
|
+
setRating(null);
|
|
13249
|
+
}
|
|
13250
|
+
},
|
|
13251
|
+
className: "absolute top-4 left-4 text-gray-500 hover:text-black z-10",
|
|
13252
|
+
children: /* @__PURE__ */ jsx34(ArrowLeft, {
|
|
13253
|
+
size: 20
|
|
13254
|
+
})
|
|
13255
|
+
}),
|
|
13233
13256
|
/* @__PURE__ */ jsx34("div", {
|
|
13234
13257
|
className: "absolute -top-20 -left-20 w-60 h-60 bg-[#1761a3]/20 rounded-full blur-3xl"
|
|
13235
13258
|
}),
|
|
@@ -13237,7 +13260,7 @@ function AdvancedFeedbackModal(param) {
|
|
|
13237
13260
|
className: "absolute -bottom-20 -right-20 w-60 h-60 bg-[#1761a3]/20 rounded-full blur-3xl"
|
|
13238
13261
|
}),
|
|
13239
13262
|
/* @__PURE__ */ jsxs29("div", {
|
|
13240
|
-
className: "relative p-6 md:p-8 min-h-[350px] flex flex-col justify-
|
|
13263
|
+
className: "relative p-6 md:p-8 min-h-[350px] flex flex-col justify-center",
|
|
13241
13264
|
children: [
|
|
13242
13265
|
step !== "success" && /* @__PURE__ */ jsxs29(Fragment13, {
|
|
13243
13266
|
children: [
|
|
@@ -13270,6 +13293,7 @@ function AdvancedFeedbackModal(param) {
|
|
|
13270
13293
|
return /* @__PURE__ */ jsx34("button", {
|
|
13271
13294
|
onClick: function onClick() {
|
|
13272
13295
|
setRating(star);
|
|
13296
|
+
setStep("emoji");
|
|
13273
13297
|
},
|
|
13274
13298
|
className: "transition-transform hover:scale-110",
|
|
13275
13299
|
children: /* @__PURE__ */ jsx34("div", {
|
|
@@ -13290,6 +13314,7 @@ function AdvancedFeedbackModal(param) {
|
|
|
13290
13314
|
onClick: function onClick() {
|
|
13291
13315
|
setEmojiRating(item.id);
|
|
13292
13316
|
setShowConfirm(true);
|
|
13317
|
+
setStep("confirm");
|
|
13293
13318
|
},
|
|
13294
13319
|
className: "flex flex-col items-center gap-1 flex-1 py-3 rounded-xl transition-all duration-300\n ".concat(isActive ? "bg-gradient-to-r from-[#16a34a] to-[#1761a3] text-white scale-105 shadow-md" : "text-gray-500 hover:bg-mahati-light"),
|
|
13295
13320
|
children: [
|
|
@@ -13319,7 +13344,8 @@ function AdvancedFeedbackModal(param) {
|
|
|
13319
13344
|
children: [
|
|
13320
13345
|
/* @__PURE__ */ jsx34("button", {
|
|
13321
13346
|
onClick: function onClick() {
|
|
13322
|
-
|
|
13347
|
+
setShowForm(true);
|
|
13348
|
+
setStep("form");
|
|
13323
13349
|
},
|
|
13324
13350
|
className: "px-6 py-2 rounded-xl text-white bg-gradient-to-r from-[#16a34a] to-[#1761a3]",
|
|
13325
13351
|
children: "Yes"
|
|
@@ -13337,6 +13363,27 @@ function AdvancedFeedbackModal(param) {
|
|
|
13337
13363
|
}),
|
|
13338
13364
|
showForm && /* @__PURE__ */ jsxs29(Fragment13, {
|
|
13339
13365
|
children: [
|
|
13366
|
+
sessionData && sessionData.length > 0 && /* @__PURE__ */ jsx34("div", {
|
|
13367
|
+
className: "w-full mt-3 mb-3 rounded-xl p-[1px]\r\n bg-gradient-to-r from-[#16a34a]/40 via-transparent to-[#1761a3]/40",
|
|
13368
|
+
children: /* @__PURE__ */ jsx34("div", {
|
|
13369
|
+
className: "rounded-xl bg-white/70 backdrop-blur-md\r\n border border-white/30 p-4 text-sm text-gray-800",
|
|
13370
|
+
children: sessionData.map(function(item, index) {
|
|
13371
|
+
return item.value && /* @__PURE__ */ jsxs29("p", {
|
|
13372
|
+
children: [
|
|
13373
|
+
/* @__PURE__ */ jsxs29("span", {
|
|
13374
|
+
className: "font-semibold text-[#0f2a44]",
|
|
13375
|
+
children: [
|
|
13376
|
+
item.label,
|
|
13377
|
+
":"
|
|
13378
|
+
]
|
|
13379
|
+
}),
|
|
13380
|
+
" ",
|
|
13381
|
+
item.value
|
|
13382
|
+
]
|
|
13383
|
+
}, index);
|
|
13384
|
+
})
|
|
13385
|
+
})
|
|
13386
|
+
}),
|
|
13340
13387
|
/* @__PURE__ */ jsx34("textarea", {
|
|
13341
13388
|
value: message,
|
|
13342
13389
|
onChange: function onChange(e) {
|