@mahatisystems/mahati-ui-components 0.1.1

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.mjs ADDED
@@ -0,0 +1,1057 @@
1
+ // src/components/Button.tsx
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_with_holes(arr) {
8
+ if (Array.isArray(arr)) return arr;
9
+ }
10
+ function _define_property(obj, key, value) {
11
+ if (key in obj) {
12
+ Object.defineProperty(obj, key, {
13
+ value: value,
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true
17
+ });
18
+ } else {
19
+ obj[key] = value;
20
+ }
21
+ return obj;
22
+ }
23
+ function _instanceof(left, right) {
24
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
25
+ return !!right[Symbol.hasInstance](left);
26
+ } else {
27
+ return left instanceof right;
28
+ }
29
+ }
30
+ function _iterable_to_array_limit(arr, i) {
31
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
32
+ if (_i == null) return;
33
+ var _arr = [];
34
+ var _n = true;
35
+ var _d = false;
36
+ var _s, _e;
37
+ try {
38
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
39
+ _arr.push(_s.value);
40
+ if (i && _arr.length === i) break;
41
+ }
42
+ } catch (err) {
43
+ _d = true;
44
+ _e = err;
45
+ } finally{
46
+ try {
47
+ if (!_n && _i["return"] != null) _i["return"]();
48
+ } finally{
49
+ if (_d) throw _e;
50
+ }
51
+ }
52
+ return _arr;
53
+ }
54
+ function _non_iterable_rest() {
55
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
56
+ }
57
+ function _object_spread(target) {
58
+ for(var i = 1; i < arguments.length; i++){
59
+ var source = arguments[i] != null ? arguments[i] : {};
60
+ var ownKeys = Object.keys(source);
61
+ if (typeof Object.getOwnPropertySymbols === "function") {
62
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
63
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
64
+ }));
65
+ }
66
+ ownKeys.forEach(function(key) {
67
+ _define_property(target, key, source[key]);
68
+ });
69
+ }
70
+ return target;
71
+ }
72
+ function ownKeys(object, enumerableOnly) {
73
+ var keys = Object.keys(object);
74
+ if (Object.getOwnPropertySymbols) {
75
+ var symbols = Object.getOwnPropertySymbols(object);
76
+ if (enumerableOnly) {
77
+ symbols = symbols.filter(function(sym) {
78
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
79
+ });
80
+ }
81
+ keys.push.apply(keys, symbols);
82
+ }
83
+ return keys;
84
+ }
85
+ function _object_spread_props(target, source) {
86
+ source = source != null ? source : {};
87
+ if (Object.getOwnPropertyDescriptors) {
88
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
89
+ } else {
90
+ ownKeys(Object(source)).forEach(function(key) {
91
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
92
+ });
93
+ }
94
+ return target;
95
+ }
96
+ function _object_without_properties(source, excluded) {
97
+ if (source == null) return {};
98
+ var target = _object_without_properties_loose(source, excluded);
99
+ var key, i;
100
+ if (Object.getOwnPropertySymbols) {
101
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
102
+ for(i = 0; i < sourceSymbolKeys.length; i++){
103
+ key = sourceSymbolKeys[i];
104
+ if (excluded.indexOf(key) >= 0) continue;
105
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
106
+ target[key] = source[key];
107
+ }
108
+ }
109
+ return target;
110
+ }
111
+ function _object_without_properties_loose(source, excluded) {
112
+ if (source == null) return {};
113
+ var target = {};
114
+ var sourceKeys = Object.keys(source);
115
+ var key, i;
116
+ for(i = 0; i < sourceKeys.length; i++){
117
+ key = sourceKeys[i];
118
+ if (excluded.indexOf(key) >= 0) continue;
119
+ target[key] = source[key];
120
+ }
121
+ return target;
122
+ }
123
+ function _sliced_to_array(arr, i) {
124
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
125
+ }
126
+ function _type_of(obj) {
127
+ "@swc/helpers - typeof";
128
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
129
+ }
130
+ function _unsupported_iterable_to_array(o, minLen) {
131
+ if (!o) return;
132
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
133
+ var n = Object.prototype.toString.call(o).slice(8, -1);
134
+ if (n === "Object" && o.constructor) n = o.constructor.name;
135
+ if (n === "Map" || n === "Set") return Array.from(n);
136
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
137
+ }
138
+ import React from "react";
139
+ import { cva } from "class-variance-authority";
140
+ // src/lib/utils.ts
141
+ import { clsx } from "clsx";
142
+ import { twMerge } from "tailwind-merge";
143
+ function cn() {
144
+ for(var _len = arguments.length, inputs = new Array(_len), _key = 0; _key < _len; _key++){
145
+ inputs[_key] = arguments[_key];
146
+ }
147
+ return twMerge(clsx(inputs));
148
+ }
149
+ // src/components/Button.tsx
150
+ var buttonVariants = cva(// Use regular Tailwind classes that will be processed by consumer's Tailwind
151
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", {
152
+ variants: {
153
+ variant: {
154
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
155
+ destructive: "purple",
156
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
157
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
158
+ ghost: "hover:bg-accent hover:text-accent-foreground",
159
+ link: "text-primary underline-offset-4 hover:underline"
160
+ },
161
+ size: {
162
+ default: "h-10 px-4 py-2",
163
+ sm: "h-9 rounded-md px-3",
164
+ lg: "h-11 rounded-md px-8",
165
+ icon: "h-10 w-10"
166
+ }
167
+ },
168
+ defaultVariants: {
169
+ variant: "default",
170
+ size: "default"
171
+ }
172
+ });
173
+ var Button = React.forwardRef(function(_param, ref) {
174
+ var className = _param.className, variant = _param.variant, size = _param.size, _param_asChild = _param.asChild, asChild = _param_asChild === void 0 ? false : _param_asChild, props = _object_without_properties(_param, [
175
+ "className",
176
+ "variant",
177
+ "size",
178
+ "asChild"
179
+ ]);
180
+ return /* @__PURE__ */ React.createElement("button", _object_spread({
181
+ className: cn(buttonVariants({
182
+ variant: variant,
183
+ size: size,
184
+ className: className
185
+ })),
186
+ ref: ref
187
+ }, props));
188
+ });
189
+ Button.displayName = "Button";
190
+ // src/components/Card.tsx
191
+ import * as React2 from "react";
192
+ import { cva as cva2 } from "class-variance-authority";
193
+ import { ChevronDown, ChevronUp } from "lucide-react";
194
+ var cardVariants = cva2("rounded-[14px] transition-all duration-300 shadow-[0_4px_4px_0_rgba(0,0,0,0.25)]", {
195
+ variants: {
196
+ variant: {
197
+ default: "bg-white text-slate-800 border border-slate-200 hover:shadow-lg",
198
+ elevated: "bg-white shadow-md border border-transparent",
199
+ outline: "bg-slate-50 border border-slate-200",
200
+ subtle: "bg-slate-50 border border-transparent",
201
+ figma: ""
202
+ },
203
+ size: {
204
+ default: "p-6 rounded-[14px]",
205
+ sm: "p-4",
206
+ lg: "p-8",
207
+ figma: "w-[280px] p-6"
208
+ }
209
+ },
210
+ defaultVariants: {
211
+ variant: "default",
212
+ size: "default"
213
+ }
214
+ });
215
+ var Card = React2.forwardRef(function(_param, ref) {
216
+ var title = _param.title, cardContent = _param.cardContent, cardBackContent = _param.cardBackContent, _param_collapsible = _param.collapsible, collapsible = _param_collapsible === void 0 ? false : _param_collapsible, _param_flippable = _param.flippable, flippable = _param_flippable === void 0 ? false : _param_flippable, backgroundColor = _param.backgroundColor, borderRadius = _param.borderRadius, variant = _param.variant, size = _param.size, className = _param.className, children = _param.children, _param_defaultOpen = _param.defaultOpen, defaultOpen = _param_defaultOpen === void 0 ? true : _param_defaultOpen, onFlip = _param.onFlip, style = _param.style, props = _object_without_properties(_param, [
217
+ "title",
218
+ "cardContent",
219
+ "cardBackContent",
220
+ "collapsible",
221
+ "flippable",
222
+ "backgroundColor",
223
+ "borderRadius",
224
+ "variant",
225
+ "size",
226
+ "className",
227
+ "children",
228
+ "defaultOpen",
229
+ "onFlip",
230
+ "style"
231
+ ]);
232
+ var _React2_useState = _sliced_to_array(React2.useState(defaultOpen), 2), open = _React2_useState[0], setOpen = _React2_useState[1];
233
+ var _React2_useState1 = _sliced_to_array(React2.useState(false), 2), isFlipped = _React2_useState1[0], setIsFlipped = _React2_useState1[1];
234
+ var contentId = React2.useId();
235
+ var figmaStyles = variant === "figma" ? _object_spread({
236
+ backgroundColor: backgroundColor || "rgba(77, 175, 131, 0.10)",
237
+ border: "1px solid #1761A3",
238
+ boxShadow: "0 4px 4px 0 rgba(0, 0, 0, 0.25)",
239
+ borderRadius: "14px"
240
+ }, style) : backgroundColor ? _object_spread({
241
+ backgroundColor: backgroundColor
242
+ }, style) : style;
243
+ var handleFlip = function() {
244
+ if (!flippable) return;
245
+ var newFlippedState = !isFlipped;
246
+ setIsFlipped(newFlippedState);
247
+ onFlip === null || onFlip === void 0 ? void 0 : onFlip(newFlippedState);
248
+ };
249
+ var mainContent = cardContent || children;
250
+ return /* @__PURE__ */ React2.createElement("div", {
251
+ className: cn(flippable && "[perspective:1000px] group"),
252
+ onClick: handleFlip
253
+ }, /* @__PURE__ */ React2.createElement("div", _object_spread_props(_object_spread({
254
+ ref: ref
255
+ }, props), {
256
+ style: figmaStyles,
257
+ className: cn(cardVariants({
258
+ variant: variant,
259
+ size: size,
260
+ className: className
261
+ }), flippable && "relative transition-transform duration-700 [transform-style:preserve-3d]", flippable && isFlipped && "[transform:rotateY(180deg)]", className)
262
+ }), /* @__PURE__ */ React2.createElement("div", {
263
+ className: cn(flippable && "[backface-visibility:hidden]")
264
+ }, title && /* @__PURE__ */ React2.createElement("div", {
265
+ className: cn("flex items-center justify-between", {
266
+ "mb-4": open && mainContent
267
+ })
268
+ }, /* @__PURE__ */ React2.createElement("h4", {
269
+ className: "text-xl font-semibold text-slate-800"
270
+ }, title), collapsible && /* @__PURE__ */ React2.createElement("button", {
271
+ type: "button",
272
+ style: {
273
+ backgroundColor: "#1761A3"
274
+ },
275
+ className: "z-10 flex items-center justify-center w-8 h-8 rounded-full hover:opacity-80 transition-opacity duration-200 focus:outline-none focus:ring-2 focus:ring-[#1761A3] focus:ring-offset-2",
276
+ onClick: function(e) {
277
+ if (flippable) e.stopPropagation();
278
+ setOpen(function(p) {
279
+ return !p;
280
+ });
281
+ },
282
+ "aria-label": open ? "Hide content" : "Show content",
283
+ "aria-expanded": open,
284
+ "aria-controls": contentId
285
+ }, open ? /* @__PURE__ */ React2.createElement(ChevronUp, {
286
+ className: "w-5 h-5 text-white"
287
+ }) : /* @__PURE__ */ React2.createElement(ChevronDown, {
288
+ className: "w-5 h-5 text-white"
289
+ }))), mainContent && /* @__PURE__ */ React2.createElement("div", {
290
+ id: contentId,
291
+ className: cn("grid overflow-hidden transition-all duration-500 ease-in-out", open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0")
292
+ }, /* @__PURE__ */ React2.createElement("div", {
293
+ className: "overflow-hidden"
294
+ }, mainContent))), flippable && cardBackContent && /* @__PURE__ */ React2.createElement("div", {
295
+ className: "absolute inset-0 w-full h-full p-6 [backface-visibility:hidden] [transform:rotateY(180deg)]"
296
+ }, cardBackContent)));
297
+ });
298
+ Card.displayName = "Card";
299
+ // src/components/Modal.tsx
300
+ import React3 from "react";
301
+ var Modal = function(param) {
302
+ var isOpen = param.isOpen, onClose = param.onClose, title = param.title, children = param.children, className = param.className;
303
+ if (!isOpen) return null;
304
+ return /* @__PURE__ */ React3.createElement("div", {
305
+ className: "fixed inset-0 z-50"
306
+ }, /* @__PURE__ */ React3.createElement("div", {
307
+ className: "fixed inset-0 bg-black bg-opacity-50 transition-opacity",
308
+ onClick: onClose
309
+ }), /* @__PURE__ */ React3.createElement("div", {
310
+ className: "fixed inset-0 overflow-y-auto"
311
+ }, /* @__PURE__ */ React3.createElement("div", {
312
+ className: "flex min-h-full items-center justify-center p-4"
313
+ }, /* @__PURE__ */ React3.createElement("div", {
314
+ className: cn("relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6", className),
315
+ onClick: function(e) {
316
+ return e.stopPropagation();
317
+ }
318
+ }, /* @__PURE__ */ React3.createElement("button", {
319
+ onClick: onClose,
320
+ className: "absolute right-4 top-4 text-gray-400 hover:text-gray-500"
321
+ }, /* @__PURE__ */ React3.createElement("span", {
322
+ className: "sr-only"
323
+ }, "Close"), /* @__PURE__ */ React3.createElement("svg", {
324
+ className: "h-6 w-6",
325
+ fill: "none",
326
+ viewBox: "0 0 24 24",
327
+ stroke: "currentColor"
328
+ }, /* @__PURE__ */ React3.createElement("path", {
329
+ strokeLinecap: "round",
330
+ strokeLinejoin: "round",
331
+ strokeWidth: 2,
332
+ d: "M6 18L18 6M6 6l12 12"
333
+ }))), title && /* @__PURE__ */ React3.createElement("div", {
334
+ className: "mb-4"
335
+ }, /* @__PURE__ */ React3.createElement("h3", {
336
+ className: "text-lg font-medium leading-6 text-gray-900"
337
+ }, title)), /* @__PURE__ */ React3.createElement("div", {
338
+ className: "mt-2 text-black"
339
+ }, children)))));
340
+ };
341
+ Modal.displayName = "Modal";
342
+ // src/components/FormContainer.tsx
343
+ import React4 from "react";
344
+ var FormContainer = function(param) {
345
+ var children = param.children, onSubmit = param.onSubmit, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
346
+ return /* @__PURE__ */ React4.createElement("form", {
347
+ onSubmit: onSubmit,
348
+ className: "\n flex flex-col items-center justify-center\n w-full max-w-[560px] min-h-[80vh] mx-auto p-6\n bg-white shadow-lg rounded-lg\n ".concat(className, "\n ")
349
+ }, children);
350
+ };
351
+ FormContainer.displayName = "FormContainer";
352
+ // src/components/Input.tsx
353
+ import React5, { useEffect, useState as useState2 } from "react";
354
+ var Input = function(param) {
355
+ var _param_type = param.type, type = _param_type === void 0 ? "text" : _param_type, name = param.name, placeholder = param.placeholder, onChange = param.onChange, _param_hasError = param.hasError, hasError = _param_hasError === void 0 ? false : _param_hasError, _param_errorMessage = param.errorMessage, errorMessage = _param_errorMessage === void 0 ? "" : _param_errorMessage, _param_value = param.value, value = _param_value === void 0 ? "" : _param_value, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
356
+ var _useState2 = _sliced_to_array(useState2(value), 2), internalValue = _useState2[0], setInternalValue = _useState2[1];
357
+ var _useState21 = _sliced_to_array(useState2(false), 2), showError = _useState21[0], setShowError = _useState21[1];
358
+ useEffect(function() {
359
+ setInternalValue(value);
360
+ setShowError(hasError || value === "");
361
+ }, [
362
+ value,
363
+ hasError
364
+ ]);
365
+ var handleChange = function(e) {
366
+ var newValue = e.target.value;
367
+ setInternalValue(newValue);
368
+ onChange(e);
369
+ setShowError(newValue === "");
370
+ };
371
+ return /* @__PURE__ */ React5.createElement("div", {
372
+ className: "mb-4"
373
+ }, /* @__PURE__ */ React5.createElement("input", {
374
+ type: type,
375
+ name: name,
376
+ placeholder: placeholder,
377
+ value: internalValue,
378
+ onChange: handleChange,
379
+ className: "\n w-[438px] max-w-full h-[44px] flex-shrink-0\n rounded-[6px] border\n ".concat(showError ? "border-red-500" : "border-[#D9D9D9]", "\n bg-white\n text-base leading-5\n outline-none\n ").concat(className, "\n ")
380
+ }), /* @__PURE__ */ React5.createElement("span", {
381
+ className: "block text-sm text-red-500 h-[0.8rem]"
382
+ }, errorMessage));
383
+ };
384
+ Input.displayName = "Input";
385
+ // src/components/TabbedInterface.tsx
386
+ import React6, { useState as useState3, useId as useId2 } from "react";
387
+ var TabbedInterface = function(param) {
388
+ var tabs = param.tabs, _param_variant = param.variant, variant = _param_variant === void 0 ? "basic" : _param_variant, _param_defaultActiveTab = param.defaultActiveTab, defaultActiveTab = _param_defaultActiveTab === void 0 ? 0 : _param_defaultActiveTab, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, onTabChange = param.onTabChange;
389
+ var _tabs_activeTab;
390
+ var _useState3 = _sliced_to_array(useState3(defaultActiveTab), 2), activeTab = _useState3[0], setActiveTab = _useState3[1];
391
+ var id = useId2();
392
+ var PRIMARY_COLOR = "#1e73be";
393
+ var ACCENT_COLOR = "#4DAF83";
394
+ var handleTabClick = function(index) {
395
+ var _tabs_index;
396
+ if ((_tabs_index = tabs[index]) === null || _tabs_index === void 0 ? void 0 : _tabs_index.disabled) return;
397
+ setActiveTab(index);
398
+ onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(index);
399
+ };
400
+ var getTabButtonStyles = function(index) {
401
+ var _tabs_index;
402
+ var isActive = index === activeTab;
403
+ var baseStyles = "flex items-center justify-center gap-2 px-6 py-3 text-sm font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 whitespace-nowrap flex-shrink-0";
404
+ var disabledStyles = "opacity-50 cursor-not-allowed";
405
+ if ((_tabs_index = tabs[index]) === null || _tabs_index === void 0 ? void 0 : _tabs_index.disabled) {
406
+ return "".concat(baseStyles, " ").concat(disabledStyles, " text-gray-500");
407
+ }
408
+ switch(variant){
409
+ case "basic":
410
+ return "".concat(baseStyles, " ").concat(isActive ? "text-[".concat(PRIMARY_COLOR, "] border-b-2 border-[").concat(PRIMARY_COLOR, "]") : "text-gray-600 hover:text-gray-800 hover:border-b-2 hover:border-gray-300");
411
+ case "underline":
412
+ return "".concat(baseStyles, " relative ").concat(isActive ? "text-[".concat(PRIMARY_COLOR, "]") : "text-gray-600 hover:text-gray-800");
413
+ case "pill":
414
+ return "".concat(baseStyles, " rounded-full font-semibold text-[14px] leading-normal ").concat(isActive ? "bg-white text-[".concat(PRIMARY_COLOR, "] border border-gray-400 shadow-md") : "bg-[#EEF4F7] text-[".concat(PRIMARY_COLOR, "] border border-[rgba(38,118,154,0.45)] hover:bg-blue-100"));
415
+ case "square":
416
+ return "".concat(baseStyles, " rounded-[6px] border border-[rgba(38,118,154,0.45)] font-semibold text-[14px] leading-normal ").concat(isActive ? "bg-white text-[".concat(PRIMARY_COLOR, "]") : "bg-[#EEF4F7] text-gray-600 hover:bg-gray-200");
417
+ case "dark":
418
+ return "".concat(baseStyles, " rounded-lg ").concat(isActive ? "bg-gray-700 text-white shadow-md" : "bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white");
419
+ case "shadow":
420
+ return "".concat(baseStyles, " rounded-lg ").concat(isActive ? "bg-white text-[".concat(PRIMARY_COLOR, "] shadow-lg") : "bg-gray-50 text-gray-600 shadow-sm hover:bg-white");
421
+ case "glass":
422
+ return "".concat(baseStyles, " rounded-lg border border-white/30 backdrop-blur-lg ").concat(isActive ? "bg-[".concat(PRIMARY_COLOR, "]/40 text-white shadow-md") : "bg-white/20 text-[".concat(PRIMARY_COLOR, "] hover:bg-[").concat(PRIMARY_COLOR, "]/50 hover:text-white"));
423
+ case "gradient":
424
+ return "".concat(baseStyles, " rounded-lg ").concat(isActive ? "bg-gradient-to-r from-[".concat(PRIMARY_COLOR, "] to-[").concat(ACCENT_COLOR, "] text-white shadow-md") : "bg-gray-100 text-[".concat(PRIMARY_COLOR, "] hover:bg-gray-200"));
425
+ default:
426
+ return "".concat(baseStyles, " ").concat(isActive ? "text-[".concat(PRIMARY_COLOR, "]") : "text-gray-600 hover:text-gray-800");
427
+ }
428
+ };
429
+ var getUnderlineBarClasses = function(index) {
430
+ var isActive = index === activeTab;
431
+ if (variant === "underline") {
432
+ return "absolute bottom-0 left-0 h-[3px] bg-gradient-to-r from-[".concat(PRIMARY_COLOR, "] to-[").concat(ACCENT_COLOR, "] transition-all duration-300 ease-out ").concat(isActive ? "w-full" : "w-0");
433
+ }
434
+ return "hidden";
435
+ };
436
+ return /* @__PURE__ */ React6.createElement("div", {
437
+ className: "w-full bg-[#EEF4F7] rounded-lg border border-gray-200 shadow-sm ".concat(className)
438
+ }, /* @__PURE__ */ React6.createElement("div", {
439
+ className: "flex flex-row overflow-x-auto scrollbar-hide space-x-4 p-4",
440
+ role: "tablist"
441
+ }, tabs.map(function(tab, index) {
442
+ return /* @__PURE__ */ React6.createElement("button", {
443
+ key: tab.id || "tab-".concat(id, "-").concat(index),
444
+ className: getTabButtonStyles(index),
445
+ onClick: function() {
446
+ return handleTabClick(index);
447
+ },
448
+ disabled: tab.disabled,
449
+ "aria-selected": index === activeTab,
450
+ "aria-controls": "".concat(id, "-tabpanel-").concat(index),
451
+ role: "tab",
452
+ type: "button"
453
+ }, tab.icon && /* @__PURE__ */ React6.createElement("span", {
454
+ className: "flex-shrink-0 w-4 h-4"
455
+ }, tab.icon), /* @__PURE__ */ React6.createElement("span", {
456
+ className: "truncate"
457
+ }, tab.label), variant === "underline" && /* @__PURE__ */ React6.createElement("span", {
458
+ className: getUnderlineBarClasses(index)
459
+ }));
460
+ })), /* @__PURE__ */ React6.createElement("div", {
461
+ className: "h-[2px] flex-shrink-0 bg-[#D9D9D9]"
462
+ }), /* @__PURE__ */ React6.createElement("div", {
463
+ id: "".concat(id, "-tabpanel-").concat(activeTab),
464
+ role: "tabpanel",
465
+ "aria-labelledby": "".concat(id, "-tab-").concat(activeTab),
466
+ className: "p-6 animate-fade-in bg-white"
467
+ }, ((_tabs_activeTab = tabs[activeTab]) === null || _tabs_activeTab === void 0 ? void 0 : _tabs_activeTab.content) || /* @__PURE__ */ React6.createElement("div", {
468
+ className: "text-center text-gray-500 py-8"
469
+ }, "No content available for this tab")));
470
+ };
471
+ TabbedInterface.displayName = "TabbedInterface";
472
+ // src/components/Table.tsx
473
+ import React7, { useState as useState4 } from "react";
474
+ import { ArrowDownOnSquareIcon, ArrowPathIcon, XMarkIcon } from "@heroicons/react/24/outline";
475
+ var Table = function(param) {
476
+ var headers = param.headers, data = param.data, page = param.page, setPage = param.setPage, limit = param.limit, setLimit = param.setLimit, totalCount = param.totalCount, highlightRowColor = param.highlightRowColor, actions = param.actions, paginationRequired = param.paginationRequired, _param_paginationPosition = param.paginationPosition, paginationPosition = _param_paginationPosition === void 0 ? "bottom-center" : _param_paginationPosition, onDownloadPDF = param.onDownloadPDF, onDownloadExcel = param.onDownloadExcel, _param_searchable = param.searchable, searchable = _param_searchable === void 0 ? false : _param_searchable, _param_searchTerm = param.searchTerm, searchTerm = _param_searchTerm === void 0 ? "" : _param_searchTerm, onResetSearch = param.onResetSearch, onSearch = param.onSearch, _param_searchModeOptions = param.searchModeOptions, searchModeOptions = _param_searchModeOptions === void 0 ? [
477
+ "includes",
478
+ "startsWith"
479
+ ] : _param_searchModeOptions;
480
+ var _useState4 = _sliced_to_array(useState4(searchModeOptions[0]), 2), searchMode = _useState4[0], setSearchMode = _useState4[1];
481
+ var isPaginated = paginationRequired;
482
+ var handleChange = function(e) {
483
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value, searchMode);
484
+ };
485
+ var totalPages = isPaginated ? Math.max(1, Math.ceil((totalCount || 0) / (limit || 1))) : 0;
486
+ var currentPage = isPaginated ? typeof page === "number" && page > 0 ? page : 1 : 1;
487
+ var goToPage = function(p) {
488
+ if (!isPaginated) return;
489
+ var clamped = Math.max(1, Math.min(totalPages, p));
490
+ setPage === null || setPage === void 0 ? void 0 : setPage(clamped);
491
+ };
492
+ var renderPageNumbers = function() {
493
+ var _loop = function(i) {
494
+ pages.push(/* @__PURE__ */ React7.createElement("button", {
495
+ key: i,
496
+ onClick: function() {
497
+ return goToPage(i);
498
+ },
499
+ disabled: currentPage === i,
500
+ className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
501
+ style: {
502
+ background: currentPage === i ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
503
+ }
504
+ }, i));
505
+ };
506
+ if (!isPaginated || totalPages <= 1) return null;
507
+ var pages = [];
508
+ var siblings = 1;
509
+ pages.push(/* @__PURE__ */ React7.createElement("button", {
510
+ key: 1,
511
+ onClick: function() {
512
+ return goToPage(1);
513
+ },
514
+ disabled: currentPage === 1,
515
+ className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
516
+ style: {
517
+ background: currentPage === 1 ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
518
+ }
519
+ }, "1"));
520
+ if (currentPage > siblings + 2) {
521
+ pages.push(/* @__PURE__ */ React7.createElement("span", {
522
+ key: "start-ellipsis",
523
+ className: "px-1 text-sm text-slate-500"
524
+ }, "..."));
525
+ }
526
+ var start = Math.max(2, currentPage - siblings);
527
+ var end = Math.min(totalPages - 1, currentPage + siblings);
528
+ for(var i = start; i <= end; i++)_loop(i);
529
+ if (currentPage < totalPages - siblings - 1) {
530
+ pages.push(/* @__PURE__ */ React7.createElement("span", {
531
+ key: "end-ellipsis",
532
+ className: "px-1 text-sm text-slate-500"
533
+ }, "..."));
534
+ }
535
+ if (totalPages > 1) {
536
+ pages.push(/* @__PURE__ */ React7.createElement("button", {
537
+ key: totalPages,
538
+ onClick: function() {
539
+ return goToPage(totalPages);
540
+ },
541
+ disabled: currentPage === totalPages,
542
+ className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
543
+ style: {
544
+ background: currentPage === totalPages ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
545
+ }
546
+ }, totalPages));
547
+ }
548
+ return pages;
549
+ };
550
+ var renderPagination = function() {
551
+ if (!isPaginated) return null;
552
+ var align = paginationPosition.includes("left") ? "justify-start" : paginationPosition.includes("right") ? "justify-end" : "justify-center";
553
+ return /* @__PURE__ */ React7.createElement("div", {
554
+ className: "my-2 flex w-full ".concat(align)
555
+ }, /* @__PURE__ */ React7.createElement("div", {
556
+ className: "flex flex-wrap items-center justify-center gap-2"
557
+ }, /* @__PURE__ */ React7.createElement("button", {
558
+ onClick: function() {
559
+ return goToPage(currentPage - 1);
560
+ },
561
+ disabled: currentPage === 1,
562
+ className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
563
+ style: {
564
+ background: currentPage === 1 ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
565
+ }
566
+ }, "Previous"), renderPageNumbers(), /* @__PURE__ */ React7.createElement("button", {
567
+ onClick: function() {
568
+ return goToPage(currentPage + 1);
569
+ },
570
+ disabled: currentPage === totalPages,
571
+ className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
572
+ style: {
573
+ background: currentPage === totalPages ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
574
+ }
575
+ }, "Next"), /* @__PURE__ */ React7.createElement("select", {
576
+ value: limit,
577
+ onChange: function(e) {
578
+ setPage === null || setPage === void 0 ? void 0 : setPage(1);
579
+ setLimit === null || setLimit === void 0 ? void 0 : setLimit(Number(e.target.value));
580
+ },
581
+ className: "ml-2 rounded-md border border-slate-300 px-2 py-1 text-sm text-slate-700"
582
+ }, [
583
+ 5,
584
+ 10,
585
+ 15
586
+ ].map(function(size) {
587
+ return /* @__PURE__ */ React7.createElement("option", {
588
+ key: size,
589
+ value: size
590
+ }, size);
591
+ })), /* @__PURE__ */ React7.createElement("span", {
592
+ className: "ml-2 text-xs text-slate-600"
593
+ }, "Page ", currentPage, " of ", totalPages, " (Total: ", totalCount, " items)")));
594
+ };
595
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, (searchable || onDownloadExcel || onDownloadPDF) && /* @__PURE__ */ React7.createElement("div", {
596
+ className: "mb-3 flex flex-wrap items-center justify-between gap-3"
597
+ }, searchable && /* @__PURE__ */ React7.createElement("div", {
598
+ className: "flex items-center gap-2"
599
+ }, /* @__PURE__ */ React7.createElement("div", {
600
+ className: "relative flex items-center"
601
+ }, /* @__PURE__ */ React7.createElement("input", {
602
+ type: "text",
603
+ placeholder: "Search...",
604
+ value: searchTerm,
605
+ onChange: handleChange,
606
+ className: "w-56 rounded-lg border border-transparent bg-white px-3 py-2 pr-8 text-sm font-medium text-[#1761A3] shadow-sm outline-none ring-1 ring-transparent transition focus:border-transparent focus:ring-2 focus:ring-emerald-400"
607
+ }), searchTerm && /* @__PURE__ */ React7.createElement("button", {
608
+ onClick: onResetSearch,
609
+ "aria-label": "Clear search",
610
+ className: "absolute right-2 flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
611
+ }, /* @__PURE__ */ React7.createElement(XMarkIcon, {
612
+ className: "h-4 w-4"
613
+ }))), /* @__PURE__ */ React7.createElement("select", {
614
+ value: searchMode,
615
+ onChange: function(e) {
616
+ return setSearchMode(e.target.value);
617
+ },
618
+ className: "rounded-lg border border-transparent bg-white px-2 py-2 text-sm font-medium text-slate-700 shadow-sm outline-none ring-1 ring-transparent transition hover:bg-slate-50 focus:border-transparent focus:ring-2 focus:ring-emerald-400"
619
+ }, searchModeOptions.map(function(mode) {
620
+ return /* @__PURE__ */ React7.createElement("option", {
621
+ key: mode,
622
+ value: mode
623
+ }, mode === "startsWith" ? "Starts With" : "Includes");
624
+ }))), (onDownloadPDF || onDownloadExcel) && /* @__PURE__ */ React7.createElement("div", {
625
+ className: "mt-1 flex items-center gap-2"
626
+ }, onDownloadPDF && /* @__PURE__ */ React7.createElement("button", {
627
+ onClick: function() {
628
+ return onDownloadPDF(data, headers);
629
+ },
630
+ className: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90",
631
+ style: {
632
+ background: "linear-gradient(to right, #1e73be, #28a97d)"
633
+ }
634
+ }, /* @__PURE__ */ React7.createElement(ArrowDownOnSquareIcon, {
635
+ className: "h-5 w-5"
636
+ })), onDownloadExcel && /* @__PURE__ */ React7.createElement("button", {
637
+ onClick: function() {
638
+ return onDownloadExcel(data, headers);
639
+ },
640
+ className: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90",
641
+ style: {
642
+ background: "linear-gradient(to right, #1e73be, #28a97d)"
643
+ }
644
+ }, /* @__PURE__ */ React7.createElement(ArrowDownOnSquareIcon, {
645
+ className: "h-5 w-5"
646
+ }), /* @__PURE__ */ React7.createElement("span", null, "Excel")))), paginationPosition.startsWith("top") && data.length > 0 && renderPagination(), /* @__PURE__ */ React7.createElement("div", {
647
+ className: "mt-1 overflow-hidden rounded-xl border border-[#1761A3] bg-white"
648
+ }, /* @__PURE__ */ React7.createElement("table", {
649
+ className: "w-full border-collapse"
650
+ }, /* @__PURE__ */ React7.createElement("thead", {
651
+ style: {
652
+ background: "linear-gradient(to right, #1e73be, #28a97d)"
653
+ }
654
+ }, /* @__PURE__ */ React7.createElement("tr", null, headers.map(function(header, idx) {
655
+ return /* @__PURE__ */ React7.createElement("th", {
656
+ key: idx,
657
+ className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white first:rounded-tl-xl last:rounded-tr-xl"
658
+ }, header.label);
659
+ }), actions && /* @__PURE__ */ React7.createElement("th", {
660
+ className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white"
661
+ }, "Actions"))), /* @__PURE__ */ React7.createElement("tbody", null, data.length > 0 ? data.map(function(row, rowIndex) {
662
+ return /* @__PURE__ */ React7.createElement("tr", {
663
+ key: rowIndex,
664
+ className: "h-[57px] border-b border-slate-200 text-sm text-slate-900 even:bg-slate-50 hover:bg-slate-100 ".concat(highlightRowColor || "")
665
+ }, headers.map(function(header, cellIdx) {
666
+ return /* @__PURE__ */ React7.createElement("td", {
667
+ key: cellIdx,
668
+ className: "px-3 py-2"
669
+ }, function() {
670
+ var value = row[header.key];
671
+ if (React7.isValidElement(value)) return value;
672
+ if (typeof value === "function") {
673
+ try {
674
+ var result = value();
675
+ if (React7.isValidElement(result)) return result;
676
+ } catch (e) {
677
+ console.warn("Error executing function in table cell:", e);
678
+ }
679
+ }
680
+ if (typeof value === "string" && value.trim().startsWith("<") && value.trim().endsWith(">")) {
681
+ return /* @__PURE__ */ React7.createElement("span", {
682
+ dangerouslySetInnerHTML: {
683
+ __html: value
684
+ }
685
+ });
686
+ }
687
+ if (Array.isArray(value)) {
688
+ if (value.some(function(item) {
689
+ return React7.isValidElement(item);
690
+ })) {
691
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, value);
692
+ }
693
+ return value.join(", ");
694
+ }
695
+ if (_instanceof(value, Date)) return value.toLocaleString();
696
+ if (typeof value === "boolean") return value ? "Yes" : "No";
697
+ if (value === null || value === void 0) return "-";
698
+ if (typeof value === "number") return value.toString();
699
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") return JSON.stringify(value);
700
+ return String(value);
701
+ }());
702
+ }), actions && /* @__PURE__ */ React7.createElement("td", {
703
+ className: "px-3 py-2"
704
+ }, actions(row)));
705
+ }) : /* @__PURE__ */ React7.createElement("tr", null, /* @__PURE__ */ React7.createElement("td", {
706
+ colSpan: headers.length + (actions ? 1 : 0),
707
+ className: "px-4 py-6 text-center text-slate-500"
708
+ }, /* @__PURE__ */ React7.createElement("div", {
709
+ className: "flex items-center justify-center gap-4"
710
+ }, /* @__PURE__ */ React7.createElement("span", null, "No records found."), onResetSearch && /* @__PURE__ */ React7.createElement("button", {
711
+ onClick: onResetSearch,
712
+ className: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90",
713
+ style: {
714
+ background: "linear-gradient(to right, #1e73be, #28a97d)"
715
+ }
716
+ }, /* @__PURE__ */ React7.createElement("span", null, "Reset"), /* @__PURE__ */ React7.createElement(ArrowPathIcon, {
717
+ className: "h-5 w-5"
718
+ })))))))), paginationPosition.startsWith("bottom") && data.length > 0 && renderPagination());
719
+ };
720
+ Table.displayName = "Table";
721
+ // src/components/TableTailwindCSS.tsx
722
+ import React8, { useState as useState5 } from "react";
723
+ import { ArrowDownOnSquareIcon as ArrowDownOnSquareIcon2, ArrowPathIcon as ArrowPathIcon2, XMarkIcon as XMarkIcon2 } from "@heroicons/react/24/outline";
724
+ var TableTailwind = function(param) {
725
+ var headers = param.headers, data = param.data, page = param.page, setPage = param.setPage, limit = param.limit, setLimit = param.setLimit, totalCount = param.totalCount, highlightRowColor = param.highlightRowColor, actions = param.actions, paginationRequired = param.paginationRequired, _param_paginationPosition = param.paginationPosition, paginationPosition = _param_paginationPosition === void 0 ? "bottom-center" : _param_paginationPosition, onDownloadPDF = param.onDownloadPDF, onDownloadExcel = param.onDownloadExcel, _param_searchable = param.searchable, searchable = _param_searchable === void 0 ? false : _param_searchable, _param_searchTerm = param.searchTerm, searchTerm = _param_searchTerm === void 0 ? "" : _param_searchTerm, onResetSearch = param.onResetSearch, onSearch = param.onSearch, _param_searchModeOptions = param.searchModeOptions, searchModeOptions = _param_searchModeOptions === void 0 ? [
726
+ "includes",
727
+ "startsWith"
728
+ ] : _param_searchModeOptions;
729
+ var _useState5 = _sliced_to_array(useState5(searchModeOptions[0]), 2), searchMode = _useState5[0], setSearchMode = _useState5[1];
730
+ var isPaginated = paginationRequired;
731
+ var handleChange = function(e) {
732
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value, searchMode);
733
+ };
734
+ var totalPages = isPaginated ? Math.max(1, Math.ceil((totalCount || 0) / (limit || 1))) : 0;
735
+ var currentPage = isPaginated ? typeof page === "number" && page > 0 ? page : 1 : 1;
736
+ var goToPage = function(p) {
737
+ if (!isPaginated) return;
738
+ var clamped = Math.max(1, Math.min(totalPages, p));
739
+ setPage === null || setPage === void 0 ? void 0 : setPage(clamped);
740
+ };
741
+ var renderPageNumbers = function() {
742
+ var _loop = function(i) {
743
+ pages.push(/* @__PURE__ */ React8.createElement("button", {
744
+ key: i,
745
+ onClick: function() {
746
+ return goToPage(i);
747
+ },
748
+ disabled: currentPage === i,
749
+ className: "inline-flex items-center rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50"
750
+ }, i));
751
+ };
752
+ if (!isPaginated || totalPages <= 1) return null;
753
+ var pages = [];
754
+ var siblings = 1;
755
+ pages.push(/* @__PURE__ */ React8.createElement("button", {
756
+ key: 1,
757
+ onClick: function() {
758
+ return goToPage(1);
759
+ },
760
+ disabled: currentPage === 1,
761
+ className: "inline-flex items-center rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50"
762
+ }, "1"));
763
+ if (currentPage > siblings + 2) {
764
+ pages.push(/* @__PURE__ */ React8.createElement("span", {
765
+ key: "start-ellipsis",
766
+ className: "px-1 text-sm text-slate-500"
767
+ }, "..."));
768
+ }
769
+ var start = Math.max(2, currentPage - siblings);
770
+ var end = Math.min(totalPages - 1, currentPage + siblings);
771
+ for(var i = start; i <= end; i++)_loop(i);
772
+ if (currentPage < totalPages - siblings - 1) {
773
+ pages.push(/* @__PURE__ */ React8.createElement("span", {
774
+ key: "end-ellipsis",
775
+ className: "px-1 text-sm text-slate-500"
776
+ }, "..."));
777
+ }
778
+ if (totalPages > 1) {
779
+ pages.push(/* @__PURE__ */ React8.createElement("button", {
780
+ key: totalPages,
781
+ onClick: function() {
782
+ return goToPage(totalPages);
783
+ },
784
+ disabled: currentPage === totalPages,
785
+ className: "inline-flex items-center rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50"
786
+ }, totalPages));
787
+ }
788
+ return pages;
789
+ };
790
+ var renderPagination = function() {
791
+ if (!isPaginated) return null;
792
+ var align = paginationPosition.includes("left") ? "justify-start" : paginationPosition.includes("right") ? "justify-end" : "justify-center";
793
+ return /* @__PURE__ */ React8.createElement("div", {
794
+ className: "my-2 flex w-full ".concat(align)
795
+ }, /* @__PURE__ */ React8.createElement("div", {
796
+ className: "flex flex-wrap items-center justify-center gap-2"
797
+ }, /* @__PURE__ */ React8.createElement("button", {
798
+ onClick: function() {
799
+ return goToPage(currentPage - 1);
800
+ },
801
+ disabled: currentPage === 1,
802
+ className: "inline-flex items-center rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50"
803
+ }, "Previous"), renderPageNumbers(), /* @__PURE__ */ React8.createElement("button", {
804
+ onClick: function() {
805
+ return goToPage(currentPage + 1);
806
+ },
807
+ disabled: currentPage === totalPages,
808
+ className: "inline-flex items-center rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50"
809
+ }, "Next"), /* @__PURE__ */ React8.createElement("select", {
810
+ value: limit,
811
+ onChange: function(e) {
812
+ setPage === null || setPage === void 0 ? void 0 : setPage(1);
813
+ setLimit === null || setLimit === void 0 ? void 0 : setLimit(Number(e.target.value));
814
+ },
815
+ className: "ml-2 rounded-md border border-slate-300 px-2 py-1 text-sm text-slate-700"
816
+ }, [
817
+ 5,
818
+ 10,
819
+ 15
820
+ ].map(function(size) {
821
+ return /* @__PURE__ */ React8.createElement("option", {
822
+ key: size,
823
+ value: size
824
+ }, size);
825
+ })), /* @__PURE__ */ React8.createElement("span", {
826
+ className: "ml-2 text-xs text-slate-600"
827
+ }, "Page ", currentPage, " of ", totalPages, " (Total: ", totalCount, " items)")));
828
+ };
829
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, (searchable || onDownloadExcel || onDownloadPDF) && /* @__PURE__ */ React8.createElement("div", {
830
+ className: "mb-3 flex flex-wrap items-center justify-between gap-3"
831
+ }, searchable && /* @__PURE__ */ React8.createElement("div", {
832
+ className: "flex items-center gap-2"
833
+ }, /* @__PURE__ */ React8.createElement("div", {
834
+ className: "relative flex items-center"
835
+ }, /* @__PURE__ */ React8.createElement("input", {
836
+ type: "text",
837
+ placeholder: "Search...",
838
+ value: searchTerm,
839
+ onChange: handleChange,
840
+ className: "w-56 rounded-lg border border-transparent bg-white px-3 py-2 pr-8 text-sm font-medium text-[#1761A3] shadow-sm outline-none ring-1 ring-transparent transition focus:border-transparent focus:ring-2 focus:ring-emerald-400"
841
+ }), searchTerm && /* @__PURE__ */ React8.createElement("button", {
842
+ onClick: onResetSearch,
843
+ "aria-label": "Clear search",
844
+ className: "absolute right-2 flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
845
+ }, /* @__PURE__ */ React8.createElement(XMarkIcon2, {
846
+ className: "h-4 w-4"
847
+ }))), /* @__PURE__ */ React8.createElement("select", {
848
+ value: searchMode,
849
+ onChange: function(e) {
850
+ return setSearchMode(e.target.value);
851
+ },
852
+ className: "rounded-lg border border-transparent bg-white px-2 py-2 text-sm font-medium text-slate-700 shadow-sm outline-none ring-1 ring-transparent transition hover:bg-slate-50 focus:border-transparent focus:ring-2 focus:ring-emerald-400"
853
+ }, searchModeOptions.map(function(mode) {
854
+ return /* @__PURE__ */ React8.createElement("option", {
855
+ key: mode,
856
+ value: mode
857
+ }, mode === "startsWith" ? "Starts With" : "Includes");
858
+ }))), (onDownloadPDF || onDownloadExcel) && /* @__PURE__ */ React8.createElement("div", {
859
+ className: "mt-1 flex items-center gap-2"
860
+ }, onDownloadPDF && /* @__PURE__ */ React8.createElement("button", {
861
+ onClick: function() {
862
+ return onDownloadPDF(data, headers);
863
+ },
864
+ className: "inline-flex items-center gap-1 rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90"
865
+ }, /* @__PURE__ */ React8.createElement(ArrowDownOnSquareIcon2, {
866
+ className: "h-5 w-5"
867
+ })), onDownloadExcel && /* @__PURE__ */ React8.createElement("button", {
868
+ onClick: function() {
869
+ return onDownloadExcel(data, headers);
870
+ },
871
+ className: "inline-flex items-center gap-1 rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90"
872
+ }, /* @__PURE__ */ React8.createElement(ArrowDownOnSquareIcon2, {
873
+ className: "h-5 w-5"
874
+ }), /* @__PURE__ */ React8.createElement("span", null, "Excel")))), paginationPosition.startsWith("top") && data.length > 0 && renderPagination(), /* @__PURE__ */ React8.createElement("div", {
875
+ className: "mt-1 overflow-hidden rounded-xl border border-[#1761A3] bg-white"
876
+ }, /* @__PURE__ */ React8.createElement("table", {
877
+ className: "w-full border-collapse"
878
+ }, /* @__PURE__ */ React8.createElement("thead", {
879
+ className: "bg-gradient-to-r from-[#1e73be] to-[#28a97d]"
880
+ }, /* @__PURE__ */ React8.createElement("tr", null, headers.map(function(header, idx) {
881
+ return /* @__PURE__ */ React8.createElement("th", {
882
+ key: idx,
883
+ className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white first:rounded-tl-xl last:rounded-tr-xl"
884
+ }, header.label);
885
+ }), actions && /* @__PURE__ */ React8.createElement("th", {
886
+ className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white"
887
+ }, "Actions"))), /* @__PURE__ */ React8.createElement("tbody", null, data.length > 0 ? data.map(function(row, rowIndex) {
888
+ return /* @__PURE__ */ React8.createElement("tr", {
889
+ key: rowIndex,
890
+ className: "h-[57px] border-b border-slate-200 text-sm text-slate-900 even:bg-slate-50 hover:bg-slate-100 ".concat(highlightRowColor || "")
891
+ }, headers.map(function(header, cellIdx) {
892
+ return /* @__PURE__ */ React8.createElement("td", {
893
+ key: cellIdx,
894
+ className: "px-3 py-2"
895
+ }, function() {
896
+ var value = row[header.key];
897
+ if (React8.isValidElement(value)) return value;
898
+ if (typeof value === "function") {
899
+ try {
900
+ var result = value();
901
+ if (React8.isValidElement(result)) return result;
902
+ } catch (e) {
903
+ console.warn("Error executing function in table cell:", e);
904
+ }
905
+ }
906
+ if (typeof value === "string" && value.trim().startsWith("<") && value.trim().endsWith(">")) {
907
+ return /* @__PURE__ */ React8.createElement("span", {
908
+ dangerouslySetInnerHTML: {
909
+ __html: value
910
+ }
911
+ });
912
+ }
913
+ if (Array.isArray(value)) {
914
+ if (value.some(function(item) {
915
+ return React8.isValidElement(item);
916
+ })) {
917
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, value);
918
+ }
919
+ return value.join(", ");
920
+ }
921
+ if (_instanceof(value, Date)) return value.toLocaleString();
922
+ if (typeof value === "boolean") return value ? "Yes" : "No";
923
+ if (value === null || value === void 0) return "-";
924
+ if (typeof value === "number") return value.toString();
925
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") return JSON.stringify(value);
926
+ return String(value);
927
+ }());
928
+ }), actions && /* @__PURE__ */ React8.createElement("td", {
929
+ className: "px-3 py-2"
930
+ }, actions(row)));
931
+ }) : /* @__PURE__ */ React8.createElement("tr", null, /* @__PURE__ */ React8.createElement("td", {
932
+ colSpan: headers.length + (actions ? 1 : 0),
933
+ className: "px-4 py-6 text-center text-slate-500"
934
+ }, /* @__PURE__ */ React8.createElement("div", {
935
+ className: "flex items-center justify-center gap-4"
936
+ }, /* @__PURE__ */ React8.createElement("span", null, "No records found."), onResetSearch && /* @__PURE__ */ React8.createElement("button", {
937
+ onClick: onResetSearch,
938
+ className: "inline-flex items-center gap-1 rounded-md bg-gradient-to-r from-[#1e73be] to-[#28a97d] px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90"
939
+ }, /* @__PURE__ */ React8.createElement("span", null, "Reset"), /* @__PURE__ */ React8.createElement(ArrowPathIcon2, {
940
+ className: "h-5 w-5"
941
+ })))))))), paginationPosition.startsWith("bottom") && data.length > 0 && renderPagination());
942
+ };
943
+ TableTailwind.displayName = "TableTailwind";
944
+ // src/components/TooltipTailwindCSS.tsx
945
+ import React9, { useState as useState6 } from "react";
946
+ var Tooltip = function(param) {
947
+ var text = param.text, _param_position = param.position, position = _param_position === void 0 ? "top" : _param_position, children = param.children, _param_variant = param.variant, variant = _param_variant === void 0 ? "default" : _param_variant, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, _param_textColor = param.textColor, textColor = _param_textColor === void 0 ? "text-gray-800" : _param_textColor, _param_backgroundColor = param.backgroundColor, backgroundColor = _param_backgroundColor === void 0 ? "bg-[rgba(23,97,163,1)] bg-gradient-to-r from-[rgba(23,97,163,1)] to-[rgba(77,175,131,1)]" : _param_backgroundColor, image = param.image, animation = param.animation;
948
+ var _useState6 = _sliced_to_array(useState6(false), 2), visible = _useState6[0], setVisible = _useState6[1];
949
+ var _useState61 = _sliced_to_array(useState6(false), 2), showAnimation = _useState61[0], setShowAnimation = _useState61[1];
950
+ var showTooltip = function() {
951
+ setVisible(true);
952
+ if (animation) {
953
+ var delay = animation.triggerDelay || 100;
954
+ setTimeout(function() {
955
+ return setShowAnimation(true);
956
+ }, delay);
957
+ }
958
+ };
959
+ var hideTooltip = function() {
960
+ setVisible(false);
961
+ setShowAnimation(false);
962
+ };
963
+ var containerClasses = "relative inline-block ".concat(className);
964
+ var defaultTooltipClasses = "\n absolute z-50 \n font-poppins \n font-medium \n \n text-[rgba(255,255,255,1)]\n text-[10px] \n leading-normal \n not-italic\n rounded \n shadow-sm \n transition-opacity \n duration-200\n w-[98px] \n h-[26px] \n flex-shrink-0 flex \n items-center \n justify-center\n bg-[rgba(23,97,163,1)] \n bg-gradient-to-r from-[rgba(23,97,163,1)] to-[rgba(77,175,131,1)]\n ".concat(visible ? "opacity-100" : "opacity-0 pointer-events-none", "\n ").concat(image ? "" : "px-3 py-3", "\n ");
965
+ var transparentTooltipClasses = "\n absolute z-50 font-medium ".concat(textColor, "\n rounded transition-all duration-200\n ").concat(visible ? "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none", "\n ").concat(image ? "p-1" : "px-3 py-2", "\n ");
966
+ var positionClasses = {
967
+ top: "bottom-full left-1/2 transform -translate-x-1/2 -translate-y-2 mb-2",
968
+ right: "left-full top-1/2 transform -translate-y-1/2 translate-x-2 ml-2",
969
+ bottom: "top-full left-1/2 transform -translate-x-1/2 translate-y-2 mt-2",
970
+ left: "right-full top-1/2 transform -translate-y-1/2 -translate-x-2 mr-2"
971
+ };
972
+ var arrowBaseClasses = "absolute w-2 h-2 transform rotate-45";
973
+ var arrowPositionClasses = {
974
+ top: "bottom-[-4px] left-1/2 transform -translate-x-1/2",
975
+ right: "left-[-4px] top-1/2 transform -translate-y-1/2",
976
+ bottom: "top-[-4px] left-1/2 transform -translate-x-1/2",
977
+ left: "right-[-4px] top-1/2 transform -translate-y-1/2"
978
+ };
979
+ var arrowBackgroundClass = "bg-[rgba(23,97,163,1)]";
980
+ var tooltipClasses = variant === "transparent" ? "".concat(transparentTooltipClasses, " ").concat(positionClasses[position]) : "".concat(defaultTooltipClasses, " ").concat(positionClasses[position]);
981
+ var renderTooltipContent = function() {
982
+ if (image) {
983
+ return /* @__PURE__ */ React9.createElement("img", {
984
+ src: image.src,
985
+ alt: image.alt || "Tooltip image",
986
+ width: image.width || 200,
987
+ height: image.height || 150,
988
+ className: "rounded-md object-cover",
989
+ loading: "lazy"
990
+ });
991
+ }
992
+ return text;
993
+ };
994
+ var renderAnimation = function() {
995
+ if (!animation || !showAnimation) return null;
996
+ var AnimationComponent = animation.component;
997
+ return /* @__PURE__ */ React9.createElement(AnimationComponent, _object_spread({
998
+ isActive: showAnimation
999
+ }, animation.props));
1000
+ };
1001
+ return /* @__PURE__ */ React9.createElement("div", {
1002
+ className: containerClasses,
1003
+ onMouseEnter: showTooltip,
1004
+ onMouseLeave: hideTooltip,
1005
+ onFocus: showTooltip,
1006
+ onBlur: hideTooltip
1007
+ }, children, renderAnimation(), /* @__PURE__ */ React9.createElement("div", {
1008
+ className: tooltipClasses,
1009
+ role: "tooltip"
1010
+ }, renderTooltipContent(), variant === "default" && !image && /* @__PURE__ */ React9.createElement("div", {
1011
+ className: "".concat(arrowBaseClasses, " ").concat(arrowPositionClasses[position], " ").concat(arrowBackgroundClass, " rounded-sm")
1012
+ })));
1013
+ };
1014
+ Tooltip.displayName = "Tooltip";
1015
+ // src/components/Dropdown.tsx
1016
+ import React10, { useState as useState7 } from "react";
1017
+ var variantStyles = {
1018
+ basic: "bg-blue-600 text-white hover:bg-blue-700",
1019
+ outline: "border border-blue-600 text-blue-600 hover:bg-blue-50",
1020
+ pill: "bg-blue-600 text-white rounded-full hover:bg-blue-700",
1021
+ dark: "bg-gray-800 text-white hover:bg-gray-700",
1022
+ underline: "border-b-2 border-blue-500 bg-transparent text-blue-700 hover:bg-blue-50",
1023
+ shadow: "bg-white text-gray-700 shadow-md hover:shadow-lg border border-gray-200",
1024
+ glass: "bg-white/20 backdrop-blur-md text-white border border-white/40 hover:bg-white/30",
1025
+ gradient: "bg-gradient-to-r from-blue-500 to-purple-500 text-white hover:opacity-90"
1026
+ };
1027
+ var Dropdown = function(param) {
1028
+ var options = param.options, onSelect = param.onSelect, _param_variant = param.variant, variant = _param_variant === void 0 ? "basic" : _param_variant;
1029
+ var _useState7 = _sliced_to_array(useState7(false), 2), open = _useState7[0], setOpen = _useState7[1];
1030
+ var _useState71 = _sliced_to_array(useState7(null), 2), selected = _useState71[0], setSelected = _useState71[1];
1031
+ var handleSelect = function(option) {
1032
+ setSelected(option);
1033
+ onSelect(option);
1034
+ setOpen(false);
1035
+ };
1036
+ return /* @__PURE__ */ React10.createElement("div", {
1037
+ className: "relative w-56"
1038
+ }, /* @__PURE__ */ React10.createElement("button", {
1039
+ onClick: function() {
1040
+ return setOpen(!open);
1041
+ },
1042
+ className: "w-full text-left px-4 py-2 rounded-md transition-all duration-200 ".concat(variantStyles[variant])
1043
+ }, selected || "Select an option"), open && /* @__PURE__ */ React10.createElement("div", {
1044
+ className: "absolute mt-2 w-full bg-white border border-gray-200 rounded-md shadow-lg z-20"
1045
+ }, options.map(function(opt, idx) {
1046
+ return /* @__PURE__ */ React10.createElement("div", {
1047
+ key: idx,
1048
+ onClick: function() {
1049
+ return handleSelect(opt);
1050
+ },
1051
+ className: "px-4 py-2 cursor-pointer hover:bg-gray-100 text-gray-700"
1052
+ }, opt);
1053
+ })));
1054
+ };
1055
+ Dropdown.displayName = "Dropdown";
1056
+ export { Button as MahatiButton, Card as MahatiCard, Dropdown as MahatiDropdown, FormContainer as MahatiFormContainer, Input as MahatiInput, Modal as MahatiModal, TabbedInterface as MahatiTabbedInterface, Table as MahatiTable, TableTailwind as MahatiTableTailwind, Tooltip as MahatiTooltip };
1057
+ //# sourceMappingURL=index.mjs.map