@mci-ui/mci-ui 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,1190 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Breadcrumb: () => Breadcrumb,
24
+ Button: () => Button,
25
+ Collapse: () => Collapse,
26
+ InputMain: () => InputMain,
27
+ MciTable: () => MciTable,
28
+ Modal: () => Modal,
29
+ Pagination: () => Pagination,
30
+ Skeleton: () => Skeleton,
31
+ TabPanel: () => TabPanel,
32
+ Tabs: () => Tabs,
33
+ Tag: () => Tag,
34
+ Textarea: () => Textarea,
35
+ ToastContainer: () => ToastContainer,
36
+ Tooltip: () => Tooltip
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/shared/ui/breadcrumb/Breadcrumb.tsx
41
+ var import_lucide_react = require("lucide-react");
42
+
43
+ // src/shared/lib/utils.ts
44
+ var import_clsx = require("clsx");
45
+ var import_tailwind_merge = require("tailwind-merge");
46
+ function cn(...inputs) {
47
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
48
+ }
49
+ function useEscapeKey(callback) {
50
+ const handleEscape = (e) => {
51
+ if (e.key === "Escape") callback();
52
+ };
53
+ return { handleEscape };
54
+ }
55
+ function useClickOutside(ref, callback) {
56
+ const handleClick = (e) => {
57
+ if (ref.current && !ref.current.contains(e.target)) {
58
+ callback();
59
+ }
60
+ };
61
+ return { handleClick };
62
+ }
63
+
64
+ // src/shared/ui/breadcrumb/Breadcrumb.tsx
65
+ var import_jsx_runtime = require("react/jsx-runtime");
66
+ function Breadcrumb({
67
+ items,
68
+ className,
69
+ separatorIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronRight, { className: "w-4 h-4 text-gray-400 dark:text-gray-500" })
70
+ }) {
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
+ "nav",
73
+ {
74
+ className: cn(
75
+ "flex items-center space-x-2 text-sm font-medium text-gray-600 dark:text-gray-300",
76
+ className
77
+ ),
78
+ "aria-label": "Breadcrumb",
79
+ children: items.map((item, index) => {
80
+ const isLast = index === items.length - 1;
81
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center", children: [
82
+ item.href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ "a",
84
+ {
85
+ href: item.href,
86
+ onClick: item.onClick,
87
+ className: cn(
88
+ "hover:text-primary-600 dark:hover:text-primary-400 transition-colors",
89
+ isLast && "text-primary-600 dark:text-primary-400"
90
+ ),
91
+ children: item.label
92
+ }
93
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
94
+ "span",
95
+ {
96
+ className: cn(
97
+ isLast ? "text-primary-600 dark:text-primary-400" : "text-gray-500 dark:text-gray-400"
98
+ ),
99
+ children: item.label
100
+ }
101
+ ),
102
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mx-2 flex items-center", children: separatorIcon })
103
+ ] }, index);
104
+ })
105
+ }
106
+ );
107
+ }
108
+
109
+ // src/shared/ui/button/Button.tsx
110
+ var import_lucide_react2 = require("lucide-react");
111
+ var import_jsx_runtime2 = require("react/jsx-runtime");
112
+ function Button({
113
+ text,
114
+ icon,
115
+ iconPosition = "left",
116
+ size = "md",
117
+ variant = "accent",
118
+ loading = false,
119
+ disabled = false,
120
+ onClick,
121
+ className
122
+ }) {
123
+ const sizes2 = {
124
+ sm: "h-[38px] px-3 text-sm gap-2",
125
+ md: "h-[48px] px-4 text-base gap-2.5",
126
+ lg: "h-[56px] px-5 text-lg gap-3"
127
+ };
128
+ const variants2 = {
129
+ primary: `
130
+ bg-secondary-500
131
+ hover:bg-secondary-600
132
+ active:bg-secondary-700
133
+ hover:shadow-lg
134
+ hover:shadow-secondary-500/30
135
+ active:scale-[0.98]
136
+ text-white
137
+ `,
138
+ secondary: `
139
+ bg-secondary-50
140
+ hover:bg-secondary-100
141
+ active:bg-secondary-200
142
+ hover:shadow-md
143
+ hover:shadow-secondary-500/10
144
+ active:scale-[0.98]
145
+ text-secondary-700
146
+ border border-secondary-200
147
+ hover:border-secondary-300
148
+ `,
149
+ accent: `
150
+ bg-accent-500
151
+ hover:bg-accent-600
152
+ active:bg-accent-700
153
+ hover:shadow-lg
154
+ hover:shadow-accent-500/30
155
+ active:scale-[0.98]
156
+ text-white
157
+ `
158
+ };
159
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
160
+ "button",
161
+ {
162
+ onClick,
163
+ disabled: disabled || loading,
164
+ className: cn(
165
+ "inline-flex items-center justify-center rounded-[7px] font-medium",
166
+ "transition-all duration-300 ease-in-out",
167
+ "transform hover:-translate-y-0.5",
168
+ "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:hover:shadow-none",
169
+ "focus:outline-none focus:ring-2 focus:ring-offset-2",
170
+ variant === "primary" && "focus:ring-secondary-500",
171
+ variant === "secondary" && "focus:ring-secondary-400",
172
+ variant === "accent" && "focus:ring-accent-500",
173
+ variants2[variant],
174
+ sizes2[size],
175
+ className
176
+ ),
177
+ children: [
178
+ icon && iconPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex items-center justify-center transition-transform duration-300 ease-in-out group-hover:scale-110", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Loader, { className: "animate-spin", size: 20 }) : icon }),
179
+ text && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "transition-all duration-300", children: text }),
180
+ icon && iconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex items-center justify-center transition-transform duration-300 ease-in-out group-hover:scale-110", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Loader, { className: "animate-spin", size: 20 }) : icon }),
181
+ loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Loader, { className: "animate-spin", size: 20 })
182
+ ]
183
+ }
184
+ );
185
+ }
186
+
187
+ // src/shared/ui/collapse/Collapse.tsx
188
+ var import_lucide_react3 = require("lucide-react");
189
+ var import_react = require("react");
190
+ var import_jsx_runtime3 = require("react/jsx-runtime");
191
+ function Collapse({
192
+ title,
193
+ children,
194
+ defaultOpen = false,
195
+ icon,
196
+ variant = "primary",
197
+ className,
198
+ titleClassName,
199
+ contentClassName
200
+ }) {
201
+ const [isOpen, setIsOpen] = (0, import_react.useState)(defaultOpen);
202
+ const [contentHeight, setContentHeight] = (0, import_react.useState)(0);
203
+ const contentRef = (0, import_react.useRef)(null);
204
+ (0, import_react.useEffect)(() => {
205
+ if (contentRef.current) {
206
+ setContentHeight(isOpen ? contentRef.current.scrollHeight : 0);
207
+ }
208
+ }, [isOpen]);
209
+ const variantClasses = {
210
+ primary: {
211
+ title: "bg-secondary-50 hover:bg-secondary-100 border-secondary-200 text-secondary-800",
212
+ content: "bg-secondary-25 border-secondary-100"
213
+ },
214
+ secondary: {
215
+ title: "bg-accent-50 hover:bg-accent-100 border-accent-200 text-accent-800",
216
+ content: "bg-accent-25 border-accent-100"
217
+ },
218
+ accent: {
219
+ title: "bg-gray-50 hover:bg-gray-100 border-gray-200 text-gray-800",
220
+ content: "bg-gray-25 border-gray-100"
221
+ }
222
+ };
223
+ const variantConfig = variantClasses[variant];
224
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cn("border rounded-lg overflow-hidden", className), children: [
225
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
226
+ "button",
227
+ {
228
+ onClick: () => setIsOpen(!isOpen),
229
+ className: cn(
230
+ "w-full flex items-center justify-between p-4 transition-all duration-300",
231
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-blue-500",
232
+ "border-b",
233
+ variantConfig.title
234
+ ),
235
+ children: [
236
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-3", children: [
237
+ icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "flex-shrink-0", children: icon }),
238
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn("font-medium text-left", titleClassName), children: title })
239
+ ] }),
240
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
241
+ import_lucide_react3.ChevronDownIcon,
242
+ {
243
+ className: cn(
244
+ "w-5 h-5 transition-transform duration-300 flex-shrink-0",
245
+ isOpen && "rotate-180"
246
+ )
247
+ }
248
+ )
249
+ ]
250
+ }
251
+ ),
252
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
253
+ "div",
254
+ {
255
+ className: cn(
256
+ "transition-all duration-300 ease-out overflow-hidden",
257
+ variantConfig.content
258
+ ),
259
+ style: {
260
+ height: `${contentHeight}px`
261
+ },
262
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: contentRef, className: cn("p-4", contentClassName), children })
263
+ }
264
+ )
265
+ ] });
266
+ }
267
+
268
+ // src/shared/ui/inputMain/InputMain.tsx
269
+ var import_lucide_react4 = require("lucide-react");
270
+ var import_react2 = require("react");
271
+ var import_jsx_runtime4 = require("react/jsx-runtime");
272
+ function InputMain({
273
+ label,
274
+ placeholder,
275
+ type = "text",
276
+ icon,
277
+ iconPosition = "left",
278
+ size = "md",
279
+ error,
280
+ success,
281
+ disabled = false,
282
+ required = false,
283
+ value,
284
+ onChange,
285
+ onFocus,
286
+ onBlur,
287
+ className
288
+ }) {
289
+ const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
290
+ const [internalValue, setInternalValue] = (0, import_react2.useState)("");
291
+ const [showPassword, setShowPassword] = (0, import_react2.useState)(false);
292
+ const [autoFilled, setAutoFilled] = (0, import_react2.useState)(false);
293
+ const currentValue = value ?? internalValue;
294
+ const hasValue = Boolean(currentValue) || autoFilled;
295
+ const isPassword = type === "password";
296
+ const handleFocus = () => {
297
+ setIsFocused(true);
298
+ onFocus?.();
299
+ };
300
+ const handleBlur = () => {
301
+ setIsFocused(false);
302
+ onBlur?.();
303
+ };
304
+ const handleChange = (e) => {
305
+ if (value === void 0) setInternalValue(e.target.value);
306
+ onChange?.(e);
307
+ };
308
+ const togglePassword = () => setShowPassword((p) => !p);
309
+ const sizes2 = (0, import_react2.useMemo)(
310
+ () => ({
311
+ sm: {
312
+ input: "h-[38px] text-sm",
313
+ padding: icon ? iconPosition === "left" ? "pl-10 pr-3" : "pl-3 pr-10" : "px-3",
314
+ icon: "w-4 h-4",
315
+ iconWrapper: iconPosition === "left" ? "left-3" : "right-3",
316
+ labelFont: "text-xs"
317
+ },
318
+ md: {
319
+ input: "h-[48px] text-base",
320
+ padding: icon ? iconPosition === "left" ? "pl-12 pr-4" : "pl-4 pr-12" : "px-4",
321
+ icon: "w-5 h-5",
322
+ iconWrapper: iconPosition === "left" ? "left-3.5" : "right-3.5",
323
+ labelFont: "text-sm"
324
+ },
325
+ lg: {
326
+ input: "h-[56px] text-lg",
327
+ padding: icon ? iconPosition === "left" ? "pl-14 pr-5" : "pl-5 pr-14" : "px-5",
328
+ icon: "w-6 h-6",
329
+ iconWrapper: iconPosition === "left" ? "left-4" : "right-4",
330
+ labelFont: "text-base"
331
+ }
332
+ }),
333
+ [icon, iconPosition]
334
+ );
335
+ const stateStyles = (0, import_react2.useMemo)(() => {
336
+ if (error)
337
+ return "border-error-500 focus:border-error-600 focus:ring-error-500/20";
338
+ if (success)
339
+ return "border-success-500 focus:border-success-600 focus:ring-success-500/20";
340
+ return "border-gray-300 hover:border-gray-400 focus:border-accent-500 focus:ring-accent-500/20";
341
+ }, [error, success]);
342
+ const handleAutoFill = (e) => {
343
+ if (e.animationName === "onAutoFillStart") {
344
+ setAutoFilled(true);
345
+ } else if (e.animationName === "onAutoFillCancel") {
346
+ setAutoFilled(false);
347
+ }
348
+ };
349
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("w-full", className), children: [
350
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex items-center", children: [
351
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
352
+ "input",
353
+ {
354
+ type: isPassword && showPassword ? "text" : type,
355
+ value: currentValue,
356
+ onChange: handleChange,
357
+ onFocus: handleFocus,
358
+ onBlur: handleBlur,
359
+ onAnimationStart: handleAutoFill,
360
+ disabled,
361
+ placeholder: label ? "" : placeholder,
362
+ required,
363
+ className: cn(
364
+ "w-full rounded-[7px] border bg-white font-medium outline-none transition-all duration-300 ease-in-out",
365
+ "focus:ring-4 disabled:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 autofill:shadow-[inset_0_0_0px_1000px_white]",
366
+ sizes2[size].input,
367
+ sizes2[size].padding,
368
+ stateStyles
369
+ ),
370
+ autoComplete: "on"
371
+ }
372
+ ),
373
+ label && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
374
+ "label",
375
+ {
376
+ className: cn(
377
+ "absolute pointer-events-none transition-all duration-300 ease-in-out font-medium",
378
+ icon && iconPosition === "left" && !hasValue && !isFocused ? sizes2[size].padding : "left-4",
379
+ isFocused || hasValue ? cn(
380
+ "top-0 -translate-y-1/2 bg-white px-2",
381
+ sizes2[size].labelFont,
382
+ error ? "text-error-600" : success ? "text-success-600" : "text-accent-600"
383
+ ) : cn(
384
+ "top-1/2 -translate-y-1/2 text-gray-500",
385
+ sizes2[size].input.includes("38") && "text-sm",
386
+ sizes2[size].input.includes("48") && "text-base",
387
+ sizes2[size].input.includes("56") && "text-lg"
388
+ )
389
+ ),
390
+ children: [
391
+ label,
392
+ required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-error-500 ml-1", children: "*" })
393
+ ]
394
+ }
395
+ ),
396
+ icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
397
+ "div",
398
+ {
399
+ className: cn(
400
+ "absolute top-1/2 -translate-y-1/2 flex items-center transition-all duration-300",
401
+ sizes2[size].iconWrapper,
402
+ error ? "text-error-500" : success ? "text-success-500" : isFocused ? "text-accent-500" : "text-gray-400"
403
+ ),
404
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: cn(sizes2[size].icon, "mr-2"), children: icon })
405
+ }
406
+ ),
407
+ isPassword && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
408
+ "button",
409
+ {
410
+ type: "button",
411
+ onClick: togglePassword,
412
+ className: cn(
413
+ "absolute top-1/2 -translate-y-1/2 flex items-center justify-center text-gray-400 hover:text-gray-600 transition-all",
414
+ "right-3"
415
+ ),
416
+ children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.EyeOff, { className: cn(sizes2[size].icon) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Eye, { className: cn(sizes2[size].icon) })
417
+ }
418
+ )
419
+ ] }),
420
+ error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mt-1.5 text-sm text-error-600 flex items-center gap-1 animate-[slideDown_0.3s_ease-out]", children: error }),
421
+ success && !error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mt-1.5 text-sm text-success-600 flex items-center gap-1 animate-[slideDown_0.3s_ease-out]", children: success }),
422
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
423
+ input {
424
+ animation-name: onAutoFillCancel;
425
+ }
426
+ input:-webkit-autofill {
427
+ animation-name: onAutoFillStart;
428
+ }
429
+ @keyframes onAutoFillStart {}
430
+ @keyframes onAutoFillCancel {}
431
+ ` })
432
+ ] });
433
+ }
434
+
435
+ // src/shared/ui/mciTable/MciTable.tsx
436
+ var import_lucide_react9 = require("lucide-react");
437
+ var import_react7 = require("react");
438
+
439
+ // src/shared/ui/modal/Modal.tsx
440
+ var import_lucide_react5 = require("lucide-react");
441
+ var import_react3 = require("react");
442
+ var import_jsx_runtime5 = require("react/jsx-runtime");
443
+ function Modal({
444
+ show,
445
+ setShow,
446
+ title,
447
+ Header,
448
+ Body,
449
+ footer
450
+ }) {
451
+ const modalRef = (0, import_react3.useRef)(null);
452
+ const { handleEscape } = useEscapeKey(() => setShow(false));
453
+ (0, import_react3.useEffect)(() => {
454
+ if (show) {
455
+ document.addEventListener("keydown", handleEscape);
456
+ document.body.style.overflow = "hidden";
457
+ } else {
458
+ document.body.style.overflow = "unset";
459
+ }
460
+ return () => document.removeEventListener("keydown", handleEscape);
461
+ }, [show, handleEscape]);
462
+ const { handleClick } = useClickOutside(modalRef, () => setShow(false));
463
+ (0, import_react3.useEffect)(() => {
464
+ if (show) document.addEventListener("mousedown", handleClick);
465
+ return () => document.removeEventListener("mousedown", handleClick);
466
+ }, [show, handleClick]);
467
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
468
+ "div",
469
+ {
470
+ className: cn(
471
+ "fixed inset-0 z-50 flex items-center justify-center p-4 bg-secondary-100/50 backdrop-blur-sm transition-all duration-500 ease-in-out",
472
+ show ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"
473
+ ),
474
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
475
+ "div",
476
+ {
477
+ ref: modalRef,
478
+ className: cn(
479
+ "relative w-full max-w-lg rounded-[7px] shadow-xl bg-secondary-50 text-gray-800",
480
+ "transform transition-all duration-500 ease-out",
481
+ show ? "opacity-100 scale-100" : "opacity-0 scale-90"
482
+ ),
483
+ children: [
484
+ (Header || title) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-secondary-300", children: [
485
+ Header || /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "text-xl font-semibold text-gray-800", children: title }),
486
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
487
+ "button",
488
+ {
489
+ onClick: () => setShow(false),
490
+ className: "text-gray-800 hover:text-secondary-300 active:animate-spin transition",
491
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react5.X, { className: "w-5 h-5" })
492
+ }
493
+ )
494
+ ] }),
495
+ Body && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-6 py-4 max-h-96 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300", children: Body }),
496
+ footer && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex items-center justify-end gap-3 px-6 py-4 border-t border-secondary-300", children: footer })
497
+ ]
498
+ }
499
+ )
500
+ }
501
+ );
502
+ }
503
+
504
+ // src/shared/ui/pagination/Pagination.tsx
505
+ var import_lucide_react6 = require("lucide-react");
506
+ var import_jsx_runtime6 = require("react/jsx-runtime");
507
+ function Pagination({
508
+ totalItems,
509
+ currentPage,
510
+ perPage,
511
+ onPageChange,
512
+ onPerPageChange,
513
+ siblingCount = 1,
514
+ perPageOptions = [10, 20, 30],
515
+ showPerPage = true
516
+ }) {
517
+ const totalPages = Math.ceil(totalItems / perPage);
518
+ const createPageRange = () => {
519
+ const totalPageNumbers = siblingCount * 2 + 5;
520
+ if (totalPages <= totalPageNumbers) {
521
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
522
+ }
523
+ const leftSiblingIndex = Math.max(currentPage - siblingCount, 2);
524
+ const rightSiblingIndex = Math.min(
525
+ currentPage + siblingCount,
526
+ totalPages - 1
527
+ );
528
+ const showLeftDots = leftSiblingIndex > 2;
529
+ const showRightDots = rightSiblingIndex < totalPages - 1;
530
+ const range = [1];
531
+ if (showLeftDots) range.push("...");
532
+ for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {
533
+ range.push(i);
534
+ }
535
+ if (showRightDots) range.push("...");
536
+ range.push(totalPages);
537
+ return range;
538
+ };
539
+ const pages = createPageRange();
540
+ const handlePrev = () => {
541
+ if (currentPage > 1) onPageChange(currentPage - 1);
542
+ };
543
+ const handleNext = () => {
544
+ if (currentPage < totalPages) onPageChange(currentPage + 1);
545
+ };
546
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w-full flex flex-col md:flex-row md:justify-between md:items-center gap-4 py-4", children: [
547
+ showPerPage && onPerPageChange && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex justify-center md:justify-start w-full md:w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
548
+ "select",
549
+ {
550
+ value: perPage,
551
+ onChange: (e) => onPerPageChange(Number(e.target.value)),
552
+ className: "border rounded-lg px-3 py-2 text-sm bg-white\n hover:border-secondary-500 \n focus:outline-none focus:ring-2 focus:ring-secondary-500\n transition-all duration-200",
553
+ children: perPageOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("option", { value: option, children: [
554
+ option,
555
+ " / page"
556
+ ] }, option))
557
+ }
558
+ ) }),
559
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-center md:justify-end w-full", children: [
560
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
561
+ "button",
562
+ {
563
+ onClick: handlePrev,
564
+ disabled: currentPage === 1,
565
+ className: `flex items-center justify-center rounded-xl border px-3 py-2 transition-all duration-200
566
+ ${currentPage === 1 ? "opacity-40 cursor-not-allowed" : "hover:bg-secondary-100 hover:text-secondary-700"}`,
567
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.ChevronLeft, { size: 18 })
568
+ }
569
+ ),
570
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center gap-1 mx-2", children: pages.map((page, idx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
571
+ "button",
572
+ {
573
+ onClick: () => typeof page === "number" && onPageChange(page),
574
+ disabled: page === "...",
575
+ className: `min-w-[40px] rounded-xl border px-3 py-2 text-sm font-medium transition-all duration-200
576
+ ${page === currentPage ? "bg-secondary-500 text-white shadow-md" : page === "..." ? "cursor-default border-none text-gray-400" : "bg-white text-secondary-700 hover:bg-secondary-100"}`,
577
+ children: page
578
+ },
579
+ idx
580
+ )) }),
581
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
582
+ "button",
583
+ {
584
+ onClick: handleNext,
585
+ disabled: currentPage === totalPages,
586
+ className: `flex items-center justify-center rounded-xl border px-3 py-2 transition-all duration-200
587
+ ${currentPage === totalPages ? "opacity-40 cursor-not-allowed" : "hover:bg-secondary-100 hover:text-secondary-700"}`,
588
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react6.ChevronRight, { size: 18 })
589
+ }
590
+ )
591
+ ] })
592
+ ] });
593
+ }
594
+
595
+ // src/shared/ui/skeleton/Skeleton.tsx
596
+ var import_jsx_runtime7 = require("react/jsx-runtime");
597
+ function Skeleton({
598
+ className,
599
+ variant = "default",
600
+ width = "100%",
601
+ height = "1rem"
602
+ }) {
603
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
604
+ "div",
605
+ {
606
+ className: cn(
607
+ "relative overflow-hidden bg-secondary-200 dark:bg-secondary-800",
608
+ "rounded-sm",
609
+ variant === "circle" && "rounded-full",
610
+ variant === "rounded" && "rounded-md",
611
+ className
612
+ ),
613
+ style: {
614
+ width: typeof width === "number" ? `${width}px` : width,
615
+ height: typeof height === "number" ? `${height}px` : height
616
+ },
617
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute inset-0 shimmer-mask" })
618
+ }
619
+ );
620
+ }
621
+
622
+ // src/shared/ui/tabs/Tabs.tsx
623
+ var import_react4 = require("react");
624
+ var import_jsx_runtime8 = require("react/jsx-runtime");
625
+ function Tabs({
626
+ tabs,
627
+ defaultTab,
628
+ position = "top",
629
+ variant = "primary",
630
+ className,
631
+ onChange
632
+ }) {
633
+ const [activeTab, setActiveTab] = (0, import_react4.useState)(defaultTab || tabs[0]?.id);
634
+ const [indicatorStyle, setIndicatorStyle] = (0, import_react4.useState)({});
635
+ const tabsRef = (0, import_react4.useRef)([]);
636
+ (0, import_react4.useEffect)(() => {
637
+ const activeIndex = tabs.findIndex((tab) => tab.id === activeTab);
638
+ const activeTabElement = tabsRef.current[activeIndex];
639
+ if (activeTabElement) {
640
+ const { offsetLeft, offsetTop, offsetWidth, offsetHeight } = activeTabElement;
641
+ setIndicatorStyle({
642
+ left: offsetLeft,
643
+ top: offsetTop,
644
+ width: offsetWidth,
645
+ height: offsetHeight,
646
+ transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
647
+ });
648
+ }
649
+ }, [activeTab, position, tabs]);
650
+ const containerClasses = {
651
+ top: "flex-col",
652
+ bottom: "flex-col-reverse",
653
+ left: "flex-row",
654
+ right: "flex-row-reverse"
655
+ };
656
+ const tabsContainerClasses = {
657
+ top: "flex-row",
658
+ bottom: "flex-row",
659
+ left: "flex-col",
660
+ right: "flex-col"
661
+ };
662
+ const contentClasses = {
663
+ top: "mt-6",
664
+ bottom: "mb-6",
665
+ left: "ml-6",
666
+ right: "mr-6"
667
+ };
668
+ const variantClasses = {
669
+ primary: {
670
+ active: "text-secondary-600",
671
+ inactive: "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",
672
+ disabled: "text-gray-300 dark:text-gray-600 cursor-not-allowed",
673
+ bg: "bg-secondary-100 dark:bg-secondary-900"
674
+ },
675
+ secondary: {
676
+ active: "text-accent-600",
677
+ inactive: "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",
678
+ disabled: "text-gray-300 dark:text-gray-600 cursor-not-allowed",
679
+ bg: "bg-accent-100 dark:bg-accent-900"
680
+ },
681
+ accent: {
682
+ active: "text-gray-800 dark:text-gray-200",
683
+ inactive: "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",
684
+ disabled: "text-gray-300 dark:text-gray-600 cursor-not-allowed",
685
+ bg: "bg-gray-100 dark:bg-gray-800"
686
+ }
687
+ };
688
+ const isVertical = position === "left" || position === "right";
689
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("flex w-full", containerClasses[position], className), children: [
690
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
691
+ "div",
692
+ {
693
+ className: cn(
694
+ "flex relative bg-gray-50 dark:bg-gray-900 rounded-lg p-1",
695
+ tabsContainerClasses[position],
696
+ isVertical ? "min-w-48" : "w-full"
697
+ ),
698
+ children: [
699
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
700
+ "div",
701
+ {
702
+ className: cn(
703
+ "absolute rounded-md transition-all duration-300 ease-out",
704
+ variantClasses[variant].bg,
705
+ isVertical ? "w-full" : "h-full"
706
+ ),
707
+ style: indicatorStyle
708
+ }
709
+ ),
710
+ tabs.map((tab, index) => {
711
+ const isActive = activeTab === tab.id;
712
+ const variantConfig = variantClasses[variant];
713
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
714
+ "button",
715
+ {
716
+ ref: (el) => {
717
+ tabsRef.current[index] = el;
718
+ },
719
+ onClick: () => {
720
+ if (!tab.disabled) {
721
+ setActiveTab(tab.id);
722
+ onChange?.(tab.id);
723
+ }
724
+ },
725
+ disabled: tab.disabled,
726
+ className: cn(
727
+ "relative flex items-center justify-center gap-2 px-4 py-3 font-medium",
728
+ "text-sm whitespace-nowrap transition-all duration-200 z-10",
729
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500",
730
+ "rounded-md",
731
+ isActive ? [variantConfig.active, "font-semibold"] : [
732
+ variantConfig.inactive,
733
+ "hover:bg-white/50 dark:hover:bg-gray-800/50"
734
+ ],
735
+ tab.disabled && variantConfig.disabled,
736
+ isVertical ? "w-full justify-start" : "flex-1"
737
+ ),
738
+ children: [
739
+ tab.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
740
+ "span",
741
+ {
742
+ className: cn(
743
+ "flex-shrink-0 transition-transform duration-200",
744
+ isActive && "scale-110"
745
+ ),
746
+ children: tab.icon
747
+ }
748
+ ),
749
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "relative z-10", children: tab.label })
750
+ ]
751
+ },
752
+ tab.id
753
+ );
754
+ })
755
+ ]
756
+ }
757
+ ),
758
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("flex-1 overflow-hidden", contentClasses[position]), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "animate-fade-in", children: tabs.find((tab) => tab.id === activeTab)?.content }, activeTab) })
759
+ ] });
760
+ }
761
+ function TabPanel({ children, className }) {
762
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
763
+ "div",
764
+ {
765
+ className: cn(
766
+ "p-6 rounded-lg bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700",
767
+ className
768
+ ),
769
+ children
770
+ }
771
+ );
772
+ }
773
+
774
+ // src/shared/ui/tag/Tag.tsx
775
+ var import_lucide_react7 = require("lucide-react");
776
+ var import_jsx_runtime9 = require("react/jsx-runtime");
777
+ var sizes = {
778
+ sm: "text-xs px-2 py-0.5",
779
+ md: "text-sm px-3 py-1",
780
+ lg: "text-base px-4 py-1.5"
781
+ };
782
+ var iconSizes = {
783
+ sm: "w-3 h-3",
784
+ md: "w-4 h-4",
785
+ lg: "w-5 h-5"
786
+ };
787
+ var variants = {
788
+ default: "bg-gray-100 text-gray-800 border border-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:border-gray-700",
789
+ secondary: "bg-secondary-100 text-secondary-800 border border-secondary-200 dark:bg-secondary-800 dark:text-secondary-50 dark:border-secondary-700",
790
+ success: "bg-success-100 text-success-800 border border-success-200 dark:bg-success-800 dark:text-success-50 dark:border-success-700",
791
+ error: "bg-error-100 text-error-800 border border-error-200 dark:bg-error-800 dark:text-error-50 dark:border-error-700",
792
+ info: "bg-info-100 text-info-800 border border-info-200 dark:bg-info-800 dark:text-info-50 dark:border-info-700",
793
+ accent: "bg-accent-100 text-accent-800 border border-accent-200 dark:bg-accent-800 dark:text-accent-50 dark:border-accent-700"
794
+ };
795
+ function Tag({
796
+ children,
797
+ variant = "default",
798
+ size = "md",
799
+ icon,
800
+ iconPosition = "left",
801
+ closable = false,
802
+ onClose,
803
+ className
804
+ }) {
805
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
806
+ "span",
807
+ {
808
+ className: cn(
809
+ "inline-flex items-center font-medium animate-[fadeIn_0.3s_ease-out] rounded-[7px]",
810
+ sizes[size],
811
+ variants[variant],
812
+ icon && "gap-1.5",
813
+ className
814
+ ),
815
+ children: [
816
+ icon && iconPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `flex items-center ${cn(iconSizes[size])}`, children: icon }),
817
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children }),
818
+ icon && iconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `flex items-center ${cn(iconSizes[size])}`, children: icon }),
819
+ closable && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
820
+ "button",
821
+ {
822
+ type: "button",
823
+ onClick: onClose,
824
+ className: "ml-1 rounded-full p-0.5 hover:bg-black/10 dark:hover:bg-white/10 transition-colors",
825
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react7.X, { className: cn(iconSizes[size]) })
826
+ }
827
+ )
828
+ ]
829
+ }
830
+ );
831
+ }
832
+
833
+ // src/shared/ui/textarea/Textarea.tsx
834
+ var import_react5 = require("react");
835
+ var import_jsx_runtime10 = require("react/jsx-runtime");
836
+ function Textarea({
837
+ label,
838
+ placeholder,
839
+ value = "",
840
+ onChange,
841
+ required = false,
842
+ disabled = false,
843
+ error,
844
+ className,
845
+ rows = 4
846
+ }) {
847
+ const [focused, setFocused] = (0, import_react5.useState)(false);
848
+ const isFloating = focused || value.length > 0;
849
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative w-full", children: [
850
+ label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
851
+ "label",
852
+ {
853
+ className: cn(
854
+ "absolute left-3 top-2 text-gray-500 dark:text-gray-400 transition-all duration-200 pointer-events-none",
855
+ isFloating ? "text-xs -translate-y-3 bg-white dark:bg-gray-900 px-1" : "text-sm translate-y-0"
856
+ ),
857
+ children: [
858
+ label,
859
+ required && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-error-500 ml-0.5", children: "*" })
860
+ ]
861
+ }
862
+ ),
863
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
864
+ "textarea",
865
+ {
866
+ rows,
867
+ placeholder: label ? void 0 : placeholder,
868
+ value,
869
+ onChange: (e) => onChange?.(e.target.value),
870
+ onFocus: () => setFocused(true),
871
+ onBlur: () => setFocused(false),
872
+ disabled,
873
+ className: cn(
874
+ "w-full rounded-md border border-gray-300 dark:border-gray-700 bg-transparent text-gray-900 dark:text-gray-100 px-3 py-2 outline-none transition-all resize-none",
875
+ "focus:border-primary-500 focus:ring-1 focus:ring-primary-500",
876
+ disabled && "opacity-50 cursor-not-allowed",
877
+ error && "border-error-500 focus:ring-error-500 focus:border-error-500",
878
+ label && "pt-5",
879
+ className
880
+ )
881
+ }
882
+ ),
883
+ error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "mt-1 text-sm text-error-500", children: error })
884
+ ] });
885
+ }
886
+
887
+ // src/shared/ui/toast/Toast.tsx
888
+ var import_lucide_react8 = require("lucide-react");
889
+ var import_react6 = require("react");
890
+ var import_jsx_runtime11 = require("react/jsx-runtime");
891
+ function Toast({
892
+ id = Math.random().toString(36),
893
+ title,
894
+ description,
895
+ type = "info",
896
+ duration = 5e3,
897
+ position = "top-right",
898
+ onClose,
899
+ action
900
+ }) {
901
+ const [isVisible, setIsVisible] = (0, import_react6.useState)(false);
902
+ const [isLeaving, setIsLeaving] = (0, import_react6.useState)(false);
903
+ (0, import_react6.useEffect)(() => {
904
+ const showTimer = setTimeout(() => setIsVisible(true), 100);
905
+ if (duration !== Infinity) {
906
+ const closeTimer = setTimeout(() => handleClose(), duration);
907
+ return () => {
908
+ clearTimeout(showTimer);
909
+ clearTimeout(closeTimer);
910
+ };
911
+ }
912
+ return () => clearTimeout(showTimer);
913
+ }, [duration]);
914
+ const handleClose = () => {
915
+ setIsLeaving(true);
916
+ setTimeout(() => {
917
+ setIsVisible(false);
918
+ onClose?.(id);
919
+ }, 300);
920
+ };
921
+ const handleAction = () => {
922
+ action?.onClick();
923
+ handleClose();
924
+ };
925
+ const icons = {
926
+ success: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.CheckCircle2, { className: "w-5 h-5" }),
927
+ error: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.XCircle, { className: "w-5 h-5" }),
928
+ warning: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.AlertCircle, { className: "w-5 h-5" }),
929
+ info: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.Info, { className: "w-5 h-5" }),
930
+ loading: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.Loader2, { className: "w-5 h-5 animate-spin" })
931
+ };
932
+ const variantClasses = {
933
+ success: "bg-success-50 border-success-200 text-success-800",
934
+ error: "bg-error-50 border-error-200 text-error-800",
935
+ warning: "bg-secondary-50 border-secondary-200 text-secondary-800",
936
+ info: "bg-info-50 border-info-200 text-info-800",
937
+ loading: "bg-gray-50 border-gray-200 text-gray-800"
938
+ };
939
+ const iconColors = {
940
+ success: "text-success-600",
941
+ error: "text-error-600",
942
+ warning: "text-secondary-600",
943
+ info: "text-info-600",
944
+ loading: "text-gray-600"
945
+ };
946
+ const positionClasses = {
947
+ "top-right": "top-4 right-4",
948
+ "top-left": "top-4 left-4",
949
+ "bottom-right": "bottom-4 right-4",
950
+ "bottom-left": "bottom-4 left-4",
951
+ "top-center": "top-4 left-1/2 -translate-x-1/2",
952
+ "bottom-center": "bottom-4 left-1/2 -translate-x-1/2"
953
+ };
954
+ if (!isVisible) return null;
955
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
956
+ "div",
957
+ {
958
+ className: cn(
959
+ "fixed z-50 transform transition-all duration-300",
960
+ positionClasses[position],
961
+ isLeaving ? "opacity-0 scale-95" : "opacity-100 scale-100",
962
+ position.includes("top") && !isLeaving && "animate-slide-down",
963
+ position.includes("bottom") && !isLeaving && "animate-slide-up"
964
+ ),
965
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
966
+ "div",
967
+ {
968
+ className: cn(
969
+ "flex items-start gap-3 p-4 rounded-lg border shadow-lg max-w-sm",
970
+ "backdrop-blur-sm bg-white/95",
971
+ variantClasses[type]
972
+ ),
973
+ children: [
974
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("flex-shrink-0 mt-0.5", iconColors[type]), children: icons[type] }),
975
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex-1 min-w-0", children: [
976
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h4", { className: "font-semibold text-sm mb-1", children: title }),
977
+ description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm opacity-90", children: description }),
978
+ action && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
979
+ "button",
980
+ {
981
+ onClick: handleAction,
982
+ className: "mt-2 text-sm font-medium underline underline-offset-2 hover:no-underline",
983
+ children: action.label
984
+ }
985
+ )
986
+ ] }),
987
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
988
+ "button",
989
+ {
990
+ onClick: handleClose,
991
+ className: "flex-shrink-0 p-1 rounded-full hover:bg-black/5 transition-colors",
992
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react8.X, { className: "w-4 h-4" })
993
+ }
994
+ )
995
+ ]
996
+ }
997
+ )
998
+ }
999
+ );
1000
+ }
1001
+
1002
+ // src/shared/ui/toast/ToastContainer.tsx
1003
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1004
+ function ToastContainer({
1005
+ toasts,
1006
+ onRemove,
1007
+ position = "top-right"
1008
+ }) {
1009
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Toast, { ...t, onClose: onRemove, position }, t.id)) });
1010
+ }
1011
+
1012
+ // src/shared/ui/tooltip/Tooltip.tsx
1013
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1014
+ function Tooltip({
1015
+ content,
1016
+ children,
1017
+ position = "top",
1018
+ delay = 200,
1019
+ className
1020
+ }) {
1021
+ const positionClasses = {
1022
+ top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
1023
+ bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
1024
+ left: "right-full top-1/2 -translate-y-1/2 mr-2",
1025
+ right: "left-full top-1/2 -translate-y-1/2 ml-2"
1026
+ };
1027
+ const arrowClasses = {
1028
+ top: "left-1/2 -translate-x-1/2 top-full",
1029
+ bottom: "left-1/2 -translate-x-1/2 bottom-full",
1030
+ left: "top-1/2 -translate-y-1/2 left-full",
1031
+ right: "top-1/2 -translate-y-1/2 right-full"
1032
+ };
1033
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative inline-block group", children: [
1034
+ children,
1035
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1036
+ "div",
1037
+ {
1038
+ className: cn(
1039
+ "absolute z-50 whitespace-nowrap rounded-md bg-gray-800 text-white text-xs px-2 py-1 shadow-md dark:bg-gray-900",
1040
+ "transition-all opacity-0 scale-95 group-hover:opacity-100 group-hover:scale-100",
1041
+ "group-hover:delay-200 duration-200 ease-out",
1042
+ positionClasses[position],
1043
+ className
1044
+ ),
1045
+ style: { transitionDelay: `${delay}ms` },
1046
+ children: [
1047
+ content,
1048
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1049
+ "span",
1050
+ {
1051
+ className: cn(
1052
+ "absolute w-2 h-2 bg-gray-800 dark:bg-gray-900 rotate-45",
1053
+ arrowClasses[position]
1054
+ )
1055
+ }
1056
+ )
1057
+ ]
1058
+ }
1059
+ )
1060
+ ] });
1061
+ }
1062
+
1063
+ // src/shared/ui/mciTable/MciTable.tsx
1064
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1065
+ function MciTable({
1066
+ columns,
1067
+ data,
1068
+ loading = false,
1069
+ variant = "clean",
1070
+ skeletonRows = 5,
1071
+ actions,
1072
+ noDataText
1073
+ }) {
1074
+ const [sortConfig, setSortConfig] = (0, import_react7.useState)(null);
1075
+ const sortedData = (0, import_react7.useMemo)(() => {
1076
+ if (!sortConfig || !sortConfig.direction) return data;
1077
+ return [...data].sort((a, b) => {
1078
+ const aVal = a[sortConfig.key];
1079
+ const bVal = b[sortConfig.key];
1080
+ if (aVal < bVal) return sortConfig.direction === "asc" ? -1 : 1;
1081
+ if (aVal > bVal) return sortConfig.direction === "asc" ? 1 : -1;
1082
+ return 0;
1083
+ });
1084
+ }, [data, sortConfig]);
1085
+ const handleSort = (col) => {
1086
+ if (!col.sortable) return;
1087
+ setSortConfig((prev) => {
1088
+ if (!prev || prev.key !== col.key) {
1089
+ return { key: col.key, direction: "asc" };
1090
+ }
1091
+ if (prev.direction === "asc") return { key: col.key, direction: "desc" };
1092
+ if (prev.direction === "desc") return { key: col.key, direction: null };
1093
+ return null;
1094
+ });
1095
+ };
1096
+ const getSortIcon = (col) => {
1097
+ if (!col.sortable) return null;
1098
+ if (!sortConfig || sortConfig.key !== col.key || !sortConfig.direction) {
1099
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.ArrowUpDown, { size: 15, className: "opacity-40" });
1100
+ }
1101
+ return sortConfig.direction === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.ChevronUp, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react9.ChevronDown, { size: 15 });
1102
+ };
1103
+ const variantStyle = cn(
1104
+ "w-full border-separate border-spacing-0 transition-all duration-300",
1105
+ variant === "clean" && "bg-white",
1106
+ variant === "elevated" && "bg-white shadow-lg",
1107
+ variant === "bordered" && "border border-secondary-200 rounded-lg"
1108
+ );
1109
+ const headerCell = (col) => cn(
1110
+ "bg-secondary-50 text-secondary-800 text-sm font-semibold py-3 px-4 select-none",
1111
+ "border-b border-secondary-200 transition-colors",
1112
+ col.align === "center" && "text-center",
1113
+ col.align === "right" && "text-right",
1114
+ col.sortable && "cursor-pointer hover:bg-secondary-100/70"
1115
+ );
1116
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w-full space-y-3", children: [
1117
+ actions && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex justify-between items-center mb-2", children: actions }),
1118
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-full overflow-x-auto rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: variantStyle, children: [
1119
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: columns.map((col, idx) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1120
+ "th",
1121
+ {
1122
+ onClick: () => handleSort(col),
1123
+ className: cn(
1124
+ headerCell(col),
1125
+ idx === 0 && "rounded-tl-lg",
1126
+ idx === columns.length - 1 && "rounded-tr-lg"
1127
+ ),
1128
+ style: { width: col.width },
1129
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1130
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: col.title }),
1131
+ getSortIcon(col)
1132
+ ] })
1133
+ },
1134
+ String(col.key)
1135
+ )) }) }),
1136
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: loading ? Array.from({ length: skeletonRows }).map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: columns.map((_2, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Skeleton, { height: 18, variant: "rounded" }) }, i)) }, idx)) : sortedData.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1137
+ "tr",
1138
+ {
1139
+ className: cn(
1140
+ "border-b border-secondary-100 transition-all duration-200"
1141
+ ),
1142
+ children: columns.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1143
+ "td",
1144
+ {
1145
+ className: cn(
1146
+ "px-4 py-3 text-sm text-gray-800",
1147
+ col.align === "center" && "text-center",
1148
+ col.align === "right" && "text-right"
1149
+ ),
1150
+ children: col.render ? col.render(row[col.key], row) : String(row[col.key])
1151
+ },
1152
+ i
1153
+ ))
1154
+ },
1155
+ idx
1156
+ )) })
1157
+ ] }) }),
1158
+ !loading && sortedData.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col items-center justify-center py-10 text-gray-500 dark:text-gray-400 animate-[fadeIn_0.4s_ease-in-out]", children: [
1159
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative", children: [
1160
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1161
+ import_lucide_react9.Box,
1162
+ {
1163
+ size: 64,
1164
+ className: "mb-3 text-secondary-400 dark:text-secondary-500 opacity-80 animate-[float_2.5s_ease-in-out_infinite]"
1165
+ }
1166
+ ),
1167
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute inset-0 blur-2xl bg-secondary-200/20 dark:bg-secondary-700/20 rounded-full scale-75 animate-[pulse_3s_ease-in-out_infinite]" })
1168
+ ] }),
1169
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm font-medium animate-[fadeUp_0.6s_ease-out]", children: noDataText })
1170
+ ] })
1171
+ ] });
1172
+ }
1173
+ // Annotate the CommonJS export names for ESM import in node:
1174
+ 0 && (module.exports = {
1175
+ Breadcrumb,
1176
+ Button,
1177
+ Collapse,
1178
+ InputMain,
1179
+ MciTable,
1180
+ Modal,
1181
+ Pagination,
1182
+ Skeleton,
1183
+ TabPanel,
1184
+ Tabs,
1185
+ Tag,
1186
+ Textarea,
1187
+ ToastContainer,
1188
+ Tooltip
1189
+ });
1190
+ //# sourceMappingURL=index.cjs.map