@mci-ui/mci-ui 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -1158
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -1125
- package/dist/index.js.map +1 -1
- package/package.json +63 -61
- package/src/App.tsx +5 -0
- package/src/index.ts +31 -0
- package/src/main.tsx +10 -0
- package/src/shared/hooks/toast.ts +32 -0
- package/src/shared/lib/utils.ts +37 -0
- package/src/shared/types/MciTableType.ts +10 -0
- package/src/shared/ui/breadcrumb/Breadcrumb.tsx +68 -0
- package/src/shared/ui/button/Button.tsx +105 -0
- package/src/shared/ui/collapse/Collapse.tsx +98 -0
- package/src/shared/ui/index.ts +30 -0
- package/src/shared/ui/inputMain/InputMain.tsx +241 -0
- package/src/shared/ui/mciTable/MciTable.tsx +166 -0
- package/src/shared/ui/modal/Modal.tsx +92 -0
- package/src/shared/ui/pagination/Pagination.tsx +141 -0
- package/src/shared/ui/skeleton/Skeleton.tsx +33 -0
- package/src/shared/ui/tabs/Tabs.tsx +192 -0
- package/src/shared/ui/tag/Tag.tsx +92 -0
- package/src/shared/ui/textarea/Textarea.tsx +72 -0
- package/src/shared/ui/toast/Toast.tsx +150 -0
- package/src/shared/ui/toast/ToastContainer.tsx +19 -0
- package/src/shared/ui/tooltip/Tooltip.tsx +58 -0
- package/src/styles/index.css +36 -0
- package/src/styles/tailwind-config.css +294 -0
package/dist/index.cjs
CHANGED
|
@@ -1,132 +1,4 @@
|
|
|
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: `
|
|
1
|
+
"use strict";var ce=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Be=Object.prototype.hasOwnProperty;var Fe=(t,r)=>{for(var a in r)ce(t,a,{get:r[a],enumerable:!0})},ze=(t,r,a,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Ae(r))!Be.call(t,n)&&n!==a&&ce(t,n,{get:()=>r[n],enumerable:!(e=Le(r,n))||e.enumerable});return t};var De=t=>ze(ce({},"__esModule",{value:!0}),t);var je={};Fe(je,{Breadcrumb:()=>q,Button:()=>J,Collapse:()=>Q,InputMain:()=>Z,MciTable:()=>ie,Modal:()=>ee,Pagination:()=>re,Skeleton:()=>O,TabPanel:()=>me,Tabs:()=>ae,Tag:()=>oe,Textarea:()=>se,ToastContainer:()=>fe,Tooltip:()=>ne});module.exports=De(je);var Ne=require("lucide-react");var ye=require("clsx"),xe=require("tailwind-merge");function o(...t){return(0,xe.twMerge)((0,ye.clsx)(t))}function he(t){return{handleEscape:a=>{a.key==="Escape"&&t()}}}function ve(t,r){return{handleClick:e=>{t.current&&!t.current.contains(e.target)&&r()}}}var _=require("react/jsx-runtime");function q({items:t,className:r,separatorIcon:a=(0,_.jsx)(Ne.ChevronRight,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}){return(0,_.jsx)("nav",{className:o("flex items-center space-x-2 text-sm font-medium text-gray-600 dark:text-gray-300",r),"aria-label":"Breadcrumb",children:t.map((e,n)=>{let s=n===t.length-1;return(0,_.jsxs)("div",{className:"flex items-center",children:[e.href?(0,_.jsx)("a",{href:e.href,onClick:e.onClick,className:o("hover:text-primary-600 dark:hover:text-primary-400 transition-colors",s&&"text-primary-600 dark:text-primary-400"),children:e.label}):(0,_.jsx)("span",{className:o(s?"text-primary-600 dark:text-primary-400":"text-gray-500 dark:text-gray-400"),children:e.label}),!s&&(0,_.jsx)("span",{className:"mx-2 flex items-center",children:a})]},n)})})}var G=require("lucide-react");var S=require("react/jsx-runtime");function J({text:t,icon:r,iconPosition:a="left",size:e="md",variant:n="accent",loading:s=!1,disabled:c=!1,onClick:l,className:d}){let x={sm:"h-[38px] px-3 text-sm gap-2",md:"h-[48px] px-4 text-base gap-2.5",lg:"h-[56px] px-5 text-lg gap-3"};return(0,S.jsxs)("button",{onClick:l,disabled:c||s,className:o("inline-flex items-center justify-center rounded-[7px] font-medium","transition-all duration-300 ease-in-out","transform hover:-translate-y-0.5","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:hover:shadow-none","focus:outline-none focus:ring-2 focus:ring-offset-2",n==="primary"&&"focus:ring-secondary-500",n==="secondary"&&"focus:ring-secondary-400",n==="accent"&&"focus:ring-accent-500",{primary:`
|
|
130
2
|
bg-secondary-500
|
|
131
3
|
hover:bg-secondary-600
|
|
132
4
|
active:bg-secondary-700
|
|
@@ -134,8 +6,7 @@ function Button({
|
|
|
134
6
|
hover:shadow-secondary-500/30
|
|
135
7
|
active:scale-[0.98]
|
|
136
8
|
text-white
|
|
137
|
-
`,
|
|
138
|
-
secondary: `
|
|
9
|
+
`,secondary:`
|
|
139
10
|
bg-secondary-50
|
|
140
11
|
hover:bg-secondary-100
|
|
141
12
|
active:bg-secondary-200
|
|
@@ -145,8 +16,7 @@ function Button({
|
|
|
145
16
|
text-secondary-700
|
|
146
17
|
border border-secondary-200
|
|
147
18
|
hover:border-secondary-300
|
|
148
|
-
`,
|
|
149
|
-
accent: `
|
|
19
|
+
`,accent:`
|
|
150
20
|
bg-accent-500
|
|
151
21
|
hover:bg-accent-600
|
|
152
22
|
active:bg-accent-700
|
|
@@ -154,272 +24,7 @@ function Button({
|
|
|
154
24
|
hover:shadow-accent-500/30
|
|
155
25
|
active:scale-[0.98]
|
|
156
26
|
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: `
|
|
27
|
+
`}[n],x[e],d),children:[r&&a==="left"&&(0,S.jsx)("span",{className:"flex items-center justify-center transition-transform duration-300 ease-in-out group-hover:scale-110",children:s?(0,S.jsx)(G.Loader,{className:"animate-spin",size:20}):r}),t&&(0,S.jsx)("span",{className:"transition-all duration-300",children:t}),r&&a==="right"&&(0,S.jsx)("span",{className:"flex items-center justify-center transition-transform duration-300 ease-in-out group-hover:scale-110",children:s?(0,S.jsx)(G.Loader,{className:"animate-spin",size:20}):r}),s&&(0,S.jsx)(G.Loader,{className:"animate-spin",size:20})]})}var we=require("lucide-react"),D=require("react");var E=require("react/jsx-runtime");function Q({title:t,children:r,defaultOpen:a=!1,icon:e,variant:n="primary",className:s,titleClassName:c,contentClassName:l}){let[d,x]=(0,D.useState)(a),[g,v]=(0,D.useState)(0),y=(0,D.useRef)(null);(0,D.useEffect)(()=>{y.current&&v(d?y.current.scrollHeight:0)},[d]);let i={primary:{title:"bg-secondary-50 hover:bg-secondary-100 border-secondary-200 text-secondary-800",content:"bg-secondary-25 border-secondary-100"},secondary:{title:"bg-accent-50 hover:bg-accent-100 border-accent-200 text-accent-800",content:"bg-accent-25 border-accent-100"},accent:{title:"bg-gray-50 hover:bg-gray-100 border-gray-200 text-gray-800",content:"bg-gray-25 border-gray-100"}}[n];return(0,E.jsxs)("div",{className:o("border rounded-lg overflow-hidden",s),children:[(0,E.jsxs)("button",{onClick:()=>x(!d),className:o("w-full flex items-center justify-between p-4 transition-all duration-300","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-blue-500","border-b",i.title),children:[(0,E.jsxs)("div",{className:"flex items-center gap-3",children:[e&&(0,E.jsx)("span",{className:"flex-shrink-0",children:e}),(0,E.jsx)("span",{className:o("font-medium text-left",c),children:t})]}),(0,E.jsx)(we.ChevronDownIcon,{className:o("w-5 h-5 transition-transform duration-300 flex-shrink-0",d&&"rotate-180")})]}),(0,E.jsx)("div",{className:o("transition-all duration-300 ease-out overflow-hidden",i.content),style:{height:`${g}px`},children:(0,E.jsx)("div",{ref:y,className:o("p-4",l),children:r})})]})}var Y=require("lucide-react"),L=require("react");var w=require("react/jsx-runtime");function Z({label:t,placeholder:r,type:a="text",icon:e,iconPosition:n="left",size:s="md",error:c,success:l,disabled:d=!1,required:x=!1,value:g,onChange:v,onFocus:y,onBlur:u,className:i}){let[m,b]=(0,L.useState)(!1),[N,f]=(0,L.useState)(""),[k,M]=(0,L.useState)(!1),[F,j]=(0,L.useState)(!1),U=g??N,be=!!U||F,ge=a==="password",Pe=()=>{b(!0),y==null||y()},Me=()=>{b(!1),u==null||u()},Ee=z=>{g===void 0&&f(z.target.value),v==null||v(z)},Ie=()=>M(z=>!z),R=(0,L.useMemo)(()=>({sm:{input:"h-[38px] text-sm",padding:e?n==="left"?"pl-10 pr-3":"pl-3 pr-10":"px-3",icon:"w-4 h-4",iconWrapper:n==="left"?"left-3":"right-3",labelFont:"text-xs"},md:{input:"h-[48px] text-base",padding:e?n==="left"?"pl-12 pr-4":"pl-4 pr-12":"px-4",icon:"w-5 h-5",iconWrapper:n==="left"?"left-3.5":"right-3.5",labelFont:"text-sm"},lg:{input:"h-[56px] text-lg",padding:e?n==="left"?"pl-14 pr-5":"pl-5 pr-14":"px-5",icon:"w-6 h-6",iconWrapper:n==="left"?"left-4":"right-4",labelFont:"text-base"}}),[e,n]),Se=(0,L.useMemo)(()=>c?"border-error-500 focus:border-error-600 focus:ring-error-500/20":l?"border-success-500 focus:border-success-600 focus:ring-success-500/20":"border-gray-300 hover:border-gray-400 focus:border-accent-500 focus:ring-accent-500/20",[c,l]),_e=z=>{z.animationName==="onAutoFillStart"?j(!0):z.animationName==="onAutoFillCancel"&&j(!1)};return(0,w.jsxs)("div",{className:o("w-full",i),children:[(0,w.jsxs)("div",{className:"relative flex items-center",children:[(0,w.jsx)("input",{type:ge&&k?"text":a,value:U,onChange:Ee,onFocus:Pe,onBlur:Me,onAnimationStart:_e,disabled:d,placeholder:t?"":r,required:x,className:o("w-full rounded-[7px] border bg-white font-medium outline-none transition-all duration-300 ease-in-out","focus:ring-4 disabled:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 autofill:shadow-[inset_0_0_0px_1000px_white]",R[s].input,R[s].padding,Se),autoComplete:"on"}),t&&(0,w.jsxs)("label",{className:o("absolute pointer-events-none transition-all duration-300 ease-in-out font-medium",e&&n==="left"&&!be&&!m?R[s].padding:"left-4",m||be?o("top-0 -translate-y-1/2 bg-white px-2",R[s].labelFont,c?"text-error-600":l?"text-success-600":"text-accent-600"):o("top-1/2 -translate-y-1/2 text-gray-500",R[s].input.includes("38")&&"text-sm",R[s].input.includes("48")&&"text-base",R[s].input.includes("56")&&"text-lg")),children:[t,x&&(0,w.jsx)("span",{className:"text-error-500 ml-1",children:"*"})]}),e&&(0,w.jsx)("div",{className:o("absolute top-1/2 -translate-y-1/2 flex items-center transition-all duration-300",R[s].iconWrapper,c?"text-error-500":l?"text-success-500":m?"text-accent-500":"text-gray-400"),children:(0,w.jsx)("span",{className:o(R[s].icon,"mr-2"),children:e})}),ge&&(0,w.jsx)("button",{type:"button",onClick:Ie,className:o("absolute top-1/2 -translate-y-1/2 flex items-center justify-center text-gray-400 hover:text-gray-600 transition-all","right-3"),children:k?(0,w.jsx)(Y.EyeOff,{className:o(R[s].icon)}):(0,w.jsx)(Y.Eye,{className:o(R[s].icon)})})]}),c&&(0,w.jsx)("p",{className:"mt-1.5 text-sm text-error-600 flex items-center gap-1 animate-[slideDown_0.3s_ease-out]",children:c}),l&&!c&&(0,w.jsx)("p",{className:"mt-1.5 text-sm text-success-600 flex items-center gap-1 animate-[slideDown_0.3s_ease-out]",children:l}),(0,w.jsx)("style",{children:`
|
|
423
28
|
input {
|
|
424
29
|
animation-name: onAutoFillCancel;
|
|
425
30
|
}
|
|
@@ -428,763 +33,12 @@ function InputMain({
|
|
|
428
33
|
}
|
|
429
34
|
@keyframes onAutoFillStart {}
|
|
430
35
|
@keyframes onAutoFillCancel {}
|
|
431
|
-
` })
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
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
|
-
});
|
|
36
|
+
`})]})}var B=require("lucide-react"),le=require("react");var ke=require("lucide-react"),$=require("react");var I=require("react/jsx-runtime");function ee({show:t,setShow:r,title:a,Header:e,Body:n,footer:s}){let c=(0,$.useRef)(null),{handleEscape:l}=he(()=>r(!1));(0,$.useEffect)(()=>(t?(document.addEventListener("keydown",l),document.body.style.overflow="hidden"):document.body.style.overflow="unset",()=>document.removeEventListener("keydown",l)),[t,l]);let{handleClick:d}=ve(c,()=>r(!1));return(0,$.useEffect)(()=>(t&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)),[t,d]),(0,I.jsx)("div",{className:o("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",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),children:(0,I.jsxs)("div",{ref:c,className:o("relative w-full max-w-lg rounded-[7px] shadow-xl bg-secondary-50 text-gray-800","transform transition-all duration-500 ease-out",t?"opacity-100 scale-100":"opacity-0 scale-90"),children:[(e||a)&&(0,I.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-secondary-300",children:[e||(0,I.jsx)("h2",{className:"text-xl font-semibold text-gray-800",children:a}),(0,I.jsx)("button",{onClick:()=>r(!1),className:"text-gray-800 hover:text-secondary-300 active:animate-spin transition",children:(0,I.jsx)(ke.X,{className:"w-5 h-5"})})]}),n&&(0,I.jsx)("div",{className:"px-6 py-4 max-h-96 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300",children:n}),s&&(0,I.jsx)("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-secondary-300",children:s})]})})}var te=require("lucide-react"),T=require("react/jsx-runtime");function re({totalItems:t,currentPage:r,perPage:a,onPageChange:e,onPerPageChange:n,siblingCount:s=1,perPageOptions:c=[10,20,30],showPerPage:l=!0}){let d=Math.ceil(t/a),g=(()=>{let u=s*2+5;if(d<=u)return Array.from({length:d},(k,M)=>M+1);let i=Math.max(r-s,2),m=Math.min(r+s,d-1),b=i>2,N=m<d-1,f=[1];b&&f.push("...");for(let k=i;k<=m;k++)f.push(k);return N&&f.push("..."),f.push(d),f})(),v=()=>{r>1&&e(r-1)},y=()=>{r<d&&e(r+1)};return(0,T.jsxs)("div",{className:"w-full flex flex-col md:flex-row md:justify-between md:items-center gap-4 py-4",children:[l&&n&&(0,T.jsx)("div",{className:"flex justify-center md:justify-start w-full md:w-auto",children:(0,T.jsx)("select",{value:a,onChange:u=>n(Number(u.target.value)),className:`border rounded-lg px-3 py-2 text-sm bg-white
|
|
37
|
+
hover:border-secondary-500
|
|
38
|
+
focus:outline-none focus:ring-2 focus:ring-secondary-500
|
|
39
|
+
transition-all duration-200`,children:c.map(u=>(0,T.jsxs)("option",{value:u,children:[u," / page"]},u))})}),(0,T.jsxs)("div",{className:"flex items-center justify-center md:justify-end w-full",children:[(0,T.jsx)("button",{onClick:v,disabled:r===1,className:`flex items-center justify-center rounded-xl border px-3 py-2 transition-all duration-200
|
|
40
|
+
${r===1?"opacity-40 cursor-not-allowed":"hover:bg-secondary-100 hover:text-secondary-700"}`,children:(0,T.jsx)(te.ChevronLeft,{size:18})}),(0,T.jsx)("div",{className:"flex items-center gap-1 mx-2",children:g.map((u,i)=>(0,T.jsx)("button",{onClick:()=>typeof u=="number"&&e(u),disabled:u==="...",className:`min-w-[40px] rounded-xl border px-3 py-2 text-sm font-medium transition-all duration-200
|
|
41
|
+
${u===r?"bg-secondary-500 text-white shadow-md":u==="..."?"cursor-default border-none text-gray-400":"bg-white text-secondary-700 hover:bg-secondary-100"}`,children:u},i))}),(0,T.jsx)("button",{onClick:y,disabled:r===d,className:`flex items-center justify-center rounded-xl border px-3 py-2 transition-all duration-200
|
|
42
|
+
${r===d?"opacity-40 cursor-not-allowed":"hover:bg-secondary-100 hover:text-secondary-700"}`,children:(0,T.jsx)(te.ChevronRight,{size:18})})]})]})}var de=require("react/jsx-runtime");function O({className:t,variant:r="default",width:a="100%",height:e="1rem"}){return(0,de.jsx)("div",{className:o("relative overflow-hidden bg-secondary-200 dark:bg-secondary-800","rounded-sm",r==="circle"&&"rounded-full",r==="rounded"&&"rounded-md",t),style:{width:typeof a=="number"?`${a}px`:a,height:typeof e=="number"?`${e}px`:e},children:(0,de.jsx)("div",{className:"absolute inset-0 shimmer-mask"})})}var H=require("react");var P=require("react/jsx-runtime");function ae({tabs:t,defaultTab:r,position:a="top",variant:e="primary",className:n,onChange:s}){var b,N;let[c,l]=(0,H.useState)(r||((b=t[0])==null?void 0:b.id)),[d,x]=(0,H.useState)({}),g=(0,H.useRef)([]);(0,H.useEffect)(()=>{let f=t.findIndex(M=>M.id===c),k=g.current[f];if(k){let{offsetLeft:M,offsetTop:F,offsetWidth:j,offsetHeight:U}=k;x({left:M,top:F,width:j,height:U,transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"})}},[c,a,t]);let v={top:"flex-col",bottom:"flex-col-reverse",left:"flex-row",right:"flex-row-reverse"},y={top:"flex-row",bottom:"flex-row",left:"flex-col",right:"flex-col"},u={top:"mt-6",bottom:"mb-6",left:"ml-6",right:"mr-6"},i={primary:{active:"text-secondary-600",inactive:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",disabled:"text-gray-300 dark:text-gray-600 cursor-not-allowed",bg:"bg-secondary-100 dark:bg-secondary-900"},secondary:{active:"text-accent-600",inactive:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",disabled:"text-gray-300 dark:text-gray-600 cursor-not-allowed",bg:"bg-accent-100 dark:bg-accent-900"},accent:{active:"text-gray-800 dark:text-gray-200",inactive:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",disabled:"text-gray-300 dark:text-gray-600 cursor-not-allowed",bg:"bg-gray-100 dark:bg-gray-800"}},m=a==="left"||a==="right";return(0,P.jsxs)("div",{className:o("flex w-full",v[a],n),children:[(0,P.jsxs)("div",{className:o("flex relative bg-gray-50 dark:bg-gray-900 rounded-lg p-1",y[a],m?"min-w-48":"w-full"),children:[(0,P.jsx)("div",{className:o("absolute rounded-md transition-all duration-300 ease-out",i[e].bg,m?"w-full":"h-full"),style:d}),t.map((f,k)=>{let M=c===f.id,F=i[e];return(0,P.jsxs)("button",{ref:j=>{g.current[k]=j},onClick:()=>{f.disabled||(l(f.id),s==null||s(f.id))},disabled:f.disabled,className:o("relative flex items-center justify-center gap-2 px-4 py-3 font-medium","text-sm whitespace-nowrap transition-all duration-200 z-10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500","rounded-md",M?[F.active,"font-semibold"]:[F.inactive,"hover:bg-white/50 dark:hover:bg-gray-800/50"],f.disabled&&F.disabled,m?"w-full justify-start":"flex-1"),children:[f.icon&&(0,P.jsx)("span",{className:o("flex-shrink-0 transition-transform duration-200",M&&"scale-110"),children:f.icon}),(0,P.jsx)("span",{className:"relative z-10",children:f.label})]},f.id)})]}),(0,P.jsx)("div",{className:o("flex-1 overflow-hidden",u[a]),children:(0,P.jsx)("div",{className:"animate-fade-in",children:(N=t.find(f=>f.id===c))==null?void 0:N.content},c)})]})}function me({children:t,className:r}){return(0,P.jsx)("div",{className:o("p-6 rounded-lg bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700",r),children:t})}var Te=require("lucide-react");var A=require("react/jsx-runtime"),He={sm:"text-xs px-2 py-0.5",md:"text-sm px-3 py-1",lg:"text-base px-4 py-1.5"},ue={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5"},Ve={default:"bg-gray-100 text-gray-800 border border-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:border-gray-700",secondary:"bg-secondary-100 text-secondary-800 border border-secondary-200 dark:bg-secondary-800 dark:text-secondary-50 dark:border-secondary-700",success:"bg-success-100 text-success-800 border border-success-200 dark:bg-success-800 dark:text-success-50 dark:border-success-700",error:"bg-error-100 text-error-800 border border-error-200 dark:bg-error-800 dark:text-error-50 dark:border-error-700",info:"bg-info-100 text-info-800 border border-info-200 dark:bg-info-800 dark:text-info-50 dark:border-info-700",accent:"bg-accent-100 text-accent-800 border border-accent-200 dark:bg-accent-800 dark:text-accent-50 dark:border-accent-700"};function oe({children:t,variant:r="default",size:a="md",icon:e,iconPosition:n="left",closable:s=!1,onClose:c,className:l}){return(0,A.jsxs)("span",{className:o("inline-flex items-center font-medium animate-[fadeIn_0.3s_ease-out] rounded-[7px]",He[a],Ve[r],e&&"gap-1.5",l),children:[e&&n==="left"&&(0,A.jsx)("span",{className:`flex items-center ${o(ue[a])}`,children:e}),(0,A.jsx)("span",{children:t}),e&&n==="right"&&(0,A.jsx)("span",{className:`flex items-center ${o(ue[a])}`,children:e}),s&&(0,A.jsx)("button",{type:"button",onClick:c,className:"ml-1 rounded-full p-0.5 hover:bg-black/10 dark:hover:bg-white/10 transition-colors",children:(0,A.jsx)(Te.X,{className:o(ue[a])})})]})}var Ce=require("react");var V=require("react/jsx-runtime");function se({label:t,placeholder:r,value:a="",onChange:e,required:n=!1,disabled:s=!1,error:c,className:l,rows:d=4}){let[x,g]=(0,Ce.useState)(!1),v=x||a.length>0;return(0,V.jsxs)("div",{className:"relative w-full",children:[t&&(0,V.jsxs)("label",{className:o("absolute left-3 top-2 text-gray-500 dark:text-gray-400 transition-all duration-200 pointer-events-none",v?"text-xs -translate-y-3 bg-white dark:bg-gray-900 px-1":"text-sm translate-y-0"),children:[t,n&&(0,V.jsx)("span",{className:"text-error-500 ml-0.5",children:"*"})]}),(0,V.jsx)("textarea",{rows:d,placeholder:t?void 0:r,value:a,onChange:y=>e==null?void 0:e(y.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),disabled:s,className:o("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","focus:border-primary-500 focus:ring-1 focus:ring-primary-500",s&&"opacity-50 cursor-not-allowed",c&&"border-error-500 focus:ring-error-500 focus:border-error-500",t&&"pt-5",l)}),c&&(0,V.jsx)("p",{className:"mt-1 text-sm text-error-500",children:c})]})}var C=require("lucide-react"),W=require("react");var h=require("react/jsx-runtime");function Re({id:t=Math.random().toString(36),title:r,description:a,type:e="info",duration:n=5e3,position:s="top-right",onClose:c,action:l}){let[d,x]=(0,W.useState)(!1),[g,v]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let f=setTimeout(()=>x(!0),100);if(n!==1/0){let k=setTimeout(()=>y(),n);return()=>{clearTimeout(f),clearTimeout(k)}}return()=>clearTimeout(f)},[n]);let y=()=>{v(!0),setTimeout(()=>{x(!1),c==null||c(t)},300)},u=()=>{l==null||l.onClick(),y()},i={success:(0,h.jsx)(C.CheckCircle2,{className:"w-5 h-5"}),error:(0,h.jsx)(C.XCircle,{className:"w-5 h-5"}),warning:(0,h.jsx)(C.AlertCircle,{className:"w-5 h-5"}),info:(0,h.jsx)(C.Info,{className:"w-5 h-5"}),loading:(0,h.jsx)(C.Loader2,{className:"w-5 h-5 animate-spin"})},m={success:"bg-success-50 border-success-200 text-success-800",error:"bg-error-50 border-error-200 text-error-800",warning:"bg-secondary-50 border-secondary-200 text-secondary-800",info:"bg-info-50 border-info-200 text-info-800",loading:"bg-gray-50 border-gray-200 text-gray-800"},b={success:"text-success-600",error:"text-error-600",warning:"text-secondary-600",info:"text-info-600",loading:"text-gray-600"},N={"top-right":"top-4 right-4","top-left":"top-4 left-4","bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","bottom-center":"bottom-4 left-1/2 -translate-x-1/2"};return d?(0,h.jsx)("div",{className:o("fixed z-50 transform transition-all duration-300",N[s],g?"opacity-0 scale-95":"opacity-100 scale-100",s.includes("top")&&!g&&"animate-slide-down",s.includes("bottom")&&!g&&"animate-slide-up"),children:(0,h.jsxs)("div",{className:o("flex items-start gap-3 p-4 rounded-lg border shadow-lg max-w-sm","backdrop-blur-sm bg-white/95",m[e]),children:[(0,h.jsx)("div",{className:o("flex-shrink-0 mt-0.5",b[e]),children:i[e]}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsx)("h4",{className:"font-semibold text-sm mb-1",children:r}),a&&(0,h.jsx)("p",{className:"text-sm opacity-90",children:a}),l&&(0,h.jsx)("button",{onClick:u,className:"mt-2 text-sm font-medium underline underline-offset-2 hover:no-underline",children:l.label})]}),(0,h.jsx)("button",{onClick:y,className:"flex-shrink-0 p-1 rounded-full hover:bg-black/5 transition-colors",children:(0,h.jsx)(C.X,{className:"w-4 h-4"})})]})}):null}var X=require("react/jsx-runtime");function fe({toasts:t,onRemove:r,position:a="top-right"}){return(0,X.jsx)(X.Fragment,{children:t.map(e=>(0,X.jsx)(Re,{...e,onClose:r,position:a},e.id))})}var K=require("react/jsx-runtime");function ne({content:t,children:r,position:a="top",delay:e=200,className:n}){let s={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},c={top:"left-1/2 -translate-x-1/2 top-full",bottom:"left-1/2 -translate-x-1/2 bottom-full",left:"top-1/2 -translate-y-1/2 left-full",right:"top-1/2 -translate-y-1/2 right-full"};return(0,K.jsxs)("div",{className:"relative inline-block group",children:[r,(0,K.jsxs)("div",{className:o("absolute z-50 whitespace-nowrap rounded-md bg-gray-800 text-white text-xs px-2 py-1 shadow-md dark:bg-gray-900","transition-all opacity-0 scale-95 group-hover:opacity-100 group-hover:scale-100","group-hover:delay-200 duration-200 ease-out",s[a],n),style:{transitionDelay:`${e}ms`},children:[t,(0,K.jsx)("span",{className:o("absolute w-2 h-2 bg-gray-800 dark:bg-gray-900 rotate-45",c[a])})]})]})}var p=require("react/jsx-runtime");function ie({columns:t,data:r,loading:a=!1,variant:e="clean",skeletonRows:n=5,actions:s,noDataText:c}){let[l,d]=(0,le.useState)(null),x=(0,le.useMemo)(()=>!l||!l.direction?r:[...r].sort((i,m)=>{let b=i[l.key],N=m[l.key];return b<N?l.direction==="asc"?-1:1:b>N?l.direction==="asc"?1:-1:0}),[r,l]),g=i=>{i.sortable&&d(m=>!m||m.key!==i.key?{key:i.key,direction:"asc"}:m.direction==="asc"?{key:i.key,direction:"desc"}:m.direction==="desc"?{key:i.key,direction:null}:null)},v=i=>i.sortable?!l||l.key!==i.key||!l.direction?(0,p.jsx)(B.ArrowUpDown,{size:15,className:"opacity-40"}):l.direction==="asc"?(0,p.jsx)(B.ChevronUp,{size:15}):(0,p.jsx)(B.ChevronDown,{size:15}):null,y=o("w-full border-separate border-spacing-0 transition-all duration-300",e==="clean"&&"bg-white",e==="elevated"&&"bg-white shadow-lg",e==="bordered"&&"border border-secondary-200 rounded-lg"),u=i=>o("bg-secondary-50 text-secondary-800 text-sm font-semibold py-3 px-4 select-none","border-b border-secondary-200 transition-colors",i.align==="center"&&"text-center",i.align==="right"&&"text-right",i.sortable&&"cursor-pointer hover:bg-secondary-100/70");return(0,p.jsxs)("div",{className:"w-full space-y-3",children:[s&&(0,p.jsx)("div",{className:"flex justify-between items-center mb-2",children:s}),(0,p.jsx)("div",{className:"w-full overflow-x-auto rounded-lg",children:(0,p.jsxs)("table",{className:y,children:[(0,p.jsx)("thead",{children:(0,p.jsx)("tr",{children:t.map((i,m)=>(0,p.jsx)("th",{onClick:()=>g(i),className:o(u(i),m===0&&"rounded-tl-lg",m===t.length-1&&"rounded-tr-lg"),style:{width:i.width},children:(0,p.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,p.jsx)("span",{className:"truncate",children:i.title}),v(i)]})},String(i.key)))})}),(0,p.jsx)("tbody",{children:a?Array.from({length:n}).map((i,m)=>(0,p.jsx)("tr",{children:t.map((b,N)=>(0,p.jsx)("td",{className:"px-4 py-3",children:(0,p.jsx)(O,{height:18,variant:"rounded"})},N))},m)):x.map((i,m)=>(0,p.jsx)("tr",{className:o("border-b border-secondary-100 transition-all duration-200"),children:t.map((b,N)=>(0,p.jsx)("td",{className:o("px-4 py-3 text-sm text-gray-800",b.align==="center"&&"text-center",b.align==="right"&&"text-right"),children:b.render?b.render(i[b.key],i):String(i[b.key])},N))},m))})]})}),!a&&x.length===0&&(0,p.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:[(0,p.jsxs)("div",{className:"relative",children:[(0,p.jsx)(B.Box,{size:64,className:"mb-3 text-secondary-400 dark:text-secondary-500 opacity-80 animate-[float_2.5s_ease-in-out_infinite]"}),(0,p.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]"})]}),(0,p.jsx)("p",{className:"text-sm font-medium animate-[fadeUp_0.6s_ease-out]",children:c})]})]})}function pe(t,{insertAt:r}={}){if(!t||typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",r==="top"&&a.firstChild?a.insertBefore(e,a.firstChild):a.appendChild(e),e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}pe(`@import"./tailwind-config.css";*{box-sizing:border-box}html,body{font-family:system-ui,Avenir,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}button{cursor:pointer}a{text-decoration:none;color:inherit}ul,ol{list-style:none;padding:0}input,textarea,button,select{font:inherit;outline:none}
|
|
43
|
+
`);0&&(module.exports={Breadcrumb,Button,Collapse,InputMain,MciTable,Modal,Pagination,Skeleton,TabPanel,Tabs,Tag,Textarea,ToastContainer,Tooltip});
|
|
1190
44
|
//# sourceMappingURL=index.cjs.map
|