@mahatisystems/mahati-ui-components 1.2.1 → 1.3.2
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/check-mark_1-6GNY6HFY.png +0 -0
- package/dist/check-mark_2-YWM2KQA2.png +0 -0
- package/dist/close-EEDOIEDC.png +0 -0
- package/dist/close_copy_1-PFFNUORV.png +0 -0
- package/dist/danger_1-LUIFNS2J.png +0 -0
- package/dist/danger_1_1-PHLDGYEA.png +0 -0
- package/dist/danger_2-YTNTGWQA.png +0 -0
- package/dist/index.css +301 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +628 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +627 -106
- package/dist/index.mjs.map +1 -1
- package/dist/notification_1-K2I7DVDH.png +0 -0
- package/dist/notification_2-KFI6MN7T.png +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -154,6 +154,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
154
154
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
155
155
|
var __getProtoOf = Object.getPrototypeOf;
|
|
156
156
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
157
|
+
var __commonJS = function(cb, mod) {
|
|
158
|
+
return function __require() {
|
|
159
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
|
|
160
|
+
exports: {}
|
|
161
|
+
}).exports, mod), mod.exports;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
157
164
|
var __export = function(target, all) {
|
|
158
165
|
for(var name in all)__defProp(target, name, {
|
|
159
166
|
get: all[name],
|
|
@@ -206,6 +213,60 @@ var __toCommonJS = function(mod) {
|
|
|
206
213
|
value: true
|
|
207
214
|
}), mod);
|
|
208
215
|
};
|
|
216
|
+
// src/assets/icons/check-mark_1.png
|
|
217
|
+
var require_check_mark_1 = __commonJS({
|
|
218
|
+
"src/assets/icons/check-mark_1.png": function(exports2, module2) {
|
|
219
|
+
module2.exports = "./check-mark_1-6GNY6HFY.png";
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
// src/assets/icons/check-mark_2.png
|
|
223
|
+
var require_check_mark_2 = __commonJS({
|
|
224
|
+
"src/assets/icons/check-mark_2.png": function(exports2, module2) {
|
|
225
|
+
module2.exports = "./check-mark_2-YWM2KQA2.png";
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
// src/assets/icons/danger_1.png
|
|
229
|
+
var require_danger_1 = __commonJS({
|
|
230
|
+
"src/assets/icons/danger_1.png": function(exports2, module2) {
|
|
231
|
+
module2.exports = "./danger_1-LUIFNS2J.png";
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
// src/assets/icons/danger_2.png
|
|
235
|
+
var require_danger_2 = __commonJS({
|
|
236
|
+
"src/assets/icons/danger_2.png": function(exports2, module2) {
|
|
237
|
+
module2.exports = "./danger_2-YTNTGWQA.png";
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
// src/assets/icons/danger_1_1.png
|
|
241
|
+
var require_danger_1_1 = __commonJS({
|
|
242
|
+
"src/assets/icons/danger_1_1.png": function(exports2, module2) {
|
|
243
|
+
module2.exports = "./danger_1_1-PHLDGYEA.png";
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
// src/assets/icons/notification_1.png
|
|
247
|
+
var require_notification_1 = __commonJS({
|
|
248
|
+
"src/assets/icons/notification_1.png": function(exports2, module2) {
|
|
249
|
+
module2.exports = "./notification_1-K2I7DVDH.png";
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
// src/assets/icons/notification_2.png
|
|
253
|
+
var require_notification_2 = __commonJS({
|
|
254
|
+
"src/assets/icons/notification_2.png": function(exports2, module2) {
|
|
255
|
+
module2.exports = "./notification_2-KFI6MN7T.png";
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
// src/assets/icons/close.png
|
|
259
|
+
var require_close = __commonJS({
|
|
260
|
+
"src/assets/icons/close.png": function(exports2, module2) {
|
|
261
|
+
module2.exports = "./close-EEDOIEDC.png";
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
// src/assets/icons/close_copy_1.png
|
|
265
|
+
var require_close_copy_1 = __commonJS({
|
|
266
|
+
"src/assets/icons/close_copy_1.png": function(exports2, module2) {
|
|
267
|
+
module2.exports = "./close_copy_1-PFFNUORV.png";
|
|
268
|
+
}
|
|
269
|
+
});
|
|
209
270
|
// src/index.ts
|
|
210
271
|
var index_exports = {};
|
|
211
272
|
__export(index_exports, {
|
|
@@ -257,6 +318,9 @@ __export(index_exports, {
|
|
|
257
318
|
MahatiTableTailwind: function() {
|
|
258
319
|
return Table2;
|
|
259
320
|
},
|
|
321
|
+
MahatiToastMessage: function() {
|
|
322
|
+
return ToastMessage;
|
|
323
|
+
},
|
|
260
324
|
MahatiTooltip: function() {
|
|
261
325
|
return Tooltip;
|
|
262
326
|
}
|
|
@@ -3005,8 +3069,318 @@ var Calendar = function(param) {
|
|
|
3005
3069
|
})), isOpen && calendarContent);
|
|
3006
3070
|
};
|
|
3007
3071
|
Calendar.displayName = "Calendar";
|
|
3008
|
-
// src/components/
|
|
3072
|
+
// src/components/ToastMessage.tsx
|
|
3009
3073
|
var import_react12 = __toESM(require("react"));
|
|
3074
|
+
var cn5 = function() {
|
|
3075
|
+
for(var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++){
|
|
3076
|
+
values[_key] = arguments[_key];
|
|
3077
|
+
}
|
|
3078
|
+
return values.filter(Boolean).join(" ");
|
|
3079
|
+
};
|
|
3080
|
+
var cnArr = function(values) {
|
|
3081
|
+
return values.filter(Boolean).join(" ");
|
|
3082
|
+
};
|
|
3083
|
+
var assetSrc = function(m) {
|
|
3084
|
+
if (typeof m === "string") return m;
|
|
3085
|
+
var anyM = m;
|
|
3086
|
+
if (typeof (anyM === null || anyM === void 0 ? void 0 : anyM.src) === "string") return anyM.src;
|
|
3087
|
+
var d = anyM === null || anyM === void 0 ? void 0 : anyM.default;
|
|
3088
|
+
if (typeof d === "string") return d;
|
|
3089
|
+
if (typeof (d === null || d === void 0 ? void 0 : d.src) === "string") return d.src;
|
|
3090
|
+
return "";
|
|
3091
|
+
};
|
|
3092
|
+
var checkMarkSolid = require_check_mark_1();
|
|
3093
|
+
var checkMarkTransparent = require_check_mark_2();
|
|
3094
|
+
var dangerSolid = require_danger_1();
|
|
3095
|
+
var dangerTransparent = require_danger_2();
|
|
3096
|
+
var warningTransparent = require_danger_1_1();
|
|
3097
|
+
var notificationSolid = require_notification_1();
|
|
3098
|
+
var notificationTransparent = require_notification_2();
|
|
3099
|
+
var closeSolid = require_close();
|
|
3100
|
+
var closeTransparent = require_close_copy_1();
|
|
3101
|
+
var presetFor = function(type) {
|
|
3102
|
+
var commonContainer = "w-[min(92vw,420px)] md:w-[325px] rounded-[12px] shadow-[0_4px_12px_0_rgba(0,0,0,0.08)]";
|
|
3103
|
+
switch(type){
|
|
3104
|
+
case "Success":
|
|
3105
|
+
return {
|
|
3106
|
+
container: "".concat(commonContainer, " h-[70px]"),
|
|
3107
|
+
bgSolid: "bg-[linear-gradient(90deg,rgba(40,167,69,1)_0%,rgba(58,208,125,1)_100%)]",
|
|
3108
|
+
stripBg: "bg-[linear-gradient(90deg,rgba(40,167,69,1)_22.5%,rgba(58,208,125,1)_130%)]",
|
|
3109
|
+
stripTitleColor: "text-[rgba(40,167,69,1)]"
|
|
3110
|
+
};
|
|
3111
|
+
case "Error":
|
|
3112
|
+
return {
|
|
3113
|
+
container: "".concat(commonContainer, " h-[70px]"),
|
|
3114
|
+
bgSolid: "bg-[linear-gradient(90deg,rgba(220,53,69,1)_0%,rgba(183,28,28,1)_100%)]",
|
|
3115
|
+
stripBg: "bg-[linear-gradient(90deg,rgba(220,53,69,1)_22.5%,rgba(183,28,28,1)_130%)]",
|
|
3116
|
+
stripTitleColor: "text-[rgba(220,53,69,1)]"
|
|
3117
|
+
};
|
|
3118
|
+
case "Warning":
|
|
3119
|
+
return {
|
|
3120
|
+
container: "".concat(commonContainer, " h-[70px]"),
|
|
3121
|
+
bgSolid: "bg-[linear-gradient(90deg,rgba(245,158,11,1)_0%,rgba(255,191,92,1)_100%)]",
|
|
3122
|
+
stripBg: "bg-[linear-gradient(90deg,rgba(245,158,11,1)_22.5%,rgba(255,191,92,1)_130%)]",
|
|
3123
|
+
stripTitleColor: "text-[rgba(245,158,11,1)]"
|
|
3124
|
+
};
|
|
3125
|
+
case "Notification":
|
|
3126
|
+
return {
|
|
3127
|
+
container: "".concat(commonContainer, " h-[70px]"),
|
|
3128
|
+
bgSolid: "bg-[linear-gradient(90deg,rgba(23,97,163,1)_0%,rgba(77,175,131,1)_100%)]",
|
|
3129
|
+
stripBg: "bg-[linear-gradient(90deg,rgba(23,97,163,1)_22.5%,rgba(77,175,131,1)_130%)]",
|
|
3130
|
+
stripTitleColor: "text-[rgba(23,97,163,1)]"
|
|
3131
|
+
};
|
|
3132
|
+
case "LiquidUI":
|
|
3133
|
+
return {
|
|
3134
|
+
container: "".concat(commonContainer, " h-[70px]"),
|
|
3135
|
+
bgSolid: "bg-[linear-gradient(90deg,rgba(16,185,129,1)_0%,rgba(59,130,246,1)_100%)]",
|
|
3136
|
+
stripBg: "bg-[linear-gradient(90deg,rgba(16,185,129,1)_22.5%,rgba(59,130,246,1)_130%)]",
|
|
3137
|
+
stripTitleColor: "text-[rgba(16,185,129,1)]"
|
|
3138
|
+
};
|
|
3139
|
+
case "Action":
|
|
3140
|
+
return {
|
|
3141
|
+
container: "".concat(commonContainer, " h-[110px]"),
|
|
3142
|
+
bgSolid: "bg-[linear-gradient(90deg,rgba(139,92,246,1)_0%,rgba(168,85,247,1)_100%)]",
|
|
3143
|
+
stripBg: "bg-[linear-gradient(90deg,rgba(139,92,246,1)_22.5%,rgba(168,85,247,1)_130%)]",
|
|
3144
|
+
stripTitleColor: "text-[rgba(139,92,246,1)]"
|
|
3145
|
+
};
|
|
3146
|
+
default:
|
|
3147
|
+
return {
|
|
3148
|
+
container: "".concat(commonContainer, " h-[70px]"),
|
|
3149
|
+
bgSolid: "bg-[linear-gradient(90deg,rgba(245,158,11,1)_0%,rgba(255,191,92,1)_100%)]",
|
|
3150
|
+
stripBg: "bg-[linear-gradient(90deg,rgba(245,158,11,1)_22.5%,rgba(255,191,92,1)_130%)]",
|
|
3151
|
+
stripTitleColor: "text-[rgba(245,158,11,1)]"
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
var titleForType = function(type) {
|
|
3156
|
+
switch(type){
|
|
3157
|
+
case "LiquidUI":
|
|
3158
|
+
return "Liquid UI";
|
|
3159
|
+
case "Action":
|
|
3160
|
+
return "Confirmation";
|
|
3161
|
+
default:
|
|
3162
|
+
return type;
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
var iconFor = function(type, background) {
|
|
3166
|
+
var solid = background === "solid";
|
|
3167
|
+
switch(type){
|
|
3168
|
+
case "Success":
|
|
3169
|
+
return assetSrc(solid ? checkMarkSolid : checkMarkTransparent);
|
|
3170
|
+
case "Error":
|
|
3171
|
+
return assetSrc(solid ? dangerSolid : dangerTransparent);
|
|
3172
|
+
case "Warning":
|
|
3173
|
+
return assetSrc(solid ? dangerSolid : warningTransparent);
|
|
3174
|
+
case "Notification":
|
|
3175
|
+
return assetSrc(solid ? notificationSolid : notificationTransparent);
|
|
3176
|
+
case "LiquidUI":
|
|
3177
|
+
return assetSrc(checkMarkSolid);
|
|
3178
|
+
case "Action":
|
|
3179
|
+
return assetSrc(checkMarkSolid);
|
|
3180
|
+
default:
|
|
3181
|
+
return assetSrc(checkMarkSolid);
|
|
3182
|
+
}
|
|
3183
|
+
};
|
|
3184
|
+
var closeIconFor = function(background) {
|
|
3185
|
+
return assetSrc(background === "solid" ? closeSolid : closeTransparent);
|
|
3186
|
+
};
|
|
3187
|
+
var ToastItem = function(param) {
|
|
3188
|
+
var toast = param.toast, onClose = param.onClose;
|
|
3189
|
+
var _toast_actions, _toast_actions1;
|
|
3190
|
+
var _ref = _sliced_to_array((0, import_react12.useState)(false), 2), isExiting = _ref[0], setIsExiting = _ref[1];
|
|
3191
|
+
var _ref1 = _sliced_to_array((0, import_react12.useState)(false), 2), hovered = _ref1[0], setHovered = _ref1[1];
|
|
3192
|
+
var hasActions = !!(toast.actions && toast.actions.length > 0);
|
|
3193
|
+
var preset = (0, import_react12.useMemo)(function() {
|
|
3194
|
+
return presetFor(toast.type);
|
|
3195
|
+
}, [
|
|
3196
|
+
toast.type
|
|
3197
|
+
]);
|
|
3198
|
+
var _toast_background;
|
|
3199
|
+
var background = (_toast_background = toast.background) !== null && _toast_background !== void 0 ? _toast_background : "solid";
|
|
3200
|
+
var _toast_message;
|
|
3201
|
+
var rawMessage = (_toast_message = toast.message) !== null && _toast_message !== void 0 ? _toast_message : "";
|
|
3202
|
+
var hasMessage = rawMessage.trim().length > 0;
|
|
3203
|
+
var handleClose = function() {
|
|
3204
|
+
setIsExiting(true);
|
|
3205
|
+
setTimeout(function() {
|
|
3206
|
+
return onClose(toast.id);
|
|
3207
|
+
}, 300);
|
|
3208
|
+
};
|
|
3209
|
+
var handleAction = function(action) {
|
|
3210
|
+
action === null || action === void 0 ? void 0 : action();
|
|
3211
|
+
handleClose();
|
|
3212
|
+
};
|
|
3213
|
+
(0, import_react12.useEffect)(function() {
|
|
3214
|
+
if (toast.duration && toast.duration > 0 && !hovered && !hasActions) {
|
|
3215
|
+
var t = setTimeout(function() {
|
|
3216
|
+
return handleClose();
|
|
3217
|
+
}, toast.duration);
|
|
3218
|
+
return function() {
|
|
3219
|
+
return clearTimeout(t);
|
|
3220
|
+
};
|
|
3221
|
+
}
|
|
3222
|
+
return;
|
|
3223
|
+
}, [
|
|
3224
|
+
toast.duration,
|
|
3225
|
+
hovered,
|
|
3226
|
+
hasActions
|
|
3227
|
+
]);
|
|
3228
|
+
var titleBottomClass = hasActions ? "bottom-[78px]" : "bottom-[33px]";
|
|
3229
|
+
var messageBottomClass = hasActions ? "bottom-[52px]" : "bottom-[16px]";
|
|
3230
|
+
var containerBgClass = background === "solid" ? preset.bgSolid : "bg-[rgba(255,255,255,1)]";
|
|
3231
|
+
var titleTextClass = background === "transparent" ? preset.stripTitleColor : "text-[rgba(255,255,255,1)]";
|
|
3232
|
+
var messageTextClass = background === "transparent" ? "text-[rgba(0,0,0,1)]" : "text-[rgba(255,255,255,1)]";
|
|
3233
|
+
var _toast_classNames;
|
|
3234
|
+
var slots = (_toast_classNames = toast.classNames) !== null && _toast_classNames !== void 0 ? _toast_classNames : {};
|
|
3235
|
+
var titleRight = "right-[80px] md:right-[140px]";
|
|
3236
|
+
var messageRight = "right-[70px] md:right-[94px]";
|
|
3237
|
+
var closeLeft = "left-[calc(100%-36px)] md:left-[289px]";
|
|
3238
|
+
var baseClass = cnArr([
|
|
3239
|
+
"relative flex overflow-hidden border border-transparent transition-all duration-300",
|
|
3240
|
+
preset.container,
|
|
3241
|
+
containerBgClass,
|
|
3242
|
+
isExiting ? "opacity-0 translate-x-full" : "opacity-100 translate-x-0",
|
|
3243
|
+
slots.base
|
|
3244
|
+
]);
|
|
3245
|
+
var stripClass = cnArr([
|
|
3246
|
+
"absolute top-0 left-[5px] w-[5px] h-full rounded-[20px_0_0_20px]",
|
|
3247
|
+
preset.stripBg,
|
|
3248
|
+
slots.strip
|
|
3249
|
+
]);
|
|
3250
|
+
var iconWrapClass = cnArr([
|
|
3251
|
+
"absolute left-[36px] top-[22px] h-[26px] w-[26px]",
|
|
3252
|
+
slots.icon
|
|
3253
|
+
]);
|
|
3254
|
+
var iconImgClass = "block h-[26px] w-[26px] object-contain";
|
|
3255
|
+
var isTitleCentered = !hasActions && !hasMessage;
|
|
3256
|
+
var titleTopClass = isTitleCentered ? "top-1/2 -translate-y-1/2" : "top-[13px]";
|
|
3257
|
+
var titleClass = cnArr([
|
|
3258
|
+
"absolute left-[80px]",
|
|
3259
|
+
titleTopClass,
|
|
3260
|
+
titleRight,
|
|
3261
|
+
!isTitleCentered && titleBottomClass,
|
|
3262
|
+
'font-["Poppins"] text-[16px] font-[700] leading-none overflow-hidden text-ellipsis whitespace-nowrap',
|
|
3263
|
+
titleTextClass,
|
|
3264
|
+
slots.title
|
|
3265
|
+
]);
|
|
3266
|
+
var messageClass = cnArr([
|
|
3267
|
+
"absolute left-[80px] top-[39px]",
|
|
3268
|
+
messageRight,
|
|
3269
|
+
messageBottomClass,
|
|
3270
|
+
'font-["Poppins"] text-[10px] font-[400] leading-none truncate',
|
|
3271
|
+
messageTextClass,
|
|
3272
|
+
slots.message
|
|
3273
|
+
]);
|
|
3274
|
+
var closeBtnClass = cnArr([
|
|
3275
|
+
"absolute top-[27px] h-[14px] w-[14px]",
|
|
3276
|
+
closeLeft,
|
|
3277
|
+
slots.close
|
|
3278
|
+
]);
|
|
3279
|
+
var actionsWrapClass = cnArr([
|
|
3280
|
+
"absolute left-[80px] right-[12px] md:right-[22px] bottom-[10px] flex flex-wrap gap-2",
|
|
3281
|
+
slots.actions
|
|
3282
|
+
]);
|
|
3283
|
+
var primaryActionClass = cnArr([
|
|
3284
|
+
"inline-flex w-fit whitespace-nowrap items-center justify-center rounded-lg",
|
|
3285
|
+
"bg-[rgba(17,24,39,1)] px-3 py-2 text-[12px] font-[600] text-[rgba(255,255,255,1)] transition-colors hover:bg-[rgba(31,41,55,1)]",
|
|
3286
|
+
slots.primaryAction
|
|
3287
|
+
]);
|
|
3288
|
+
var secondaryActionClass = cnArr([
|
|
3289
|
+
"inline-flex w-fit whitespace-nowrap items-center justify-center rounded-lg",
|
|
3290
|
+
"border border-[rgba(255,255,255,0.6)] bg-[rgba(255,255,255,0.15)] px-3 py-2 text-[12px] font-[600] text-[rgba(255,255,255,1)] transition-colors hover:bg-[rgba(255,255,255,0.22)]",
|
|
3291
|
+
slots.secondaryAction
|
|
3292
|
+
]);
|
|
3293
|
+
var iconSrc = iconFor(toast.type, background);
|
|
3294
|
+
var closeSrc = closeIconFor(background);
|
|
3295
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
3296
|
+
onMouseEnter: function() {
|
|
3297
|
+
return setHovered(true);
|
|
3298
|
+
},
|
|
3299
|
+
onMouseLeave: function() {
|
|
3300
|
+
return setHovered(false);
|
|
3301
|
+
},
|
|
3302
|
+
className: baseClass,
|
|
3303
|
+
role: "status",
|
|
3304
|
+
"aria-live": "polite"
|
|
3305
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
3306
|
+
className: stripClass,
|
|
3307
|
+
"aria-hidden": "true"
|
|
3308
|
+
}), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
3309
|
+
className: iconWrapClass,
|
|
3310
|
+
"aria-hidden": "true"
|
|
3311
|
+
}, /* @__PURE__ */ import_react12.default.createElement("img", {
|
|
3312
|
+
src: iconSrc,
|
|
3313
|
+
alt: "",
|
|
3314
|
+
className: iconImgClass
|
|
3315
|
+
})), /* @__PURE__ */ import_react12.default.createElement("h4", {
|
|
3316
|
+
className: titleClass
|
|
3317
|
+
}, toast.title), hasMessage && /* @__PURE__ */ import_react12.default.createElement("p", {
|
|
3318
|
+
className: messageClass
|
|
3319
|
+
}, rawMessage), !hasActions && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
3320
|
+
onClick: handleClose,
|
|
3321
|
+
className: closeBtnClass,
|
|
3322
|
+
"aria-label": "Close"
|
|
3323
|
+
}, /* @__PURE__ */ import_react12.default.createElement("img", {
|
|
3324
|
+
src: closeSrc,
|
|
3325
|
+
alt: "",
|
|
3326
|
+
className: "block h-[14px] w-[14px] object-contain",
|
|
3327
|
+
"aria-hidden": "true"
|
|
3328
|
+
})), hasActions && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
3329
|
+
className: actionsWrapClass
|
|
3330
|
+
}, ((_toast_actions = toast.actions) === null || _toast_actions === void 0 ? void 0 : _toast_actions[0]) && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
3331
|
+
onClick: function() {
|
|
3332
|
+
var _toast_actions_, _toast_actions;
|
|
3333
|
+
return handleAction((_toast_actions = toast.actions) === null || _toast_actions === void 0 ? void 0 : (_toast_actions_ = _toast_actions[0]) === null || _toast_actions_ === void 0 ? void 0 : _toast_actions_.onClick);
|
|
3334
|
+
},
|
|
3335
|
+
className: primaryActionClass
|
|
3336
|
+
}, toast.actions[0].label), ((_toast_actions1 = toast.actions) === null || _toast_actions1 === void 0 ? void 0 : _toast_actions1[1]) && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
3337
|
+
onClick: function() {
|
|
3338
|
+
var _toast_actions_, _toast_actions;
|
|
3339
|
+
return handleAction((_toast_actions = toast.actions) === null || _toast_actions === void 0 ? void 0 : (_toast_actions_ = _toast_actions[1]) === null || _toast_actions_ === void 0 ? void 0 : _toast_actions_.onClick);
|
|
3340
|
+
},
|
|
3341
|
+
className: secondaryActionClass
|
|
3342
|
+
}, toast.actions[1].label)));
|
|
3343
|
+
};
|
|
3344
|
+
ToastItem.displayName = "ToastItem";
|
|
3345
|
+
var posClass = function(p) {
|
|
3346
|
+
switch(p){
|
|
3347
|
+
case "top-left":
|
|
3348
|
+
return "top-4 left-4";
|
|
3349
|
+
case "top-center":
|
|
3350
|
+
return "top-4 left-1/2 -translate-x-1/2";
|
|
3351
|
+
case "top-right":
|
|
3352
|
+
return "top-4 right-4";
|
|
3353
|
+
case "bottom-left":
|
|
3354
|
+
return "bottom-4 left-4";
|
|
3355
|
+
case "bottom-center":
|
|
3356
|
+
return "bottom-4 left-1/2 -translate-x-1/2";
|
|
3357
|
+
case "bottom-right":
|
|
3358
|
+
return "bottom-4 right-4";
|
|
3359
|
+
default:
|
|
3360
|
+
return "top-4 right-4";
|
|
3361
|
+
}
|
|
3362
|
+
};
|
|
3363
|
+
var ToastMessageBase = function(param) {
|
|
3364
|
+
var toasts = param.toasts, position = param.position, onClose = param.onClose;
|
|
3365
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
3366
|
+
className: cn5("fixed z-[9999] flex flex-col gap-3 pointer-events-none", posClass(position))
|
|
3367
|
+
}, toasts.map(function(t) {
|
|
3368
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
3369
|
+
key: t.id,
|
|
3370
|
+
className: "pointer-events-auto"
|
|
3371
|
+
}, /* @__PURE__ */ import_react12.default.createElement(ToastItem, {
|
|
3372
|
+
toast: t,
|
|
3373
|
+
onClose: onClose
|
|
3374
|
+
}));
|
|
3375
|
+
}));
|
|
3376
|
+
};
|
|
3377
|
+
ToastMessageBase.displayName = "ToastMessage";
|
|
3378
|
+
var ToastMessage = ToastMessageBase;
|
|
3379
|
+
ToastMessage.cn = cn5;
|
|
3380
|
+
ToastMessage.titleForType = titleForType;
|
|
3381
|
+
ToastMessage.displayName = "ToastMessage";
|
|
3382
|
+
// src/components/Dropdown.tsx
|
|
3383
|
+
var import_react13 = __toESM(require("react"));
|
|
3010
3384
|
var variantStyles = {
|
|
3011
3385
|
basic: "bg-blue-600 text-white hover:bg-blue-700",
|
|
3012
3386
|
outline: "border border-black-600 text-blue-600 hover:bg-blue-50",
|
|
@@ -3019,13 +3393,13 @@ var variantStyles = {
|
|
|
3019
3393
|
};
|
|
3020
3394
|
var Dropdown = function(param) {
|
|
3021
3395
|
var options = param.options, value = param.value, onSelect = param.onSelect, _param_variant = param.variant, variant = _param_variant === void 0 ? "basic" : _param_variant, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "Select an option" : _param_placeholder;
|
|
3022
|
-
var _ref = _sliced_to_array((0,
|
|
3023
|
-
var _ref1 = _sliced_to_array((0,
|
|
3024
|
-
var dropdownRef = (0,
|
|
3396
|
+
var _ref = _sliced_to_array((0, import_react13.useState)(false), 2), open = _ref[0], setOpen = _ref[1];
|
|
3397
|
+
var _ref1 = _sliced_to_array((0, import_react13.useState)(null), 2), internalSelected = _ref1[0], setInternalSelected = _ref1[1];
|
|
3398
|
+
var dropdownRef = (0, import_react13.useRef)(null);
|
|
3025
3399
|
var selectedOption = value !== void 0 ? options.find(function(opt) {
|
|
3026
3400
|
return opt.value === value;
|
|
3027
3401
|
}) : internalSelected;
|
|
3028
|
-
(0,
|
|
3402
|
+
(0, import_react13.useEffect)(function() {
|
|
3029
3403
|
var handleClickOutside = function handleClickOutside(event) {
|
|
3030
3404
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
3031
3405
|
setOpen(false);
|
|
@@ -3046,18 +3420,18 @@ var Dropdown = function(param) {
|
|
|
3046
3420
|
onSelect(option.value);
|
|
3047
3421
|
setOpen(false);
|
|
3048
3422
|
};
|
|
3049
|
-
return /* @__PURE__ */
|
|
3423
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
3050
3424
|
ref: dropdownRef,
|
|
3051
3425
|
className: "relative w-56 ".concat(className)
|
|
3052
|
-
}, /* @__PURE__ */
|
|
3426
|
+
}, /* @__PURE__ */ import_react13.default.createElement("button", {
|
|
3053
3427
|
onClick: function() {
|
|
3054
3428
|
return setOpen(!open);
|
|
3055
3429
|
},
|
|
3056
3430
|
className: "w-full text-left px-4 py-2 rounded-md transition-all duration-200 ".concat(variantStyles[variant])
|
|
3057
|
-
}, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.key) || placeholder), open && /* @__PURE__ */
|
|
3431
|
+
}, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.key) || placeholder), open && /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
3058
3432
|
className: "absolute mt-2 w-full bg-white border border-gray-200 rounded-md shadow-lg z-20"
|
|
3059
3433
|
}, options.map(function(opt) {
|
|
3060
|
-
return /* @__PURE__ */
|
|
3434
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
3061
3435
|
key: opt.value,
|
|
3062
3436
|
onClick: function() {
|
|
3063
3437
|
return handleSelect(opt);
|
|
@@ -3068,11 +3442,16 @@ var Dropdown = function(param) {
|
|
|
3068
3442
|
};
|
|
3069
3443
|
Dropdown.displayName = "Dropdown";
|
|
3070
3444
|
// src/components/Filter.tsx
|
|
3071
|
-
var
|
|
3445
|
+
var import_react14 = __toESM(require("react"));
|
|
3072
3446
|
var import_lucide_react3 = require("lucide-react");
|
|
3447
|
+
var import_react_dom = require("react-dom");
|
|
3448
|
+
var fieldStyles = {
|
|
3449
|
+
small: "w-full px-3 py-2 pr-5 bg-white border border-gray-300 rounded-md appearance-none focus:outline-none focus:ring-2 focus:ring-[#1761a3]",
|
|
3450
|
+
medium: "w-full px-4 py-3 pr-6 bg-white border border-slate-300 rounded-md appearance-none focus:outline-none focus:ring-2 focus:ring-[#1761a3]"
|
|
3451
|
+
};
|
|
3073
3452
|
var Filter = function() {
|
|
3074
|
-
var _ref = _sliced_to_array((0,
|
|
3075
|
-
var _ref1 = _sliced_to_array((0,
|
|
3453
|
+
var _ref = _sliced_to_array((0, import_react14.useState)(false), 2), open = _ref[0], setOpen = _ref[1];
|
|
3454
|
+
var _ref1 = _sliced_to_array((0, import_react14.useState)({
|
|
3076
3455
|
date: {
|
|
3077
3456
|
start: null,
|
|
3078
3457
|
end: null
|
|
@@ -3117,9 +3496,9 @@ var Filter = function() {
|
|
|
3117
3496
|
console.log("Applied Filters:", values);
|
|
3118
3497
|
setOpen(false);
|
|
3119
3498
|
};
|
|
3120
|
-
return /* @__PURE__ */
|
|
3499
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3121
3500
|
className: "relative"
|
|
3122
|
-
}, /* @__PURE__ */
|
|
3501
|
+
}, /* @__PURE__ */ import_react14.default.createElement(Button, {
|
|
3123
3502
|
variant: "outline",
|
|
3124
3503
|
className: "flex items-center gap-2 px-5 py-3 rounded-lg\r\n border border-[rgba(23,97,163,0.35)]\r\n bg-gradient-to-r from-[#f2fbf8] to-[#eef6fb]\r\n text-[#0f172a] font-semibold shadow-sm",
|
|
3125
3504
|
onClick: function() {
|
|
@@ -3127,149 +3506,293 @@ var Filter = function() {
|
|
|
3127
3506
|
return !p;
|
|
3128
3507
|
});
|
|
3129
3508
|
}
|
|
3130
|
-
}, "Filter"), open && /* @__PURE__ */
|
|
3509
|
+
}, "Filter"), open && /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3131
3510
|
className: "absolute right-0 mt-3 z-50"
|
|
3132
|
-
}, /* @__PURE__ */
|
|
3511
|
+
}, /* @__PURE__ */ import_react14.default.createElement(Card, {
|
|
3133
3512
|
variant: "figma",
|
|
3134
3513
|
className: "w-[360px] p-0 overflow-hidden bg-white"
|
|
3135
|
-
}, /* @__PURE__ */
|
|
3514
|
+
}, /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3136
3515
|
className: "flex justify-between items-center px-5 py-3 border-b border-[rgba(23,97,163,0.35)]"
|
|
3137
|
-
}, /* @__PURE__ */
|
|
3516
|
+
}, /* @__PURE__ */ import_react14.default.createElement("h3", {
|
|
3138
3517
|
className: "text-md font-semibold"
|
|
3139
|
-
}, "Add Filter"), /* @__PURE__ */
|
|
3518
|
+
}, "Add Filter"), /* @__PURE__ */ import_react14.default.createElement("button", {
|
|
3140
3519
|
onClick: function() {
|
|
3141
3520
|
return setOpen(false);
|
|
3142
3521
|
},
|
|
3143
3522
|
className: "w-8 h-8 rounded-full bg-slate-100 flex items-center justify-center"
|
|
3144
|
-
}, /* @__PURE__ */
|
|
3523
|
+
}, /* @__PURE__ */ import_react14.default.createElement(import_lucide_react3.X, {
|
|
3145
3524
|
className: "w-4 h-4 text-slate-600"
|
|
3146
|
-
}))), /* @__PURE__ */
|
|
3525
|
+
}))), /* @__PURE__ */ import_react14.default.createElement(Section, {
|
|
3147
3526
|
title: "Date Range",
|
|
3148
3527
|
onReset: function() {
|
|
3149
3528
|
return resetField("date");
|
|
3150
3529
|
}
|
|
3151
|
-
}, /* @__PURE__ */
|
|
3530
|
+
}, /* @__PURE__ */ import_react14.default.createElement(Calendar, {
|
|
3152
3531
|
enableRangeSelection: true,
|
|
3153
3532
|
rangeValue: values.date,
|
|
3154
3533
|
onRangeChange: function(range) {
|
|
3155
3534
|
return handleChange("date", range);
|
|
3156
3535
|
},
|
|
3157
3536
|
size: "small"
|
|
3158
|
-
})), /* @__PURE__ */
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
return resetField("activity");
|
|
3162
|
-
}
|
|
3163
|
-
}, /* @__PURE__ */ import_react13.default.createElement(MahatiActivity, {
|
|
3537
|
+
})), /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3538
|
+
className: "relative w-full"
|
|
3539
|
+
}, /* @__PURE__ */ import_react14.default.createElement("select", {
|
|
3164
3540
|
value: values.activity,
|
|
3165
|
-
onChange: function(
|
|
3166
|
-
return handleChange("activity",
|
|
3167
|
-
}
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
}, /* @__PURE__ */
|
|
3541
|
+
onChange: function(e) {
|
|
3542
|
+
return handleChange("activity", e.target.value);
|
|
3543
|
+
},
|
|
3544
|
+
className: "\r\n w-full appearance-none\r\n px-4 py-3 pr-10\r\n rounded-[6px]\r\n border border-slate-300\r\n bg-white text-sm\r\n focus:outline-none focus:ring-2 focus:ring-[#1761A3]\r\n "
|
|
3545
|
+
}, /* @__PURE__ */ import_react14.default.createElement("option", {
|
|
3546
|
+
value: ""
|
|
3547
|
+
}, "Select Activity"), /* @__PURE__ */ import_react14.default.createElement("option", null, "Activity List"), /* @__PURE__ */ import_react14.default.createElement("option", null, "Login"), /* @__PURE__ */ import_react14.default.createElement("option", null, "Update"), /* @__PURE__ */ import_react14.default.createElement("option", null, "Delete")), /* @__PURE__ */ import_react14.default.createElement(import_lucide_react3.ChevronDown, {
|
|
3548
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"
|
|
3549
|
+
})), /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3550
|
+
className: "relative w-full"
|
|
3551
|
+
}, /* @__PURE__ */ import_react14.default.createElement("select", {
|
|
3174
3552
|
value: values.status,
|
|
3175
|
-
onChange: function(
|
|
3176
|
-
return handleChange("status",
|
|
3177
|
-
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
}, /* @__PURE__ */
|
|
3553
|
+
onChange: function(e) {
|
|
3554
|
+
return handleChange("status", e.target.value);
|
|
3555
|
+
},
|
|
3556
|
+
className: "\r\n w-full appearance-none\r\n px-4 py-3 pr-10\r\n rounded-[6px]\r\n border border-slate-300\r\n bg-white text-sm\r\n focus:outline-none focus:ring-2 focus:ring-[#1761A3]\r\n "
|
|
3557
|
+
}, /* @__PURE__ */ import_react14.default.createElement("option", {
|
|
3558
|
+
value: ""
|
|
3559
|
+
}, "Select Status"), /* @__PURE__ */ import_react14.default.createElement("option", null, "Pending"), /* @__PURE__ */ import_react14.default.createElement("option", null, "Approved"), /* @__PURE__ */ import_react14.default.createElement("option", null, "Rejected")), /* @__PURE__ */ import_react14.default.createElement(import_lucide_react3.ChevronDown, {
|
|
3560
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"
|
|
3561
|
+
})), /* @__PURE__ */ import_react14.default.createElement("input", {
|
|
3184
3562
|
value: values.keyword,
|
|
3185
|
-
onChange: function(
|
|
3186
|
-
return handleChange("keyword",
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3563
|
+
onChange: function(e) {
|
|
3564
|
+
return handleChange("keyword", e.target.value);
|
|
3565
|
+
},
|
|
3566
|
+
placeholder: "Search...",
|
|
3567
|
+
className: "\r\n w-full px-4 py-3\r\n rounded-[6px]\r\n border border-slate-300\r\n bg-white text-sm\r\n focus:outline-none focus:ring-2 focus:ring-[#1761A3]\r\n "
|
|
3568
|
+
}), /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3189
3569
|
className: "flex justify-between items-center px-5 py-4 bg-gradient-to-r from-[#f3fbf8] to-[#eef6fb]"
|
|
3190
|
-
}, /* @__PURE__ */
|
|
3570
|
+
}, /* @__PURE__ */ import_react14.default.createElement(Button, {
|
|
3191
3571
|
variant: "outline",
|
|
3192
3572
|
className: "border-[#1761A3] bg-[#F0F8FF]",
|
|
3193
3573
|
onClick: resetAll
|
|
3194
|
-
}, "Reset all"), /* @__PURE__ */
|
|
3574
|
+
}, "Reset all"), /* @__PURE__ */ import_react14.default.createElement(Button, {
|
|
3195
3575
|
className: "text-white bg-gradient-to-r from-[#1761a3] to-[#4daf83]",
|
|
3196
3576
|
onClick: applyFilters
|
|
3197
3577
|
}, "Apply Now")))));
|
|
3198
3578
|
};
|
|
3199
3579
|
var Section = function(param) {
|
|
3200
3580
|
var title = param.title, onReset = param.onReset, children = param.children;
|
|
3201
|
-
return /* @__PURE__ */
|
|
3581
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3202
3582
|
className: "px-5 py-4 bg-gradient-to-r from-[#f3fbf8] to-[#eef6fb]\r\n border-b border-[rgba(23,97,163,0.35)]"
|
|
3203
|
-
}, /* @__PURE__ */
|
|
3583
|
+
}, /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3204
3584
|
className: "flex justify-between items-center mb-3"
|
|
3205
|
-
}, /* @__PURE__ */
|
|
3585
|
+
}, /* @__PURE__ */ import_react14.default.createElement("h6", {
|
|
3206
3586
|
className: "font-semibold text-sm"
|
|
3207
|
-
}, title), /* @__PURE__ */
|
|
3587
|
+
}, title), /* @__PURE__ */ import_react14.default.createElement("button", {
|
|
3208
3588
|
onClick: onReset,
|
|
3209
3589
|
className: "text-[#1761a3] font-semibold text-sm"
|
|
3210
3590
|
}, "Reset")), children);
|
|
3211
3591
|
};
|
|
3212
|
-
var
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3592
|
+
var DEFAULT_ACTIVITY_OPTIONS = [
|
|
3593
|
+
{
|
|
3594
|
+
label: "Select Activity",
|
|
3595
|
+
value: ""
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
label: "Activity List",
|
|
3599
|
+
value: "Activity List"
|
|
3600
|
+
},
|
|
3601
|
+
{
|
|
3602
|
+
label: "Login",
|
|
3603
|
+
value: "Login"
|
|
3604
|
+
},
|
|
3605
|
+
{
|
|
3606
|
+
label: "Update",
|
|
3607
|
+
value: "Update"
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
label: "Delete",
|
|
3611
|
+
value: "Delete"
|
|
3612
|
+
}
|
|
3222
3613
|
];
|
|
3223
3614
|
var MahatiActivity = function(param) {
|
|
3224
|
-
var value = param.value, onChange = param.onChange;
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3615
|
+
var value = param.value, onChange = param.onChange, _param_options = param.options, options = _param_options === void 0 ? DEFAULT_ACTIVITY_OPTIONS : _param_options, _param_size = param.size, size = _param_size === void 0 ? "medium" : _param_size;
|
|
3616
|
+
var _options_find;
|
|
3617
|
+
var _ref = _sliced_to_array((0, import_react14.useState)(false), 2), open = _ref[0], setOpen = _ref[1];
|
|
3618
|
+
var triggerRef = (0, import_react14.useRef)(null);
|
|
3619
|
+
var dropdownRef = (0, import_react14.useRef)(null);
|
|
3620
|
+
var _ref1 = _sliced_to_array((0, import_react14.useState)(null), 2), pos = _ref1[0], setPos = _ref1[1];
|
|
3621
|
+
var selectedLabel = ((_options_find = options.find(function(o) {
|
|
3622
|
+
return o.value == value;
|
|
3623
|
+
})) === null || _options_find === void 0 ? void 0 : _options_find.label) || "Select Activity";
|
|
3624
|
+
var updatePosition = function() {
|
|
3625
|
+
if (!triggerRef.current) return;
|
|
3626
|
+
var rect = triggerRef.current.getBoundingClientRect();
|
|
3627
|
+
setPos({
|
|
3628
|
+
top: rect.bottom + window.scrollY + 6,
|
|
3629
|
+
left: rect.left + window.scrollX,
|
|
3630
|
+
width: rect.width
|
|
3631
|
+
});
|
|
3632
|
+
};
|
|
3633
|
+
(0, import_react14.useEffect)(function() {
|
|
3634
|
+
if (!open) return;
|
|
3635
|
+
updatePosition();
|
|
3636
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
3637
|
+
window.addEventListener("resize", updatePosition);
|
|
3638
|
+
return function() {
|
|
3639
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
3640
|
+
window.removeEventListener("resize", updatePosition);
|
|
3641
|
+
};
|
|
3642
|
+
}, [
|
|
3643
|
+
open
|
|
3644
|
+
]);
|
|
3645
|
+
(0, import_react14.useEffect)(function() {
|
|
3646
|
+
var handler = function(e) {
|
|
3647
|
+
var _triggerRef_current, _dropdownRef_current;
|
|
3648
|
+
if (((_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.contains(e.target)) || ((_dropdownRef_current = dropdownRef.current) === null || _dropdownRef_current === void 0 ? void 0 : _dropdownRef_current.contains(e.target))) {
|
|
3649
|
+
return;
|
|
3650
|
+
}
|
|
3651
|
+
setOpen(false);
|
|
3652
|
+
};
|
|
3653
|
+
document.addEventListener("mousedown", handler);
|
|
3654
|
+
return function() {
|
|
3655
|
+
return document.removeEventListener("mousedown", handler);
|
|
3656
|
+
};
|
|
3657
|
+
}, []);
|
|
3658
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3659
|
+
ref: triggerRef,
|
|
3660
|
+
onClick: function() {
|
|
3661
|
+
return setOpen(function(p) {
|
|
3662
|
+
return !p;
|
|
3663
|
+
});
|
|
3664
|
+
},
|
|
3665
|
+
className: "\n ".concat(fieldStyles[size], "\n cursor-pointer\n flex items-center justify-between\n relative\n ").concat(open ? "border-[#1761a3] ring-2 ring-[#1761a3]" : "", "\n ")
|
|
3666
|
+
}, /* @__PURE__ */ import_react14.default.createElement("span", {
|
|
3667
|
+
className: "truncate"
|
|
3668
|
+
}, selectedLabel), /* @__PURE__ */ import_react14.default.createElement(import_lucide_react3.ChevronDown, {
|
|
3669
|
+
className: "w-4 h-4 text-slate-500 transition-transform ".concat(open ? "rotate-180" : "")
|
|
3670
|
+
})), open && pos && (0, import_react_dom.createPortal)(/* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3671
|
+
ref: dropdownRef,
|
|
3672
|
+
style: {
|
|
3673
|
+
position: "absolute",
|
|
3674
|
+
top: pos.top,
|
|
3675
|
+
left: pos.left,
|
|
3676
|
+
width: pos.width
|
|
3677
|
+
},
|
|
3678
|
+
className: "\r\n z-[9999]\r\n rounded-[6px]\r\n border border-slate-300\r\n bg-white\r\n shadow-xl\r\n max-h-[240px]\r\n overflow-y-auto\r\n "
|
|
3679
|
+
}, options.map(function(opt) {
|
|
3680
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3681
|
+
key: String(opt.value),
|
|
3682
|
+
onClick: function() {
|
|
3683
|
+
onChange(opt.value);
|
|
3684
|
+
setOpen(false);
|
|
3685
|
+
},
|
|
3686
|
+
className: "\r\n px-4 py-2\r\n text-sm\r\n cursor-pointer\r\n text-black hover:bg-[#1761a3] hover:text-white\r\n "
|
|
3687
|
+
}, opt.label);
|
|
3688
|
+
})), document.body));
|
|
3231
3689
|
};
|
|
3690
|
+
var DEFAULT_STATUS_OPTIONS = [
|
|
3691
|
+
{
|
|
3692
|
+
label: "Select Status",
|
|
3693
|
+
value: ""
|
|
3694
|
+
},
|
|
3695
|
+
{
|
|
3696
|
+
label: "Pending",
|
|
3697
|
+
value: "Pending"
|
|
3698
|
+
},
|
|
3699
|
+
{
|
|
3700
|
+
label: "Approved",
|
|
3701
|
+
value: "Approved"
|
|
3702
|
+
},
|
|
3703
|
+
{
|
|
3704
|
+
label: "Rejected",
|
|
3705
|
+
value: "Rejected"
|
|
3706
|
+
}
|
|
3707
|
+
];
|
|
3232
3708
|
var MahatiStatus = function(param) {
|
|
3233
|
-
var value = param.value, onChange = param.onChange;
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3709
|
+
var value = param.value, onChange = param.onChange, _param_options = param.options, options = _param_options === void 0 ? DEFAULT_STATUS_OPTIONS : _param_options, _param_size = param.size, size = _param_size === void 0 ? "medium" : _param_size;
|
|
3710
|
+
var _options_find;
|
|
3711
|
+
var _ref = _sliced_to_array((0, import_react14.useState)(false), 2), open = _ref[0], setOpen = _ref[1];
|
|
3712
|
+
var triggerRef = (0, import_react14.useRef)(null);
|
|
3713
|
+
var dropdownRef = (0, import_react14.useRef)(null);
|
|
3714
|
+
var _ref1 = _sliced_to_array((0, import_react14.useState)(null), 2), pos = _ref1[0], setPos = _ref1[1];
|
|
3715
|
+
var selectedLabel = (options === null || options === void 0 ? void 0 : (_options_find = options.find(function(o) {
|
|
3716
|
+
return o.value == value;
|
|
3717
|
+
})) === null || _options_find === void 0 ? void 0 : _options_find.label) || "Select Status";
|
|
3718
|
+
var updatePosition = function() {
|
|
3719
|
+
if (!triggerRef.current) return;
|
|
3720
|
+
var rect = triggerRef.current.getBoundingClientRect();
|
|
3721
|
+
setPos({
|
|
3722
|
+
top: rect.bottom + window.scrollY + 6,
|
|
3723
|
+
left: rect.left + window.scrollX,
|
|
3724
|
+
width: rect.width
|
|
3725
|
+
});
|
|
3726
|
+
};
|
|
3727
|
+
(0, import_react14.useEffect)(function() {
|
|
3728
|
+
if (!open) return;
|
|
3729
|
+
updatePosition();
|
|
3730
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
3731
|
+
window.addEventListener("resize", updatePosition);
|
|
3732
|
+
return function() {
|
|
3733
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
3734
|
+
window.removeEventListener("resize", updatePosition);
|
|
3735
|
+
};
|
|
3736
|
+
}, [
|
|
3737
|
+
open
|
|
3738
|
+
]);
|
|
3739
|
+
(0, import_react14.useEffect)(function() {
|
|
3740
|
+
var handler = function(e) {
|
|
3741
|
+
var _triggerRef_current, _dropdownRef_current;
|
|
3742
|
+
if (((_triggerRef_current = triggerRef.current) === null || _triggerRef_current === void 0 ? void 0 : _triggerRef_current.contains(e.target)) || ((_dropdownRef_current = dropdownRef.current) === null || _dropdownRef_current === void 0 ? void 0 : _dropdownRef_current.contains(e.target))) {
|
|
3743
|
+
return;
|
|
3744
|
+
}
|
|
3745
|
+
setOpen(false);
|
|
3746
|
+
};
|
|
3747
|
+
document.addEventListener("mousedown", handler);
|
|
3748
|
+
return function() {
|
|
3749
|
+
return document.removeEventListener("mousedown", handler);
|
|
3750
|
+
};
|
|
3751
|
+
}, []);
|
|
3752
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3753
|
+
ref: triggerRef,
|
|
3754
|
+
onClick: function() {
|
|
3755
|
+
return setOpen(function(p) {
|
|
3756
|
+
return !p;
|
|
3757
|
+
});
|
|
3758
|
+
},
|
|
3759
|
+
className: "\n ".concat(fieldStyles[size], "\n cursor-pointer\n flex items-center justify-between\n relative\n ").concat(open ? "border-[#1761a3] ring-2 ring-[#1761a3]" : "", "\n ")
|
|
3760
|
+
}, /* @__PURE__ */ import_react14.default.createElement("span", {
|
|
3761
|
+
className: "truncate"
|
|
3762
|
+
}, selectedLabel), /* @__PURE__ */ import_react14.default.createElement(import_lucide_react3.ChevronDown, {
|
|
3763
|
+
className: "w-4 h-4 text-slate-500 transition-transform ".concat(open ? "rotate-180" : "")
|
|
3764
|
+
})), open && pos && (0, import_react_dom.createPortal)(/* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3765
|
+
ref: dropdownRef,
|
|
3766
|
+
style: {
|
|
3767
|
+
position: "absolute",
|
|
3768
|
+
top: pos.top,
|
|
3769
|
+
left: pos.left,
|
|
3770
|
+
width: pos.width
|
|
3771
|
+
},
|
|
3772
|
+
className: "\r\n z-[9999]\r\n rounded-[6px]\r\n border border-slate-300\r\n bg-white\r\n shadow-xl\r\n max-h-[240px]\r\n overflow-y-auto\r\n "
|
|
3773
|
+
}, options === null || options === void 0 ? void 0 : options.map(function(opt) {
|
|
3774
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
3775
|
+
key: String(opt.value),
|
|
3776
|
+
onClick: function() {
|
|
3777
|
+
onChange(opt.value);
|
|
3778
|
+
setOpen(false);
|
|
3779
|
+
},
|
|
3780
|
+
className: "\r\n px-4 py-2\r\n text-sm\r\n cursor-pointer\r\n text-black hover:bg-[#1761a3] hover:text-white\r\n "
|
|
3781
|
+
}, opt.label);
|
|
3782
|
+
})), document.body));
|
|
3240
3783
|
};
|
|
3241
3784
|
var MahatiSearch = function(param) {
|
|
3242
|
-
var value = param.value, onChange = param.onChange;
|
|
3243
|
-
return /* @__PURE__ */
|
|
3785
|
+
var value = param.value, onChange = param.onChange, _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "Search..." : _param_placeholder, _param_size = param.size, size = _param_size === void 0 ? "medium" : _param_size;
|
|
3786
|
+
return /* @__PURE__ */ import_react14.default.createElement("input", {
|
|
3244
3787
|
type: "text",
|
|
3245
3788
|
value: value,
|
|
3246
|
-
placeholder:
|
|
3789
|
+
placeholder: placeholder,
|
|
3247
3790
|
onChange: function(e) {
|
|
3248
3791
|
return onChange(e.target.value);
|
|
3249
3792
|
},
|
|
3250
|
-
className:
|
|
3793
|
+
className: fieldStyles[size]
|
|
3251
3794
|
});
|
|
3252
3795
|
};
|
|
3253
|
-
var Select = function(param) {
|
|
3254
|
-
var value = param.value, options = param.options, placeholder = param.placeholder, onChange = param.onChange;
|
|
3255
|
-
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
3256
|
-
className: "relative"
|
|
3257
|
-
}, /* @__PURE__ */ import_react13.default.createElement("select", {
|
|
3258
|
-
value: value,
|
|
3259
|
-
onChange: function(e) {
|
|
3260
|
-
return onChange(e.target.value);
|
|
3261
|
-
},
|
|
3262
|
-
className: "w-full appearance-none px-4 py-3 pr-10\r\n rounded-[6px] border border-slate-300 bg-white\r\n focus:outline-none focus:ring-2 focus:ring-[#1761a3]"
|
|
3263
|
-
}, /* @__PURE__ */ import_react13.default.createElement("option", {
|
|
3264
|
-
value: ""
|
|
3265
|
-
}, placeholder), options.map(function(opt) {
|
|
3266
|
-
return /* @__PURE__ */ import_react13.default.createElement("option", {
|
|
3267
|
-
key: opt
|
|
3268
|
-
}, opt);
|
|
3269
|
-
})), /* @__PURE__ */ import_react13.default.createElement(import_lucide_react3.ChevronDown, {
|
|
3270
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2\r\n w-4 h-4 text-slate-500 pointer-events-none"
|
|
3271
|
-
}));
|
|
3272
|
-
};
|
|
3273
3796
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3274
3797
|
0 && (module.exports = {
|
|
3275
3798
|
MahatiActivity: MahatiActivity,
|
|
@@ -3288,6 +3811,7 @@ var Select = function(param) {
|
|
|
3288
3811
|
MahatiTabbedInterfaceTailwind: MahatiTabbedInterfaceTailwind,
|
|
3289
3812
|
MahatiTable: MahatiTable,
|
|
3290
3813
|
MahatiTableTailwind: MahatiTableTailwind,
|
|
3814
|
+
MahatiToastMessage: MahatiToastMessage,
|
|
3291
3815
|
MahatiTooltip: MahatiTooltip
|
|
3292
3816
|
});
|
|
3293
3817
|
//# sourceMappingURL=index.js.map
|