@mci-ui/mci-ui 0.0.72 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.es.js +879 -867
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as e, jsxs as i, Fragment as
|
|
2
|
-
import { AltArrowRight as
|
|
3
|
-
import { clsx as
|
|
4
|
-
import { twMerge as
|
|
5
|
-
import * as
|
|
6
|
-
import { memo as
|
|
7
|
-
import { createRoot as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import { AltArrowRight as be, Star2 as We, AltArrowDown as Fe, EyeClosed as Qe, Eye as Oe, Calendar as et, AltArrowLeft as ke, DoubleAltArrowLeft as tt, DoubleAltArrowRight as rt, ConfoundedSquare as nt, SortVertical as lt, SortFromTopToBottom as at, SortFromBottomToTop as st, Upload as ot, File as Te, FileText as Se, MusicNote as it, VideoFramePlayHorizontal as ct, Gallery as dt, MenuDots as ut, Refresh as mt, InfoCircle as ht, DangerCircle as ft, CloseCircle as pt, CheckCircle as gt, Phone as bt, TransferVertical as xt } from "@solar-icons/react";
|
|
3
|
+
import { clsx as wt } from "clsx";
|
|
4
|
+
import { twMerge as vt } from "tailwind-merge";
|
|
5
|
+
import * as re from "react";
|
|
6
|
+
import { memo as yt, useState as _, useMemo as Z, useCallback as R, useRef as le, useEffect as J, forwardRef as fe } from "react";
|
|
7
|
+
import { createRoot as Nt } from "react-dom/client";
|
|
8
8
|
function n(...t) {
|
|
9
|
-
return
|
|
9
|
+
return vt(wt(t));
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Ee(t) {
|
|
12
12
|
return { handleEscape: (r) => {
|
|
13
13
|
r.key === "Escape" && t();
|
|
14
14
|
} };
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function De(t, a) {
|
|
17
17
|
return { handleClick: (l) => {
|
|
18
18
|
t.current && !t.current.contains(l.target) && a();
|
|
19
19
|
} };
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function qt({
|
|
22
22
|
items: t,
|
|
23
23
|
variant: a = "blue",
|
|
24
24
|
className: r
|
|
25
25
|
}) {
|
|
26
|
-
const l = a === "blue",
|
|
26
|
+
const l = a === "blue", f = l ? "hover:text-blue-600" : "hover:text-yellow-500", d = l ? "text-blue-600" : "text-yellow-500";
|
|
27
27
|
return /* @__PURE__ */ e("nav", { className: n("flex items-center", r), "aria-label": "Breadcrumb", children: t.map((s, c) => {
|
|
28
28
|
const C = c === t.length - 1;
|
|
29
29
|
return /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
@@ -39,7 +39,7 @@ function Kt({
|
|
|
39
39
|
},
|
|
40
40
|
className: n(
|
|
41
41
|
"flex items-center gap-x-2 transition-all text-sm font-normal text-slate-500",
|
|
42
|
-
|
|
42
|
+
f
|
|
43
43
|
),
|
|
44
44
|
children: [
|
|
45
45
|
s.icon,
|
|
@@ -47,22 +47,22 @@ function Kt({
|
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
),
|
|
50
|
-
!C && /* @__PURE__ */ e("span", { className: "mx-2 flex items-center", children: /* @__PURE__ */ e(
|
|
50
|
+
!C && /* @__PURE__ */ e("span", { className: "mx-2 flex items-center", children: /* @__PURE__ */ e(be, { weight: "Linear", size: 20, className: "text-slate-500" }) })
|
|
51
51
|
] }, c);
|
|
52
52
|
}) });
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Kt({
|
|
55
55
|
children: t,
|
|
56
56
|
text: a,
|
|
57
57
|
icon: r,
|
|
58
58
|
iconPosition: l = "left",
|
|
59
|
-
size:
|
|
59
|
+
size: f = "base",
|
|
60
60
|
variant: d = "primary",
|
|
61
61
|
color: s = "yellow",
|
|
62
62
|
loading: c = !1,
|
|
63
63
|
disabled: C = !1,
|
|
64
64
|
onClick: k,
|
|
65
|
-
className:
|
|
65
|
+
className: D,
|
|
66
66
|
type: M = "button"
|
|
67
67
|
}) {
|
|
68
68
|
const L = t ?? a, F = {
|
|
@@ -83,31 +83,31 @@ function Jt({
|
|
|
83
83
|
}[s][d] : {
|
|
84
84
|
danger: "bg-red-600 text-white hover:bg-red-700 active:bg-red-800 focus:ring-2 focus:shadow-red",
|
|
85
85
|
tertiary: "bg-slate-100 text-black hover:bg-slate-200 active:bg-slate-300 focus:ring-2 focus:shadow-slate"
|
|
86
|
-
}[d],
|
|
86
|
+
}[d], b = C || c, w = b ? d === "outline" ? "border-slate-200 bg-white text-slate-400 cursor-not-allowed hover:bg-transparent hover:border-slate-200 hover:text-slate-400 active:border-slate-200 active:text-slate-400 active:bg-transparent focus:bg-transparent focus:ring-0" : "bg-slate-200 text-slate-400 cursor-not-allowed hover:bg-slate-200 active:bg-slate-200 focus:ring-0" : "";
|
|
87
87
|
return /* @__PURE__ */ i(
|
|
88
88
|
"button",
|
|
89
89
|
{
|
|
90
90
|
type: M,
|
|
91
91
|
onClick: k,
|
|
92
|
-
disabled:
|
|
92
|
+
disabled: b,
|
|
93
93
|
className: n(
|
|
94
94
|
"inline-flex items-center justify-center font-medium transition-all duration-200 cursor-pointer",
|
|
95
|
-
F[
|
|
95
|
+
F[f],
|
|
96
96
|
u,
|
|
97
|
-
!
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
!b && u,
|
|
98
|
+
w,
|
|
99
|
+
D
|
|
100
100
|
),
|
|
101
101
|
children: [
|
|
102
102
|
r && l === "left" && !c && /* @__PURE__ */ e("span", { className: "flex items-center", children: r }),
|
|
103
103
|
L && /* @__PURE__ */ e("span", { children: L }),
|
|
104
104
|
r && l === "right" && !c && /* @__PURE__ */ e("span", { className: "flex items-center", children: r }),
|
|
105
|
-
c && /* @__PURE__ */ e(
|
|
105
|
+
c && /* @__PURE__ */ e(We, { weight: "Linear", size: 20, className: "animate-spin" })
|
|
106
106
|
]
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const kt = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 11, height: 8, viewBox: "0 0 11 8", fill: "none", ...t }, /* @__PURE__ */ re.createElement("path", { d: "M0.625 3.76944L3.76944 6.91389L10.0694 0.625", stroke: "currentColor", strokeWidth: 1.25, strokeLinecap: "round", strokeLinejoin: "round" })), Ct = {
|
|
111
111
|
blue: {
|
|
112
112
|
border: "border-blue-600",
|
|
113
113
|
bg: "bg-blue-600",
|
|
@@ -120,29 +120,29 @@ const Ct = (t) => /* @__PURE__ */ te.createElement("svg", { xmlns: "http://www.w
|
|
|
120
120
|
hover: "hover:border-yellow-500 hover:bg-yello-100",
|
|
121
121
|
focus: "focus:ring-2 focus:ring-yellow-300"
|
|
122
122
|
}
|
|
123
|
-
},
|
|
123
|
+
}, Me = yt(function({
|
|
124
124
|
type: a = "checkbox",
|
|
125
125
|
label: r,
|
|
126
126
|
supportText: l,
|
|
127
|
-
checked:
|
|
127
|
+
checked: f,
|
|
128
128
|
onChange: d,
|
|
129
129
|
error: s,
|
|
130
130
|
disabled: c = !1,
|
|
131
131
|
required: C = !1,
|
|
132
132
|
className: k,
|
|
133
|
-
variant:
|
|
133
|
+
variant: D = "yellow",
|
|
134
134
|
name: M,
|
|
135
135
|
value: L
|
|
136
136
|
}) {
|
|
137
|
-
const [F,
|
|
138
|
-
() =>
|
|
139
|
-
[
|
|
140
|
-
),
|
|
141
|
-
(
|
|
142
|
-
c || (
|
|
137
|
+
const [F, v] = _(!1), m = a === "radio", u = Z(
|
|
138
|
+
() => f ?? F,
|
|
139
|
+
[f, F]
|
|
140
|
+
), b = R(
|
|
141
|
+
(y) => {
|
|
142
|
+
c || (f === void 0 && v(y.target.checked), d?.(y));
|
|
143
143
|
},
|
|
144
|
-
[
|
|
145
|
-
),
|
|
144
|
+
[f, d, c]
|
|
145
|
+
), w = Z(() => {
|
|
146
146
|
if (c) {
|
|
147
147
|
const E = "border-slate-200 bg-slate-100";
|
|
148
148
|
return m ? {
|
|
@@ -155,35 +155,35 @@ const Ct = (t) => /* @__PURE__ */ te.createElement("svg", { xmlns: "http://www.w
|
|
|
155
155
|
check: u ? "text-slate-400" : "text-transparent"
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
const
|
|
158
|
+
const y = Ct[D];
|
|
159
159
|
if (m) {
|
|
160
160
|
const E = n(
|
|
161
161
|
"border transition-all duration-200",
|
|
162
|
-
u ?
|
|
163
|
-
!u &&
|
|
164
|
-
|
|
162
|
+
u ? y.border : "border-slate-400",
|
|
163
|
+
!u && y.hover,
|
|
164
|
+
y.focus,
|
|
165
165
|
u && ""
|
|
166
|
-
),
|
|
166
|
+
), j = n(
|
|
167
167
|
"transition-all duration-200 rounded-full",
|
|
168
|
-
u ?
|
|
168
|
+
u ? y.bg : "bg-transparent"
|
|
169
169
|
);
|
|
170
170
|
return {
|
|
171
171
|
container: E,
|
|
172
|
-
dot:
|
|
172
|
+
dot: j,
|
|
173
173
|
check: ""
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
176
|
return {
|
|
177
177
|
container: n(
|
|
178
178
|
"border transition-all duration-200",
|
|
179
|
-
u ? n(
|
|
180
|
-
!u &&
|
|
181
|
-
|
|
179
|
+
u ? n(y.bg, y.border) : "border-slate-400",
|
|
180
|
+
!u && y.hover,
|
|
181
|
+
y.focus
|
|
182
182
|
),
|
|
183
183
|
dot: "",
|
|
184
184
|
check: u ? "text-white" : "text-transparent"
|
|
185
185
|
};
|
|
186
|
-
}, [m, u, c,
|
|
186
|
+
}, [m, u, c, D]), p = Z(() => !r && !l ? null : /* @__PURE__ */ i("div", { className: "flex flex-col", children: [
|
|
187
187
|
r && /* @__PURE__ */ i(
|
|
188
188
|
"span",
|
|
189
189
|
{
|
|
@@ -223,7 +223,7 @@ const Ct = (t) => /* @__PURE__ */ te.createElement("svg", { xmlns: "http://www.w
|
|
|
223
223
|
{
|
|
224
224
|
type: a,
|
|
225
225
|
checked: u,
|
|
226
|
-
onChange:
|
|
226
|
+
onChange: b,
|
|
227
227
|
disabled: c,
|
|
228
228
|
required: C,
|
|
229
229
|
className: "sr-only",
|
|
@@ -239,49 +239,49 @@ const Ct = (t) => /* @__PURE__ */ te.createElement("svg", { xmlns: "http://www.w
|
|
|
239
239
|
className: n(
|
|
240
240
|
"relative flex items-center justify-center",
|
|
241
241
|
m ? "w-5 h-5 rounded-full" : "w-5 h-5 rounded",
|
|
242
|
-
|
|
242
|
+
w.container
|
|
243
243
|
),
|
|
244
244
|
children: m ? /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
245
245
|
"span",
|
|
246
246
|
{
|
|
247
247
|
className: n(
|
|
248
248
|
"w-3 h-3 rounded-full transition-all duration-200",
|
|
249
|
-
|
|
249
|
+
w.dot,
|
|
250
250
|
u ? "opacity-100 scale-100" : "opacity-0 scale-50"
|
|
251
251
|
)
|
|
252
252
|
}
|
|
253
253
|
) }) : /* @__PURE__ */ e(
|
|
254
|
-
|
|
254
|
+
kt,
|
|
255
255
|
{
|
|
256
256
|
className: n(
|
|
257
257
|
"w-4 h-4 stroke-[2.5px] transition-opacity duration-200",
|
|
258
|
-
|
|
258
|
+
w.check,
|
|
259
259
|
u ? "opacity-100" : "opacity-0"
|
|
260
260
|
)
|
|
261
261
|
}
|
|
262
262
|
)
|
|
263
263
|
}
|
|
264
264
|
),
|
|
265
|
-
|
|
265
|
+
p
|
|
266
266
|
]
|
|
267
267
|
}
|
|
268
268
|
),
|
|
269
269
|
s && /* @__PURE__ */ e("p", { id: `${M}-error`, className: "mt-1 text-extra-small text-red-600", children: s })
|
|
270
270
|
] });
|
|
271
271
|
});
|
|
272
|
-
|
|
273
|
-
function
|
|
272
|
+
Me.displayName = "MciCheck";
|
|
273
|
+
function Jt({
|
|
274
274
|
title: t,
|
|
275
275
|
children: a,
|
|
276
276
|
defaultOpen: r = !1,
|
|
277
277
|
icon: l,
|
|
278
|
-
className:
|
|
278
|
+
className: f,
|
|
279
279
|
contentClassName: d
|
|
280
280
|
}) {
|
|
281
|
-
const [s, c] =
|
|
281
|
+
const [s, c] = _(r), [C, k] = _(0), D = le(null);
|
|
282
282
|
return J(() => {
|
|
283
|
-
|
|
284
|
-
}, [s]), /* @__PURE__ */ i("div", { className: n("overflow-hidden rounded-xl border border-slate-200",
|
|
283
|
+
D.current && k(s ? D.current.scrollHeight : 0);
|
|
284
|
+
}, [s]), /* @__PURE__ */ i("div", { className: n("overflow-hidden rounded-xl border border-slate-200", f), children: [
|
|
285
285
|
/* @__PURE__ */ i(
|
|
286
286
|
"button",
|
|
287
287
|
{
|
|
@@ -296,7 +296,7 @@ function Gt({
|
|
|
296
296
|
/* @__PURE__ */ e("div", { className: n("text-base font-medium text-black"), children: t })
|
|
297
297
|
] }),
|
|
298
298
|
/* @__PURE__ */ e(
|
|
299
|
-
|
|
299
|
+
Fe,
|
|
300
300
|
{
|
|
301
301
|
weight: "Linear",
|
|
302
302
|
size: 20,
|
|
@@ -318,40 +318,40 @@ function Gt({
|
|
|
318
318
|
style: {
|
|
319
319
|
height: `${C}px`
|
|
320
320
|
},
|
|
321
|
-
children: /* @__PURE__ */ e("div", { ref:
|
|
321
|
+
children: /* @__PURE__ */ e("div", { ref: D, className: n("p-5", d), children: a })
|
|
322
322
|
}
|
|
323
323
|
)
|
|
324
324
|
] });
|
|
325
325
|
}
|
|
326
|
-
const
|
|
327
|
-
function
|
|
326
|
+
const pe = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", ...t }, /* @__PURE__ */ re.createElement("path", { d: "M7.75739 7.75735L16.2427 16.2426", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ re.createElement("path", { d: "M7.75733 16.2426L16.2426 7.75735", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
327
|
+
function Gt({
|
|
328
328
|
isOpen: t,
|
|
329
329
|
onClose: a,
|
|
330
330
|
position: r = "right",
|
|
331
331
|
children: l,
|
|
332
|
-
footer:
|
|
332
|
+
footer: f,
|
|
333
333
|
title: d,
|
|
334
334
|
description: s,
|
|
335
335
|
showCloseButton: c = !0,
|
|
336
336
|
drawerClassName: C,
|
|
337
337
|
closeOnOverlayClick: k = !0,
|
|
338
|
-
closeOnEscape:
|
|
338
|
+
closeOnEscape: D = !0,
|
|
339
339
|
width: M = 572
|
|
340
340
|
}) {
|
|
341
|
-
const L =
|
|
341
|
+
const L = le(null), F = le(null), v = R(() => a(), [a]);
|
|
342
342
|
J(() => {
|
|
343
343
|
t ? (F.current = document.activeElement, L.current?.focus()) : F.current?.focus();
|
|
344
344
|
}, [t]), J(() => (t && (document.body.style.overflow = "hidden"), () => {
|
|
345
345
|
document.body.style.overflow = "unset";
|
|
346
346
|
}), [t]);
|
|
347
|
-
const m =
|
|
347
|
+
const m = Z(
|
|
348
348
|
() => ({
|
|
349
349
|
"--drawer-w": typeof M == "number" ? `${M}px` : M,
|
|
350
350
|
transform: t ? "translateX(0)" : r === "right" ? "translateX(calc(100% + 48px))" : "translateX(calc(-100% - 48px))"
|
|
351
351
|
}),
|
|
352
352
|
[t, M, r]
|
|
353
|
-
), u = !!(d || s || c),
|
|
354
|
-
return /* @__PURE__ */ i(
|
|
353
|
+
), u = !!(d || s || c), b = r === "right" ? "top-0 bottom-0 right-0 left-3 rounded-l-3xl rounded-r-none" : "top-0 bottom-0 left-0 right-3 rounded-r-3xl rounded-l-none", w = r === "right" ? "sm:top-6 sm:bottom-6 sm:right-6 sm:left-auto" : "sm:top-6 sm:bottom-6 sm:left-6 sm:right-auto";
|
|
354
|
+
return /* @__PURE__ */ i(he, { children: [
|
|
355
355
|
/* @__PURE__ */ e(
|
|
356
356
|
"div",
|
|
357
357
|
{
|
|
@@ -359,7 +359,7 @@ function Xt({
|
|
|
359
359
|
"fixed inset-0 z-50 bg-black/40 transition-opacity duration-300",
|
|
360
360
|
t ? "opacity-100 visible cursor-pointer" : "opacity-0 invisible pointer-events-none"
|
|
361
361
|
),
|
|
362
|
-
onClick: k ?
|
|
362
|
+
onClick: k ? v : void 0,
|
|
363
363
|
"aria-hidden": "true"
|
|
364
364
|
}
|
|
365
365
|
),
|
|
@@ -373,10 +373,10 @@ function Xt({
|
|
|
373
373
|
"fixed z-50 flex flex-col bg-white outline-none min-h-0",
|
|
374
374
|
"transition-transform duration-300 ease-in-out",
|
|
375
375
|
"shadow-2xl",
|
|
376
|
-
|
|
376
|
+
b,
|
|
377
377
|
"h-[100dvh]",
|
|
378
378
|
"pb-[env(safe-area-inset-bottom)]",
|
|
379
|
-
|
|
379
|
+
w,
|
|
380
380
|
"sm:h-auto sm:rounded-2xl sm:pb-0",
|
|
381
381
|
"sm:w-[var(--drawer-w)]",
|
|
382
382
|
C
|
|
@@ -401,57 +401,57 @@ function Xt({
|
|
|
401
401
|
"button",
|
|
402
402
|
{
|
|
403
403
|
type: "button",
|
|
404
|
-
onClick:
|
|
404
|
+
onClick: v,
|
|
405
405
|
className: "bg-slate-100 rounded-xl w-11 h-11 sm:w-12 sm:h-12 hover:cursor-pointer text-black transition flex items-center justify-center group active:scale-95",
|
|
406
|
-
children: /* @__PURE__ */ e(
|
|
406
|
+
children: /* @__PURE__ */ e(pe, { className: "h-5 w-5 sm:h-6 sm:w-6 transition-transform duration-300 group-hover:rotate-180" })
|
|
407
407
|
}
|
|
408
408
|
)
|
|
409
409
|
] }),
|
|
410
410
|
/* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-y-auto scrollbar-thin scrollbar-thumb-slate-200 px-4 py-4 sm:p-6", children: l }),
|
|
411
|
-
|
|
411
|
+
f && /* @__PURE__ */ e("div", { className: "shrink-0 flex items-center justify-end border-t border-slate-200 px-4 py-4 sm:p-6 gap-3", children: f })
|
|
412
412
|
]
|
|
413
413
|
}
|
|
414
414
|
)
|
|
415
415
|
] });
|
|
416
416
|
}
|
|
417
|
-
const
|
|
417
|
+
const Le = fe(
|
|
418
418
|
({
|
|
419
419
|
label: t,
|
|
420
420
|
placeholder: a,
|
|
421
421
|
type: r = "text",
|
|
422
422
|
icon: l,
|
|
423
|
-
rightIcon:
|
|
423
|
+
rightIcon: f,
|
|
424
424
|
iconPosition: d = "left",
|
|
425
425
|
size: s = "base",
|
|
426
426
|
error: c,
|
|
427
427
|
disabled: C = !1,
|
|
428
428
|
required: k = !1,
|
|
429
|
-
value:
|
|
429
|
+
value: D,
|
|
430
430
|
onChange: M,
|
|
431
431
|
onFocus: L,
|
|
432
432
|
onBlur: F,
|
|
433
|
-
className:
|
|
433
|
+
className: v,
|
|
434
434
|
name: m,
|
|
435
435
|
maxLength: u = 250,
|
|
436
|
-
onClear:
|
|
437
|
-
showClearButton:
|
|
438
|
-
step:
|
|
439
|
-
autoComplete:
|
|
440
|
-
},
|
|
441
|
-
const [E,
|
|
442
|
-
|
|
443
|
-
},
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
let
|
|
447
|
-
r === "number" && u &&
|
|
448
|
-
},
|
|
449
|
-
|
|
450
|
-
},
|
|
436
|
+
onClear: b,
|
|
437
|
+
showClearButton: w = !1,
|
|
438
|
+
step: p,
|
|
439
|
+
autoComplete: y = "off"
|
|
440
|
+
}, $) => {
|
|
441
|
+
const [E, j] = _(!1), [o, N] = _(""), [T, Y] = _(!1), q = D ?? o, B = r === "password", P = w && !!q && !C, W = l && d === "left", Q = l && d === "right" || f || B, ne = Q || P, K = () => {
|
|
442
|
+
j(!0), L?.();
|
|
443
|
+
}, ae = () => {
|
|
444
|
+
j(!1), F?.();
|
|
445
|
+
}, ce = (g) => {
|
|
446
|
+
let I = g.target.value;
|
|
447
|
+
r === "number" && u && I.length > u && (I = I.slice(0, u), g.target.value = I), D === void 0 && N(I), M?.(g);
|
|
448
|
+
}, ee = () => Y((g) => !g), de = () => {
|
|
449
|
+
D === void 0 && N(""), b?.();
|
|
450
|
+
}, z = Z(
|
|
451
451
|
() => ({
|
|
452
452
|
sm: {
|
|
453
453
|
input: "h-9 text-sm",
|
|
454
|
-
padding:
|
|
454
|
+
padding: W && Q ? "pl-7 pr-7" : W ? "pl-7 pr-2" : Q ? "pl-2 pr-7" : "px-2",
|
|
455
455
|
icon: "w-4 h-4",
|
|
456
456
|
leftIcon: "left-2",
|
|
457
457
|
rightIcon: "right-2",
|
|
@@ -460,7 +460,7 @@ const Fe = he(
|
|
|
460
460
|
},
|
|
461
461
|
md: {
|
|
462
462
|
input: "h-10 text-sm",
|
|
463
|
-
padding:
|
|
463
|
+
padding: W && Q ? "pl-8 pr-8" : W ? "pl-8 pr-2" : Q ? "pl-2 pr-8" : "px-4",
|
|
464
464
|
icon: "w-4 h-4",
|
|
465
465
|
leftIcon: "left-2",
|
|
466
466
|
rightIcon: "right-2",
|
|
@@ -469,7 +469,7 @@ const Fe = he(
|
|
|
469
469
|
},
|
|
470
470
|
base: {
|
|
471
471
|
input: "h-12 text-base",
|
|
472
|
-
padding:
|
|
472
|
+
padding: W && Q ? "pl-9 pr-9" : W ? "pl-9 pr-3" : Q ? "pl-3 pr-9" : "px-4",
|
|
473
473
|
icon: "w-5 h-5",
|
|
474
474
|
leftIcon: "left-3",
|
|
475
475
|
rightIcon: "right-3",
|
|
@@ -477,9 +477,9 @@ const Fe = he(
|
|
|
477
477
|
iconWrapper: "h-5"
|
|
478
478
|
}
|
|
479
479
|
}),
|
|
480
|
-
[
|
|
481
|
-
),
|
|
482
|
-
return /* @__PURE__ */ i("div", { className: n("w-full",
|
|
480
|
+
[W, Q]
|
|
481
|
+
), G = Z(() => c ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600", [c]), oe = Z(() => C ? "text-slate-400" : c ? "text-red-600" : E ? "text-black" : "text-slate-400", [c, E, C]);
|
|
482
|
+
return /* @__PURE__ */ i("div", { className: n("w-full", v), children: [
|
|
483
483
|
t && /* @__PURE__ */ i(
|
|
484
484
|
"label",
|
|
485
485
|
{
|
|
@@ -487,7 +487,7 @@ const Fe = he(
|
|
|
487
487
|
className: n(
|
|
488
488
|
"mb-2 block text-base font-medium",
|
|
489
489
|
c ? "text-red-600" : "text-slate-700",
|
|
490
|
-
|
|
490
|
+
z[s].labelFont
|
|
491
491
|
),
|
|
492
492
|
children: [
|
|
493
493
|
t,
|
|
@@ -499,105 +499,105 @@ const Fe = he(
|
|
|
499
499
|
/* @__PURE__ */ e(
|
|
500
500
|
"input",
|
|
501
501
|
{
|
|
502
|
-
ref:
|
|
502
|
+
ref: $,
|
|
503
503
|
name: m,
|
|
504
|
-
type: B &&
|
|
505
|
-
value:
|
|
506
|
-
onChange:
|
|
507
|
-
onFocus:
|
|
508
|
-
onBlur:
|
|
504
|
+
type: B && T ? "text" : r,
|
|
505
|
+
value: q,
|
|
506
|
+
onChange: ce,
|
|
507
|
+
onFocus: K,
|
|
508
|
+
onBlur: ae,
|
|
509
509
|
disabled: C,
|
|
510
510
|
required: k,
|
|
511
|
-
autoComplete:
|
|
511
|
+
autoComplete: y,
|
|
512
512
|
placeholder: a,
|
|
513
|
-
step:
|
|
513
|
+
step: p,
|
|
514
514
|
className: n(
|
|
515
515
|
"w-full border bg-white font-normal transition-all duration-300 ease-in-out outline-none",
|
|
516
516
|
s === "base" ? "rounded-xl" : "rounded-lg",
|
|
517
517
|
"disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
|
|
518
518
|
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
519
|
+
z[s].input,
|
|
520
|
+
z[s].padding,
|
|
521
|
+
G
|
|
522
522
|
),
|
|
523
523
|
maxLength: u
|
|
524
524
|
}
|
|
525
525
|
),
|
|
526
|
-
|
|
526
|
+
W && /* @__PURE__ */ e(
|
|
527
527
|
"div",
|
|
528
528
|
{
|
|
529
529
|
className: n(
|
|
530
530
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center",
|
|
531
531
|
"transition-all duration-300",
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
z[s].leftIcon,
|
|
533
|
+
oe
|
|
534
534
|
),
|
|
535
535
|
children: /* @__PURE__ */ e(
|
|
536
536
|
"div",
|
|
537
537
|
{
|
|
538
|
-
className: n("flex items-center justify-center",
|
|
539
|
-
children: /* @__PURE__ */ e("span", { className: n("flex items-center justify-center",
|
|
538
|
+
className: n("flex items-center justify-center", z[s].iconWrapper),
|
|
539
|
+
children: /* @__PURE__ */ e("span", { className: n("flex items-center justify-center", z[s].icon), children: l })
|
|
540
540
|
}
|
|
541
541
|
)
|
|
542
542
|
}
|
|
543
543
|
),
|
|
544
|
-
|
|
544
|
+
ne && /* @__PURE__ */ i(
|
|
545
545
|
"div",
|
|
546
546
|
{
|
|
547
547
|
className: n(
|
|
548
548
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center gap-2",
|
|
549
549
|
"transition-all duration-300",
|
|
550
|
-
|
|
550
|
+
z[s].rightIcon
|
|
551
551
|
),
|
|
552
552
|
children: [
|
|
553
|
-
|
|
553
|
+
P && /* @__PURE__ */ e(
|
|
554
554
|
"button",
|
|
555
555
|
{
|
|
556
556
|
type: "button",
|
|
557
|
-
onClick:
|
|
557
|
+
onClick: de,
|
|
558
558
|
className: n(
|
|
559
559
|
"flex items-center justify-center",
|
|
560
|
-
|
|
560
|
+
z[s].iconWrapper,
|
|
561
561
|
"text-slate-base hover:text-black"
|
|
562
562
|
),
|
|
563
563
|
style: { cursor: "pointer" },
|
|
564
|
-
children: /* @__PURE__ */ e("span", { className: n("flex items-center justify-center",
|
|
564
|
+
children: /* @__PURE__ */ e("span", { className: n("flex items-center justify-center", z[s].icon), children: /* @__PURE__ */ e(pe, { className: n("h-full w-full") }) })
|
|
565
565
|
}
|
|
566
566
|
),
|
|
567
|
-
|
|
567
|
+
f && !B && /* @__PURE__ */ e(
|
|
568
568
|
"div",
|
|
569
569
|
{
|
|
570
|
-
className: n("flex items-center justify-center",
|
|
570
|
+
className: n("flex items-center justify-center", z[s].iconWrapper),
|
|
571
571
|
children: /* @__PURE__ */ e(
|
|
572
572
|
"span",
|
|
573
573
|
{
|
|
574
574
|
className: n(
|
|
575
575
|
"flex items-center justify-center",
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
z[s].icon,
|
|
577
|
+
oe
|
|
578
578
|
),
|
|
579
|
-
children:
|
|
579
|
+
children: f
|
|
580
580
|
}
|
|
581
581
|
)
|
|
582
582
|
}
|
|
583
583
|
),
|
|
584
|
-
B && /* @__PURE__ */ i(
|
|
585
|
-
|
|
584
|
+
B && /* @__PURE__ */ i(he, { children: [
|
|
585
|
+
f && /* @__PURE__ */ e(
|
|
586
586
|
"div",
|
|
587
587
|
{
|
|
588
588
|
className: n(
|
|
589
589
|
"flex items-center justify-center",
|
|
590
|
-
|
|
590
|
+
z[s].iconWrapper
|
|
591
591
|
),
|
|
592
592
|
children: /* @__PURE__ */ e(
|
|
593
593
|
"span",
|
|
594
594
|
{
|
|
595
595
|
className: n(
|
|
596
596
|
"flex items-center justify-center",
|
|
597
|
-
|
|
598
|
-
|
|
597
|
+
z[s].icon,
|
|
598
|
+
oe
|
|
599
599
|
),
|
|
600
|
-
children:
|
|
600
|
+
children: f
|
|
601
601
|
}
|
|
602
602
|
)
|
|
603
603
|
}
|
|
@@ -606,17 +606,17 @@ const Fe = he(
|
|
|
606
606
|
"button",
|
|
607
607
|
{
|
|
608
608
|
type: "button",
|
|
609
|
-
onClick:
|
|
609
|
+
onClick: ee,
|
|
610
610
|
className: n(
|
|
611
611
|
"flex items-center justify-center",
|
|
612
|
-
|
|
613
|
-
|
|
612
|
+
z[s].iconWrapper,
|
|
613
|
+
oe
|
|
614
614
|
),
|
|
615
615
|
children: /* @__PURE__ */ e(
|
|
616
616
|
"span",
|
|
617
617
|
{
|
|
618
|
-
className: n("flex items-center justify-center cursor-pointer",
|
|
619
|
-
children:
|
|
618
|
+
className: n("flex items-center justify-center cursor-pointer", z[s].icon),
|
|
619
|
+
children: T ? /* @__PURE__ */ e(Qe, { weight: "Linear", className: n("h-full w-full") }) : /* @__PURE__ */ e(Oe, { weight: "Linear", className: n("h-full w-full") })
|
|
620
620
|
}
|
|
621
621
|
)
|
|
622
622
|
}
|
|
@@ -625,14 +625,14 @@ const Fe = he(
|
|
|
625
625
|
l && d === "right" && !B && /* @__PURE__ */ e(
|
|
626
626
|
"div",
|
|
627
627
|
{
|
|
628
|
-
className: n("flex items-center justify-center",
|
|
628
|
+
className: n("flex items-center justify-center", z[s].iconWrapper),
|
|
629
629
|
children: /* @__PURE__ */ e(
|
|
630
630
|
"span",
|
|
631
631
|
{
|
|
632
632
|
className: n(
|
|
633
633
|
"flex items-center justify-center",
|
|
634
|
-
|
|
635
|
-
|
|
634
|
+
z[s].icon,
|
|
635
|
+
oe
|
|
636
636
|
),
|
|
637
637
|
children: l
|
|
638
638
|
}
|
|
@@ -647,8 +647,8 @@ const Fe = he(
|
|
|
647
647
|
] });
|
|
648
648
|
}
|
|
649
649
|
);
|
|
650
|
-
|
|
651
|
-
const
|
|
650
|
+
Le.displayName = "MciInput";
|
|
651
|
+
const Mt = {
|
|
652
652
|
uz: {
|
|
653
653
|
months: [
|
|
654
654
|
"Yanvar",
|
|
@@ -745,203 +745,203 @@ const Dt = {
|
|
|
745
745
|
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
746
746
|
weekdaysShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
|
|
747
747
|
}
|
|
748
|
-
},
|
|
748
|
+
}, Dt = fe(
|
|
749
749
|
({
|
|
750
750
|
type: t = "date",
|
|
751
751
|
value: a,
|
|
752
752
|
onChange: r,
|
|
753
753
|
placeholder: l,
|
|
754
|
-
label:
|
|
754
|
+
label: f,
|
|
755
755
|
disabled: d = !1,
|
|
756
756
|
required: s = !1,
|
|
757
757
|
className: c,
|
|
758
758
|
format: C = "DD.MM.YYYY",
|
|
759
759
|
minDate: k,
|
|
760
|
-
maxDate:
|
|
760
|
+
maxDate: D,
|
|
761
761
|
error: M,
|
|
762
762
|
showClear: L = !0,
|
|
763
763
|
allowManualInput: F = !0,
|
|
764
|
-
locale:
|
|
764
|
+
locale: v = "uz",
|
|
765
765
|
startView: m = "day",
|
|
766
766
|
iconPosition: u = "left",
|
|
767
|
-
align:
|
|
768
|
-
},
|
|
769
|
-
const [
|
|
767
|
+
align: b = "auto"
|
|
768
|
+
}, w) => {
|
|
769
|
+
const [p, y] = _(!1), [$, E] = _(
|
|
770
770
|
t === "range" ? [null, null] : null
|
|
771
|
-
), [
|
|
771
|
+
), [j, o] = _([null, null]), N = R((h) => {
|
|
772
772
|
if (!h) return null;
|
|
773
|
-
const
|
|
774
|
-
return isNaN(
|
|
775
|
-
}, []), [
|
|
776
|
-
const h = a !== void 0 ? a :
|
|
777
|
-
if (t === "date") return
|
|
778
|
-
const
|
|
779
|
-
return [
|
|
780
|
-
}, [a,
|
|
773
|
+
const x = new Date(h);
|
|
774
|
+
return isNaN(x.getTime()) ? null : x;
|
|
775
|
+
}, []), [T, Y] = _(/* @__PURE__ */ new Date()), [q, B] = _(m), [P, W] = _(0), [Q, ne] = _(""), [K, ae] = _(b), ce = le(null), ee = Z(() => {
|
|
776
|
+
const h = a !== void 0 ? a : $;
|
|
777
|
+
if (t === "date") return N(h);
|
|
778
|
+
const x = h;
|
|
779
|
+
return [N(x[0]), N(x[1])];
|
|
780
|
+
}, [a, $, t, N]), de = Mt[v], z = R((h) => new Date(h.getFullYear(), h.getMonth(), h.getDate()), []), G = R(
|
|
781
781
|
(h) => {
|
|
782
782
|
if (!h) return "";
|
|
783
|
-
const
|
|
784
|
-
return C.replace("DD",
|
|
783
|
+
const x = h.getDate().toString().padStart(2, "0"), S = (h.getMonth() + 1).toString().padStart(2, "0"), H = h.getFullYear();
|
|
784
|
+
return C.replace("DD", x).replace("MM", S).replace("YYYY", H.toString());
|
|
785
785
|
},
|
|
786
786
|
[C]
|
|
787
|
-
),
|
|
787
|
+
), oe = R((h) => {
|
|
788
788
|
if (!h || h.length !== 10) return null;
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
791
|
-
const
|
|
792
|
-
if (
|
|
793
|
-
const
|
|
794
|
-
return
|
|
795
|
-
}, []),
|
|
789
|
+
const x = h.replace(/\D/g, "");
|
|
790
|
+
if (x.length !== 8) return null;
|
|
791
|
+
const S = parseInt(x.slice(0, 2), 10), H = parseInt(x.slice(2, 4), 10), V = parseInt(x.slice(4, 8), 10);
|
|
792
|
+
if (V < 1e3 || H < 1 || H > 12 || S < 1 || S > 31) return null;
|
|
793
|
+
const te = new Date(V, H - 1, S);
|
|
794
|
+
return te.getFullYear() !== V || te.getMonth() !== H - 1 || te.getDate() !== S ? null : te;
|
|
795
|
+
}, []), g = R(
|
|
796
796
|
(h) => {
|
|
797
|
-
const
|
|
798
|
-
return !!(k &&
|
|
797
|
+
const x = z(h);
|
|
798
|
+
return !!(k && x < z(k) || D && x > z(D));
|
|
799
799
|
},
|
|
800
|
-
[k,
|
|
801
|
-
),
|
|
802
|
-
if (t === "date") return
|
|
803
|
-
const [h,
|
|
804
|
-
return !h && !
|
|
805
|
-
}, [t,
|
|
800
|
+
[k, D, z]
|
|
801
|
+
), I = Z(() => {
|
|
802
|
+
if (t === "date") return G(ee);
|
|
803
|
+
const [h, x] = ee;
|
|
804
|
+
return !h && !x ? "" : h && x ? `${G(h)} - ${G(x)}` : h ? `${G(h)} - ...` : "...";
|
|
805
|
+
}, [t, ee, G]);
|
|
806
806
|
J(() => {
|
|
807
|
-
|
|
808
|
-
}, [
|
|
809
|
-
if (
|
|
807
|
+
p ? Q === "" && I !== "" && ne(I) : ne(I);
|
|
808
|
+
}, [I, p]), J(() => {
|
|
809
|
+
if (p)
|
|
810
810
|
if (t === "range") {
|
|
811
|
-
const h =
|
|
812
|
-
o(h), h[0] ?
|
|
811
|
+
const h = ee;
|
|
812
|
+
o(h), h[0] ? Y(h[0]) : h[1] ? Y(h[1]) : Y(/* @__PURE__ */ new Date());
|
|
813
813
|
} else {
|
|
814
|
-
const h =
|
|
815
|
-
|
|
814
|
+
const h = ee;
|
|
815
|
+
Y(h || /* @__PURE__ */ new Date());
|
|
816
816
|
}
|
|
817
|
-
}, [
|
|
818
|
-
if (
|
|
819
|
-
const h =
|
|
820
|
-
|
|
817
|
+
}, [p]), J(() => {
|
|
818
|
+
if (p && b === "auto" && ce.current) {
|
|
819
|
+
const h = ce.current.getBoundingClientRect(), x = window.innerWidth - h.right, S = h.left;
|
|
820
|
+
x < 300 && S > 300 ? ae("right") : ae("left");
|
|
821
821
|
}
|
|
822
|
-
}, [
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
}, [m,
|
|
826
|
-
d || (h.preventDefault(), h.stopPropagation(),
|
|
827
|
-
}, [d]), { handleClick:
|
|
822
|
+
}, [p, b]);
|
|
823
|
+
const O = R(() => {
|
|
824
|
+
y(!1), B(m), W(0), ne(I);
|
|
825
|
+
}, [m, I]), U = R((h) => {
|
|
826
|
+
d || (h.preventDefault(), h.stopPropagation(), y((x) => !x));
|
|
827
|
+
}, [d]), { handleClick: A } = De(ce, O), { handleEscape: X } = Ee(O);
|
|
828
828
|
J(() => {
|
|
829
|
-
if (
|
|
830
|
-
return document.addEventListener("mousedown",
|
|
831
|
-
document.removeEventListener("mousedown",
|
|
829
|
+
if (p)
|
|
830
|
+
return document.addEventListener("mousedown", A), document.addEventListener("keydown", X), () => {
|
|
831
|
+
document.removeEventListener("mousedown", A), document.removeEventListener("keydown", X);
|
|
832
832
|
};
|
|
833
|
-
}, [
|
|
834
|
-
const
|
|
835
|
-
d ||
|
|
836
|
-
},
|
|
833
|
+
}, [p, A, X]);
|
|
834
|
+
const me = () => {
|
|
835
|
+
d || p || (t === "range" || !F) && (y(!0), B(m));
|
|
836
|
+
}, xe = (h) => {
|
|
837
837
|
if (t !== "date") return;
|
|
838
|
-
let
|
|
839
|
-
|
|
840
|
-
let
|
|
841
|
-
if (
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
} else
|
|
845
|
-
},
|
|
838
|
+
let S = h.target.value.replace(/\D/g, "");
|
|
839
|
+
S.length > 8 && (S = S.slice(0, 8));
|
|
840
|
+
let H = "";
|
|
841
|
+
if (S.length > 4 ? H = `${S.slice(0, 2)}.${S.slice(2, 4)}.${S.slice(4)}` : S.length > 2 ? H = `${S.slice(0, 2)}.${S.slice(2)}` : H = S, ne(H), H.length === 10) {
|
|
842
|
+
const V = oe(H);
|
|
843
|
+
V && !g(V) && (E(V), r?.(V), Y(V));
|
|
844
|
+
} else H === "" && (E(null), r?.(null));
|
|
845
|
+
}, Ye = R(() => {
|
|
846
846
|
const h = t === "range" ? [null, null] : null;
|
|
847
|
-
E(h), o([null, null]), r?.(h),
|
|
848
|
-
}, [t, r]),
|
|
847
|
+
E(h), o([null, null]), r?.(h), ne("");
|
|
848
|
+
}, [t, r]), Ue = R(
|
|
849
849
|
(h) => {
|
|
850
|
-
if (
|
|
851
|
-
const
|
|
850
|
+
if (g(h)) return;
|
|
851
|
+
const x = z(h);
|
|
852
852
|
if (t === "date")
|
|
853
|
-
E(
|
|
853
|
+
E(x), r?.(x), ne(G(x)), O();
|
|
854
854
|
else {
|
|
855
|
-
const [
|
|
856
|
-
if (!
|
|
857
|
-
o([
|
|
858
|
-
else if (
|
|
859
|
-
const
|
|
860
|
-
o(
|
|
861
|
-
const [
|
|
862
|
-
|
|
855
|
+
const [S, H] = j;
|
|
856
|
+
if (!S && !H || S && H)
|
|
857
|
+
o([x, null]), ne(`${G(x)} - ...`);
|
|
858
|
+
else if (S && !H) {
|
|
859
|
+
const V = x < S ? [x, S] : [S, x];
|
|
860
|
+
o(V), E(V), r?.(V);
|
|
861
|
+
const [te, ue] = V;
|
|
862
|
+
ne(`${G(te)} - ${G(ue)}`), O();
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
},
|
|
866
|
-
[t,
|
|
867
|
-
),
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
}, [
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
}, [
|
|
874
|
-
|
|
875
|
-
},
|
|
876
|
-
|
|
877
|
-
},
|
|
878
|
-
const
|
|
879
|
-
for (let
|
|
880
|
-
for (let
|
|
881
|
-
const
|
|
882
|
-
for (let
|
|
883
|
-
return
|
|
884
|
-
}, []),
|
|
885
|
-
const
|
|
886
|
-
if (t === "date") return
|
|
887
|
-
const [
|
|
888
|
-
return
|
|
866
|
+
[t, j, g, z, r, O, G]
|
|
867
|
+
), _e = R((h) => {
|
|
868
|
+
const x = new Date(T.getFullYear(), h, 1);
|
|
869
|
+
Y(x), m === "month" && t === "date" ? (E(x), r?.(x), ne(G(x)), O()) : B("day");
|
|
870
|
+
}, [T, m, r, O, t, G]), He = R((h) => {
|
|
871
|
+
const x = new Date(h, T.getMonth(), 1);
|
|
872
|
+
Y(x), m === "year" && t === "date" ? (E(x), r?.(x), ne(G(x)), O()) : B("month");
|
|
873
|
+
}, [T, m, r, O, t, G]), je = (h) => {
|
|
874
|
+
Y((x) => new Date(x.getFullYear(), x.getMonth() + h, 1));
|
|
875
|
+
}, we = (h) => {
|
|
876
|
+
Y((x) => new Date(x.getFullYear() + h, x.getMonth(), 1));
|
|
877
|
+
}, Ve = R((h) => {
|
|
878
|
+
const x = h.getFullYear(), S = h.getMonth(), H = new Date(x, S, 1).getDay(), V = new Date(x, S + 1, 0).getDate(), te = [];
|
|
879
|
+
for (let se = H; se > 0; se--) te.push({ date: new Date(x, S, 1 - se), isCurrentMonth: !1 });
|
|
880
|
+
for (let se = 1; se <= V; se++) te.push({ date: new Date(x, S, se), isCurrentMonth: !0 });
|
|
881
|
+
const ue = 42 - te.length;
|
|
882
|
+
for (let se = 1; se <= ue; se++) te.push({ date: new Date(x, S + 1, se), isCurrentMonth: !1 });
|
|
883
|
+
return te;
|
|
884
|
+
}, []), ve = R((h, x) => z(h).getTime() === z(x).getTime(), [z]), Ze = (h) => {
|
|
885
|
+
const x = z(h);
|
|
886
|
+
if (t === "date") return ee && ve(x, ee);
|
|
887
|
+
const [S] = j[0] ? j : ee;
|
|
888
|
+
return N(S) && ve(x, N(S));
|
|
889
889
|
}, qe = (h) => {
|
|
890
890
|
if (t !== "range") return !1;
|
|
891
|
-
const
|
|
892
|
-
return
|
|
891
|
+
const x = z(h), [, S] = j[1] ? j : ee;
|
|
892
|
+
return N(S) && ve(x, N(S));
|
|
893
893
|
}, Ke = (h) => {
|
|
894
894
|
if (t !== "range") return !1;
|
|
895
|
-
const
|
|
896
|
-
return
|
|
897
|
-
},
|
|
898
|
-
const
|
|
895
|
+
const x = z(h), [S, H] = j[0] ? j : ee, V = N(S), te = N(H);
|
|
896
|
+
return V && !te ? !1 : V && te && x > z(V) && x < z(te);
|
|
897
|
+
}, Ie = (h, x, S) => {
|
|
898
|
+
const H = Ve(h);
|
|
899
899
|
return /* @__PURE__ */ i("div", { className: "w-[300px] p-2 select-none", children: [
|
|
900
900
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-4 py-1", children: [
|
|
901
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16", children:
|
|
902
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
903
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
901
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16", children: x && /* @__PURE__ */ i(he, { children: [
|
|
902
|
+
/* @__PURE__ */ e("button", { onClick: () => we(-1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(tt, { size: 18 }) }),
|
|
903
|
+
/* @__PURE__ */ e("button", { onClick: () => je(-1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(ke, { size: 18 }) })
|
|
904
904
|
] }) }),
|
|
905
905
|
/* @__PURE__ */ i("div", { className: "flex gap-1 font-semibold text-slate-700 text-sm whitespace-nowrap", children: [
|
|
906
|
-
/* @__PURE__ */ e("span", { className: "cursor-pointer hover:text-blue-600 transition-colors p-1 rounded hover:bg-slate-50", onClick: () => B("month"), children:
|
|
906
|
+
/* @__PURE__ */ e("span", { className: "cursor-pointer hover:text-blue-600 transition-colors p-1 rounded hover:bg-slate-50", onClick: () => B("month"), children: de.months[h.getMonth()] }),
|
|
907
907
|
/* @__PURE__ */ e("span", { className: "cursor-pointer hover:text-blue-600 transition-colors p-1 rounded hover:bg-slate-50", onClick: () => B("year"), children: h.getFullYear() })
|
|
908
908
|
] }),
|
|
909
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16 justify-end", children:
|
|
910
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
911
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
909
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16 justify-end", children: S && /* @__PURE__ */ i(he, { children: [
|
|
910
|
+
/* @__PURE__ */ e("button", { onClick: () => je(1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(be, { size: 18 }) }),
|
|
911
|
+
/* @__PURE__ */ e("button", { onClick: () => we(1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(rt, { size: 18 }) })
|
|
912
912
|
] }) })
|
|
913
913
|
] }),
|
|
914
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 mb-1 text-center text-[11px] font-bold text-blue-600 uppercase", children:
|
|
915
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-y-1 relative", children:
|
|
916
|
-
const
|
|
917
|
-
return /* @__PURE__ */ e("div", { className: n("h-10 flex items-center justify-center relative", Xe && "bg-blue-50",
|
|
914
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 mb-1 text-center text-[11px] font-bold text-blue-600 uppercase", children: de.weekdaysShort.map((V) => /* @__PURE__ */ e("div", { className: "py-1", children: V }, V)) }),
|
|
915
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-y-1 relative", children: H.map((V, te) => {
|
|
916
|
+
const ue = V.date, se = g(ue), ye = Ze(ue), Ne = qe(ue), Xe = Ke(ue);
|
|
917
|
+
return /* @__PURE__ */ e("div", { className: n("h-10 flex items-center justify-center relative", Xe && "bg-blue-50", ye && t === "range" && Ne ? "bg-blue-50 rounded-full" : ye && t === "range" ? "bg-gradient-to-r from-transparent to-blue-50 rounded-l-full" : "", Ne && t === "range" ? "bg-gradient-to-l from-transparent to-blue-50 rounded-r-full" : ""), children: /* @__PURE__ */ e("button", { type: "button", onClick: () => Ue(ue), disabled: se, className: n("w-9 h-9 cursor-pointer rounded-full flex items-center justify-center text-sm font-medium transition-all z-10", V.isCurrentMonth ? "text-slate-700" : "text-slate-300", se && "opacity-20 cursor-not-allowed", ye || Ne ? "bg-blue-600 text-white shadow-md shadow-blue-200 hover:bg-blue-700" : "hover:bg-blue-50", ve(ue, /* @__PURE__ */ new Date()) && !ye && !Ne && "text-blue-600 border border-blue-600"), children: ue.getDate() }) }, te);
|
|
918
918
|
}) })
|
|
919
919
|
] });
|
|
920
920
|
}, Je = () => /* @__PURE__ */ i("div", { className: "w-[300px] p-3", children: [
|
|
921
921
|
/* @__PURE__ */ i("div", { className: "flex justify-between items-center mb-4 px-2", children: [
|
|
922
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
923
|
-
/* @__PURE__ */ e("span", { className: "font-bold text-slate-800", children:
|
|
924
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
922
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => we(-1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(ke, { size: 20 }) }),
|
|
923
|
+
/* @__PURE__ */ e("span", { className: "font-bold text-slate-800", children: T.getFullYear() }),
|
|
924
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => we(1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(be, { size: 20 }) })
|
|
925
925
|
] }),
|
|
926
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-2", children:
|
|
926
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-2", children: de.monthsShort.map((h, x) => /* @__PURE__ */ e("button", { type: "button", onClick: () => _e(x), className: n("hover:cursor-pointer py-3 rounded-lg text-sm font-semibold transition-colors", T.getMonth() === x ? "bg-blue-600 text-white" : "hover:bg-blue-50 text-slate-600"), children: h }, h)) })
|
|
927
927
|
] }), Ge = () => {
|
|
928
|
-
const h = Math.floor(
|
|
928
|
+
const h = Math.floor(T.getFullYear() / 12) * 12 + P * 12, x = Array.from({ length: 12 }, (S, H) => h + H);
|
|
929
929
|
return /* @__PURE__ */ i("div", { className: "w-[300px] p-3", children: [
|
|
930
930
|
/* @__PURE__ */ i("div", { className: "flex justify-between items-center mb-4 px-2", children: [
|
|
931
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
931
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => W((S) => S - 1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(ke, { size: 20 }) }),
|
|
932
932
|
/* @__PURE__ */ i("span", { className: "font-bold text-slate-800", children: [
|
|
933
|
-
|
|
933
|
+
x[0],
|
|
934
934
|
" - ",
|
|
935
|
-
|
|
935
|
+
x[11]
|
|
936
936
|
] }),
|
|
937
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
937
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => W((S) => S + 1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(be, { size: 20 }) })
|
|
938
938
|
] }),
|
|
939
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-2", children:
|
|
939
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-2", children: x.map((S) => /* @__PURE__ */ e("button", { type: "button", onClick: () => He(S), className: n("hover:cursor-pointer py-3 rounded-lg text-sm font-semibold transition-colors", T.getFullYear() === S ? "bg-blue-600 text-white" : "hover:bg-blue-50 text-slate-600"), children: S }, S)) })
|
|
940
940
|
] });
|
|
941
|
-
},
|
|
941
|
+
}, Re = /* @__PURE__ */ e(
|
|
942
942
|
"div",
|
|
943
943
|
{
|
|
944
|
-
onClick:
|
|
944
|
+
onClick: U,
|
|
945
945
|
className: n(
|
|
946
946
|
"cursor-pointer flex items-center justify-center p-1 rounded-md transition-colors",
|
|
947
947
|
d ? "pointer-events-none opacity-50" : "hover:bg-slate-100 active:bg-slate-200"
|
|
@@ -949,49 +949,49 @@ const Dt = {
|
|
|
949
949
|
children: /* @__PURE__ */ e(et, { weight: "Linear", size: 20, className: "text-slate-400" })
|
|
950
950
|
}
|
|
951
951
|
);
|
|
952
|
-
return /* @__PURE__ */ i("div", { ref:
|
|
953
|
-
/* @__PURE__ */ e("div", { ref:
|
|
954
|
-
|
|
952
|
+
return /* @__PURE__ */ i("div", { ref: ce, className: n("relative w-full group", c), children: [
|
|
953
|
+
/* @__PURE__ */ e("div", { ref: w, children: /* @__PURE__ */ e(
|
|
954
|
+
Le,
|
|
955
955
|
{
|
|
956
|
-
label:
|
|
956
|
+
label: f,
|
|
957
957
|
placeholder: Array.isArray(l) ? l[0] : l,
|
|
958
|
-
value:
|
|
959
|
-
onChange:
|
|
960
|
-
icon: u === "left" ?
|
|
961
|
-
rightIcon: u === "right" ?
|
|
958
|
+
value: Q,
|
|
959
|
+
onChange: xe,
|
|
960
|
+
icon: u === "left" ? Re : void 0,
|
|
961
|
+
rightIcon: u === "right" ? Re : void 0,
|
|
962
962
|
disabled: d,
|
|
963
963
|
required: s,
|
|
964
964
|
error: M,
|
|
965
965
|
maxLength: t === "date" ? 10 : void 0,
|
|
966
|
-
onFocus:
|
|
966
|
+
onFocus: me,
|
|
967
967
|
readOnly: !F || t === "range",
|
|
968
968
|
showClearButton: L,
|
|
969
|
-
onClear:
|
|
969
|
+
onClear: Ye
|
|
970
970
|
}
|
|
971
971
|
) }),
|
|
972
|
-
|
|
972
|
+
p && /* @__PURE__ */ e(
|
|
973
973
|
"div",
|
|
974
974
|
{
|
|
975
975
|
className: n(
|
|
976
976
|
"absolute top-[calc(100%+4px)] z-[100] bg-white rounded-xl shadow-xl border border-slate-200",
|
|
977
977
|
"flex flex-col md:flex-row overflow-hidden animate-in fade-in zoom-in-95 duration-200",
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
978
|
+
K === "right" && "right-0 origin-top-right",
|
|
979
|
+
K === "left" && "left-0 origin-top-left",
|
|
980
|
+
K === "center" && "left-1/2 -translate-x-1/2 origin-top"
|
|
981
981
|
),
|
|
982
982
|
style: { width: "max-content" },
|
|
983
983
|
onMouseDown: (h) => h.stopPropagation(),
|
|
984
|
-
children:
|
|
985
|
-
|
|
986
|
-
t === "range" && /* @__PURE__ */ e("div", { className: "hidden md:block border-l border-slate-100", children:
|
|
987
|
-
] }) :
|
|
984
|
+
children: q === "day" ? /* @__PURE__ */ i(he, { children: [
|
|
985
|
+
Ie(T, !0, t !== "range"),
|
|
986
|
+
t === "range" && /* @__PURE__ */ e("div", { className: "hidden md:block border-l border-slate-100", children: Ie(new Date(T.getFullYear(), T.getMonth() + 1, 1), !1, !0) })
|
|
987
|
+
] }) : q === "month" ? Je() : Ge()
|
|
988
988
|
}
|
|
989
989
|
)
|
|
990
990
|
] });
|
|
991
991
|
}
|
|
992
992
|
);
|
|
993
|
-
|
|
994
|
-
const
|
|
993
|
+
Dt.displayName = "MciPicker";
|
|
994
|
+
const St = {
|
|
995
995
|
sm: {
|
|
996
996
|
container: "h-9 text-sm",
|
|
997
997
|
padding: "px-2",
|
|
@@ -1025,97 +1025,97 @@ const At = {
|
|
|
1025
1025
|
label: "text-base",
|
|
1026
1026
|
dropdown: "text-base"
|
|
1027
1027
|
}
|
|
1028
|
-
},
|
|
1028
|
+
}, At = fe(
|
|
1029
1029
|
({
|
|
1030
1030
|
label: t,
|
|
1031
1031
|
placeholder: a = "Выберите...",
|
|
1032
1032
|
options: r = [],
|
|
1033
1033
|
icon: l,
|
|
1034
|
-
iconPosition:
|
|
1034
|
+
iconPosition: f = "left",
|
|
1035
1035
|
size: d = "base",
|
|
1036
1036
|
error: s,
|
|
1037
1037
|
disabled: c = !1,
|
|
1038
1038
|
required: C = !1,
|
|
1039
1039
|
value: k,
|
|
1040
|
-
onChange:
|
|
1040
|
+
onChange: D,
|
|
1041
1041
|
onFocus: M,
|
|
1042
1042
|
onBlur: L,
|
|
1043
1043
|
className: F,
|
|
1044
|
-
clearable:
|
|
1044
|
+
clearable: v = !1,
|
|
1045
1045
|
searchable: m = !1,
|
|
1046
1046
|
onSearch: u,
|
|
1047
|
-
name:
|
|
1048
|
-
},
|
|
1049
|
-
const [
|
|
1047
|
+
name: b
|
|
1048
|
+
}, w) => {
|
|
1049
|
+
const [p, y] = _(!1), [$, E] = _(!1), [j, o] = _(""), [N, T] = _(""), [Y, q] = _(-1), B = le(null), P = le(null), W = k !== void 0 ? k : j, Q = r.find((A) => A.value === W), ne = W !== "" && W !== void 0, K = St[d], ae = Z(() => {
|
|
1050
1050
|
if (!m || u) return r;
|
|
1051
|
-
const
|
|
1051
|
+
const A = N.toLowerCase();
|
|
1052
1052
|
return r.filter(
|
|
1053
|
-
(
|
|
1053
|
+
(X) => X.label.toLowerCase().includes(A)
|
|
1054
1054
|
);
|
|
1055
|
-
}, [r,
|
|
1056
|
-
|
|
1057
|
-
}, [L]), { handleClick:
|
|
1055
|
+
}, [r, N, m, u]), ce = R(() => {
|
|
1056
|
+
y(!1), E(!1), T(""), q(-1), L?.();
|
|
1057
|
+
}, [L]), { handleClick: ee } = De(B, ce), { handleEscape: de } = Ee(ce);
|
|
1058
1058
|
J(() => {
|
|
1059
|
-
if (
|
|
1060
|
-
return document.addEventListener("mousedown",
|
|
1061
|
-
document.removeEventListener("mousedown",
|
|
1059
|
+
if (p)
|
|
1060
|
+
return document.addEventListener("mousedown", ee), document.addEventListener("keydown", de), () => {
|
|
1061
|
+
document.removeEventListener("mousedown", ee), document.removeEventListener("keydown", de);
|
|
1062
1062
|
};
|
|
1063
|
-
}, [
|
|
1064
|
-
|
|
1065
|
-
}, [
|
|
1066
|
-
const
|
|
1067
|
-
(
|
|
1063
|
+
}, [p, ee, de]), J(() => {
|
|
1064
|
+
p && m && P.current && P.current.focus();
|
|
1065
|
+
}, [p, m]);
|
|
1066
|
+
const z = R(
|
|
1067
|
+
(A) => {
|
|
1068
1068
|
if (!c) {
|
|
1069
|
-
if (!
|
|
1070
|
-
|
|
1069
|
+
if (!p && (A.key === "ArrowDown" || A.key === "ArrowUp" || A.key === "Enter")) {
|
|
1070
|
+
A.preventDefault(), y(!0);
|
|
1071
1071
|
return;
|
|
1072
1072
|
}
|
|
1073
|
-
if (
|
|
1074
|
-
switch (
|
|
1073
|
+
if (p)
|
|
1074
|
+
switch (A.key) {
|
|
1075
1075
|
case "ArrowDown":
|
|
1076
|
-
|
|
1077
|
-
(
|
|
1076
|
+
A.preventDefault(), q(
|
|
1077
|
+
(X) => X < ae.length - 1 ? X + 1 : 0
|
|
1078
1078
|
);
|
|
1079
1079
|
break;
|
|
1080
1080
|
case "ArrowUp":
|
|
1081
|
-
|
|
1082
|
-
(
|
|
1081
|
+
A.preventDefault(), q(
|
|
1082
|
+
(X) => X > 0 ? X - 1 : ae.length - 1
|
|
1083
1083
|
);
|
|
1084
1084
|
break;
|
|
1085
1085
|
case "Enter":
|
|
1086
|
-
|
|
1086
|
+
A.preventDefault(), Y >= 0 && ae[Y] && oe(ae[Y].value);
|
|
1087
1087
|
break;
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
1090
|
},
|
|
1091
|
-
[
|
|
1092
|
-
),
|
|
1093
|
-
c || (
|
|
1094
|
-
}, [c,
|
|
1095
|
-
(
|
|
1096
|
-
k === void 0 && o(
|
|
1091
|
+
[p, ae, Y, c]
|
|
1092
|
+
), G = R(() => {
|
|
1093
|
+
c || (y((A) => !A), p ? (T(""), q(-1)) : (E(!0), M?.()));
|
|
1094
|
+
}, [c, p, M]), oe = R(
|
|
1095
|
+
(A) => {
|
|
1096
|
+
k === void 0 && o(A), D?.(A), y(!1), E(!1), T(""), q(-1), L?.();
|
|
1097
1097
|
},
|
|
1098
|
-
[k,
|
|
1099
|
-
),
|
|
1100
|
-
(
|
|
1101
|
-
|
|
1098
|
+
[k, D, L]
|
|
1099
|
+
), g = R(
|
|
1100
|
+
(A) => {
|
|
1101
|
+
A.stopPropagation(), !c && (k === void 0 && o(""), D?.(""), T(""), q(-1));
|
|
1102
1102
|
},
|
|
1103
|
-
[k,
|
|
1104
|
-
),
|
|
1105
|
-
(
|
|
1106
|
-
|
|
1103
|
+
[k, D, c]
|
|
1104
|
+
), I = R(
|
|
1105
|
+
(A) => {
|
|
1106
|
+
T(A), u?.(A), q(0);
|
|
1107
1107
|
},
|
|
1108
1108
|
[u]
|
|
1109
|
-
),
|
|
1110
|
-
return /* @__PURE__ */ i("div", { className: n("w-full", F), ref:
|
|
1109
|
+
), O = Z(() => c ? "border-slate-200 bg-slate-100 text-slate-400 cursor-not-allowed" : s ? "border-red-600 focus:border-red-600 shadow-red bg-white" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600 bg-white", [s, c]), U = Z(() => c ? "text-slate-400" : s ? "text-red-600" : p || $ ? "text-black" : "text-slate-400", [c, s, p, $]);
|
|
1110
|
+
return /* @__PURE__ */ i("div", { className: n("w-full", F), ref: w, children: [
|
|
1111
1111
|
t && /* @__PURE__ */ i(
|
|
1112
1112
|
"label",
|
|
1113
1113
|
{
|
|
1114
|
-
htmlFor:
|
|
1114
|
+
htmlFor: b,
|
|
1115
1115
|
className: n(
|
|
1116
1116
|
"mb-2 block text-base font-medium",
|
|
1117
1117
|
s ? "text-red-600" : "text-slate-700",
|
|
1118
|
-
|
|
1118
|
+
K.label
|
|
1119
1119
|
),
|
|
1120
1120
|
children: [
|
|
1121
1121
|
t,
|
|
@@ -1128,25 +1128,25 @@ const At = {
|
|
|
1128
1128
|
{
|
|
1129
1129
|
ref: B,
|
|
1130
1130
|
className: "relative",
|
|
1131
|
-
onKeyDown:
|
|
1131
|
+
onKeyDown: z,
|
|
1132
1132
|
children: [
|
|
1133
1133
|
/* @__PURE__ */ i(
|
|
1134
1134
|
"div",
|
|
1135
1135
|
{
|
|
1136
1136
|
role: "combobox",
|
|
1137
|
-
"aria-expanded":
|
|
1137
|
+
"aria-expanded": p,
|
|
1138
1138
|
"aria-haspopup": "listbox",
|
|
1139
|
-
"aria-controls": `${
|
|
1139
|
+
"aria-controls": `${b}-listbox`,
|
|
1140
1140
|
"aria-disabled": c,
|
|
1141
1141
|
tabIndex: c ? -1 : 0,
|
|
1142
|
-
onClick:
|
|
1142
|
+
onClick: G,
|
|
1143
1143
|
className: n(
|
|
1144
1144
|
"flex w-full items-center border font-normal transition-all duration-300 ease-in-out",
|
|
1145
1145
|
d === "base" ? "rounded-xl" : "rounded-lg",
|
|
1146
|
-
|
|
1147
|
-
l ?
|
|
1148
|
-
|
|
1149
|
-
!c &&
|
|
1146
|
+
K.container,
|
|
1147
|
+
l ? f === "left" ? K.iconPaddingLeft : K.iconPaddingRight : K.padding,
|
|
1148
|
+
O,
|
|
1149
|
+
!c && $ && "shadow-blue border-blue-600"
|
|
1150
1150
|
),
|
|
1151
1151
|
children: [
|
|
1152
1152
|
l && /* @__PURE__ */ e(
|
|
@@ -1154,44 +1154,44 @@ const At = {
|
|
|
1154
1154
|
{
|
|
1155
1155
|
className: n(
|
|
1156
1156
|
"absolute top-1/2 -translate-y-1/2 pointer-events-none transition-colors duration-300",
|
|
1157
|
-
|
|
1158
|
-
|
|
1157
|
+
f === "left" ? K.iconWrapper : K.rightIconWrapper,
|
|
1158
|
+
U
|
|
1159
1159
|
),
|
|
1160
1160
|
children: l
|
|
1161
1161
|
}
|
|
1162
1162
|
),
|
|
1163
|
-
m &&
|
|
1163
|
+
m && p ? /* @__PURE__ */ e(
|
|
1164
1164
|
"input",
|
|
1165
1165
|
{
|
|
1166
|
-
ref:
|
|
1166
|
+
ref: P,
|
|
1167
1167
|
type: "text",
|
|
1168
|
-
value:
|
|
1169
|
-
onChange: (
|
|
1168
|
+
value: N,
|
|
1169
|
+
onChange: (A) => I(A.target.value),
|
|
1170
1170
|
placeholder: a,
|
|
1171
1171
|
className: "w-full bg-transparent outline-none",
|
|
1172
|
-
onClick: (
|
|
1172
|
+
onClick: (A) => A.stopPropagation()
|
|
1173
1173
|
}
|
|
1174
1174
|
) : /* @__PURE__ */ e(
|
|
1175
1175
|
"span",
|
|
1176
1176
|
{
|
|
1177
1177
|
className: n(
|
|
1178
1178
|
"block truncate select-none",
|
|
1179
|
-
!
|
|
1179
|
+
!ne && !c && "text-slate-400"
|
|
1180
1180
|
),
|
|
1181
|
-
children:
|
|
1181
|
+
children: Q?.label || a
|
|
1182
1182
|
}
|
|
1183
1183
|
),
|
|
1184
|
-
|
|
1184
|
+
v && ne && !c && /* @__PURE__ */ e(
|
|
1185
1185
|
"button",
|
|
1186
1186
|
{
|
|
1187
1187
|
type: "button",
|
|
1188
|
-
onClick:
|
|
1188
|
+
onClick: g,
|
|
1189
1189
|
className: n(
|
|
1190
1190
|
"absolute top-1/2 -translate-y-1/2 text-slate-400 hover:text-black transition-colors cursor-pointer",
|
|
1191
|
-
l &&
|
|
1191
|
+
l && f === "left" ? "right-8" : "right-10"
|
|
1192
1192
|
),
|
|
1193
1193
|
"aria-label": "Очистить",
|
|
1194
|
-
children: /* @__PURE__ */ e(
|
|
1194
|
+
children: /* @__PURE__ */ e(pe, { className: K.iconSize })
|
|
1195
1195
|
}
|
|
1196
1196
|
),
|
|
1197
1197
|
/* @__PURE__ */ e(
|
|
@@ -1199,37 +1199,37 @@ const At = {
|
|
|
1199
1199
|
{
|
|
1200
1200
|
className: n(
|
|
1201
1201
|
"absolute top-1/2 right-3 -translate-y-1/2 pointer-events-none transition-all duration-300",
|
|
1202
|
-
|
|
1203
|
-
|
|
1202
|
+
p && "rotate-180",
|
|
1203
|
+
U
|
|
1204
1204
|
),
|
|
1205
|
-
children: /* @__PURE__ */ e(
|
|
1205
|
+
children: /* @__PURE__ */ e(Fe, { className: K.iconSize })
|
|
1206
1206
|
}
|
|
1207
1207
|
)
|
|
1208
1208
|
]
|
|
1209
1209
|
}
|
|
1210
1210
|
),
|
|
1211
|
-
|
|
1211
|
+
p && !c && /* @__PURE__ */ e(
|
|
1212
1212
|
"div",
|
|
1213
1213
|
{
|
|
1214
|
-
id: `${
|
|
1214
|
+
id: `${b}-listbox`,
|
|
1215
1215
|
role: "listbox",
|
|
1216
1216
|
className: n(
|
|
1217
1217
|
"absolute z-50 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-slate-200 bg-white shadow-md p-1 text-black",
|
|
1218
|
-
|
|
1218
|
+
K.dropdown
|
|
1219
1219
|
),
|
|
1220
|
-
children:
|
|
1220
|
+
children: ae.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-center text-base font-normal text-slate-500", children: "Ничего не найдено" }) : ae.map((A) => /* @__PURE__ */ e(
|
|
1221
1221
|
"div",
|
|
1222
1222
|
{
|
|
1223
1223
|
role: "option",
|
|
1224
|
-
"aria-selected":
|
|
1225
|
-
onClick: () =>
|
|
1224
|
+
"aria-selected": W === A.value,
|
|
1225
|
+
onClick: () => oe(A.value),
|
|
1226
1226
|
className: n(
|
|
1227
1227
|
"cursor-pointer px-3 py-2 font-normal transition-colors hover:bg-slate-100 rounded-sm",
|
|
1228
|
-
|
|
1228
|
+
W === A.value ? "bg-slate-100" : ""
|
|
1229
1229
|
),
|
|
1230
|
-
children:
|
|
1230
|
+
children: A.label
|
|
1231
1231
|
},
|
|
1232
|
-
|
|
1232
|
+
A.value
|
|
1233
1233
|
))
|
|
1234
1234
|
}
|
|
1235
1235
|
)
|
|
@@ -1240,65 +1240,65 @@ const At = {
|
|
|
1240
1240
|
] });
|
|
1241
1241
|
}
|
|
1242
1242
|
);
|
|
1243
|
-
|
|
1244
|
-
function
|
|
1243
|
+
At.displayName = "MciSelect";
|
|
1244
|
+
function Ft(t) {
|
|
1245
1245
|
if (t != null)
|
|
1246
1246
|
return typeof t == "number" ? `${t}px` : t;
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function Et({ children: t, title: a }) {
|
|
1249
1249
|
return /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("div", { className: "clamp-2 break-words", title: a ?? (typeof t == "string" ? t : void 0), children: t }) });
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1251
|
+
function Xt({
|
|
1252
1252
|
columns: t,
|
|
1253
1253
|
data: a = [],
|
|
1254
1254
|
loading: r = !1,
|
|
1255
1255
|
skeletonRows: l = 5,
|
|
1256
|
-
noDataText:
|
|
1256
|
+
noDataText: f = "",
|
|
1257
1257
|
sort: d,
|
|
1258
1258
|
onSortChange: s,
|
|
1259
1259
|
className: c,
|
|
1260
1260
|
headerClassName: C,
|
|
1261
1261
|
bodyClassName: k,
|
|
1262
|
-
rowKey:
|
|
1262
|
+
rowKey: D = "id",
|
|
1263
1263
|
rowSelection: M
|
|
1264
1264
|
}) {
|
|
1265
|
-
const [L, F] =
|
|
1265
|
+
const [L, F] = _(
|
|
1266
1266
|
null
|
|
1267
|
-
),
|
|
1268
|
-
const
|
|
1269
|
-
return
|
|
1270
|
-
}), [m,
|
|
1267
|
+
), v = d ?? L, m = Z(() => Array.isArray(a) ? a : [], [a]), u = Z(() => !v || d ? m : [...m].sort((o, N) => {
|
|
1268
|
+
const T = o[v.key], Y = N[v.key];
|
|
1269
|
+
return T == null ? 1 : Y == null ? -1 : T < Y ? v.direction === "asc" ? -1 : 1 : T > Y ? v.direction === "asc" ? 1 : -1 : 0;
|
|
1270
|
+
}), [m, v, d]);
|
|
1271
1271
|
J(() => {
|
|
1272
1272
|
d !== void 0 && F(null);
|
|
1273
1273
|
}, [d]);
|
|
1274
|
-
const
|
|
1274
|
+
const b = r ? [] : d ? m : u, w = R(
|
|
1275
1275
|
(o) => {
|
|
1276
1276
|
if (!o.sortable) return;
|
|
1277
|
-
let
|
|
1278
|
-
|
|
1277
|
+
let N = null;
|
|
1278
|
+
v?.key !== o.key ? N = { key: o.key, direction: "asc" } : v.direction === "asc" && (N = { key: o.key, direction: "desc" }), d !== void 0 ? s?.(N) : F(N);
|
|
1279
1279
|
},
|
|
1280
|
-
[
|
|
1281
|
-
),
|
|
1280
|
+
[v, d, s]
|
|
1281
|
+
), p = (o) => {
|
|
1282
1282
|
if (!M) return;
|
|
1283
|
-
const { onChange:
|
|
1283
|
+
const { onChange: N, getCheckboxProps: T } = M;
|
|
1284
1284
|
if (o.target.checked) {
|
|
1285
|
-
const B =
|
|
1286
|
-
|
|
1285
|
+
const B = b.filter((P) => !T?.(P)?.disabled).map((P) => P[D]);
|
|
1286
|
+
N(B);
|
|
1287
1287
|
} else
|
|
1288
|
-
|
|
1289
|
-
},
|
|
1288
|
+
N([]);
|
|
1289
|
+
}, y = (o, N) => {
|
|
1290
1290
|
if (!M) return;
|
|
1291
|
-
const { selectedRowKeys:
|
|
1292
|
-
|
|
1293
|
-
},
|
|
1294
|
-
if (!M ||
|
|
1295
|
-
const o =
|
|
1291
|
+
const { selectedRowKeys: T, onChange: Y } = M, q = o[D], B = N ? [...T, q] : T.filter((P) => P !== q);
|
|
1292
|
+
Y(B);
|
|
1293
|
+
}, $ = Z(() => {
|
|
1294
|
+
if (!M || b.length === 0) return !1;
|
|
1295
|
+
const o = b.filter((N) => !M.getCheckboxProps?.(N)?.disabled);
|
|
1296
1296
|
return o.length === 0 ? !1 : o.every(
|
|
1297
|
-
(
|
|
1297
|
+
(N) => M.selectedRowKeys.includes(N[D])
|
|
1298
1298
|
);
|
|
1299
|
-
}, [M,
|
|
1299
|
+
}, [M, b, D]), E = (o) => o.sortable ? !v || v.key !== o.key ? /* @__PURE__ */ e(lt, { weight: "Linear", size: 20, className: "text-slate-base shrink-0" }) : v.direction === "asc" ? /* @__PURE__ */ e(at, { weight: "Linear", size: 20, className: "text-slate-base shrink-0" }) : /* @__PURE__ */ e(st, { weight: "Linear", size: 20, className: "text-slate-base shrink-0" }) : null, j = () => /* @__PURE__ */ i("colgroup", { children: [
|
|
1300
1300
|
M && /* @__PURE__ */ e("col", { style: { width: 48 } }),
|
|
1301
|
-
t.map((o) => /* @__PURE__ */ e("col", { style: { width:
|
|
1301
|
+
t.map((o) => /* @__PURE__ */ e("col", { style: { width: Ft(o.width) ?? "auto" } }, o.key))
|
|
1302
1302
|
] });
|
|
1303
1303
|
return /* @__PURE__ */ e(
|
|
1304
1304
|
"div",
|
|
@@ -1314,21 +1314,21 @@ function Qt({
|
|
|
1314
1314
|
),
|
|
1315
1315
|
children: /* @__PURE__ */ i("div", { className: "inline-block min-w-full align-middle", children: [
|
|
1316
1316
|
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-slate-100", children: /* @__PURE__ */ i("table", { className: "w-full table-fixed", children: [
|
|
1317
|
-
|
|
1317
|
+
j(),
|
|
1318
1318
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
1319
1319
|
M && /* @__PURE__ */ e("th", { className: n("w-12 px-4 py-3", C), children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
1320
|
-
|
|
1320
|
+
Me,
|
|
1321
1321
|
{
|
|
1322
|
-
checked:
|
|
1323
|
-
onChange:
|
|
1322
|
+
checked: $,
|
|
1323
|
+
onChange: p,
|
|
1324
1324
|
variant: "yellow",
|
|
1325
|
-
disabled: r ||
|
|
1325
|
+
disabled: r || b.length === 0
|
|
1326
1326
|
}
|
|
1327
1327
|
) }) }),
|
|
1328
1328
|
t.map((o) => /* @__PURE__ */ e(
|
|
1329
1329
|
"th",
|
|
1330
1330
|
{
|
|
1331
|
-
onClick: () =>
|
|
1331
|
+
onClick: () => w(o),
|
|
1332
1332
|
className: n(
|
|
1333
1333
|
"px-4 py-3 text-left text-sm font-medium text-slate-700 transition-colors",
|
|
1334
1334
|
"whitespace-nowrap overflow-hidden text-ellipsis",
|
|
@@ -1347,58 +1347,51 @@ function Qt({
|
|
|
1347
1347
|
] }) })
|
|
1348
1348
|
] }) }),
|
|
1349
1349
|
/* @__PURE__ */ e("div", { className: "rounded-xl border border-t-0 border-slate-200 bg-white overflow-hidden", children: /* @__PURE__ */ i("table", { className: "w-full table-fixed", children: [
|
|
1350
|
-
|
|
1351
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-slate-200", children: r ? Array.from({ length: l }).map((o,
|
|
1352
|
-
M && /* @__PURE__ */ e("td", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ e(
|
|
1353
|
-
t.map((
|
|
1354
|
-
] },
|
|
1355
|
-
/* @__PURE__ */ e("div", { className: "relative mb-4", children: /* @__PURE__ */ e(
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
size: 64,
|
|
1360
|
-
className: "animate-float text-slate-400"
|
|
1361
|
-
}
|
|
1362
|
-
) }),
|
|
1363
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-slate-400", children: p })
|
|
1364
|
-
] }) }) }) : g.map((o, y) => {
|
|
1365
|
-
const R = o[S], W = M?.selectedRowKeys.includes(R), Z = M?.getCheckboxProps?.(o)?.disabled;
|
|
1350
|
+
j(),
|
|
1351
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-slate-200", children: r ? Array.from({ length: l }).map((o, N) => /* @__PURE__ */ i("tr", { children: [
|
|
1352
|
+
M && /* @__PURE__ */ e("td", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ e($e, { height: 20, width: 20, variant: "rounded" }) }),
|
|
1353
|
+
t.map((T) => /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ e($e, { height: 30, variant: "rounded" }) }, T.key))
|
|
1354
|
+
] }, N)) : b.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: t.length + (M ? 1 : 0), className: "py-20", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1355
|
+
/* @__PURE__ */ e("div", { className: "relative mb-4", children: /* @__PURE__ */ e(nt, { weight: "Bold", size: 64, className: "animate-float text-slate-400" }) }),
|
|
1356
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-slate-400", children: f })
|
|
1357
|
+
] }) }) }) : b.map((o, N) => {
|
|
1358
|
+
const T = o[D], Y = M?.selectedRowKeys.includes(T), q = M?.getCheckboxProps?.(o)?.disabled;
|
|
1366
1359
|
return /* @__PURE__ */ i("tr", { className: "group transition-colors hover:bg-slate-50", children: [
|
|
1367
1360
|
M && /* @__PURE__ */ e("td", { className: n("w-12 px-4 py-3 align-top", k), children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center pt-1", children: /* @__PURE__ */ e(
|
|
1368
|
-
|
|
1361
|
+
Me,
|
|
1369
1362
|
{
|
|
1370
|
-
checked:
|
|
1371
|
-
disabled:
|
|
1363
|
+
checked: Y,
|
|
1364
|
+
disabled: q,
|
|
1372
1365
|
variant: "yellow",
|
|
1373
|
-
onChange: (B) =>
|
|
1366
|
+
onChange: (B) => y(o, B.target.checked)
|
|
1374
1367
|
}
|
|
1375
1368
|
) }) }),
|
|
1376
1369
|
t.map((B) => {
|
|
1377
|
-
const
|
|
1370
|
+
const P = o[B.key], W = B.render ? B.render(P, o) : String(P ?? "-");
|
|
1378
1371
|
return /* @__PURE__ */ e(
|
|
1379
1372
|
"td",
|
|
1380
1373
|
{
|
|
1381
1374
|
className: n(
|
|
1382
1375
|
"align-top px-4 py-3 text-sm font-normal text-black",
|
|
1383
|
-
"
|
|
1376
|
+
"min-w-0 whitespace-normal",
|
|
1384
1377
|
B.align === "center" && "text-center",
|
|
1385
1378
|
B.align === "right" && "text-right",
|
|
1386
1379
|
k,
|
|
1387
1380
|
B.className
|
|
1388
1381
|
),
|
|
1389
|
-
children:
|
|
1382
|
+
children: /* @__PURE__ */ e(Et, { title: typeof W == "string" ? W : void 0, children: W })
|
|
1390
1383
|
},
|
|
1391
1384
|
B.key
|
|
1392
1385
|
);
|
|
1393
1386
|
})
|
|
1394
|
-
] },
|
|
1387
|
+
] }, N);
|
|
1395
1388
|
}) })
|
|
1396
1389
|
] }) })
|
|
1397
1390
|
] })
|
|
1398
1391
|
}
|
|
1399
1392
|
);
|
|
1400
1393
|
}
|
|
1401
|
-
const
|
|
1394
|
+
const Lt = {
|
|
1402
1395
|
uz: {
|
|
1403
1396
|
dragAndDrop: "Faylni bu yerga torting",
|
|
1404
1397
|
clickToUpload: "yoki bosib tanlang",
|
|
@@ -1471,25 +1464,25 @@ const It = {
|
|
|
1471
1464
|
audio: "Audio",
|
|
1472
1465
|
document: "Document"
|
|
1473
1466
|
}
|
|
1474
|
-
},
|
|
1467
|
+
}, Qt = ({
|
|
1475
1468
|
multiple: t = !1,
|
|
1476
1469
|
accept: a = "*/*",
|
|
1477
1470
|
maxSize: r = 10,
|
|
1478
1471
|
maxFiles: l = 5,
|
|
1479
|
-
disabled:
|
|
1472
|
+
disabled: f = !1,
|
|
1480
1473
|
label: d,
|
|
1481
1474
|
required: s = !1,
|
|
1482
1475
|
error: c,
|
|
1483
1476
|
className: C,
|
|
1484
1477
|
onFilesChange: k,
|
|
1485
|
-
onUpload:
|
|
1478
|
+
onUpload: D,
|
|
1486
1479
|
showPreview: M = !0,
|
|
1487
1480
|
locale: L = "uz",
|
|
1488
1481
|
showFileTypeIcon: F = !0,
|
|
1489
|
-
variant:
|
|
1482
|
+
variant: v = "yellow",
|
|
1490
1483
|
customValidator: m
|
|
1491
1484
|
}) => {
|
|
1492
|
-
const [u,
|
|
1485
|
+
const [u, b] = _([]), [w, p] = _(!1), [y, $] = _(!1), E = le(null), j = Lt[L], o = v === "blue" ? {
|
|
1493
1486
|
dropBorder: "border-blue-200 hover:border-blue-300",
|
|
1494
1487
|
dropBg: "bg-blue-50/40 hover:bg-blue-50/60",
|
|
1495
1488
|
dropActive: "border-blue-600 bg-blue-50",
|
|
@@ -1509,94 +1502,108 @@ const It = {
|
|
|
1509
1502
|
progressFill: "bg-yellow-600",
|
|
1510
1503
|
fileIconImg: "bg-blue-50 text-blue-600",
|
|
1511
1504
|
fileIconDoc: "bg-green-50 text-green-600"
|
|
1512
|
-
},
|
|
1513
|
-
switch (
|
|
1505
|
+
}, N = (g) => {
|
|
1506
|
+
switch (g.type.split("/")[0]) {
|
|
1514
1507
|
case "image":
|
|
1515
|
-
return /* @__PURE__ */ e(
|
|
1508
|
+
return /* @__PURE__ */ e(dt, { className: "h-5 w-5 text-blue-500" });
|
|
1516
1509
|
case "video":
|
|
1517
|
-
return /* @__PURE__ */ e(
|
|
1510
|
+
return /* @__PURE__ */ e(ct, { className: "h-5 w-5 text-purple-500" });
|
|
1518
1511
|
case "audio":
|
|
1519
|
-
return /* @__PURE__ */ e(
|
|
1512
|
+
return /* @__PURE__ */ e(it, { className: "h-5 w-5 text-green-500" });
|
|
1520
1513
|
default:
|
|
1521
|
-
return
|
|
1514
|
+
return g.type.includes("pdf") ? /* @__PURE__ */ e(Se, { className: "h-5 w-5 text-red-500" }) : g.type.includes("word") || g.type.includes("document") ? /* @__PURE__ */ e(Se, { className: "h-5 w-5 text-blue-600" }) : g.type.includes("excel") || g.type.includes("spreadsheet") ? /* @__PURE__ */ e(Se, { className: "h-5 w-5 text-green-600" }) : /* @__PURE__ */ e(Te, { className: "h-5 w-5 text-gray-500" });
|
|
1522
1515
|
}
|
|
1523
|
-
},
|
|
1524
|
-
if (
|
|
1525
|
-
const
|
|
1526
|
-
return parseFloat((
|
|
1527
|
-
},
|
|
1528
|
-
const
|
|
1529
|
-
return
|
|
1530
|
-
},
|
|
1531
|
-
if (
|
|
1532
|
-
const
|
|
1533
|
-
return
|
|
1516
|
+
}, T = (g) => {
|
|
1517
|
+
if (g === 0) return "0 Bytes";
|
|
1518
|
+
const I = 1024, O = ["Bytes", "KB", "MB", "GB"], U = Math.floor(Math.log(g) / Math.log(I));
|
|
1519
|
+
return parseFloat((g / Math.pow(I, U)).toFixed(2)) + " " + O[U];
|
|
1520
|
+
}, Y = (g) => {
|
|
1521
|
+
const I = r * 1024 * 1024;
|
|
1522
|
+
return g.size <= I;
|
|
1523
|
+
}, q = (g) => a === "*/*" ? !0 : a.split(",").map((O) => O.trim()).some((O) => {
|
|
1524
|
+
if (O.endsWith("/*")) {
|
|
1525
|
+
const U = O.replace("/*", "");
|
|
1526
|
+
return g.type.startsWith(U);
|
|
1534
1527
|
}
|
|
1535
|
-
return
|
|
1536
|
-
}), B = (
|
|
1537
|
-
if (
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1528
|
+
return g.type === O || g.name.toLowerCase().endsWith(O.replace("*.", "."));
|
|
1529
|
+
}), B = (g) => new Promise((I) => {
|
|
1530
|
+
if (g.type.startsWith("image/")) {
|
|
1531
|
+
const O = new FileReader();
|
|
1532
|
+
O.onload = (U) => I(U.target?.result), O.readAsDataURL(g);
|
|
1540
1533
|
} else
|
|
1541
|
-
|
|
1542
|
-
}),
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1534
|
+
I("");
|
|
1535
|
+
}), P = le(/* @__PURE__ */ new Map()), W = R((g) => {
|
|
1536
|
+
const I = P.current.get(g);
|
|
1537
|
+
I && (URL.revokeObjectURL(I), P.current.delete(g));
|
|
1538
|
+
}, []), Q = R(() => {
|
|
1539
|
+
for (const g of P.current.values())
|
|
1540
|
+
URL.revokeObjectURL(g);
|
|
1541
|
+
P.current.clear();
|
|
1542
|
+
}, []);
|
|
1543
|
+
J(() => () => {
|
|
1544
|
+
Q();
|
|
1545
|
+
}, [Q]);
|
|
1546
|
+
const ne = R((g) => {
|
|
1547
|
+
let I = P.current.get(g.id);
|
|
1548
|
+
I || (I = URL.createObjectURL(g.file), P.current.set(g.id, I), setTimeout(() => W(g.id), 5 * 6e4)), window.open(I, "_blank", "noopener,noreferrer");
|
|
1549
|
+
}, [W]), K = R(
|
|
1550
|
+
async (g) => {
|
|
1551
|
+
const I = Array.from(g), O = [];
|
|
1552
|
+
for (const U of I) {
|
|
1553
|
+
if (u.length + O.length >= l) {
|
|
1554
|
+
alert(j.maxFilesError(l));
|
|
1548
1555
|
break;
|
|
1549
1556
|
}
|
|
1550
|
-
if (!
|
|
1551
|
-
alert(
|
|
1557
|
+
if (!Y(U)) {
|
|
1558
|
+
alert(j.fileSizeError(U.name, r));
|
|
1552
1559
|
continue;
|
|
1553
1560
|
}
|
|
1554
|
-
if (!
|
|
1555
|
-
alert(
|
|
1561
|
+
if (!q(U)) {
|
|
1562
|
+
alert(j.fileTypeError(U.name));
|
|
1556
1563
|
continue;
|
|
1557
1564
|
}
|
|
1558
1565
|
if (m) {
|
|
1559
|
-
const
|
|
1560
|
-
if (
|
|
1561
|
-
alert(
|
|
1566
|
+
const xe = m(U);
|
|
1567
|
+
if (xe) {
|
|
1568
|
+
alert(xe);
|
|
1562
1569
|
continue;
|
|
1563
1570
|
}
|
|
1564
1571
|
}
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1572
|
+
const A = await B(U), X = D ? "uploading" : "success", me = D ? 0 : 100;
|
|
1573
|
+
O.push({
|
|
1567
1574
|
id: Math.random().toString(36).substr(2, 9),
|
|
1568
|
-
file:
|
|
1569
|
-
preview:
|
|
1570
|
-
progress:
|
|
1571
|
-
status:
|
|
1575
|
+
file: U,
|
|
1576
|
+
preview: A,
|
|
1577
|
+
progress: me,
|
|
1578
|
+
status: X
|
|
1572
1579
|
});
|
|
1573
1580
|
}
|
|
1574
|
-
if (
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1577
|
-
|
|
1581
|
+
if (O.length > 0) {
|
|
1582
|
+
const U = t ? [...u, ...O] : O;
|
|
1583
|
+
if (b(U), k?.(U.map((A) => A.file)), D) {
|
|
1584
|
+
$(!0);
|
|
1578
1585
|
try {
|
|
1579
|
-
const
|
|
1580
|
-
...
|
|
1581
|
-
progress: Math.min(100, (
|
|
1586
|
+
const A = U.map((X, me) => ({
|
|
1587
|
+
...X,
|
|
1588
|
+
progress: Math.min(100, (me + 1) / U.length * 100)
|
|
1582
1589
|
}));
|
|
1583
|
-
|
|
1584
|
-
(
|
|
1585
|
-
...
|
|
1590
|
+
b(A), await D(A), b(
|
|
1591
|
+
(X) => X.map((me) => ({
|
|
1592
|
+
...me,
|
|
1586
1593
|
status: "success",
|
|
1587
1594
|
progress: 100
|
|
1588
1595
|
}))
|
|
1589
1596
|
);
|
|
1590
|
-
} catch (
|
|
1591
|
-
|
|
1592
|
-
(
|
|
1593
|
-
...
|
|
1597
|
+
} catch (A) {
|
|
1598
|
+
b(
|
|
1599
|
+
(X) => X.map((me) => ({
|
|
1600
|
+
...me,
|
|
1594
1601
|
status: "error",
|
|
1595
|
-
error:
|
|
1602
|
+
error: A instanceof Error ? A.message : j.uploadFailed
|
|
1596
1603
|
}))
|
|
1597
1604
|
);
|
|
1598
1605
|
} finally {
|
|
1599
|
-
|
|
1606
|
+
$(!1);
|
|
1600
1607
|
}
|
|
1601
1608
|
}
|
|
1602
1609
|
}
|
|
@@ -1604,46 +1611,46 @@ const It = {
|
|
|
1604
1611
|
[
|
|
1605
1612
|
u,
|
|
1606
1613
|
l,
|
|
1607
|
-
|
|
1608
|
-
|
|
1614
|
+
Y,
|
|
1615
|
+
q,
|
|
1609
1616
|
m,
|
|
1610
|
-
|
|
1617
|
+
j,
|
|
1611
1618
|
r,
|
|
1612
1619
|
t,
|
|
1613
1620
|
k,
|
|
1614
|
-
|
|
1621
|
+
D
|
|
1615
1622
|
]
|
|
1616
|
-
),
|
|
1617
|
-
(
|
|
1618
|
-
|
|
1623
|
+
), ae = R(
|
|
1624
|
+
(g) => {
|
|
1625
|
+
g.preventDefault(), f || p(!0);
|
|
1619
1626
|
},
|
|
1620
|
-
[
|
|
1621
|
-
),
|
|
1622
|
-
|
|
1623
|
-
}, []),
|
|
1624
|
-
(
|
|
1625
|
-
if (
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1627
|
+
[f]
|
|
1628
|
+
), ce = R((g) => {
|
|
1629
|
+
g.preventDefault(), p(!1);
|
|
1630
|
+
}, []), ee = R(
|
|
1631
|
+
(g) => {
|
|
1632
|
+
if (g.preventDefault(), p(!1), f) return;
|
|
1633
|
+
const I = g.dataTransfer.files;
|
|
1634
|
+
I.length > 0 && K(I);
|
|
1628
1635
|
},
|
|
1629
|
-
[
|
|
1630
|
-
),
|
|
1631
|
-
(
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1636
|
+
[f, K]
|
|
1637
|
+
), de = R(
|
|
1638
|
+
(g) => {
|
|
1639
|
+
const I = g.target.files;
|
|
1640
|
+
I && I.length > 0 && (K(I), E.current && (E.current.value = ""));
|
|
1634
1641
|
},
|
|
1635
|
-
[
|
|
1636
|
-
),
|
|
1637
|
-
(
|
|
1638
|
-
g((
|
|
1639
|
-
const
|
|
1640
|
-
return k?.(
|
|
1642
|
+
[K]
|
|
1643
|
+
), z = R(
|
|
1644
|
+
(g) => {
|
|
1645
|
+
W(g), b((I) => {
|
|
1646
|
+
const O = I.filter((U) => U.id !== g);
|
|
1647
|
+
return k?.(O.map((U) => U.file)), O;
|
|
1641
1648
|
});
|
|
1642
1649
|
},
|
|
1643
|
-
[k]
|
|
1644
|
-
),
|
|
1645
|
-
|
|
1646
|
-
}, [k]),
|
|
1650
|
+
[k, W]
|
|
1651
|
+
), G = R(() => {
|
|
1652
|
+
Q(), b([]), k?.([]);
|
|
1653
|
+
}, [k, Q]), oe = R(() => {
|
|
1647
1654
|
E.current?.click();
|
|
1648
1655
|
}, []);
|
|
1649
1656
|
return /* @__PURE__ */ i("div", { className: n("w-full", C), children: [
|
|
@@ -1667,14 +1674,14 @@ const It = {
|
|
|
1667
1674
|
"group relative flex min-h-[180px] w-full cursor-pointer items-center justify-center rounded-2xl border border-dashed p-6 text-center transition-all duration-300",
|
|
1668
1675
|
o.dropBorder,
|
|
1669
1676
|
o.dropBg,
|
|
1670
|
-
|
|
1671
|
-
|
|
1677
|
+
w && o.dropActive,
|
|
1678
|
+
f && "cursor-not-allowed opacity-60",
|
|
1672
1679
|
c && "border-red-600 bg-red-50/30"
|
|
1673
1680
|
),
|
|
1674
|
-
onDragOver:
|
|
1675
|
-
onDragLeave:
|
|
1676
|
-
onDrop:
|
|
1677
|
-
onClick:
|
|
1681
|
+
onDragOver: ae,
|
|
1682
|
+
onDragLeave: ce,
|
|
1683
|
+
onDrop: ee,
|
|
1684
|
+
onClick: oe,
|
|
1678
1685
|
children: [
|
|
1679
1686
|
/* @__PURE__ */ e(
|
|
1680
1687
|
"input",
|
|
@@ -1683,15 +1690,15 @@ const It = {
|
|
|
1683
1690
|
type: "file",
|
|
1684
1691
|
multiple: t,
|
|
1685
1692
|
accept: a,
|
|
1686
|
-
onChange:
|
|
1687
|
-
disabled:
|
|
1693
|
+
onChange: de,
|
|
1694
|
+
disabled: f,
|
|
1688
1695
|
className: "hidden"
|
|
1689
1696
|
}
|
|
1690
1697
|
),
|
|
1691
1698
|
/* @__PURE__ */ i("div", { className: "flex flex-col items-center gap-3", children: [
|
|
1692
1699
|
/* @__PURE__ */ e("div", { className: n("flex h-12 w-12 items-center justify-center rounded-xl", o.iconWrap), children: /* @__PURE__ */ e(ot, { size: 20 }) }),
|
|
1693
|
-
/* @__PURE__ */ e("p", { className: n("text-base font-medium", o.title), children:
|
|
1694
|
-
/* @__PURE__ */ e("p", { className: n("text-sm font-normal", o.hint), children:
|
|
1700
|
+
/* @__PURE__ */ e("p", { className: n("text-base font-medium", o.title), children: j.dropHereTitle }),
|
|
1701
|
+
/* @__PURE__ */ e("p", { className: n("text-sm font-normal", o.hint), children: j.fileRequirements(t, l, r, a) })
|
|
1695
1702
|
] })
|
|
1696
1703
|
]
|
|
1697
1704
|
}
|
|
@@ -1699,7 +1706,7 @@ const It = {
|
|
|
1699
1706
|
u.length > 0 && /* @__PURE__ */ i("div", { className: "mt-4 space-y-3", children: [
|
|
1700
1707
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1701
1708
|
/* @__PURE__ */ i("span", { className: "text-sm font-medium text-slate-700", children: [
|
|
1702
|
-
|
|
1709
|
+
j.selectedFiles,
|
|
1703
1710
|
" (",
|
|
1704
1711
|
u.length,
|
|
1705
1712
|
")"
|
|
@@ -1708,56 +1715,68 @@ const It = {
|
|
|
1708
1715
|
"button",
|
|
1709
1716
|
{
|
|
1710
1717
|
type: "button",
|
|
1711
|
-
onClick:
|
|
1712
|
-
disabled:
|
|
1718
|
+
onClick: G,
|
|
1719
|
+
disabled: f || y,
|
|
1713
1720
|
className: "text-sm font-medium text-red-600 disabled:opacity-50",
|
|
1714
|
-
children:
|
|
1721
|
+
children: j.clearAll
|
|
1715
1722
|
}
|
|
1716
1723
|
)
|
|
1717
1724
|
] }),
|
|
1718
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children: u.map((
|
|
1719
|
-
const
|
|
1725
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: u.map((g) => {
|
|
1726
|
+
const O = !!g.preview ? o.fileIconImg : o.fileIconDoc, U = f || y || g.status === "uploading";
|
|
1720
1727
|
return /* @__PURE__ */ i(
|
|
1721
1728
|
"div",
|
|
1722
1729
|
{
|
|
1723
1730
|
className: n(
|
|
1724
1731
|
"flex items-center justify-between rounded-2xl border border-slate-200 p-4",
|
|
1725
|
-
|
|
1732
|
+
g.status === "error" && "border-red-600"
|
|
1726
1733
|
),
|
|
1727
1734
|
children: [
|
|
1728
1735
|
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-4", children: [
|
|
1729
|
-
/* @__PURE__ */ e(
|
|
1730
|
-
"
|
|
1736
|
+
/* @__PURE__ */ e(
|
|
1737
|
+
"div",
|
|
1731
1738
|
{
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1739
|
+
className: n(
|
|
1740
|
+
"flex h-14 w-14 items-center justify-center rounded-2xl",
|
|
1741
|
+
O
|
|
1742
|
+
),
|
|
1743
|
+
children: M && g.preview ? /* @__PURE__ */ e(
|
|
1744
|
+
"img",
|
|
1745
|
+
{
|
|
1746
|
+
src: g.preview,
|
|
1747
|
+
alt: g.file.name,
|
|
1748
|
+
className: "h-10 w-10 rounded-xl object-cover"
|
|
1749
|
+
}
|
|
1750
|
+
) : F ? N(g.file) : /* @__PURE__ */ e(Te, { className: "h-6 w-6 text-slate-500" })
|
|
1735
1751
|
}
|
|
1736
|
-
)
|
|
1752
|
+
),
|
|
1737
1753
|
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
1738
|
-
/* @__PURE__ */ e("p", { className: "truncate text-lg font-semibold text-primary", children:
|
|
1754
|
+
/* @__PURE__ */ e("p", { className: "truncate text-lg font-semibold text-primary", children: g.file.name }),
|
|
1739
1755
|
/* @__PURE__ */ i("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-sm text-slate-500", children: [
|
|
1740
|
-
/* @__PURE__ */ e("span", { children:
|
|
1741
|
-
|
|
1756
|
+
/* @__PURE__ */ e("span", { children: T(g.file.size) }),
|
|
1757
|
+
g.status === "uploading" && /* @__PURE__ */ i(he, { children: [
|
|
1742
1758
|
/* @__PURE__ */ e("span", { children: "•" }),
|
|
1743
1759
|
/* @__PURE__ */ i("span", { className: "inline-flex items-center", children: [
|
|
1744
|
-
/* @__PURE__ */ e(
|
|
1745
|
-
|
|
1760
|
+
/* @__PURE__ */ e(We, { className: "mr-1 h-5 w-5 animate-spin" }),
|
|
1761
|
+
j.uploading
|
|
1746
1762
|
] })
|
|
1747
1763
|
] }),
|
|
1748
|
-
|
|
1764
|
+
g.status === "success" && /* @__PURE__ */ i(he, { children: [
|
|
1749
1765
|
/* @__PURE__ */ e("span", { children: "•" }),
|
|
1750
|
-
/* @__PURE__ */ e("span", { className: "font-normal text-green-600", children:
|
|
1766
|
+
/* @__PURE__ */ e("span", { className: "font-normal text-green-600", children: j.success })
|
|
1751
1767
|
] })
|
|
1752
1768
|
] }),
|
|
1753
|
-
|
|
1769
|
+
g.status === "uploading" && /* @__PURE__ */ e("div", { className: n("mt-2 h-1.5 w-full rounded-full bg-slate-200"), children: /* @__PURE__ */ e(
|
|
1754
1770
|
"div",
|
|
1755
1771
|
{
|
|
1756
|
-
className: n(
|
|
1757
|
-
|
|
1772
|
+
className: n(
|
|
1773
|
+
"h-1.5 rounded-full transition-all duration-300",
|
|
1774
|
+
o.progressFill
|
|
1775
|
+
),
|
|
1776
|
+
style: { width: `${g.progress}%` }
|
|
1758
1777
|
}
|
|
1759
1778
|
) }),
|
|
1760
|
-
|
|
1779
|
+
g.status === "error" && g.error && /* @__PURE__ */ e("p", { className: "mt-2 text-sm font-normal text-red-600", children: g.error })
|
|
1761
1780
|
] })
|
|
1762
1781
|
] }),
|
|
1763
1782
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1765,68 +1784,61 @@ const It = {
|
|
|
1765
1784
|
"button",
|
|
1766
1785
|
{
|
|
1767
1786
|
type: "button",
|
|
1768
|
-
onClick: (
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
"button",
|
|
1776
|
-
{
|
|
1777
|
-
type: "button",
|
|
1778
|
-
onClick: (T) => T.stopPropagation(),
|
|
1779
|
-
className: "rounded-xl p-2 hover:bg-slate-100 hover:cursor-pointer",
|
|
1780
|
-
title: I.download,
|
|
1781
|
-
children: /* @__PURE__ */ e(it, { size: 20, className: "text-slate-400" })
|
|
1787
|
+
onClick: (A) => {
|
|
1788
|
+
A.stopPropagation(), U || ne(g);
|
|
1789
|
+
},
|
|
1790
|
+
disabled: U,
|
|
1791
|
+
className: "rounded-xl p-2 hover:bg-slate-100 hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1792
|
+
title: j.preview,
|
|
1793
|
+
children: /* @__PURE__ */ e(Oe, { size: 20, className: "text-slate-400" })
|
|
1782
1794
|
}
|
|
1783
1795
|
),
|
|
1784
1796
|
/* @__PURE__ */ e(
|
|
1785
1797
|
"button",
|
|
1786
1798
|
{
|
|
1787
1799
|
type: "button",
|
|
1788
|
-
onClick: (
|
|
1789
|
-
|
|
1800
|
+
onClick: (A) => {
|
|
1801
|
+
A.stopPropagation(), z(g.id);
|
|
1790
1802
|
},
|
|
1791
|
-
disabled:
|
|
1803
|
+
disabled: f || y,
|
|
1792
1804
|
className: "rounded-xl p-2 text-slate-base hover:bg-slate-100 disabled:opacity-50 hover:cursor-pointer",
|
|
1793
|
-
title:
|
|
1794
|
-
children: /* @__PURE__ */ e(
|
|
1805
|
+
title: j.remove,
|
|
1806
|
+
children: /* @__PURE__ */ e(pe, { className: "h-6 w-6" })
|
|
1795
1807
|
}
|
|
1796
1808
|
)
|
|
1797
1809
|
] })
|
|
1798
1810
|
]
|
|
1799
1811
|
},
|
|
1800
|
-
|
|
1812
|
+
g.id
|
|
1801
1813
|
);
|
|
1802
1814
|
}) })
|
|
1803
1815
|
] }),
|
|
1804
1816
|
c && /* @__PURE__ */ e("p", { className: "mt-2 text-sm font-normal text-red-600", children: c })
|
|
1805
1817
|
] });
|
|
1806
1818
|
};
|
|
1807
|
-
function
|
|
1819
|
+
function er({
|
|
1808
1820
|
show: t,
|
|
1809
1821
|
setShow: a,
|
|
1810
1822
|
title: r,
|
|
1811
1823
|
description: l,
|
|
1812
|
-
Header:
|
|
1824
|
+
Header: f,
|
|
1813
1825
|
Body: d,
|
|
1814
1826
|
footer: s,
|
|
1815
1827
|
handleClickOutside: c = !1,
|
|
1816
1828
|
showCloseIcon: C = !0,
|
|
1817
1829
|
showHeader: k = !0,
|
|
1818
|
-
overlayClassName:
|
|
1830
|
+
overlayClassName: D,
|
|
1819
1831
|
containerClassName: M,
|
|
1820
1832
|
bodyClassName: L,
|
|
1821
1833
|
footerClassName: F
|
|
1822
1834
|
}) {
|
|
1823
|
-
const
|
|
1835
|
+
const v = le(null), { handleEscape: m } = Ee(() => a(!1));
|
|
1824
1836
|
J(() => (t ? (document.addEventListener("keydown", m), document.body.style.overflow = "hidden") : document.body.style.overflow = "unset", () => document.removeEventListener("keydown", m)), [t, m]);
|
|
1825
|
-
const { handleClick: u } =
|
|
1837
|
+
const { handleClick: u } = De(v, () => {
|
|
1826
1838
|
c && a(!1);
|
|
1827
1839
|
});
|
|
1828
1840
|
J(() => (t && c && document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u)), [t, u, c]);
|
|
1829
|
-
const
|
|
1841
|
+
const w = k && !!(f || r || l);
|
|
1830
1842
|
return /* @__PURE__ */ e(
|
|
1831
1843
|
"div",
|
|
1832
1844
|
{
|
|
@@ -1834,12 +1846,12 @@ function tr({
|
|
|
1834
1846
|
"bg-black/40 fixed inset-0 z-50 flex justify-center transition-all duration-500 ease-in-out",
|
|
1835
1847
|
"items-end sm:items-center",
|
|
1836
1848
|
t ? "opacity-100" : "pointer-events-none opacity-0",
|
|
1837
|
-
|
|
1849
|
+
D
|
|
1838
1850
|
),
|
|
1839
1851
|
children: /* @__PURE__ */ i(
|
|
1840
1852
|
"div",
|
|
1841
1853
|
{
|
|
1842
|
-
ref:
|
|
1854
|
+
ref: v,
|
|
1843
1855
|
className: n(
|
|
1844
1856
|
"relative bg-white w-full",
|
|
1845
1857
|
"sm:max-w-[720px]",
|
|
@@ -1849,8 +1861,8 @@ function tr({
|
|
|
1849
1861
|
M
|
|
1850
1862
|
),
|
|
1851
1863
|
children: [
|
|
1852
|
-
|
|
1853
|
-
|
|
1864
|
+
w && /* @__PURE__ */ i("div", { className: "border-b border-slate-200 flex items-start justify-between p-4 sm:p-6 mb-4", children: [
|
|
1865
|
+
f || /* @__PURE__ */ i("div", { className: "block", children: [
|
|
1854
1866
|
/* @__PURE__ */ e("h2", { className: "text-h3 font-semibold text-black", children: r }),
|
|
1855
1867
|
l && /* @__PURE__ */ e("p", { className: "text-base text-slate-base font-normal mt-2", children: l })
|
|
1856
1868
|
] }),
|
|
@@ -1861,7 +1873,7 @@ function tr({
|
|
|
1861
1873
|
className: "bg-slate-100 rounded-xl w-12 h-12 hover:cursor-pointer text-black transition flex items-center justify-center group",
|
|
1862
1874
|
"aria-label": "Close modal",
|
|
1863
1875
|
type: "button",
|
|
1864
|
-
children: /* @__PURE__ */ e(
|
|
1876
|
+
children: /* @__PURE__ */ e(pe, { className: "h-6 w-6 transition-transform duration-300 group-hover:rotate-180" })
|
|
1865
1877
|
}
|
|
1866
1878
|
)
|
|
1867
1879
|
] }),
|
|
@@ -1894,33 +1906,33 @@ function tr({
|
|
|
1894
1906
|
}
|
|
1895
1907
|
);
|
|
1896
1908
|
}
|
|
1897
|
-
function
|
|
1909
|
+
function tr({
|
|
1898
1910
|
totalItems: t,
|
|
1899
1911
|
currentPage: a,
|
|
1900
1912
|
perPage: r,
|
|
1901
1913
|
onPageChange: l,
|
|
1902
|
-
onPerPageChange:
|
|
1914
|
+
onPerPageChange: f,
|
|
1903
1915
|
siblingCount: d = 1,
|
|
1904
1916
|
perPageOptions: s = [10, 30, 50, 100],
|
|
1905
1917
|
showPerPage: c = !0,
|
|
1906
1918
|
variant: C = "yellow",
|
|
1907
1919
|
size: k = "large",
|
|
1908
|
-
paginationClassName:
|
|
1920
|
+
paginationClassName: D
|
|
1909
1921
|
}) {
|
|
1910
|
-
const M = Number.isFinite(t) && t > 0 ? t : 0, L = Number.isFinite(r) && r > 0 ? r : 10, F = Math.max(1, Number.isFinite(a) ? a : 1),
|
|
1911
|
-
if (
|
|
1922
|
+
const M = Number.isFinite(t) && t > 0 ? t : 0, L = Number.isFinite(r) && r > 0 ? r : 10, F = Math.max(1, Number.isFinite(a) ? a : 1), v = Math.ceil(M / L);
|
|
1923
|
+
if (v <= 1 || M === 0) return null;
|
|
1912
1924
|
const u = (() => {
|
|
1913
|
-
const
|
|
1914
|
-
if (
|
|
1915
|
-
return Array.from({ length:
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1918
|
-
for (let
|
|
1919
|
-
return E <
|
|
1920
|
-
})(),
|
|
1925
|
+
const p = [], y = d * 2 + 5;
|
|
1926
|
+
if (v <= y)
|
|
1927
|
+
return Array.from({ length: v }, (j, o) => o + 1);
|
|
1928
|
+
const $ = Math.max(F - d, 2), E = Math.min(F + d, v - 1);
|
|
1929
|
+
p.push(1), $ > 2 && p.push("...");
|
|
1930
|
+
for (let j = $; j <= E; j++) p.push(j);
|
|
1931
|
+
return E < v - 1 && p.push("..."), v > 1 && p.push(v), p;
|
|
1932
|
+
})(), b = {
|
|
1921
1933
|
medium: "h-9 text-sm",
|
|
1922
1934
|
large: "h-10 text-base"
|
|
1923
|
-
}[k],
|
|
1935
|
+
}[k], w = {
|
|
1924
1936
|
yellow: {
|
|
1925
1937
|
active: "bg-yellow-500 text-white border-yellow-500",
|
|
1926
1938
|
inactive: "bg-slate-100 border-slate-200 text-black hover:bg-slate-200",
|
|
@@ -1936,9 +1948,9 @@ function rr({
|
|
|
1936
1948
|
}[C ?? "yellow"];
|
|
1937
1949
|
return /* @__PURE__ */ i("div", { className: n(
|
|
1938
1950
|
"flex items-center justify-between gap-4 w-full",
|
|
1939
|
-
|
|
1951
|
+
D
|
|
1940
1952
|
), children: [
|
|
1941
|
-
c &&
|
|
1953
|
+
c && f && /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1942
1954
|
/* @__PURE__ */ e(
|
|
1943
1955
|
"span",
|
|
1944
1956
|
{
|
|
@@ -1951,17 +1963,17 @@ function rr({
|
|
|
1951
1963
|
"select",
|
|
1952
1964
|
{
|
|
1953
1965
|
value: L,
|
|
1954
|
-
onChange: (
|
|
1966
|
+
onChange: (p) => f(Number(p.target.value)),
|
|
1955
1967
|
className: n(
|
|
1956
1968
|
"appearance-none bg-white border border-slate-200 rounded-lg pl-3 pr-8 text-base text-black font-medium focus:outline-none cursor-pointer",
|
|
1957
1969
|
k === "large" ? "h-10" : "h-9"
|
|
1958
1970
|
),
|
|
1959
1971
|
"aria-label": "Количество строк на странице",
|
|
1960
|
-
children: s.map((
|
|
1972
|
+
children: s.map((p) => /* @__PURE__ */ e("option", { value: p, children: p }, p))
|
|
1961
1973
|
}
|
|
1962
1974
|
),
|
|
1963
1975
|
/* @__PURE__ */ e(
|
|
1964
|
-
|
|
1976
|
+
Fe,
|
|
1965
1977
|
{
|
|
1966
1978
|
className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400",
|
|
1967
1979
|
weight: "Linear",
|
|
@@ -1979,58 +1991,58 @@ function rr({
|
|
|
1979
1991
|
"aria-label": "Предыдущая страница",
|
|
1980
1992
|
className: n(
|
|
1981
1993
|
"flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
|
|
1982
|
-
|
|
1983
|
-
F === 1 ? n("cursor-not-allowed opacity-50",
|
|
1994
|
+
b,
|
|
1995
|
+
F === 1 ? n("cursor-not-allowed opacity-50", w.disabled) : n("hover:cursor-pointer", w.arrow, "border-slate-200")
|
|
1984
1996
|
),
|
|
1985
|
-
children: /* @__PURE__ */ e(
|
|
1997
|
+
children: /* @__PURE__ */ e(ke, { weight: "Linear", size: 20 })
|
|
1986
1998
|
}
|
|
1987
1999
|
),
|
|
1988
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: u.map((
|
|
1989
|
-
if (
|
|
2000
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: u.map((p, y) => {
|
|
2001
|
+
if (p === "...")
|
|
1990
2002
|
return /* @__PURE__ */ e(
|
|
1991
2003
|
"span",
|
|
1992
2004
|
{
|
|
1993
|
-
className: n("flex items-center justify-center text-black font-medium min-w-10",
|
|
2005
|
+
className: n("flex items-center justify-center text-black font-medium min-w-10", b),
|
|
1994
2006
|
"aria-hidden": "true",
|
|
1995
|
-
children: /* @__PURE__ */ e(
|
|
2007
|
+
children: /* @__PURE__ */ e(ut, { weight: "Bold", size: 20 })
|
|
1996
2008
|
},
|
|
1997
|
-
|
|
2009
|
+
y
|
|
1998
2010
|
);
|
|
1999
|
-
const
|
|
2011
|
+
const $ = p === F;
|
|
2000
2012
|
return /* @__PURE__ */ e(
|
|
2001
2013
|
"button",
|
|
2002
2014
|
{
|
|
2003
|
-
onClick: () => l(
|
|
2004
|
-
"aria-label": `Страница ${
|
|
2005
|
-
"aria-current":
|
|
2015
|
+
onClick: () => l(p),
|
|
2016
|
+
"aria-label": `Страница ${p}${$ ? ", текущая" : ""}`,
|
|
2017
|
+
"aria-current": $ ? "page" : void 0,
|
|
2006
2018
|
className: n(
|
|
2007
2019
|
"flex items-center justify-center rounded-lg border font-medium transition-all hover:cursor-pointer min-w-10 px-2",
|
|
2008
|
-
|
|
2009
|
-
|
|
2020
|
+
b,
|
|
2021
|
+
$ ? w.active : w.inactive
|
|
2010
2022
|
),
|
|
2011
|
-
children:
|
|
2023
|
+
children: p
|
|
2012
2024
|
},
|
|
2013
|
-
|
|
2025
|
+
y
|
|
2014
2026
|
);
|
|
2015
2027
|
}) }),
|
|
2016
2028
|
/* @__PURE__ */ e(
|
|
2017
2029
|
"button",
|
|
2018
2030
|
{
|
|
2019
2031
|
onClick: () => l(F + 1),
|
|
2020
|
-
disabled: F ===
|
|
2032
|
+
disabled: F === v,
|
|
2021
2033
|
"aria-label": "Следующая страница",
|
|
2022
2034
|
className: n(
|
|
2023
2035
|
"flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
|
|
2024
|
-
|
|
2025
|
-
F ===
|
|
2036
|
+
b,
|
|
2037
|
+
F === v ? n("cursor-not-allowed opacity-50", w.disabled) : n("hover:cursor-pointer", w.arrow, "border-slate-200")
|
|
2026
2038
|
),
|
|
2027
|
-
children: /* @__PURE__ */ e(
|
|
2039
|
+
children: /* @__PURE__ */ e(be, { size: 20, weight: "Linear" })
|
|
2028
2040
|
}
|
|
2029
2041
|
)
|
|
2030
2042
|
] })
|
|
2031
2043
|
] });
|
|
2032
2044
|
}
|
|
2033
|
-
function
|
|
2045
|
+
function $e({
|
|
2034
2046
|
className: t,
|
|
2035
2047
|
variant: a = "default",
|
|
2036
2048
|
width: r = "100%",
|
|
@@ -2054,26 +2066,26 @@ function Te({
|
|
|
2054
2066
|
}
|
|
2055
2067
|
);
|
|
2056
2068
|
}
|
|
2057
|
-
function
|
|
2069
|
+
function rr({
|
|
2058
2070
|
tabs: t,
|
|
2059
2071
|
defaultTab: a,
|
|
2060
2072
|
position: r = "top",
|
|
2061
2073
|
className: l,
|
|
2062
|
-
tabListClassName:
|
|
2074
|
+
tabListClassName: f,
|
|
2063
2075
|
contentClassName: d,
|
|
2064
2076
|
extra: s,
|
|
2065
2077
|
onChange: c
|
|
2066
2078
|
}) {
|
|
2067
|
-
const [C, k] =
|
|
2079
|
+
const [C, k] = _(a || t[0]?.id), [D, M] = _({}), L = le([]), F = () => {
|
|
2068
2080
|
requestAnimationFrame(() => {
|
|
2069
|
-
const
|
|
2070
|
-
if (
|
|
2071
|
-
const { offsetLeft:
|
|
2081
|
+
const w = t.findIndex((y) => y?.id === C), p = L.current[w];
|
|
2082
|
+
if (p) {
|
|
2083
|
+
const { offsetLeft: y, offsetTop: $, offsetWidth: E, offsetHeight: j } = p;
|
|
2072
2084
|
M({
|
|
2073
|
-
left: `${
|
|
2074
|
-
top: `${
|
|
2085
|
+
left: `${y}px`,
|
|
2086
|
+
top: `${$}px`,
|
|
2075
2087
|
width: `${E}px`,
|
|
2076
|
-
height: `${
|
|
2088
|
+
height: `${j}px`,
|
|
2077
2089
|
transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
|
|
2078
2090
|
});
|
|
2079
2091
|
}
|
|
@@ -2082,7 +2094,7 @@ function nr({
|
|
|
2082
2094
|
J(() => (F(), window.addEventListener("resize", F), "fonts" in document && document.fonts.ready.then(F), () => window.removeEventListener("resize", F)), [C, r, t]), J(() => {
|
|
2083
2095
|
L.current = L.current.slice(0, t.length);
|
|
2084
2096
|
}, [t]);
|
|
2085
|
-
const
|
|
2097
|
+
const v = r === "left" || r === "right", m = {
|
|
2086
2098
|
top: "flex-col",
|
|
2087
2099
|
bottom: "flex-col-reverse",
|
|
2088
2100
|
left: "flex-row",
|
|
@@ -2092,7 +2104,7 @@ function nr({
|
|
|
2092
2104
|
bottom: "flex-row",
|
|
2093
2105
|
left: "flex-col",
|
|
2094
2106
|
right: "flex-col"
|
|
2095
|
-
},
|
|
2107
|
+
}, b = {
|
|
2096
2108
|
top: "mt-4",
|
|
2097
2109
|
bottom: "mb-4",
|
|
2098
2110
|
left: "ml-4",
|
|
@@ -2104,7 +2116,7 @@ function nr({
|
|
|
2104
2116
|
{
|
|
2105
2117
|
className: n(
|
|
2106
2118
|
"flex w-full gap-4",
|
|
2107
|
-
|
|
2119
|
+
v ? "flex-col items-start" : "flex-row flex-wrap items-center"
|
|
2108
2120
|
),
|
|
2109
2121
|
children: [
|
|
2110
2122
|
/* @__PURE__ */ e(
|
|
@@ -2112,7 +2124,7 @@ function nr({
|
|
|
2112
2124
|
{
|
|
2113
2125
|
className: n(
|
|
2114
2126
|
"flex-1",
|
|
2115
|
-
|
|
2127
|
+
v ? "w-full" : "min-w-[520px]"
|
|
2116
2128
|
),
|
|
2117
2129
|
children: /* @__PURE__ */ i(
|
|
2118
2130
|
"div",
|
|
@@ -2120,41 +2132,41 @@ function nr({
|
|
|
2120
2132
|
className: n(
|
|
2121
2133
|
"relative flex rounded-xl bg-slate-100 p-1",
|
|
2122
2134
|
u[r],
|
|
2123
|
-
!
|
|
2124
|
-
|
|
2125
|
-
|
|
2135
|
+
!v && "w-full overflow-hidden",
|
|
2136
|
+
v ? "min-w-48" : "",
|
|
2137
|
+
f
|
|
2126
2138
|
),
|
|
2127
2139
|
children: [
|
|
2128
2140
|
/* @__PURE__ */ e(
|
|
2129
2141
|
"div",
|
|
2130
2142
|
{
|
|
2131
|
-
className: n("absolute rounded-lg bg-white",
|
|
2132
|
-
style:
|
|
2143
|
+
className: n("absolute rounded-lg bg-white", v ? "w-full" : "h-full"),
|
|
2144
|
+
style: D
|
|
2133
2145
|
}
|
|
2134
2146
|
),
|
|
2135
|
-
t?.map((
|
|
2136
|
-
const
|
|
2147
|
+
t?.map((w, p) => {
|
|
2148
|
+
const y = C === w.id;
|
|
2137
2149
|
return /* @__PURE__ */ i(
|
|
2138
2150
|
"button",
|
|
2139
2151
|
{
|
|
2140
|
-
ref: (
|
|
2141
|
-
L.current[
|
|
2152
|
+
ref: ($) => {
|
|
2153
|
+
L.current[p] = $;
|
|
2142
2154
|
},
|
|
2143
2155
|
onClick: () => {
|
|
2144
|
-
|
|
2156
|
+
w?.disabled || (k(w?.id), c?.(w?.id));
|
|
2145
2157
|
},
|
|
2146
|
-
disabled:
|
|
2158
|
+
disabled: w?.disabled,
|
|
2147
2159
|
className: n(
|
|
2148
2160
|
"relative z-10 flex items-center justify-center whitespace-nowrap px-3 py-2 text-base font-normal text-black transition-colors duration-300 hover:cursor-pointer",
|
|
2149
|
-
|
|
2150
|
-
|
|
2161
|
+
w?.disabled && "cursor-not-allowed opacity-50",
|
|
2162
|
+
v ? "w-full justify-start" : "flex-1 min-w-0"
|
|
2151
2163
|
),
|
|
2152
2164
|
children: [
|
|
2153
|
-
|
|
2154
|
-
/* @__PURE__ */ e("span", { className: "relative z-10 truncate", title:
|
|
2165
|
+
w?.icon && /* @__PURE__ */ e("span", { className: n("shrink-0 transition-transform duration-200", y && "scale-110"), children: w?.icon }),
|
|
2166
|
+
/* @__PURE__ */ e("span", { className: "relative z-10 truncate", title: w?.label, children: w?.label })
|
|
2155
2167
|
]
|
|
2156
2168
|
},
|
|
2157
|
-
|
|
2169
|
+
w?.id
|
|
2158
2170
|
);
|
|
2159
2171
|
})
|
|
2160
2172
|
]
|
|
@@ -2167,7 +2179,7 @@ function nr({
|
|
|
2167
2179
|
{
|
|
2168
2180
|
className: n(
|
|
2169
2181
|
"shrink-0 ml-auto",
|
|
2170
|
-
|
|
2182
|
+
v ? "w-full" : "max-w-full"
|
|
2171
2183
|
),
|
|
2172
2184
|
children: /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center justify-end gap-2", children: s })
|
|
2173
2185
|
}
|
|
@@ -2175,30 +2187,30 @@ function nr({
|
|
|
2175
2187
|
]
|
|
2176
2188
|
}
|
|
2177
2189
|
),
|
|
2178
|
-
/* @__PURE__ */ e("div", { className: n("w-full flex-1 overflow-hidden",
|
|
2190
|
+
/* @__PURE__ */ e("div", { className: n("w-full flex-1 overflow-hidden", b[r], d), children: /* @__PURE__ */ e("div", { className: "animate-fade-in w-full", style: { animationDuration: "0.35s" }, children: t?.find((w) => w.id === C)?.content }, C) })
|
|
2179
2191
|
] });
|
|
2180
2192
|
}
|
|
2181
2193
|
const jt = {
|
|
2182
2194
|
sm: "px-2 py-0.5",
|
|
2183
2195
|
md: "px-2 py-1",
|
|
2184
2196
|
lg: "px-3 py-2"
|
|
2185
|
-
},
|
|
2197
|
+
}, Be = {
|
|
2186
2198
|
sm: "w-3 h-3",
|
|
2187
2199
|
md: "w-3 h-3",
|
|
2188
2200
|
lg: "w-3 h-3"
|
|
2189
|
-
},
|
|
2201
|
+
}, It = {
|
|
2190
2202
|
success: "bg-green-50 text-green-600",
|
|
2191
2203
|
warning: "bg-orange-50 text-orange-600",
|
|
2192
2204
|
error: "bg-red-50 text-red-600",
|
|
2193
2205
|
gray: "bg-slate-200 text-slate-700",
|
|
2194
2206
|
blue: "bg-blue-50 text-blue-600"
|
|
2195
2207
|
};
|
|
2196
|
-
function
|
|
2208
|
+
function nr({
|
|
2197
2209
|
children: t,
|
|
2198
2210
|
variant: a = "success",
|
|
2199
2211
|
size: r = "lg",
|
|
2200
2212
|
icon: l,
|
|
2201
|
-
iconPosition:
|
|
2213
|
+
iconPosition: f = "left",
|
|
2202
2214
|
className: d
|
|
2203
2215
|
}) {
|
|
2204
2216
|
return /* @__PURE__ */ i(
|
|
@@ -2207,32 +2219,32 @@ function lr({
|
|
|
2207
2219
|
className: n(
|
|
2208
2220
|
"inline-flex animate-[fadeIn_0.3s_ease-out] items-center rounded-lg text-extra-small font-medium",
|
|
2209
2221
|
jt[r],
|
|
2210
|
-
|
|
2222
|
+
It[a],
|
|
2211
2223
|
l && "gap-[2px]",
|
|
2212
2224
|
d
|
|
2213
2225
|
),
|
|
2214
2226
|
children: [
|
|
2215
|
-
l &&
|
|
2227
|
+
l && f === "left" && /* @__PURE__ */ e("span", { className: `flex items-center ${n(Be[r])}`, children: l }),
|
|
2216
2228
|
/* @__PURE__ */ e("span", { children: t }),
|
|
2217
|
-
l &&
|
|
2229
|
+
l && f === "right" && /* @__PURE__ */ e("span", { className: `flex items-center ${n(Be[r])}`, children: l })
|
|
2218
2230
|
]
|
|
2219
2231
|
}
|
|
2220
2232
|
);
|
|
2221
2233
|
}
|
|
2222
|
-
const
|
|
2234
|
+
const Rt = fe(
|
|
2223
2235
|
({
|
|
2224
2236
|
label: t,
|
|
2225
2237
|
placeholder: a,
|
|
2226
2238
|
value: r = "",
|
|
2227
2239
|
onChange: l,
|
|
2228
|
-
required:
|
|
2240
|
+
required: f = !1,
|
|
2229
2241
|
disabled: d = !1,
|
|
2230
2242
|
error: s,
|
|
2231
2243
|
className: c,
|
|
2232
2244
|
rows: C = 4,
|
|
2233
2245
|
name: k
|
|
2234
|
-
},
|
|
2235
|
-
const M =
|
|
2246
|
+
}, D) => {
|
|
2247
|
+
const M = Z(() => s ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600", [s]);
|
|
2236
2248
|
return /* @__PURE__ */ i("div", { className: n("relative w-full", c), children: [
|
|
2237
2249
|
t && /* @__PURE__ */ i(
|
|
2238
2250
|
"label",
|
|
@@ -2243,14 +2255,14 @@ const $t = he(
|
|
|
2243
2255
|
),
|
|
2244
2256
|
children: [
|
|
2245
2257
|
t,
|
|
2246
|
-
|
|
2258
|
+
f && /* @__PURE__ */ e("span", { className: "ml-1 text-red-600", children: "*" })
|
|
2247
2259
|
]
|
|
2248
2260
|
}
|
|
2249
2261
|
),
|
|
2250
2262
|
/* @__PURE__ */ e(
|
|
2251
2263
|
"textarea",
|
|
2252
2264
|
{
|
|
2253
|
-
ref:
|
|
2265
|
+
ref: D,
|
|
2254
2266
|
name: k,
|
|
2255
2267
|
rows: C,
|
|
2256
2268
|
value: r,
|
|
@@ -2268,15 +2280,15 @@ const $t = he(
|
|
|
2268
2280
|
] });
|
|
2269
2281
|
}
|
|
2270
2282
|
);
|
|
2271
|
-
|
|
2272
|
-
const
|
|
2283
|
+
Rt.displayName = "MciTextarea";
|
|
2284
|
+
const Tt = (() => {
|
|
2273
2285
|
let t = document.getElementById("mci-toast-container");
|
|
2274
2286
|
return t || (t = document.createElement("div"), t.id = "mci-toast-container", t.className = "fixed top-4 right-4 z-[9999] flex flex-col gap-3 pointer-events-none", document.body.appendChild(t)), t;
|
|
2275
2287
|
})();
|
|
2276
|
-
let
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2279
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col gap-3", children:
|
|
2288
|
+
let Ae = null, $t = 0;
|
|
2289
|
+
const Ce = [], ze = () => {
|
|
2290
|
+
Ae || (Ae = Nt(Tt)), Ae.render(
|
|
2291
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col gap-3", children: Ce.map(({ id: t, element: a }) => /* @__PURE__ */ e("div", { className: "pointer-events-auto", children: a }, t)) })
|
|
2280
2292
|
);
|
|
2281
2293
|
};
|
|
2282
2294
|
function Bt({
|
|
@@ -2284,29 +2296,29 @@ function Bt({
|
|
|
2284
2296
|
description: a,
|
|
2285
2297
|
type: r = "info",
|
|
2286
2298
|
duration: l = 3e3,
|
|
2287
|
-
action:
|
|
2299
|
+
action: f,
|
|
2288
2300
|
onClose: d
|
|
2289
2301
|
}) {
|
|
2290
|
-
const [s, c] =
|
|
2302
|
+
const [s, c] = _(100);
|
|
2291
2303
|
J(() => {
|
|
2292
2304
|
if (l === 1 / 0) {
|
|
2293
2305
|
c(100);
|
|
2294
2306
|
return;
|
|
2295
2307
|
}
|
|
2296
|
-
let
|
|
2308
|
+
let D = null;
|
|
2297
2309
|
const M = (F) => {
|
|
2298
|
-
|
|
2299
|
-
const
|
|
2310
|
+
D || (D = F);
|
|
2311
|
+
const v = F - D, m = Math.max(0, (l - v) / l * 100);
|
|
2300
2312
|
c(m), m > 0 ? requestAnimationFrame(M) : d?.();
|
|
2301
2313
|
}, L = requestAnimationFrame(M);
|
|
2302
2314
|
return () => cancelAnimationFrame(L);
|
|
2303
2315
|
}, [l, d]);
|
|
2304
2316
|
const C = {
|
|
2305
|
-
success: /* @__PURE__ */ e(
|
|
2306
|
-
error: /* @__PURE__ */ e(
|
|
2307
|
-
warning: /* @__PURE__ */ e(
|
|
2308
|
-
info: /* @__PURE__ */ e(
|
|
2309
|
-
loading: /* @__PURE__ */ e(
|
|
2317
|
+
success: /* @__PURE__ */ e(gt, { weight: "Bold", className: "w-5 h-5" }),
|
|
2318
|
+
error: /* @__PURE__ */ e(pt, { weight: "Bold", className: "w-5 h-5" }),
|
|
2319
|
+
warning: /* @__PURE__ */ e(ft, { weight: "Bold", className: "w-5 h-5" }),
|
|
2320
|
+
info: /* @__PURE__ */ e(ht, { weight: "Bold", className: "w-5 h-5" }),
|
|
2321
|
+
loading: /* @__PURE__ */ e(mt, { weight: "Bold", className: "w-5 h-5 animate-spin" })
|
|
2310
2322
|
}, k = {
|
|
2311
2323
|
bg: {
|
|
2312
2324
|
success: "bg-green-50",
|
|
@@ -2361,14 +2373,14 @@ function Bt({
|
|
|
2361
2373
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
2362
2374
|
/* @__PURE__ */ e("h4", { className: "text-base font-medium mb-1", children: t }),
|
|
2363
2375
|
a && /* @__PURE__ */ e("p", { className: "text-sm text-[#82828C]", children: a }),
|
|
2364
|
-
|
|
2376
|
+
f && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e("div", { className: n("underline font-medium text-sm", k.action[r]), children: f }) })
|
|
2365
2377
|
] }),
|
|
2366
2378
|
/* @__PURE__ */ e(
|
|
2367
2379
|
"button",
|
|
2368
2380
|
{
|
|
2369
2381
|
onClick: d,
|
|
2370
2382
|
className: "flex-shrink-0 rounded-full transition cursor-pointer active:animate-spin",
|
|
2371
|
-
children: /* @__PURE__ */ e(
|
|
2383
|
+
children: /* @__PURE__ */ e(pe, { className: "w-6 h-6 text-slate-base" })
|
|
2372
2384
|
}
|
|
2373
2385
|
)
|
|
2374
2386
|
] }) })
|
|
@@ -2376,42 +2388,42 @@ function Bt({
|
|
|
2376
2388
|
}
|
|
2377
2389
|
);
|
|
2378
2390
|
}
|
|
2379
|
-
const
|
|
2380
|
-
const a =
|
|
2381
|
-
const
|
|
2382
|
-
|
|
2391
|
+
const ge = (t) => {
|
|
2392
|
+
const a = $t++, r = () => {
|
|
2393
|
+
const f = Ce.findIndex((d) => d?.id === a);
|
|
2394
|
+
f !== -1 && (Ce.splice(f, 1), ze());
|
|
2383
2395
|
}, l = /* @__PURE__ */ e(Bt, { ...t, onClose: r });
|
|
2384
|
-
return
|
|
2385
|
-
},
|
|
2386
|
-
success: (t, a, r) =>
|
|
2396
|
+
return Ce.push({ id: a, element: l }), ze(), t.duration !== 1 / 0 && setTimeout(r, (t.duration || 3e3) + 300), { close: r };
|
|
2397
|
+
}, lr = {
|
|
2398
|
+
success: (t, a, r) => ge(typeof t == "string" ? { title: t, description: a, type: "success", action: r } : {
|
|
2387
2399
|
...t,
|
|
2388
2400
|
type: "success"
|
|
2389
2401
|
}),
|
|
2390
|
-
error: (t, a, r) =>
|
|
2402
|
+
error: (t, a, r) => ge(typeof t == "string" ? { title: t, description: a, type: "error", action: r } : {
|
|
2391
2403
|
...t,
|
|
2392
2404
|
type: "error"
|
|
2393
2405
|
}),
|
|
2394
|
-
warning: (t, a, r) =>
|
|
2406
|
+
warning: (t, a, r) => ge(typeof t == "string" ? { title: t, description: a, type: "warning", action: r } : {
|
|
2395
2407
|
...t,
|
|
2396
2408
|
type: "warning"
|
|
2397
2409
|
}),
|
|
2398
|
-
info: (t, a, r) =>
|
|
2410
|
+
info: (t, a, r) => ge(typeof t == "string" ? { title: t, description: a, type: "info", action: r } : {
|
|
2399
2411
|
...t,
|
|
2400
2412
|
type: "info"
|
|
2401
2413
|
}),
|
|
2402
|
-
loading: (t, a) =>
|
|
2414
|
+
loading: (t, a) => ge(typeof t == "string" ? {
|
|
2403
2415
|
title: t,
|
|
2404
2416
|
description: a,
|
|
2405
2417
|
type: "loading",
|
|
2406
2418
|
duration: 1 / 0
|
|
2407
2419
|
} : { ...t, type: "loading", duration: 1 / 0 })
|
|
2408
2420
|
};
|
|
2409
|
-
function
|
|
2421
|
+
function ar({
|
|
2410
2422
|
content: t,
|
|
2411
2423
|
children: a,
|
|
2412
2424
|
position: r = "top",
|
|
2413
2425
|
delay: l = 200,
|
|
2414
|
-
className:
|
|
2426
|
+
className: f
|
|
2415
2427
|
}) {
|
|
2416
2428
|
const d = {
|
|
2417
2429
|
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
@@ -2434,7 +2446,7 @@ function sr({
|
|
|
2434
2446
|
"scale-95 opacity-0 transition-all group-hover:scale-100 group-hover:opacity-100",
|
|
2435
2447
|
"duration-200 ease-out group-hover:delay-200",
|
|
2436
2448
|
d[r],
|
|
2437
|
-
|
|
2449
|
+
f
|
|
2438
2450
|
),
|
|
2439
2451
|
style: { transitionDelay: `${l}ms` },
|
|
2440
2452
|
children: [
|
|
@@ -2453,12 +2465,12 @@ function sr({
|
|
|
2453
2465
|
)
|
|
2454
2466
|
] });
|
|
2455
2467
|
}
|
|
2456
|
-
function
|
|
2468
|
+
function sr({
|
|
2457
2469
|
checked: t = !1,
|
|
2458
2470
|
onChange: a,
|
|
2459
2471
|
disabled: r = !1,
|
|
2460
2472
|
variant: l = "yellow",
|
|
2461
|
-
label:
|
|
2473
|
+
label: f,
|
|
2462
2474
|
supportText: d,
|
|
2463
2475
|
className: s
|
|
2464
2476
|
}) {
|
|
@@ -2508,14 +2520,14 @@ function or({
|
|
|
2508
2520
|
)
|
|
2509
2521
|
}
|
|
2510
2522
|
),
|
|
2511
|
-
(
|
|
2512
|
-
|
|
2523
|
+
(f || d) && /* @__PURE__ */ i("div", { className: "flex flex-col leading-tight", children: [
|
|
2524
|
+
f && /* @__PURE__ */ e(
|
|
2513
2525
|
"span",
|
|
2514
2526
|
{
|
|
2515
2527
|
className: n(
|
|
2516
2528
|
"text-base font-medium text-black"
|
|
2517
2529
|
),
|
|
2518
|
-
children:
|
|
2530
|
+
children: f
|
|
2519
2531
|
}
|
|
2520
2532
|
),
|
|
2521
2533
|
d && /* @__PURE__ */ e("span", { className: "text-sm font-normal text-slate-500", children: d })
|
|
@@ -2524,24 +2536,24 @@ function or({
|
|
|
2524
2536
|
}
|
|
2525
2537
|
);
|
|
2526
2538
|
}
|
|
2527
|
-
const
|
|
2528
|
-
function
|
|
2539
|
+
const zt = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 177 177", fill: "none", ...t }, /* @__PURE__ */ re.createElement("path", { opacity: 0.083334, d: "M94.5 48.5C94.5 41.8726 91.8137 36.5 88.5 36.5C85.1863 36.5 82.5 41.8726 82.5 48.5C82.5 55.1274 85.1863 60.5 88.5 60.5C91.8137 60.5 94.5 55.1274 94.5 48.5Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.166667, d: "M113.697 56.8591C117.011 51.1196 117.371 45.1237 114.501 43.4668C111.631 41.8099 106.618 45.1196 103.305 50.8591C99.991 56.5986 99.6311 62.5946 102.501 64.2514C105.371 65.9083 110.383 62.5986 113.697 56.8591Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.25, d: "M126.141 73.696C131.88 70.3823 135.19 65.3696 133.533 62.4999C131.876 59.6301 125.88 59.99 120.141 63.3037C114.401 66.6174 111.092 71.6301 112.749 74.4999C114.405 77.3696 120.401 77.0097 126.141 73.696Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.333334, d: "M128.5 94.5C135.127 94.5 140.5 91.8137 140.5 88.5C140.5 85.1863 135.127 82.5 128.5 82.5C121.873 82.5 116.5 85.1863 116.5 88.5C116.5 91.8137 121.873 94.5 128.5 94.5Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.416667, d: "M120.141 113.696C125.88 117.01 131.876 117.37 133.533 114.5C135.19 111.63 131.88 106.617 126.141 103.304C120.401 99.99 114.405 99.6301 112.749 102.5C111.092 105.37 114.401 110.382 120.141 113.696Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.5, d: "M103.303 126.141C106.617 131.88 111.629 135.19 114.499 133.533C117.369 131.876 117.009 125.88 113.695 120.141C110.382 114.401 105.369 111.092 102.499 112.749C99.6294 114.405 99.9893 120.401 103.303 126.141Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.583334, d: "M82.5 128.5C82.5 135.127 85.1863 140.5 88.5 140.5C91.8137 140.5 94.5 135.127 94.5 128.5C94.5 121.873 91.8137 116.5 88.5 116.5C85.1863 116.5 82.5 121.873 82.5 128.5Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.666667, d: "M63.303 120.141C59.9893 125.88 59.6294 131.876 62.4992 133.533C65.3689 135.19 70.3816 131.88 73.6953 126.141C77.009 120.401 77.3689 114.405 74.4992 112.749C71.6294 111.092 66.6167 114.401 63.303 120.141Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.75, d: "M50.8591 103.304C45.1196 106.618 41.8099 111.63 43.4668 114.5C45.1237 117.37 51.1196 117.01 56.8591 113.696C62.5986 110.383 65.9083 105.37 64.2514 102.5C62.5946 99.6304 56.5986 99.9903 50.8591 103.304Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.833334, d: "M48.5 82.5C41.8726 82.5 36.5 85.1863 36.5 88.5C36.5 91.8137 41.8726 94.5 48.5 94.5C55.1274 94.5 60.5 91.8137 60.5 88.5C60.5 85.1863 55.1274 82.5 48.5 82.5Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { opacity: 0.916667, d: "M56.8591 63.304C51.1196 59.9903 45.1237 59.6304 43.4668 62.5001C41.8099 65.3699 45.1196 70.3826 50.8591 73.6963C56.5986 77.01 62.5946 77.3699 64.2514 74.5001C65.9083 71.6304 62.5986 66.6177 56.8591 63.304Z", fill: "currentColor" }), /* @__PURE__ */ re.createElement("path", { d: "M73.697 50.8591C70.3833 45.1196 65.3706 41.8099 62.5008 43.4668C59.6311 45.1237 59.991 51.1196 63.3047 56.8591C66.6184 62.5986 71.6311 65.9083 74.5008 64.2514C77.3706 62.5946 77.0107 56.5986 73.697 50.8591Z", fill: "currentColor" }));
|
|
2540
|
+
function or({
|
|
2529
2541
|
className: t,
|
|
2530
2542
|
size: a = 150,
|
|
2531
2543
|
iconClassName: r,
|
|
2532
2544
|
isLoading: l = !1,
|
|
2533
|
-
isFullPage:
|
|
2545
|
+
isFullPage: f = !0
|
|
2534
2546
|
}) {
|
|
2535
2547
|
return l ? /* @__PURE__ */ e(
|
|
2536
2548
|
"div",
|
|
2537
2549
|
{
|
|
2538
2550
|
className: n(
|
|
2539
2551
|
"z-[99px] flex flex-col items-center justify-center transition-all duration-300",
|
|
2540
|
-
|
|
2552
|
+
f ? "fixed inset-0 backdrop-blur-[2px]" : "absolute inset-0 w-full h-full rounded-[inherit]",
|
|
2541
2553
|
t
|
|
2542
2554
|
),
|
|
2543
2555
|
children: /* @__PURE__ */ e(
|
|
2544
|
-
|
|
2556
|
+
zt,
|
|
2545
2557
|
{
|
|
2546
2558
|
width: a,
|
|
2547
2559
|
height: a,
|
|
@@ -2556,40 +2568,40 @@ function ir({
|
|
|
2556
2568
|
}
|
|
2557
2569
|
) : null;
|
|
2558
2570
|
}
|
|
2559
|
-
const
|
|
2571
|
+
const Pt = fe(
|
|
2560
2572
|
({
|
|
2561
2573
|
label: t,
|
|
2562
2574
|
placeholder: a = "+998 (__) ___ __ __",
|
|
2563
2575
|
size: r = "base",
|
|
2564
2576
|
error: l,
|
|
2565
|
-
disabled:
|
|
2577
|
+
disabled: f = !1,
|
|
2566
2578
|
required: d = !1,
|
|
2567
2579
|
value: s = "",
|
|
2568
2580
|
onChange: c,
|
|
2569
2581
|
onFocus: C,
|
|
2570
2582
|
onBlur: k,
|
|
2571
|
-
className:
|
|
2583
|
+
className: D,
|
|
2572
2584
|
name: M,
|
|
2573
2585
|
showIcon: L = !1
|
|
2574
2586
|
}, F) => {
|
|
2575
|
-
const [
|
|
2576
|
-
let o =
|
|
2587
|
+
const [v, m] = _(!1), u = R((j) => {
|
|
2588
|
+
let o = j.replace(/\D/g, "");
|
|
2577
2589
|
o.startsWith("998") || (o = "998" + o), o = o.substring(0, 12);
|
|
2578
|
-
let
|
|
2579
|
-
return o.length > 3 && (
|
|
2580
|
-
}, []),
|
|
2581
|
-
const o =
|
|
2590
|
+
let N = "+998";
|
|
2591
|
+
return o.length > 3 && (N += " (" + o.substring(3, 5)), o.length > 5 && (N += ") " + o.substring(5, 8)), o.length > 8 && (N += " " + o.substring(8, 10)), o.length > 10 && (N += " " + o.substring(10, 12)), N;
|
|
2592
|
+
}, []), b = (j) => {
|
|
2593
|
+
const o = j.target.value;
|
|
2582
2594
|
if (o.length < 5) {
|
|
2583
2595
|
c?.("+998");
|
|
2584
2596
|
return;
|
|
2585
2597
|
}
|
|
2586
|
-
const
|
|
2587
|
-
c?.(
|
|
2588
|
-
},
|
|
2598
|
+
const N = u(o);
|
|
2599
|
+
c?.(N);
|
|
2600
|
+
}, w = () => {
|
|
2589
2601
|
m(!0), (!s || s === "") && c?.("+998"), C?.();
|
|
2590
|
-
},
|
|
2602
|
+
}, p = () => {
|
|
2591
2603
|
m(!1), k?.();
|
|
2592
|
-
},
|
|
2604
|
+
}, y = Z(() => ({
|
|
2593
2605
|
sm: {
|
|
2594
2606
|
input: "h-9 text-sm",
|
|
2595
2607
|
padding: L ? "pl-8 pr-2" : "px-2",
|
|
@@ -2614,12 +2626,12 @@ const Wt = he(
|
|
|
2614
2626
|
labelFont: "text-base",
|
|
2615
2627
|
iconWrapper: "h-5"
|
|
2616
2628
|
}
|
|
2617
|
-
}), [L]),
|
|
2618
|
-
return /* @__PURE__ */ i("div", { className: n("w-full",
|
|
2629
|
+
}), [L]), $ = Z(() => l ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600", [l]), E = Z(() => f ? "text-slate-400" : l ? "text-red-600" : v ? "text-black" : "text-slate-400", [l, v, f]);
|
|
2630
|
+
return /* @__PURE__ */ i("div", { className: n("w-full", D), children: [
|
|
2619
2631
|
t && /* @__PURE__ */ i("label", { className: n(
|
|
2620
2632
|
"mb-2 block font-medium transition-colors duration-200",
|
|
2621
|
-
l ? "text-red-600" :
|
|
2622
|
-
|
|
2633
|
+
l ? "text-red-600" : v ? "text-blue-600" : "text-slate-700",
|
|
2634
|
+
y[r].labelFont
|
|
2623
2635
|
), children: [
|
|
2624
2636
|
t,
|
|
2625
2637
|
d && /* @__PURE__ */ e("span", { className: "text-red-600 ml-1", children: "*" })
|
|
@@ -2627,9 +2639,9 @@ const Wt = he(
|
|
|
2627
2639
|
/* @__PURE__ */ i("div", { className: "relative flex items-center", children: [
|
|
2628
2640
|
L && /* @__PURE__ */ e("div", { className: n(
|
|
2629
2641
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center transition-all duration-300",
|
|
2630
|
-
|
|
2642
|
+
y[r].iconLeft,
|
|
2631
2643
|
E
|
|
2632
|
-
), children: /* @__PURE__ */ e("div", { className: n("flex items-center justify-center",
|
|
2644
|
+
), children: /* @__PURE__ */ e("div", { className: n("flex items-center justify-center", y[r].iconWrapper), children: /* @__PURE__ */ e(bt, { className: n(y[r].iconSize), weight: "Linear" }) }) }),
|
|
2633
2645
|
/* @__PURE__ */ e(
|
|
2634
2646
|
"input",
|
|
2635
2647
|
{
|
|
@@ -2637,18 +2649,18 @@ const Wt = he(
|
|
|
2637
2649
|
name: M,
|
|
2638
2650
|
type: "tel",
|
|
2639
2651
|
value: s,
|
|
2640
|
-
onChange:
|
|
2641
|
-
onFocus:
|
|
2642
|
-
onBlur:
|
|
2643
|
-
disabled:
|
|
2652
|
+
onChange: b,
|
|
2653
|
+
onFocus: w,
|
|
2654
|
+
onBlur: p,
|
|
2655
|
+
disabled: f,
|
|
2644
2656
|
placeholder: a,
|
|
2645
2657
|
className: n(
|
|
2646
2658
|
"w-full border bg-white font-normal transition-all duration-300 outline-none",
|
|
2647
2659
|
r === "base" ? "rounded-xl" : "rounded-lg",
|
|
2648
2660
|
"disabled:bg-slate-100 disabled:text-slate-400 disabled:cursor-not-allowed",
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2661
|
+
y[r].input,
|
|
2662
|
+
y[r].padding,
|
|
2663
|
+
$
|
|
2652
2664
|
)
|
|
2653
2665
|
}
|
|
2654
2666
|
)
|
|
@@ -2657,22 +2669,22 @@ const Wt = he(
|
|
|
2657
2669
|
] });
|
|
2658
2670
|
}
|
|
2659
2671
|
);
|
|
2660
|
-
|
|
2661
|
-
const
|
|
2662
|
-
({ mode: t, onChange: a, value: r, ...l },
|
|
2663
|
-
const [d, s] =
|
|
2664
|
-
const m =
|
|
2672
|
+
Pt.displayName = "MciPhone";
|
|
2673
|
+
const Wt = fe(
|
|
2674
|
+
({ mode: t, onChange: a, value: r, ...l }, f) => {
|
|
2675
|
+
const [d, s] = _(""), c = r !== void 0 ? r : d, C = (v) => {
|
|
2676
|
+
const m = v.replace(/\s/g, "").toUpperCase();
|
|
2665
2677
|
let u = "";
|
|
2666
|
-
for (let
|
|
2667
|
-
const
|
|
2668
|
-
if (u.length < 2 ? /[A-Z]/.test(
|
|
2678
|
+
for (let b = 0; b < m.length; b++) {
|
|
2679
|
+
const w = m[b];
|
|
2680
|
+
if (u.length < 2 ? /[A-Z]/.test(w) && (u += w) : /[0-9]/.test(w) && (u += w), u.length >= 9) break;
|
|
2669
2681
|
}
|
|
2670
2682
|
return u.length > 2 ? u.slice(0, 2) + " " + u.slice(2) : u;
|
|
2671
|
-
}, k = (
|
|
2672
|
-
(
|
|
2673
|
-
const m =
|
|
2683
|
+
}, k = (v) => v.replace(/\D/g, "").slice(0, 14), D = (v) => v.toUpperCase().replace(/[^A-Z0-9\-\s]/g, "").replace(/\s+/g, " ").slice(0, 15), M = R(
|
|
2684
|
+
(v) => {
|
|
2685
|
+
const m = v.target.value;
|
|
2674
2686
|
let u = "";
|
|
2675
|
-
t === "passport" ? u = C(m) : t === "pinfl" ? u = k(m) : t === "metirka" && (u =
|
|
2687
|
+
t === "passport" ? u = C(m) : t === "pinfl" ? u = k(m) : t === "metirka" && (u = D(m)), r === void 0 && s(u), v.target.value = u, a?.(u, v);
|
|
2676
2688
|
},
|
|
2677
2689
|
[t, a, r]
|
|
2678
2690
|
), L = () => {
|
|
@@ -2689,9 +2701,9 @@ const Yt = he(
|
|
|
2689
2701
|
}
|
|
2690
2702
|
};
|
|
2691
2703
|
return /* @__PURE__ */ e(
|
|
2692
|
-
|
|
2704
|
+
Le,
|
|
2693
2705
|
{
|
|
2694
|
-
ref:
|
|
2706
|
+
ref: f,
|
|
2695
2707
|
...l,
|
|
2696
2708
|
value: c,
|
|
2697
2709
|
onChange: M,
|
|
@@ -2713,52 +2725,52 @@ const Yt = he(
|
|
|
2713
2725
|
);
|
|
2714
2726
|
}
|
|
2715
2727
|
);
|
|
2716
|
-
|
|
2717
|
-
function
|
|
2728
|
+
Wt.displayName = "MciIdentityInput";
|
|
2729
|
+
function ir({
|
|
2718
2730
|
open: t,
|
|
2719
2731
|
onClose: a,
|
|
2720
2732
|
columns: r,
|
|
2721
2733
|
hidden: l,
|
|
2722
|
-
onToggle:
|
|
2734
|
+
onToggle: f,
|
|
2723
2735
|
onMove: d,
|
|
2724
2736
|
minVisible: s = 5
|
|
2725
2737
|
}) {
|
|
2726
|
-
const c =
|
|
2738
|
+
const c = le(null), { handleClick: C } = De(c, a);
|
|
2727
2739
|
J(() => {
|
|
2728
2740
|
if (t)
|
|
2729
2741
|
return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
|
|
2730
2742
|
}, [t, C]);
|
|
2731
|
-
const k =
|
|
2743
|
+
const k = Z(() => new Set(l), [l]), D = Z(() => {
|
|
2732
2744
|
let o = 0;
|
|
2733
|
-
for (const
|
|
2745
|
+
for (const N of r) k.has(N.key) || o++;
|
|
2734
2746
|
return o;
|
|
2735
|
-
}, [r, k]), M =
|
|
2736
|
-
L.current = o,
|
|
2737
|
-
|
|
2747
|
+
}, [r, k]), M = le(null), L = le(null), F = le(!1), [v, m] = _(null), [u, b] = _(null), w = le(null), p = R((o) => {
|
|
2748
|
+
L.current = o, w.current == null && (w.current = requestAnimationFrame(() => {
|
|
2749
|
+
w.current = null, m(L.current);
|
|
2738
2750
|
}));
|
|
2739
2751
|
}, []);
|
|
2740
2752
|
J(() => () => {
|
|
2741
|
-
|
|
2753
|
+
w.current != null && cancelAnimationFrame(w.current);
|
|
2742
2754
|
}, []);
|
|
2743
|
-
const
|
|
2755
|
+
const y = R(
|
|
2744
2756
|
(o) => {
|
|
2745
|
-
F.current = !0, M.current = o,
|
|
2757
|
+
F.current = !0, M.current = o, b(r[o]?.key ?? null);
|
|
2746
2758
|
},
|
|
2747
2759
|
[r]
|
|
2748
|
-
),
|
|
2760
|
+
), $ = R(() => {
|
|
2749
2761
|
F.current = !1;
|
|
2750
2762
|
}, []);
|
|
2751
2763
|
J(() => {
|
|
2752
2764
|
if (t)
|
|
2753
|
-
return document.addEventListener("mouseup",
|
|
2754
|
-
}, [t,
|
|
2755
|
-
const E =
|
|
2756
|
-
M.current = null, F.current = !1,
|
|
2757
|
-
}, [
|
|
2758
|
-
(o,
|
|
2759
|
-
|
|
2765
|
+
return document.addEventListener("mouseup", $), () => document.removeEventListener("mouseup", $);
|
|
2766
|
+
}, [t, $]);
|
|
2767
|
+
const E = R(() => {
|
|
2768
|
+
M.current = null, F.current = !1, b(null), p(null);
|
|
2769
|
+
}, [p]), j = R(
|
|
2770
|
+
(o, N) => {
|
|
2771
|
+
N || f(o);
|
|
2760
2772
|
},
|
|
2761
|
-
[
|
|
2773
|
+
[f]
|
|
2762
2774
|
);
|
|
2763
2775
|
return t ? /* @__PURE__ */ i(
|
|
2764
2776
|
"div",
|
|
@@ -2795,40 +2807,40 @@ function cr({
|
|
|
2795
2807
|
"[&::-webkit-scrollbar-thumb]:rounded-full",
|
|
2796
2808
|
"hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
|
|
2797
2809
|
),
|
|
2798
|
-
children: r.map((o,
|
|
2799
|
-
const
|
|
2810
|
+
children: r.map((o, N) => {
|
|
2811
|
+
const T = !k.has(o.key), Y = T && D <= s, q = v === N, B = u === o.key;
|
|
2800
2812
|
return /* @__PURE__ */ i("div", { children: [
|
|
2801
2813
|
/* @__PURE__ */ i(
|
|
2802
2814
|
"div",
|
|
2803
2815
|
{
|
|
2804
2816
|
draggable: !0,
|
|
2805
|
-
onDragStart: (
|
|
2817
|
+
onDragStart: (P) => {
|
|
2806
2818
|
if (!F.current) {
|
|
2807
|
-
|
|
2819
|
+
P.preventDefault();
|
|
2808
2820
|
return;
|
|
2809
2821
|
}
|
|
2810
|
-
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2822
|
+
P.dataTransfer.setData("text/plain", String(N)), P.dataTransfer.effectAllowed = "move", b(o.key), p(null);
|
|
2823
|
+
const W = new Image();
|
|
2824
|
+
W.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", P.dataTransfer.setDragImage(W, 0, 0);
|
|
2813
2825
|
},
|
|
2814
|
-
onDragOver: (
|
|
2815
|
-
M.current != null && (
|
|
2826
|
+
onDragOver: (P) => {
|
|
2827
|
+
M.current != null && (P.preventDefault(), P.dataTransfer.dropEffect = "move", p(N));
|
|
2816
2828
|
},
|
|
2817
2829
|
onDragLeave: () => {
|
|
2818
|
-
L.current ===
|
|
2830
|
+
L.current === N && p(null);
|
|
2819
2831
|
},
|
|
2820
|
-
onDrop: (
|
|
2821
|
-
|
|
2822
|
-
const
|
|
2823
|
-
Number.isFinite(
|
|
2832
|
+
onDrop: (P) => {
|
|
2833
|
+
P.preventDefault();
|
|
2834
|
+
const W = M.current ?? Number(P.dataTransfer.getData("text/plain"));
|
|
2835
|
+
Number.isFinite(W) && W !== N && d(W, N), E();
|
|
2824
2836
|
},
|
|
2825
2837
|
onDragEnd: E,
|
|
2826
2838
|
className: n(
|
|
2827
2839
|
"group flex items-center py-2 px-1 gap-4",
|
|
2828
2840
|
"rounded-md box-border overflow-visible",
|
|
2829
2841
|
"transition-[background,transform] duration-150",
|
|
2830
|
-
!B && !
|
|
2831
|
-
|
|
2842
|
+
!B && !q && "hover:bg-slate-50",
|
|
2843
|
+
q && !B && "bg-slate-50",
|
|
2832
2844
|
B && "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing"
|
|
2833
2845
|
),
|
|
2834
2846
|
children: [
|
|
@@ -2836,7 +2848,7 @@ function cr({
|
|
|
2836
2848
|
"button",
|
|
2837
2849
|
{
|
|
2838
2850
|
type: "button",
|
|
2839
|
-
onMouseDown: () =>
|
|
2851
|
+
onMouseDown: () => y(N),
|
|
2840
2852
|
className: n(
|
|
2841
2853
|
"shrink-0 text-slate-400",
|
|
2842
2854
|
"cursor-grab active:cursor-grabbing",
|
|
@@ -2844,21 +2856,21 @@ function cr({
|
|
|
2844
2856
|
B && "cursor-grabbing"
|
|
2845
2857
|
),
|
|
2846
2858
|
"aria-label": "Drag",
|
|
2847
|
-
children: /* @__PURE__ */ e(
|
|
2859
|
+
children: /* @__PURE__ */ e(xt, { weight: "Linear", size: 20 })
|
|
2848
2860
|
}
|
|
2849
2861
|
),
|
|
2850
2862
|
/* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(
|
|
2851
|
-
|
|
2863
|
+
Me,
|
|
2852
2864
|
{
|
|
2853
|
-
checked:
|
|
2854
|
-
disabled:
|
|
2855
|
-
onChange: () =>
|
|
2865
|
+
checked: T,
|
|
2866
|
+
disabled: Y,
|
|
2867
|
+
onChange: () => j(o.key, Y),
|
|
2856
2868
|
variant: "blue"
|
|
2857
2869
|
}
|
|
2858
2870
|
) }),
|
|
2859
2871
|
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
|
|
2860
2872
|
/* @__PURE__ */ e("h4", { className: "truncate text-slate-700 text-base font-medium", title: o.title, children: o.title }),
|
|
2861
|
-
|
|
2873
|
+
Y && /* @__PURE__ */ i("p", { className: "text-xs text-slate-400 mt-0.5", children: [
|
|
2862
2874
|
"Минимум ",
|
|
2863
2875
|
s,
|
|
2864
2876
|
" колонок"
|
|
@@ -2867,7 +2879,7 @@ function cr({
|
|
|
2867
2879
|
]
|
|
2868
2880
|
}
|
|
2869
2881
|
),
|
|
2870
|
-
|
|
2882
|
+
N !== r.length - 1 && /* @__PURE__ */ e("div", { className: "mx-2 h-px bg-slate-100" })
|
|
2871
2883
|
] }, o.key);
|
|
2872
2884
|
})
|
|
2873
2885
|
}
|
|
@@ -2876,34 +2888,34 @@ function cr({
|
|
|
2876
2888
|
}
|
|
2877
2889
|
) : null;
|
|
2878
2890
|
}
|
|
2879
|
-
const
|
|
2891
|
+
const Pe = (t) => Array.isArray(t) && t.every((a) => typeof a == "string"), Ot = (t) => {
|
|
2880
2892
|
if (!t) return null;
|
|
2881
2893
|
try {
|
|
2882
2894
|
const a = JSON.parse(t);
|
|
2883
2895
|
if (typeof a != "object" || a === null) return null;
|
|
2884
2896
|
const r = a;
|
|
2885
|
-
return !
|
|
2897
|
+
return !Pe(r.order) || !Pe(r.hidden) ? null : { order: r.order, hidden: r.hidden };
|
|
2886
2898
|
} catch {
|
|
2887
2899
|
return null;
|
|
2888
2900
|
}
|
|
2889
|
-
},
|
|
2901
|
+
}, ie = (t) => {
|
|
2890
2902
|
const a = /* @__PURE__ */ new Set(), r = [];
|
|
2891
2903
|
for (const l of t)
|
|
2892
2904
|
a.has(l) || (a.add(l), r.push(l));
|
|
2893
2905
|
return r;
|
|
2894
2906
|
};
|
|
2895
|
-
function
|
|
2896
|
-
const { storageKey: a, columns: r, defaultVisibleKeys: l, defaultOrder:
|
|
2907
|
+
function cr(t) {
|
|
2908
|
+
const { storageKey: a, columns: r, defaultVisibleKeys: l, defaultOrder: f } = t, d = Z(() => r.map((m) => String(m.key)), [r]), s = Z(() => new Set(d), [d]), [c, C] = _(() => {
|
|
2897
2909
|
if (typeof window > "u") {
|
|
2898
|
-
const E =
|
|
2899
|
-
return { order:
|
|
2910
|
+
const E = f?.map(String) ?? d, j = l && l.length ? d.filter((o) => !new Set(l.map(String)).has(o)) : [];
|
|
2911
|
+
return { order: ie(E), hidden: ie(j) };
|
|
2900
2912
|
}
|
|
2901
|
-
const m = Ot(window.localStorage.getItem(a)), u =
|
|
2902
|
-
...
|
|
2903
|
-
...
|
|
2904
|
-
...d.filter((E) => !
|
|
2905
|
-
]),
|
|
2906
|
-
return { order:
|
|
2913
|
+
const m = Ot(window.localStorage.getItem(a)), u = f?.map(String) ?? d, b = ie(u), w = ie((m?.order ?? []).filter((E) => s.has(E))), p = ie([
|
|
2914
|
+
...w,
|
|
2915
|
+
...b.filter((E) => !w.includes(E)),
|
|
2916
|
+
...d.filter((E) => !w.includes(E) && !b.includes(E))
|
|
2917
|
+
]), y = ie((m?.hidden ?? []).filter((E) => s.has(E))), $ = y.length === 0 && l && l.length ? d.filter((E) => !new Set(l.map(String)).has(E)) : y;
|
|
2918
|
+
return { order: p, hidden: ie($) };
|
|
2907
2919
|
});
|
|
2908
2920
|
J(() => {
|
|
2909
2921
|
if (!(typeof window > "u"))
|
|
@@ -2913,72 +2925,72 @@ function dr(t) {
|
|
|
2913
2925
|
}
|
|
2914
2926
|
}, [a, c]), J(() => {
|
|
2915
2927
|
C((m) => {
|
|
2916
|
-
const u =
|
|
2917
|
-
...m.order.filter((
|
|
2918
|
-
...d.filter((
|
|
2919
|
-
]),
|
|
2920
|
-
return
|
|
2928
|
+
const u = ie([
|
|
2929
|
+
...m.order.filter((y) => s.has(y)),
|
|
2930
|
+
...d.filter((y) => !m.order.includes(y))
|
|
2931
|
+
]), b = ie(m.hidden.filter((y) => s.has(y))), w = u.length === m.order.length && u.every((y, $) => y === m.order[$]), p = b.length === m.hidden.length && b.every((y, $) => y === m.hidden[$]);
|
|
2932
|
+
return w && p ? m : { order: u, hidden: b };
|
|
2921
2933
|
});
|
|
2922
2934
|
}, [d, s]);
|
|
2923
|
-
const k =
|
|
2935
|
+
const k = Z(() => new Set(c.hidden), [c.hidden]), D = Z(() => {
|
|
2924
2936
|
const m = /* @__PURE__ */ new Map();
|
|
2925
|
-
return c.order.forEach((
|
|
2926
|
-
const
|
|
2927
|
-
return
|
|
2937
|
+
return c.order.forEach((b, w) => m.set(b, w)), [...r.filter((b) => !k.has(String(b.key)))].sort((b, w) => {
|
|
2938
|
+
const p = m.get(String(b.key)) ?? Number.MAX_SAFE_INTEGER, y = m.get(String(w.key)) ?? Number.MAX_SAFE_INTEGER;
|
|
2939
|
+
return p - y;
|
|
2928
2940
|
});
|
|
2929
|
-
}, [r, k, c.order]), M =
|
|
2941
|
+
}, [r, k, c.order]), M = Z(
|
|
2930
2942
|
() => c.hidden.filter((m) => s.has(m)),
|
|
2931
2943
|
[c.hidden, s]
|
|
2932
|
-
), L =
|
|
2944
|
+
), L = R((m) => {
|
|
2933
2945
|
const u = String(m);
|
|
2934
|
-
C((
|
|
2935
|
-
const
|
|
2936
|
-
return { ...
|
|
2946
|
+
C((b) => {
|
|
2947
|
+
const p = b.hidden.includes(u) ? b.hidden.filter((y) => y !== u) : [...b.hidden, u];
|
|
2948
|
+
return { ...b, hidden: ie(p) };
|
|
2937
2949
|
});
|
|
2938
|
-
}, []), F =
|
|
2939
|
-
C((
|
|
2940
|
-
const
|
|
2941
|
-
if (m < 0 || u < 0 || m >=
|
|
2942
|
-
const [
|
|
2943
|
-
return
|
|
2950
|
+
}, []), F = R((m, u) => {
|
|
2951
|
+
C((b) => {
|
|
2952
|
+
const w = b.order.slice();
|
|
2953
|
+
if (m < 0 || u < 0 || m >= w.length || u >= w.length) return b;
|
|
2954
|
+
const [p] = w.splice(m, 1);
|
|
2955
|
+
return w.splice(u, 0, p), { ...b, order: w };
|
|
2944
2956
|
});
|
|
2945
|
-
}, []),
|
|
2957
|
+
}, []), v = R(() => {
|
|
2946
2958
|
C(() => {
|
|
2947
|
-
const m =
|
|
2959
|
+
const m = ie(f?.map(String) ?? d), u = l && l.length ? ie(d.filter((b) => !new Set(l.map(String)).has(b))) : [];
|
|
2948
2960
|
return { order: m, hidden: u };
|
|
2949
2961
|
});
|
|
2950
|
-
}, [
|
|
2962
|
+
}, [f, l, d]);
|
|
2951
2963
|
return {
|
|
2952
|
-
orderedColumns:
|
|
2964
|
+
orderedColumns: D,
|
|
2953
2965
|
hiddenKeys: M,
|
|
2954
2966
|
toggleColumn: L,
|
|
2955
2967
|
moveColumn: F,
|
|
2956
|
-
reset:
|
|
2968
|
+
reset: v
|
|
2957
2969
|
};
|
|
2958
2970
|
}
|
|
2959
2971
|
export {
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2972
|
+
qt as MciBreadcrumb,
|
|
2973
|
+
Kt as MciButton,
|
|
2974
|
+
Me as MciCheck,
|
|
2975
|
+
Jt as MciCollapse,
|
|
2976
|
+
Gt as MciDrawer,
|
|
2977
|
+
Wt as MciIdentityInput,
|
|
2978
|
+
Le as MciInput,
|
|
2979
|
+
or as MciLoader,
|
|
2980
|
+
er as MciModal,
|
|
2981
|
+
tr as MciPagination,
|
|
2982
|
+
Pt as MciPhone,
|
|
2983
|
+
Dt as MciPicker,
|
|
2984
|
+
At as MciSelect,
|
|
2985
|
+
$e as MciSkeleton,
|
|
2986
|
+
Xt as MciTable,
|
|
2987
|
+
ir as MciTableColumnsPanel,
|
|
2988
|
+
rr as MciTabs,
|
|
2989
|
+
nr as MciTag,
|
|
2990
|
+
Rt as MciTextarea,
|
|
2991
|
+
lr as MciToast,
|
|
2992
|
+
sr as MciToggle,
|
|
2993
|
+
ar as MciTooltip,
|
|
2994
|
+
Qt as MciUpload,
|
|
2995
|
+
cr as useTableColumnSettings
|
|
2984
2996
|
};
|