@mci-ui/mci-ui 0.0.73 → 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.es.js +877 -858
- 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,27 +1347,27 @@ 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
|
-
] },
|
|
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
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:
|
|
1357
|
-
] }) }) }) :
|
|
1358
|
-
const
|
|
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;
|
|
1359
1359
|
return /* @__PURE__ */ i("tr", { className: "group transition-colors hover:bg-slate-50", children: [
|
|
1360
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(
|
|
1361
|
-
|
|
1361
|
+
Me,
|
|
1362
1362
|
{
|
|
1363
|
-
checked:
|
|
1364
|
-
disabled:
|
|
1363
|
+
checked: Y,
|
|
1364
|
+
disabled: q,
|
|
1365
1365
|
variant: "yellow",
|
|
1366
|
-
onChange: (B) =>
|
|
1366
|
+
onChange: (B) => y(o, B.target.checked)
|
|
1367
1367
|
}
|
|
1368
1368
|
) }) }),
|
|
1369
1369
|
t.map((B) => {
|
|
1370
|
-
const
|
|
1370
|
+
const P = o[B.key], W = B.render ? B.render(P, o) : String(P ?? "-");
|
|
1371
1371
|
return /* @__PURE__ */ e(
|
|
1372
1372
|
"td",
|
|
1373
1373
|
{
|
|
@@ -1379,19 +1379,19 @@ function Qt({
|
|
|
1379
1379
|
k,
|
|
1380
1380
|
B.className
|
|
1381
1381
|
),
|
|
1382
|
-
children: /* @__PURE__ */ e(
|
|
1382
|
+
children: /* @__PURE__ */ e(Et, { title: typeof W == "string" ? W : void 0, children: W })
|
|
1383
1383
|
},
|
|
1384
1384
|
B.key
|
|
1385
1385
|
);
|
|
1386
1386
|
})
|
|
1387
|
-
] },
|
|
1387
|
+
] }, N);
|
|
1388
1388
|
}) })
|
|
1389
1389
|
] }) })
|
|
1390
1390
|
] })
|
|
1391
1391
|
}
|
|
1392
1392
|
);
|
|
1393
1393
|
}
|
|
1394
|
-
const
|
|
1394
|
+
const Lt = {
|
|
1395
1395
|
uz: {
|
|
1396
1396
|
dragAndDrop: "Faylni bu yerga torting",
|
|
1397
1397
|
clickToUpload: "yoki bosib tanlang",
|
|
@@ -1464,25 +1464,25 @@ const It = {
|
|
|
1464
1464
|
audio: "Audio",
|
|
1465
1465
|
document: "Document"
|
|
1466
1466
|
}
|
|
1467
|
-
},
|
|
1467
|
+
}, Qt = ({
|
|
1468
1468
|
multiple: t = !1,
|
|
1469
1469
|
accept: a = "*/*",
|
|
1470
1470
|
maxSize: r = 10,
|
|
1471
1471
|
maxFiles: l = 5,
|
|
1472
|
-
disabled:
|
|
1472
|
+
disabled: f = !1,
|
|
1473
1473
|
label: d,
|
|
1474
1474
|
required: s = !1,
|
|
1475
1475
|
error: c,
|
|
1476
1476
|
className: C,
|
|
1477
1477
|
onFilesChange: k,
|
|
1478
|
-
onUpload:
|
|
1478
|
+
onUpload: D,
|
|
1479
1479
|
showPreview: M = !0,
|
|
1480
1480
|
locale: L = "uz",
|
|
1481
1481
|
showFileTypeIcon: F = !0,
|
|
1482
|
-
variant:
|
|
1482
|
+
variant: v = "yellow",
|
|
1483
1483
|
customValidator: m
|
|
1484
1484
|
}) => {
|
|
1485
|
-
const [u,
|
|
1485
|
+
const [u, b] = _([]), [w, p] = _(!1), [y, $] = _(!1), E = le(null), j = Lt[L], o = v === "blue" ? {
|
|
1486
1486
|
dropBorder: "border-blue-200 hover:border-blue-300",
|
|
1487
1487
|
dropBg: "bg-blue-50/40 hover:bg-blue-50/60",
|
|
1488
1488
|
dropActive: "border-blue-600 bg-blue-50",
|
|
@@ -1502,94 +1502,108 @@ const It = {
|
|
|
1502
1502
|
progressFill: "bg-yellow-600",
|
|
1503
1503
|
fileIconImg: "bg-blue-50 text-blue-600",
|
|
1504
1504
|
fileIconDoc: "bg-green-50 text-green-600"
|
|
1505
|
-
},
|
|
1506
|
-
switch (
|
|
1505
|
+
}, N = (g) => {
|
|
1506
|
+
switch (g.type.split("/")[0]) {
|
|
1507
1507
|
case "image":
|
|
1508
|
-
return /* @__PURE__ */ e(
|
|
1508
|
+
return /* @__PURE__ */ e(dt, { className: "h-5 w-5 text-blue-500" });
|
|
1509
1509
|
case "video":
|
|
1510
|
-
return /* @__PURE__ */ e(
|
|
1510
|
+
return /* @__PURE__ */ e(ct, { className: "h-5 w-5 text-purple-500" });
|
|
1511
1511
|
case "audio":
|
|
1512
|
-
return /* @__PURE__ */ e(
|
|
1512
|
+
return /* @__PURE__ */ e(it, { className: "h-5 w-5 text-green-500" });
|
|
1513
1513
|
default:
|
|
1514
|
-
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" });
|
|
1515
1515
|
}
|
|
1516
|
-
},
|
|
1517
|
-
if (
|
|
1518
|
-
const
|
|
1519
|
-
return parseFloat((
|
|
1520
|
-
},
|
|
1521
|
-
const
|
|
1522
|
-
return
|
|
1523
|
-
},
|
|
1524
|
-
if (
|
|
1525
|
-
const
|
|
1526
|
-
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);
|
|
1527
1527
|
}
|
|
1528
|
-
return
|
|
1529
|
-
}), B = (
|
|
1530
|
-
if (
|
|
1531
|
-
const
|
|
1532
|
-
|
|
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);
|
|
1533
1533
|
} else
|
|
1534
|
-
|
|
1535
|
-
}),
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
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));
|
|
1541
1555
|
break;
|
|
1542
1556
|
}
|
|
1543
|
-
if (!
|
|
1544
|
-
alert(
|
|
1557
|
+
if (!Y(U)) {
|
|
1558
|
+
alert(j.fileSizeError(U.name, r));
|
|
1545
1559
|
continue;
|
|
1546
1560
|
}
|
|
1547
|
-
if (!
|
|
1548
|
-
alert(
|
|
1561
|
+
if (!q(U)) {
|
|
1562
|
+
alert(j.fileTypeError(U.name));
|
|
1549
1563
|
continue;
|
|
1550
1564
|
}
|
|
1551
1565
|
if (m) {
|
|
1552
|
-
const
|
|
1553
|
-
if (
|
|
1554
|
-
alert(
|
|
1566
|
+
const xe = m(U);
|
|
1567
|
+
if (xe) {
|
|
1568
|
+
alert(xe);
|
|
1555
1569
|
continue;
|
|
1556
1570
|
}
|
|
1557
1571
|
}
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1572
|
+
const A = await B(U), X = D ? "uploading" : "success", me = D ? 0 : 100;
|
|
1573
|
+
O.push({
|
|
1560
1574
|
id: Math.random().toString(36).substr(2, 9),
|
|
1561
|
-
file:
|
|
1562
|
-
preview:
|
|
1563
|
-
progress:
|
|
1564
|
-
status:
|
|
1575
|
+
file: U,
|
|
1576
|
+
preview: A,
|
|
1577
|
+
progress: me,
|
|
1578
|
+
status: X
|
|
1565
1579
|
});
|
|
1566
1580
|
}
|
|
1567
|
-
if (
|
|
1568
|
-
const
|
|
1569
|
-
if (
|
|
1570
|
-
|
|
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);
|
|
1571
1585
|
try {
|
|
1572
|
-
const
|
|
1573
|
-
...
|
|
1574
|
-
progress: Math.min(100, (
|
|
1586
|
+
const A = U.map((X, me) => ({
|
|
1587
|
+
...X,
|
|
1588
|
+
progress: Math.min(100, (me + 1) / U.length * 100)
|
|
1575
1589
|
}));
|
|
1576
|
-
|
|
1577
|
-
(
|
|
1578
|
-
...
|
|
1590
|
+
b(A), await D(A), b(
|
|
1591
|
+
(X) => X.map((me) => ({
|
|
1592
|
+
...me,
|
|
1579
1593
|
status: "success",
|
|
1580
1594
|
progress: 100
|
|
1581
1595
|
}))
|
|
1582
1596
|
);
|
|
1583
|
-
} catch (
|
|
1584
|
-
|
|
1585
|
-
(
|
|
1586
|
-
...
|
|
1597
|
+
} catch (A) {
|
|
1598
|
+
b(
|
|
1599
|
+
(X) => X.map((me) => ({
|
|
1600
|
+
...me,
|
|
1587
1601
|
status: "error",
|
|
1588
|
-
error:
|
|
1602
|
+
error: A instanceof Error ? A.message : j.uploadFailed
|
|
1589
1603
|
}))
|
|
1590
1604
|
);
|
|
1591
1605
|
} finally {
|
|
1592
|
-
|
|
1606
|
+
$(!1);
|
|
1593
1607
|
}
|
|
1594
1608
|
}
|
|
1595
1609
|
}
|
|
@@ -1597,46 +1611,46 @@ const It = {
|
|
|
1597
1611
|
[
|
|
1598
1612
|
u,
|
|
1599
1613
|
l,
|
|
1600
|
-
|
|
1601
|
-
|
|
1614
|
+
Y,
|
|
1615
|
+
q,
|
|
1602
1616
|
m,
|
|
1603
|
-
|
|
1617
|
+
j,
|
|
1604
1618
|
r,
|
|
1605
1619
|
t,
|
|
1606
1620
|
k,
|
|
1607
|
-
|
|
1621
|
+
D
|
|
1608
1622
|
]
|
|
1609
|
-
),
|
|
1610
|
-
(
|
|
1611
|
-
|
|
1623
|
+
), ae = R(
|
|
1624
|
+
(g) => {
|
|
1625
|
+
g.preventDefault(), f || p(!0);
|
|
1612
1626
|
},
|
|
1613
|
-
[
|
|
1614
|
-
),
|
|
1615
|
-
|
|
1616
|
-
}, []),
|
|
1617
|
-
(
|
|
1618
|
-
if (
|
|
1619
|
-
const
|
|
1620
|
-
|
|
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);
|
|
1621
1635
|
},
|
|
1622
|
-
[
|
|
1623
|
-
),
|
|
1624
|
-
(
|
|
1625
|
-
const
|
|
1626
|
-
|
|
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 = ""));
|
|
1627
1641
|
},
|
|
1628
|
-
[
|
|
1629
|
-
),
|
|
1630
|
-
(
|
|
1631
|
-
g((
|
|
1632
|
-
const
|
|
1633
|
-
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;
|
|
1634
1648
|
});
|
|
1635
1649
|
},
|
|
1636
|
-
[k]
|
|
1637
|
-
),
|
|
1638
|
-
|
|
1639
|
-
}, [k]),
|
|
1650
|
+
[k, W]
|
|
1651
|
+
), G = R(() => {
|
|
1652
|
+
Q(), b([]), k?.([]);
|
|
1653
|
+
}, [k, Q]), oe = R(() => {
|
|
1640
1654
|
E.current?.click();
|
|
1641
1655
|
}, []);
|
|
1642
1656
|
return /* @__PURE__ */ i("div", { className: n("w-full", C), children: [
|
|
@@ -1660,14 +1674,14 @@ const It = {
|
|
|
1660
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",
|
|
1661
1675
|
o.dropBorder,
|
|
1662
1676
|
o.dropBg,
|
|
1663
|
-
|
|
1664
|
-
|
|
1677
|
+
w && o.dropActive,
|
|
1678
|
+
f && "cursor-not-allowed opacity-60",
|
|
1665
1679
|
c && "border-red-600 bg-red-50/30"
|
|
1666
1680
|
),
|
|
1667
|
-
onDragOver:
|
|
1668
|
-
onDragLeave:
|
|
1669
|
-
onDrop:
|
|
1670
|
-
onClick:
|
|
1681
|
+
onDragOver: ae,
|
|
1682
|
+
onDragLeave: ce,
|
|
1683
|
+
onDrop: ee,
|
|
1684
|
+
onClick: oe,
|
|
1671
1685
|
children: [
|
|
1672
1686
|
/* @__PURE__ */ e(
|
|
1673
1687
|
"input",
|
|
@@ -1676,15 +1690,15 @@ const It = {
|
|
|
1676
1690
|
type: "file",
|
|
1677
1691
|
multiple: t,
|
|
1678
1692
|
accept: a,
|
|
1679
|
-
onChange:
|
|
1680
|
-
disabled:
|
|
1693
|
+
onChange: de,
|
|
1694
|
+
disabled: f,
|
|
1681
1695
|
className: "hidden"
|
|
1682
1696
|
}
|
|
1683
1697
|
),
|
|
1684
1698
|
/* @__PURE__ */ i("div", { className: "flex flex-col items-center gap-3", children: [
|
|
1685
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 }) }),
|
|
1686
|
-
/* @__PURE__ */ e("p", { className: n("text-base font-medium", o.title), children:
|
|
1687
|
-
/* @__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) })
|
|
1688
1702
|
] })
|
|
1689
1703
|
]
|
|
1690
1704
|
}
|
|
@@ -1692,7 +1706,7 @@ const It = {
|
|
|
1692
1706
|
u.length > 0 && /* @__PURE__ */ i("div", { className: "mt-4 space-y-3", children: [
|
|
1693
1707
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1694
1708
|
/* @__PURE__ */ i("span", { className: "text-sm font-medium text-slate-700", children: [
|
|
1695
|
-
|
|
1709
|
+
j.selectedFiles,
|
|
1696
1710
|
" (",
|
|
1697
1711
|
u.length,
|
|
1698
1712
|
")"
|
|
@@ -1701,56 +1715,68 @@ const It = {
|
|
|
1701
1715
|
"button",
|
|
1702
1716
|
{
|
|
1703
1717
|
type: "button",
|
|
1704
|
-
onClick:
|
|
1705
|
-
disabled:
|
|
1718
|
+
onClick: G,
|
|
1719
|
+
disabled: f || y,
|
|
1706
1720
|
className: "text-sm font-medium text-red-600 disabled:opacity-50",
|
|
1707
|
-
children:
|
|
1721
|
+
children: j.clearAll
|
|
1708
1722
|
}
|
|
1709
1723
|
)
|
|
1710
1724
|
] }),
|
|
1711
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children: u.map((
|
|
1712
|
-
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";
|
|
1713
1727
|
return /* @__PURE__ */ i(
|
|
1714
1728
|
"div",
|
|
1715
1729
|
{
|
|
1716
1730
|
className: n(
|
|
1717
1731
|
"flex items-center justify-between rounded-2xl border border-slate-200 p-4",
|
|
1718
|
-
|
|
1732
|
+
g.status === "error" && "border-red-600"
|
|
1719
1733
|
),
|
|
1720
1734
|
children: [
|
|
1721
1735
|
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-center gap-4", children: [
|
|
1722
|
-
/* @__PURE__ */ e(
|
|
1723
|
-
"
|
|
1736
|
+
/* @__PURE__ */ e(
|
|
1737
|
+
"div",
|
|
1724
1738
|
{
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
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" })
|
|
1728
1751
|
}
|
|
1729
|
-
)
|
|
1752
|
+
),
|
|
1730
1753
|
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
1731
|
-
/* @__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 }),
|
|
1732
1755
|
/* @__PURE__ */ i("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-sm text-slate-500", children: [
|
|
1733
|
-
/* @__PURE__ */ e("span", { children:
|
|
1734
|
-
|
|
1756
|
+
/* @__PURE__ */ e("span", { children: T(g.file.size) }),
|
|
1757
|
+
g.status === "uploading" && /* @__PURE__ */ i(he, { children: [
|
|
1735
1758
|
/* @__PURE__ */ e("span", { children: "•" }),
|
|
1736
1759
|
/* @__PURE__ */ i("span", { className: "inline-flex items-center", children: [
|
|
1737
|
-
/* @__PURE__ */ e(
|
|
1738
|
-
|
|
1760
|
+
/* @__PURE__ */ e(We, { className: "mr-1 h-5 w-5 animate-spin" }),
|
|
1761
|
+
j.uploading
|
|
1739
1762
|
] })
|
|
1740
1763
|
] }),
|
|
1741
|
-
|
|
1764
|
+
g.status === "success" && /* @__PURE__ */ i(he, { children: [
|
|
1742
1765
|
/* @__PURE__ */ e("span", { children: "•" }),
|
|
1743
|
-
/* @__PURE__ */ e("span", { className: "font-normal text-green-600", children:
|
|
1766
|
+
/* @__PURE__ */ e("span", { className: "font-normal text-green-600", children: j.success })
|
|
1744
1767
|
] })
|
|
1745
1768
|
] }),
|
|
1746
|
-
|
|
1769
|
+
g.status === "uploading" && /* @__PURE__ */ e("div", { className: n("mt-2 h-1.5 w-full rounded-full bg-slate-200"), children: /* @__PURE__ */ e(
|
|
1747
1770
|
"div",
|
|
1748
1771
|
{
|
|
1749
|
-
className: n(
|
|
1750
|
-
|
|
1772
|
+
className: n(
|
|
1773
|
+
"h-1.5 rounded-full transition-all duration-300",
|
|
1774
|
+
o.progressFill
|
|
1775
|
+
),
|
|
1776
|
+
style: { width: `${g.progress}%` }
|
|
1751
1777
|
}
|
|
1752
1778
|
) }),
|
|
1753
|
-
|
|
1779
|
+
g.status === "error" && g.error && /* @__PURE__ */ e("p", { className: "mt-2 text-sm font-normal text-red-600", children: g.error })
|
|
1754
1780
|
] })
|
|
1755
1781
|
] }),
|
|
1756
1782
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1758,68 +1784,61 @@ const It = {
|
|
|
1758
1784
|
"button",
|
|
1759
1785
|
{
|
|
1760
1786
|
type: "button",
|
|
1761
|
-
onClick: (
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
"button",
|
|
1769
|
-
{
|
|
1770
|
-
type: "button",
|
|
1771
|
-
onClick: (T) => T.stopPropagation(),
|
|
1772
|
-
className: "rounded-xl p-2 hover:bg-slate-100 hover:cursor-pointer",
|
|
1773
|
-
title: I.download,
|
|
1774
|
-
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" })
|
|
1775
1794
|
}
|
|
1776
1795
|
),
|
|
1777
1796
|
/* @__PURE__ */ e(
|
|
1778
1797
|
"button",
|
|
1779
1798
|
{
|
|
1780
1799
|
type: "button",
|
|
1781
|
-
onClick: (
|
|
1782
|
-
|
|
1800
|
+
onClick: (A) => {
|
|
1801
|
+
A.stopPropagation(), z(g.id);
|
|
1783
1802
|
},
|
|
1784
|
-
disabled:
|
|
1803
|
+
disabled: f || y,
|
|
1785
1804
|
className: "rounded-xl p-2 text-slate-base hover:bg-slate-100 disabled:opacity-50 hover:cursor-pointer",
|
|
1786
|
-
title:
|
|
1787
|
-
children: /* @__PURE__ */ e(
|
|
1805
|
+
title: j.remove,
|
|
1806
|
+
children: /* @__PURE__ */ e(pe, { className: "h-6 w-6" })
|
|
1788
1807
|
}
|
|
1789
1808
|
)
|
|
1790
1809
|
] })
|
|
1791
1810
|
]
|
|
1792
1811
|
},
|
|
1793
|
-
|
|
1812
|
+
g.id
|
|
1794
1813
|
);
|
|
1795
1814
|
}) })
|
|
1796
1815
|
] }),
|
|
1797
1816
|
c && /* @__PURE__ */ e("p", { className: "mt-2 text-sm font-normal text-red-600", children: c })
|
|
1798
1817
|
] });
|
|
1799
1818
|
};
|
|
1800
|
-
function
|
|
1819
|
+
function er({
|
|
1801
1820
|
show: t,
|
|
1802
1821
|
setShow: a,
|
|
1803
1822
|
title: r,
|
|
1804
1823
|
description: l,
|
|
1805
|
-
Header:
|
|
1824
|
+
Header: f,
|
|
1806
1825
|
Body: d,
|
|
1807
1826
|
footer: s,
|
|
1808
1827
|
handleClickOutside: c = !1,
|
|
1809
1828
|
showCloseIcon: C = !0,
|
|
1810
1829
|
showHeader: k = !0,
|
|
1811
|
-
overlayClassName:
|
|
1830
|
+
overlayClassName: D,
|
|
1812
1831
|
containerClassName: M,
|
|
1813
1832
|
bodyClassName: L,
|
|
1814
1833
|
footerClassName: F
|
|
1815
1834
|
}) {
|
|
1816
|
-
const
|
|
1835
|
+
const v = le(null), { handleEscape: m } = Ee(() => a(!1));
|
|
1817
1836
|
J(() => (t ? (document.addEventListener("keydown", m), document.body.style.overflow = "hidden") : document.body.style.overflow = "unset", () => document.removeEventListener("keydown", m)), [t, m]);
|
|
1818
|
-
const { handleClick: u } =
|
|
1837
|
+
const { handleClick: u } = De(v, () => {
|
|
1819
1838
|
c && a(!1);
|
|
1820
1839
|
});
|
|
1821
1840
|
J(() => (t && c && document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u)), [t, u, c]);
|
|
1822
|
-
const
|
|
1841
|
+
const w = k && !!(f || r || l);
|
|
1823
1842
|
return /* @__PURE__ */ e(
|
|
1824
1843
|
"div",
|
|
1825
1844
|
{
|
|
@@ -1827,12 +1846,12 @@ function tr({
|
|
|
1827
1846
|
"bg-black/40 fixed inset-0 z-50 flex justify-center transition-all duration-500 ease-in-out",
|
|
1828
1847
|
"items-end sm:items-center",
|
|
1829
1848
|
t ? "opacity-100" : "pointer-events-none opacity-0",
|
|
1830
|
-
|
|
1849
|
+
D
|
|
1831
1850
|
),
|
|
1832
1851
|
children: /* @__PURE__ */ i(
|
|
1833
1852
|
"div",
|
|
1834
1853
|
{
|
|
1835
|
-
ref:
|
|
1854
|
+
ref: v,
|
|
1836
1855
|
className: n(
|
|
1837
1856
|
"relative bg-white w-full",
|
|
1838
1857
|
"sm:max-w-[720px]",
|
|
@@ -1842,8 +1861,8 @@ function tr({
|
|
|
1842
1861
|
M
|
|
1843
1862
|
),
|
|
1844
1863
|
children: [
|
|
1845
|
-
|
|
1846
|
-
|
|
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: [
|
|
1847
1866
|
/* @__PURE__ */ e("h2", { className: "text-h3 font-semibold text-black", children: r }),
|
|
1848
1867
|
l && /* @__PURE__ */ e("p", { className: "text-base text-slate-base font-normal mt-2", children: l })
|
|
1849
1868
|
] }),
|
|
@@ -1854,7 +1873,7 @@ function tr({
|
|
|
1854
1873
|
className: "bg-slate-100 rounded-xl w-12 h-12 hover:cursor-pointer text-black transition flex items-center justify-center group",
|
|
1855
1874
|
"aria-label": "Close modal",
|
|
1856
1875
|
type: "button",
|
|
1857
|
-
children: /* @__PURE__ */ e(
|
|
1876
|
+
children: /* @__PURE__ */ e(pe, { className: "h-6 w-6 transition-transform duration-300 group-hover:rotate-180" })
|
|
1858
1877
|
}
|
|
1859
1878
|
)
|
|
1860
1879
|
] }),
|
|
@@ -1887,33 +1906,33 @@ function tr({
|
|
|
1887
1906
|
}
|
|
1888
1907
|
);
|
|
1889
1908
|
}
|
|
1890
|
-
function
|
|
1909
|
+
function tr({
|
|
1891
1910
|
totalItems: t,
|
|
1892
1911
|
currentPage: a,
|
|
1893
1912
|
perPage: r,
|
|
1894
1913
|
onPageChange: l,
|
|
1895
|
-
onPerPageChange:
|
|
1914
|
+
onPerPageChange: f,
|
|
1896
1915
|
siblingCount: d = 1,
|
|
1897
1916
|
perPageOptions: s = [10, 30, 50, 100],
|
|
1898
1917
|
showPerPage: c = !0,
|
|
1899
1918
|
variant: C = "yellow",
|
|
1900
1919
|
size: k = "large",
|
|
1901
|
-
paginationClassName:
|
|
1920
|
+
paginationClassName: D
|
|
1902
1921
|
}) {
|
|
1903
|
-
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),
|
|
1904
|
-
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;
|
|
1905
1924
|
const u = (() => {
|
|
1906
|
-
const
|
|
1907
|
-
if (
|
|
1908
|
-
return Array.from({ length:
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
for (let
|
|
1912
|
-
return E <
|
|
1913
|
-
})(),
|
|
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 = {
|
|
1914
1933
|
medium: "h-9 text-sm",
|
|
1915
1934
|
large: "h-10 text-base"
|
|
1916
|
-
}[k],
|
|
1935
|
+
}[k], w = {
|
|
1917
1936
|
yellow: {
|
|
1918
1937
|
active: "bg-yellow-500 text-white border-yellow-500",
|
|
1919
1938
|
inactive: "bg-slate-100 border-slate-200 text-black hover:bg-slate-200",
|
|
@@ -1929,9 +1948,9 @@ function rr({
|
|
|
1929
1948
|
}[C ?? "yellow"];
|
|
1930
1949
|
return /* @__PURE__ */ i("div", { className: n(
|
|
1931
1950
|
"flex items-center justify-between gap-4 w-full",
|
|
1932
|
-
|
|
1951
|
+
D
|
|
1933
1952
|
), children: [
|
|
1934
|
-
c &&
|
|
1953
|
+
c && f && /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1935
1954
|
/* @__PURE__ */ e(
|
|
1936
1955
|
"span",
|
|
1937
1956
|
{
|
|
@@ -1944,17 +1963,17 @@ function rr({
|
|
|
1944
1963
|
"select",
|
|
1945
1964
|
{
|
|
1946
1965
|
value: L,
|
|
1947
|
-
onChange: (
|
|
1966
|
+
onChange: (p) => f(Number(p.target.value)),
|
|
1948
1967
|
className: n(
|
|
1949
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",
|
|
1950
1969
|
k === "large" ? "h-10" : "h-9"
|
|
1951
1970
|
),
|
|
1952
1971
|
"aria-label": "Количество строк на странице",
|
|
1953
|
-
children: s.map((
|
|
1972
|
+
children: s.map((p) => /* @__PURE__ */ e("option", { value: p, children: p }, p))
|
|
1954
1973
|
}
|
|
1955
1974
|
),
|
|
1956
1975
|
/* @__PURE__ */ e(
|
|
1957
|
-
|
|
1976
|
+
Fe,
|
|
1958
1977
|
{
|
|
1959
1978
|
className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400",
|
|
1960
1979
|
weight: "Linear",
|
|
@@ -1972,58 +1991,58 @@ function rr({
|
|
|
1972
1991
|
"aria-label": "Предыдущая страница",
|
|
1973
1992
|
className: n(
|
|
1974
1993
|
"flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
|
|
1975
|
-
|
|
1976
|
-
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")
|
|
1977
1996
|
),
|
|
1978
|
-
children: /* @__PURE__ */ e(
|
|
1997
|
+
children: /* @__PURE__ */ e(ke, { weight: "Linear", size: 20 })
|
|
1979
1998
|
}
|
|
1980
1999
|
),
|
|
1981
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: u.map((
|
|
1982
|
-
if (
|
|
2000
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: u.map((p, y) => {
|
|
2001
|
+
if (p === "...")
|
|
1983
2002
|
return /* @__PURE__ */ e(
|
|
1984
2003
|
"span",
|
|
1985
2004
|
{
|
|
1986
|
-
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),
|
|
1987
2006
|
"aria-hidden": "true",
|
|
1988
|
-
children: /* @__PURE__ */ e(
|
|
2007
|
+
children: /* @__PURE__ */ e(ut, { weight: "Bold", size: 20 })
|
|
1989
2008
|
},
|
|
1990
|
-
|
|
2009
|
+
y
|
|
1991
2010
|
);
|
|
1992
|
-
const
|
|
2011
|
+
const $ = p === F;
|
|
1993
2012
|
return /* @__PURE__ */ e(
|
|
1994
2013
|
"button",
|
|
1995
2014
|
{
|
|
1996
|
-
onClick: () => l(
|
|
1997
|
-
"aria-label": `Страница ${
|
|
1998
|
-
"aria-current":
|
|
2015
|
+
onClick: () => l(p),
|
|
2016
|
+
"aria-label": `Страница ${p}${$ ? ", текущая" : ""}`,
|
|
2017
|
+
"aria-current": $ ? "page" : void 0,
|
|
1999
2018
|
className: n(
|
|
2000
2019
|
"flex items-center justify-center rounded-lg border font-medium transition-all hover:cursor-pointer min-w-10 px-2",
|
|
2001
|
-
|
|
2002
|
-
|
|
2020
|
+
b,
|
|
2021
|
+
$ ? w.active : w.inactive
|
|
2003
2022
|
),
|
|
2004
|
-
children:
|
|
2023
|
+
children: p
|
|
2005
2024
|
},
|
|
2006
|
-
|
|
2025
|
+
y
|
|
2007
2026
|
);
|
|
2008
2027
|
}) }),
|
|
2009
2028
|
/* @__PURE__ */ e(
|
|
2010
2029
|
"button",
|
|
2011
2030
|
{
|
|
2012
2031
|
onClick: () => l(F + 1),
|
|
2013
|
-
disabled: F ===
|
|
2032
|
+
disabled: F === v,
|
|
2014
2033
|
"aria-label": "Следующая страница",
|
|
2015
2034
|
className: n(
|
|
2016
2035
|
"flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
|
|
2017
|
-
|
|
2018
|
-
F ===
|
|
2036
|
+
b,
|
|
2037
|
+
F === v ? n("cursor-not-allowed opacity-50", w.disabled) : n("hover:cursor-pointer", w.arrow, "border-slate-200")
|
|
2019
2038
|
),
|
|
2020
|
-
children: /* @__PURE__ */ e(
|
|
2039
|
+
children: /* @__PURE__ */ e(be, { size: 20, weight: "Linear" })
|
|
2021
2040
|
}
|
|
2022
2041
|
)
|
|
2023
2042
|
] })
|
|
2024
2043
|
] });
|
|
2025
2044
|
}
|
|
2026
|
-
function
|
|
2045
|
+
function $e({
|
|
2027
2046
|
className: t,
|
|
2028
2047
|
variant: a = "default",
|
|
2029
2048
|
width: r = "100%",
|
|
@@ -2047,26 +2066,26 @@ function Te({
|
|
|
2047
2066
|
}
|
|
2048
2067
|
);
|
|
2049
2068
|
}
|
|
2050
|
-
function
|
|
2069
|
+
function rr({
|
|
2051
2070
|
tabs: t,
|
|
2052
2071
|
defaultTab: a,
|
|
2053
2072
|
position: r = "top",
|
|
2054
2073
|
className: l,
|
|
2055
|
-
tabListClassName:
|
|
2074
|
+
tabListClassName: f,
|
|
2056
2075
|
contentClassName: d,
|
|
2057
2076
|
extra: s,
|
|
2058
2077
|
onChange: c
|
|
2059
2078
|
}) {
|
|
2060
|
-
const [C, k] =
|
|
2079
|
+
const [C, k] = _(a || t[0]?.id), [D, M] = _({}), L = le([]), F = () => {
|
|
2061
2080
|
requestAnimationFrame(() => {
|
|
2062
|
-
const
|
|
2063
|
-
if (
|
|
2064
|
-
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;
|
|
2065
2084
|
M({
|
|
2066
|
-
left: `${
|
|
2067
|
-
top: `${
|
|
2085
|
+
left: `${y}px`,
|
|
2086
|
+
top: `${$}px`,
|
|
2068
2087
|
width: `${E}px`,
|
|
2069
|
-
height: `${
|
|
2088
|
+
height: `${j}px`,
|
|
2070
2089
|
transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
|
|
2071
2090
|
});
|
|
2072
2091
|
}
|
|
@@ -2075,7 +2094,7 @@ function nr({
|
|
|
2075
2094
|
J(() => (F(), window.addEventListener("resize", F), "fonts" in document && document.fonts.ready.then(F), () => window.removeEventListener("resize", F)), [C, r, t]), J(() => {
|
|
2076
2095
|
L.current = L.current.slice(0, t.length);
|
|
2077
2096
|
}, [t]);
|
|
2078
|
-
const
|
|
2097
|
+
const v = r === "left" || r === "right", m = {
|
|
2079
2098
|
top: "flex-col",
|
|
2080
2099
|
bottom: "flex-col-reverse",
|
|
2081
2100
|
left: "flex-row",
|
|
@@ -2085,7 +2104,7 @@ function nr({
|
|
|
2085
2104
|
bottom: "flex-row",
|
|
2086
2105
|
left: "flex-col",
|
|
2087
2106
|
right: "flex-col"
|
|
2088
|
-
},
|
|
2107
|
+
}, b = {
|
|
2089
2108
|
top: "mt-4",
|
|
2090
2109
|
bottom: "mb-4",
|
|
2091
2110
|
left: "ml-4",
|
|
@@ -2097,7 +2116,7 @@ function nr({
|
|
|
2097
2116
|
{
|
|
2098
2117
|
className: n(
|
|
2099
2118
|
"flex w-full gap-4",
|
|
2100
|
-
|
|
2119
|
+
v ? "flex-col items-start" : "flex-row flex-wrap items-center"
|
|
2101
2120
|
),
|
|
2102
2121
|
children: [
|
|
2103
2122
|
/* @__PURE__ */ e(
|
|
@@ -2105,7 +2124,7 @@ function nr({
|
|
|
2105
2124
|
{
|
|
2106
2125
|
className: n(
|
|
2107
2126
|
"flex-1",
|
|
2108
|
-
|
|
2127
|
+
v ? "w-full" : "min-w-[520px]"
|
|
2109
2128
|
),
|
|
2110
2129
|
children: /* @__PURE__ */ i(
|
|
2111
2130
|
"div",
|
|
@@ -2113,41 +2132,41 @@ function nr({
|
|
|
2113
2132
|
className: n(
|
|
2114
2133
|
"relative flex rounded-xl bg-slate-100 p-1",
|
|
2115
2134
|
u[r],
|
|
2116
|
-
!
|
|
2117
|
-
|
|
2118
|
-
|
|
2135
|
+
!v && "w-full overflow-hidden",
|
|
2136
|
+
v ? "min-w-48" : "",
|
|
2137
|
+
f
|
|
2119
2138
|
),
|
|
2120
2139
|
children: [
|
|
2121
2140
|
/* @__PURE__ */ e(
|
|
2122
2141
|
"div",
|
|
2123
2142
|
{
|
|
2124
|
-
className: n("absolute rounded-lg bg-white",
|
|
2125
|
-
style:
|
|
2143
|
+
className: n("absolute rounded-lg bg-white", v ? "w-full" : "h-full"),
|
|
2144
|
+
style: D
|
|
2126
2145
|
}
|
|
2127
2146
|
),
|
|
2128
|
-
t?.map((
|
|
2129
|
-
const
|
|
2147
|
+
t?.map((w, p) => {
|
|
2148
|
+
const y = C === w.id;
|
|
2130
2149
|
return /* @__PURE__ */ i(
|
|
2131
2150
|
"button",
|
|
2132
2151
|
{
|
|
2133
|
-
ref: (
|
|
2134
|
-
L.current[
|
|
2152
|
+
ref: ($) => {
|
|
2153
|
+
L.current[p] = $;
|
|
2135
2154
|
},
|
|
2136
2155
|
onClick: () => {
|
|
2137
|
-
|
|
2156
|
+
w?.disabled || (k(w?.id), c?.(w?.id));
|
|
2138
2157
|
},
|
|
2139
|
-
disabled:
|
|
2158
|
+
disabled: w?.disabled,
|
|
2140
2159
|
className: n(
|
|
2141
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",
|
|
2142
|
-
|
|
2143
|
-
|
|
2161
|
+
w?.disabled && "cursor-not-allowed opacity-50",
|
|
2162
|
+
v ? "w-full justify-start" : "flex-1 min-w-0"
|
|
2144
2163
|
),
|
|
2145
2164
|
children: [
|
|
2146
|
-
|
|
2147
|
-
/* @__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 })
|
|
2148
2167
|
]
|
|
2149
2168
|
},
|
|
2150
|
-
|
|
2169
|
+
w?.id
|
|
2151
2170
|
);
|
|
2152
2171
|
})
|
|
2153
2172
|
]
|
|
@@ -2160,7 +2179,7 @@ function nr({
|
|
|
2160
2179
|
{
|
|
2161
2180
|
className: n(
|
|
2162
2181
|
"shrink-0 ml-auto",
|
|
2163
|
-
|
|
2182
|
+
v ? "w-full" : "max-w-full"
|
|
2164
2183
|
),
|
|
2165
2184
|
children: /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center justify-end gap-2", children: s })
|
|
2166
2185
|
}
|
|
@@ -2168,30 +2187,30 @@ function nr({
|
|
|
2168
2187
|
]
|
|
2169
2188
|
}
|
|
2170
2189
|
),
|
|
2171
|
-
/* @__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) })
|
|
2172
2191
|
] });
|
|
2173
2192
|
}
|
|
2174
2193
|
const jt = {
|
|
2175
2194
|
sm: "px-2 py-0.5",
|
|
2176
2195
|
md: "px-2 py-1",
|
|
2177
2196
|
lg: "px-3 py-2"
|
|
2178
|
-
},
|
|
2197
|
+
}, Be = {
|
|
2179
2198
|
sm: "w-3 h-3",
|
|
2180
2199
|
md: "w-3 h-3",
|
|
2181
2200
|
lg: "w-3 h-3"
|
|
2182
|
-
},
|
|
2201
|
+
}, It = {
|
|
2183
2202
|
success: "bg-green-50 text-green-600",
|
|
2184
2203
|
warning: "bg-orange-50 text-orange-600",
|
|
2185
2204
|
error: "bg-red-50 text-red-600",
|
|
2186
2205
|
gray: "bg-slate-200 text-slate-700",
|
|
2187
2206
|
blue: "bg-blue-50 text-blue-600"
|
|
2188
2207
|
};
|
|
2189
|
-
function
|
|
2208
|
+
function nr({
|
|
2190
2209
|
children: t,
|
|
2191
2210
|
variant: a = "success",
|
|
2192
2211
|
size: r = "lg",
|
|
2193
2212
|
icon: l,
|
|
2194
|
-
iconPosition:
|
|
2213
|
+
iconPosition: f = "left",
|
|
2195
2214
|
className: d
|
|
2196
2215
|
}) {
|
|
2197
2216
|
return /* @__PURE__ */ i(
|
|
@@ -2200,32 +2219,32 @@ function lr({
|
|
|
2200
2219
|
className: n(
|
|
2201
2220
|
"inline-flex animate-[fadeIn_0.3s_ease-out] items-center rounded-lg text-extra-small font-medium",
|
|
2202
2221
|
jt[r],
|
|
2203
|
-
|
|
2222
|
+
It[a],
|
|
2204
2223
|
l && "gap-[2px]",
|
|
2205
2224
|
d
|
|
2206
2225
|
),
|
|
2207
2226
|
children: [
|
|
2208
|
-
l &&
|
|
2227
|
+
l && f === "left" && /* @__PURE__ */ e("span", { className: `flex items-center ${n(Be[r])}`, children: l }),
|
|
2209
2228
|
/* @__PURE__ */ e("span", { children: t }),
|
|
2210
|
-
l &&
|
|
2229
|
+
l && f === "right" && /* @__PURE__ */ e("span", { className: `flex items-center ${n(Be[r])}`, children: l })
|
|
2211
2230
|
]
|
|
2212
2231
|
}
|
|
2213
2232
|
);
|
|
2214
2233
|
}
|
|
2215
|
-
const
|
|
2234
|
+
const Rt = fe(
|
|
2216
2235
|
({
|
|
2217
2236
|
label: t,
|
|
2218
2237
|
placeholder: a,
|
|
2219
2238
|
value: r = "",
|
|
2220
2239
|
onChange: l,
|
|
2221
|
-
required:
|
|
2240
|
+
required: f = !1,
|
|
2222
2241
|
disabled: d = !1,
|
|
2223
2242
|
error: s,
|
|
2224
2243
|
className: c,
|
|
2225
2244
|
rows: C = 4,
|
|
2226
2245
|
name: k
|
|
2227
|
-
},
|
|
2228
|
-
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]);
|
|
2229
2248
|
return /* @__PURE__ */ i("div", { className: n("relative w-full", c), children: [
|
|
2230
2249
|
t && /* @__PURE__ */ i(
|
|
2231
2250
|
"label",
|
|
@@ -2236,14 +2255,14 @@ const $t = he(
|
|
|
2236
2255
|
),
|
|
2237
2256
|
children: [
|
|
2238
2257
|
t,
|
|
2239
|
-
|
|
2258
|
+
f && /* @__PURE__ */ e("span", { className: "ml-1 text-red-600", children: "*" })
|
|
2240
2259
|
]
|
|
2241
2260
|
}
|
|
2242
2261
|
),
|
|
2243
2262
|
/* @__PURE__ */ e(
|
|
2244
2263
|
"textarea",
|
|
2245
2264
|
{
|
|
2246
|
-
ref:
|
|
2265
|
+
ref: D,
|
|
2247
2266
|
name: k,
|
|
2248
2267
|
rows: C,
|
|
2249
2268
|
value: r,
|
|
@@ -2261,15 +2280,15 @@ const $t = he(
|
|
|
2261
2280
|
] });
|
|
2262
2281
|
}
|
|
2263
2282
|
);
|
|
2264
|
-
|
|
2265
|
-
const
|
|
2283
|
+
Rt.displayName = "MciTextarea";
|
|
2284
|
+
const Tt = (() => {
|
|
2266
2285
|
let t = document.getElementById("mci-toast-container");
|
|
2267
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;
|
|
2268
2287
|
})();
|
|
2269
|
-
let
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2272
|
-
/* @__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)) })
|
|
2273
2292
|
);
|
|
2274
2293
|
};
|
|
2275
2294
|
function Bt({
|
|
@@ -2277,29 +2296,29 @@ function Bt({
|
|
|
2277
2296
|
description: a,
|
|
2278
2297
|
type: r = "info",
|
|
2279
2298
|
duration: l = 3e3,
|
|
2280
|
-
action:
|
|
2299
|
+
action: f,
|
|
2281
2300
|
onClose: d
|
|
2282
2301
|
}) {
|
|
2283
|
-
const [s, c] =
|
|
2302
|
+
const [s, c] = _(100);
|
|
2284
2303
|
J(() => {
|
|
2285
2304
|
if (l === 1 / 0) {
|
|
2286
2305
|
c(100);
|
|
2287
2306
|
return;
|
|
2288
2307
|
}
|
|
2289
|
-
let
|
|
2308
|
+
let D = null;
|
|
2290
2309
|
const M = (F) => {
|
|
2291
|
-
|
|
2292
|
-
const
|
|
2310
|
+
D || (D = F);
|
|
2311
|
+
const v = F - D, m = Math.max(0, (l - v) / l * 100);
|
|
2293
2312
|
c(m), m > 0 ? requestAnimationFrame(M) : d?.();
|
|
2294
2313
|
}, L = requestAnimationFrame(M);
|
|
2295
2314
|
return () => cancelAnimationFrame(L);
|
|
2296
2315
|
}, [l, d]);
|
|
2297
2316
|
const C = {
|
|
2298
|
-
success: /* @__PURE__ */ e(
|
|
2299
|
-
error: /* @__PURE__ */ e(
|
|
2300
|
-
warning: /* @__PURE__ */ e(
|
|
2301
|
-
info: /* @__PURE__ */ e(
|
|
2302
|
-
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" })
|
|
2303
2322
|
}, k = {
|
|
2304
2323
|
bg: {
|
|
2305
2324
|
success: "bg-green-50",
|
|
@@ -2354,14 +2373,14 @@ function Bt({
|
|
|
2354
2373
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
2355
2374
|
/* @__PURE__ */ e("h4", { className: "text-base font-medium mb-1", children: t }),
|
|
2356
2375
|
a && /* @__PURE__ */ e("p", { className: "text-sm text-[#82828C]", children: a }),
|
|
2357
|
-
|
|
2376
|
+
f && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e("div", { className: n("underline font-medium text-sm", k.action[r]), children: f }) })
|
|
2358
2377
|
] }),
|
|
2359
2378
|
/* @__PURE__ */ e(
|
|
2360
2379
|
"button",
|
|
2361
2380
|
{
|
|
2362
2381
|
onClick: d,
|
|
2363
2382
|
className: "flex-shrink-0 rounded-full transition cursor-pointer active:animate-spin",
|
|
2364
|
-
children: /* @__PURE__ */ e(
|
|
2383
|
+
children: /* @__PURE__ */ e(pe, { className: "w-6 h-6 text-slate-base" })
|
|
2365
2384
|
}
|
|
2366
2385
|
)
|
|
2367
2386
|
] }) })
|
|
@@ -2369,42 +2388,42 @@ function Bt({
|
|
|
2369
2388
|
}
|
|
2370
2389
|
);
|
|
2371
2390
|
}
|
|
2372
|
-
const
|
|
2373
|
-
const a =
|
|
2374
|
-
const
|
|
2375
|
-
|
|
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());
|
|
2376
2395
|
}, l = /* @__PURE__ */ e(Bt, { ...t, onClose: r });
|
|
2377
|
-
return
|
|
2378
|
-
},
|
|
2379
|
-
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 } : {
|
|
2380
2399
|
...t,
|
|
2381
2400
|
type: "success"
|
|
2382
2401
|
}),
|
|
2383
|
-
error: (t, a, r) =>
|
|
2402
|
+
error: (t, a, r) => ge(typeof t == "string" ? { title: t, description: a, type: "error", action: r } : {
|
|
2384
2403
|
...t,
|
|
2385
2404
|
type: "error"
|
|
2386
2405
|
}),
|
|
2387
|
-
warning: (t, a, r) =>
|
|
2406
|
+
warning: (t, a, r) => ge(typeof t == "string" ? { title: t, description: a, type: "warning", action: r } : {
|
|
2388
2407
|
...t,
|
|
2389
2408
|
type: "warning"
|
|
2390
2409
|
}),
|
|
2391
|
-
info: (t, a, r) =>
|
|
2410
|
+
info: (t, a, r) => ge(typeof t == "string" ? { title: t, description: a, type: "info", action: r } : {
|
|
2392
2411
|
...t,
|
|
2393
2412
|
type: "info"
|
|
2394
2413
|
}),
|
|
2395
|
-
loading: (t, a) =>
|
|
2414
|
+
loading: (t, a) => ge(typeof t == "string" ? {
|
|
2396
2415
|
title: t,
|
|
2397
2416
|
description: a,
|
|
2398
2417
|
type: "loading",
|
|
2399
2418
|
duration: 1 / 0
|
|
2400
2419
|
} : { ...t, type: "loading", duration: 1 / 0 })
|
|
2401
2420
|
};
|
|
2402
|
-
function
|
|
2421
|
+
function ar({
|
|
2403
2422
|
content: t,
|
|
2404
2423
|
children: a,
|
|
2405
2424
|
position: r = "top",
|
|
2406
2425
|
delay: l = 200,
|
|
2407
|
-
className:
|
|
2426
|
+
className: f
|
|
2408
2427
|
}) {
|
|
2409
2428
|
const d = {
|
|
2410
2429
|
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
@@ -2427,7 +2446,7 @@ function sr({
|
|
|
2427
2446
|
"scale-95 opacity-0 transition-all group-hover:scale-100 group-hover:opacity-100",
|
|
2428
2447
|
"duration-200 ease-out group-hover:delay-200",
|
|
2429
2448
|
d[r],
|
|
2430
|
-
|
|
2449
|
+
f
|
|
2431
2450
|
),
|
|
2432
2451
|
style: { transitionDelay: `${l}ms` },
|
|
2433
2452
|
children: [
|
|
@@ -2446,12 +2465,12 @@ function sr({
|
|
|
2446
2465
|
)
|
|
2447
2466
|
] });
|
|
2448
2467
|
}
|
|
2449
|
-
function
|
|
2468
|
+
function sr({
|
|
2450
2469
|
checked: t = !1,
|
|
2451
2470
|
onChange: a,
|
|
2452
2471
|
disabled: r = !1,
|
|
2453
2472
|
variant: l = "yellow",
|
|
2454
|
-
label:
|
|
2473
|
+
label: f,
|
|
2455
2474
|
supportText: d,
|
|
2456
2475
|
className: s
|
|
2457
2476
|
}) {
|
|
@@ -2501,14 +2520,14 @@ function or({
|
|
|
2501
2520
|
)
|
|
2502
2521
|
}
|
|
2503
2522
|
),
|
|
2504
|
-
(
|
|
2505
|
-
|
|
2523
|
+
(f || d) && /* @__PURE__ */ i("div", { className: "flex flex-col leading-tight", children: [
|
|
2524
|
+
f && /* @__PURE__ */ e(
|
|
2506
2525
|
"span",
|
|
2507
2526
|
{
|
|
2508
2527
|
className: n(
|
|
2509
2528
|
"text-base font-medium text-black"
|
|
2510
2529
|
),
|
|
2511
|
-
children:
|
|
2530
|
+
children: f
|
|
2512
2531
|
}
|
|
2513
2532
|
),
|
|
2514
2533
|
d && /* @__PURE__ */ e("span", { className: "text-sm font-normal text-slate-500", children: d })
|
|
@@ -2517,24 +2536,24 @@ function or({
|
|
|
2517
2536
|
}
|
|
2518
2537
|
);
|
|
2519
2538
|
}
|
|
2520
|
-
const
|
|
2521
|
-
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({
|
|
2522
2541
|
className: t,
|
|
2523
2542
|
size: a = 150,
|
|
2524
2543
|
iconClassName: r,
|
|
2525
2544
|
isLoading: l = !1,
|
|
2526
|
-
isFullPage:
|
|
2545
|
+
isFullPage: f = !0
|
|
2527
2546
|
}) {
|
|
2528
2547
|
return l ? /* @__PURE__ */ e(
|
|
2529
2548
|
"div",
|
|
2530
2549
|
{
|
|
2531
2550
|
className: n(
|
|
2532
2551
|
"z-[99px] flex flex-col items-center justify-center transition-all duration-300",
|
|
2533
|
-
|
|
2552
|
+
f ? "fixed inset-0 backdrop-blur-[2px]" : "absolute inset-0 w-full h-full rounded-[inherit]",
|
|
2534
2553
|
t
|
|
2535
2554
|
),
|
|
2536
2555
|
children: /* @__PURE__ */ e(
|
|
2537
|
-
|
|
2556
|
+
zt,
|
|
2538
2557
|
{
|
|
2539
2558
|
width: a,
|
|
2540
2559
|
height: a,
|
|
@@ -2549,40 +2568,40 @@ function ir({
|
|
|
2549
2568
|
}
|
|
2550
2569
|
) : null;
|
|
2551
2570
|
}
|
|
2552
|
-
const
|
|
2571
|
+
const Pt = fe(
|
|
2553
2572
|
({
|
|
2554
2573
|
label: t,
|
|
2555
2574
|
placeholder: a = "+998 (__) ___ __ __",
|
|
2556
2575
|
size: r = "base",
|
|
2557
2576
|
error: l,
|
|
2558
|
-
disabled:
|
|
2577
|
+
disabled: f = !1,
|
|
2559
2578
|
required: d = !1,
|
|
2560
2579
|
value: s = "",
|
|
2561
2580
|
onChange: c,
|
|
2562
2581
|
onFocus: C,
|
|
2563
2582
|
onBlur: k,
|
|
2564
|
-
className:
|
|
2583
|
+
className: D,
|
|
2565
2584
|
name: M,
|
|
2566
2585
|
showIcon: L = !1
|
|
2567
2586
|
}, F) => {
|
|
2568
|
-
const [
|
|
2569
|
-
let o =
|
|
2587
|
+
const [v, m] = _(!1), u = R((j) => {
|
|
2588
|
+
let o = j.replace(/\D/g, "");
|
|
2570
2589
|
o.startsWith("998") || (o = "998" + o), o = o.substring(0, 12);
|
|
2571
|
-
let
|
|
2572
|
-
return o.length > 3 && (
|
|
2573
|
-
}, []),
|
|
2574
|
-
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;
|
|
2575
2594
|
if (o.length < 5) {
|
|
2576
2595
|
c?.("+998");
|
|
2577
2596
|
return;
|
|
2578
2597
|
}
|
|
2579
|
-
const
|
|
2580
|
-
c?.(
|
|
2581
|
-
},
|
|
2598
|
+
const N = u(o);
|
|
2599
|
+
c?.(N);
|
|
2600
|
+
}, w = () => {
|
|
2582
2601
|
m(!0), (!s || s === "") && c?.("+998"), C?.();
|
|
2583
|
-
},
|
|
2602
|
+
}, p = () => {
|
|
2584
2603
|
m(!1), k?.();
|
|
2585
|
-
},
|
|
2604
|
+
}, y = Z(() => ({
|
|
2586
2605
|
sm: {
|
|
2587
2606
|
input: "h-9 text-sm",
|
|
2588
2607
|
padding: L ? "pl-8 pr-2" : "px-2",
|
|
@@ -2607,12 +2626,12 @@ const Wt = he(
|
|
|
2607
2626
|
labelFont: "text-base",
|
|
2608
2627
|
iconWrapper: "h-5"
|
|
2609
2628
|
}
|
|
2610
|
-
}), [L]),
|
|
2611
|
-
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: [
|
|
2612
2631
|
t && /* @__PURE__ */ i("label", { className: n(
|
|
2613
2632
|
"mb-2 block font-medium transition-colors duration-200",
|
|
2614
|
-
l ? "text-red-600" :
|
|
2615
|
-
|
|
2633
|
+
l ? "text-red-600" : v ? "text-blue-600" : "text-slate-700",
|
|
2634
|
+
y[r].labelFont
|
|
2616
2635
|
), children: [
|
|
2617
2636
|
t,
|
|
2618
2637
|
d && /* @__PURE__ */ e("span", { className: "text-red-600 ml-1", children: "*" })
|
|
@@ -2620,9 +2639,9 @@ const Wt = he(
|
|
|
2620
2639
|
/* @__PURE__ */ i("div", { className: "relative flex items-center", children: [
|
|
2621
2640
|
L && /* @__PURE__ */ e("div", { className: n(
|
|
2622
2641
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center transition-all duration-300",
|
|
2623
|
-
|
|
2642
|
+
y[r].iconLeft,
|
|
2624
2643
|
E
|
|
2625
|
-
), 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" }) }) }),
|
|
2626
2645
|
/* @__PURE__ */ e(
|
|
2627
2646
|
"input",
|
|
2628
2647
|
{
|
|
@@ -2630,18 +2649,18 @@ const Wt = he(
|
|
|
2630
2649
|
name: M,
|
|
2631
2650
|
type: "tel",
|
|
2632
2651
|
value: s,
|
|
2633
|
-
onChange:
|
|
2634
|
-
onFocus:
|
|
2635
|
-
onBlur:
|
|
2636
|
-
disabled:
|
|
2652
|
+
onChange: b,
|
|
2653
|
+
onFocus: w,
|
|
2654
|
+
onBlur: p,
|
|
2655
|
+
disabled: f,
|
|
2637
2656
|
placeholder: a,
|
|
2638
2657
|
className: n(
|
|
2639
2658
|
"w-full border bg-white font-normal transition-all duration-300 outline-none",
|
|
2640
2659
|
r === "base" ? "rounded-xl" : "rounded-lg",
|
|
2641
2660
|
"disabled:bg-slate-100 disabled:text-slate-400 disabled:cursor-not-allowed",
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2661
|
+
y[r].input,
|
|
2662
|
+
y[r].padding,
|
|
2663
|
+
$
|
|
2645
2664
|
)
|
|
2646
2665
|
}
|
|
2647
2666
|
)
|
|
@@ -2650,22 +2669,22 @@ const Wt = he(
|
|
|
2650
2669
|
] });
|
|
2651
2670
|
}
|
|
2652
2671
|
);
|
|
2653
|
-
|
|
2654
|
-
const
|
|
2655
|
-
({ mode: t, onChange: a, value: r, ...l },
|
|
2656
|
-
const [d, s] =
|
|
2657
|
-
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();
|
|
2658
2677
|
let u = "";
|
|
2659
|
-
for (let
|
|
2660
|
-
const
|
|
2661
|
-
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;
|
|
2662
2681
|
}
|
|
2663
2682
|
return u.length > 2 ? u.slice(0, 2) + " " + u.slice(2) : u;
|
|
2664
|
-
}, k = (
|
|
2665
|
-
(
|
|
2666
|
-
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;
|
|
2667
2686
|
let u = "";
|
|
2668
|
-
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);
|
|
2669
2688
|
},
|
|
2670
2689
|
[t, a, r]
|
|
2671
2690
|
), L = () => {
|
|
@@ -2682,9 +2701,9 @@ const Yt = he(
|
|
|
2682
2701
|
}
|
|
2683
2702
|
};
|
|
2684
2703
|
return /* @__PURE__ */ e(
|
|
2685
|
-
|
|
2704
|
+
Le,
|
|
2686
2705
|
{
|
|
2687
|
-
ref:
|
|
2706
|
+
ref: f,
|
|
2688
2707
|
...l,
|
|
2689
2708
|
value: c,
|
|
2690
2709
|
onChange: M,
|
|
@@ -2706,52 +2725,52 @@ const Yt = he(
|
|
|
2706
2725
|
);
|
|
2707
2726
|
}
|
|
2708
2727
|
);
|
|
2709
|
-
|
|
2710
|
-
function
|
|
2728
|
+
Wt.displayName = "MciIdentityInput";
|
|
2729
|
+
function ir({
|
|
2711
2730
|
open: t,
|
|
2712
2731
|
onClose: a,
|
|
2713
2732
|
columns: r,
|
|
2714
2733
|
hidden: l,
|
|
2715
|
-
onToggle:
|
|
2734
|
+
onToggle: f,
|
|
2716
2735
|
onMove: d,
|
|
2717
2736
|
minVisible: s = 5
|
|
2718
2737
|
}) {
|
|
2719
|
-
const c =
|
|
2738
|
+
const c = le(null), { handleClick: C } = De(c, a);
|
|
2720
2739
|
J(() => {
|
|
2721
2740
|
if (t)
|
|
2722
2741
|
return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
|
|
2723
2742
|
}, [t, C]);
|
|
2724
|
-
const k =
|
|
2743
|
+
const k = Z(() => new Set(l), [l]), D = Z(() => {
|
|
2725
2744
|
let o = 0;
|
|
2726
|
-
for (const
|
|
2745
|
+
for (const N of r) k.has(N.key) || o++;
|
|
2727
2746
|
return o;
|
|
2728
|
-
}, [r, k]), M =
|
|
2729
|
-
L.current = o,
|
|
2730
|
-
|
|
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);
|
|
2731
2750
|
}));
|
|
2732
2751
|
}, []);
|
|
2733
2752
|
J(() => () => {
|
|
2734
|
-
|
|
2753
|
+
w.current != null && cancelAnimationFrame(w.current);
|
|
2735
2754
|
}, []);
|
|
2736
|
-
const
|
|
2755
|
+
const y = R(
|
|
2737
2756
|
(o) => {
|
|
2738
|
-
F.current = !0, M.current = o,
|
|
2757
|
+
F.current = !0, M.current = o, b(r[o]?.key ?? null);
|
|
2739
2758
|
},
|
|
2740
2759
|
[r]
|
|
2741
|
-
),
|
|
2760
|
+
), $ = R(() => {
|
|
2742
2761
|
F.current = !1;
|
|
2743
2762
|
}, []);
|
|
2744
2763
|
J(() => {
|
|
2745
2764
|
if (t)
|
|
2746
|
-
return document.addEventListener("mouseup",
|
|
2747
|
-
}, [t,
|
|
2748
|
-
const E =
|
|
2749
|
-
M.current = null, F.current = !1,
|
|
2750
|
-
}, [
|
|
2751
|
-
(o,
|
|
2752
|
-
|
|
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);
|
|
2753
2772
|
},
|
|
2754
|
-
[
|
|
2773
|
+
[f]
|
|
2755
2774
|
);
|
|
2756
2775
|
return t ? /* @__PURE__ */ i(
|
|
2757
2776
|
"div",
|
|
@@ -2788,40 +2807,40 @@ function cr({
|
|
|
2788
2807
|
"[&::-webkit-scrollbar-thumb]:rounded-full",
|
|
2789
2808
|
"hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
|
|
2790
2809
|
),
|
|
2791
|
-
children: r.map((o,
|
|
2792
|
-
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;
|
|
2793
2812
|
return /* @__PURE__ */ i("div", { children: [
|
|
2794
2813
|
/* @__PURE__ */ i(
|
|
2795
2814
|
"div",
|
|
2796
2815
|
{
|
|
2797
2816
|
draggable: !0,
|
|
2798
|
-
onDragStart: (
|
|
2817
|
+
onDragStart: (P) => {
|
|
2799
2818
|
if (!F.current) {
|
|
2800
|
-
|
|
2819
|
+
P.preventDefault();
|
|
2801
2820
|
return;
|
|
2802
2821
|
}
|
|
2803
|
-
|
|
2804
|
-
const
|
|
2805
|
-
|
|
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);
|
|
2806
2825
|
},
|
|
2807
|
-
onDragOver: (
|
|
2808
|
-
M.current != null && (
|
|
2826
|
+
onDragOver: (P) => {
|
|
2827
|
+
M.current != null && (P.preventDefault(), P.dataTransfer.dropEffect = "move", p(N));
|
|
2809
2828
|
},
|
|
2810
2829
|
onDragLeave: () => {
|
|
2811
|
-
L.current ===
|
|
2830
|
+
L.current === N && p(null);
|
|
2812
2831
|
},
|
|
2813
|
-
onDrop: (
|
|
2814
|
-
|
|
2815
|
-
const
|
|
2816
|
-
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();
|
|
2817
2836
|
},
|
|
2818
2837
|
onDragEnd: E,
|
|
2819
2838
|
className: n(
|
|
2820
2839
|
"group flex items-center py-2 px-1 gap-4",
|
|
2821
2840
|
"rounded-md box-border overflow-visible",
|
|
2822
2841
|
"transition-[background,transform] duration-150",
|
|
2823
|
-
!B && !
|
|
2824
|
-
|
|
2842
|
+
!B && !q && "hover:bg-slate-50",
|
|
2843
|
+
q && !B && "bg-slate-50",
|
|
2825
2844
|
B && "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing"
|
|
2826
2845
|
),
|
|
2827
2846
|
children: [
|
|
@@ -2829,7 +2848,7 @@ function cr({
|
|
|
2829
2848
|
"button",
|
|
2830
2849
|
{
|
|
2831
2850
|
type: "button",
|
|
2832
|
-
onMouseDown: () =>
|
|
2851
|
+
onMouseDown: () => y(N),
|
|
2833
2852
|
className: n(
|
|
2834
2853
|
"shrink-0 text-slate-400",
|
|
2835
2854
|
"cursor-grab active:cursor-grabbing",
|
|
@@ -2837,21 +2856,21 @@ function cr({
|
|
|
2837
2856
|
B && "cursor-grabbing"
|
|
2838
2857
|
),
|
|
2839
2858
|
"aria-label": "Drag",
|
|
2840
|
-
children: /* @__PURE__ */ e(
|
|
2859
|
+
children: /* @__PURE__ */ e(xt, { weight: "Linear", size: 20 })
|
|
2841
2860
|
}
|
|
2842
2861
|
),
|
|
2843
2862
|
/* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(
|
|
2844
|
-
|
|
2863
|
+
Me,
|
|
2845
2864
|
{
|
|
2846
|
-
checked:
|
|
2847
|
-
disabled:
|
|
2848
|
-
onChange: () =>
|
|
2865
|
+
checked: T,
|
|
2866
|
+
disabled: Y,
|
|
2867
|
+
onChange: () => j(o.key, Y),
|
|
2849
2868
|
variant: "blue"
|
|
2850
2869
|
}
|
|
2851
2870
|
) }),
|
|
2852
2871
|
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
|
|
2853
2872
|
/* @__PURE__ */ e("h4", { className: "truncate text-slate-700 text-base font-medium", title: o.title, children: o.title }),
|
|
2854
|
-
|
|
2873
|
+
Y && /* @__PURE__ */ i("p", { className: "text-xs text-slate-400 mt-0.5", children: [
|
|
2855
2874
|
"Минимум ",
|
|
2856
2875
|
s,
|
|
2857
2876
|
" колонок"
|
|
@@ -2860,7 +2879,7 @@ function cr({
|
|
|
2860
2879
|
]
|
|
2861
2880
|
}
|
|
2862
2881
|
),
|
|
2863
|
-
|
|
2882
|
+
N !== r.length - 1 && /* @__PURE__ */ e("div", { className: "mx-2 h-px bg-slate-100" })
|
|
2864
2883
|
] }, o.key);
|
|
2865
2884
|
})
|
|
2866
2885
|
}
|
|
@@ -2869,34 +2888,34 @@ function cr({
|
|
|
2869
2888
|
}
|
|
2870
2889
|
) : null;
|
|
2871
2890
|
}
|
|
2872
|
-
const
|
|
2891
|
+
const Pe = (t) => Array.isArray(t) && t.every((a) => typeof a == "string"), Ot = (t) => {
|
|
2873
2892
|
if (!t) return null;
|
|
2874
2893
|
try {
|
|
2875
2894
|
const a = JSON.parse(t);
|
|
2876
2895
|
if (typeof a != "object" || a === null) return null;
|
|
2877
2896
|
const r = a;
|
|
2878
|
-
return !
|
|
2897
|
+
return !Pe(r.order) || !Pe(r.hidden) ? null : { order: r.order, hidden: r.hidden };
|
|
2879
2898
|
} catch {
|
|
2880
2899
|
return null;
|
|
2881
2900
|
}
|
|
2882
|
-
},
|
|
2901
|
+
}, ie = (t) => {
|
|
2883
2902
|
const a = /* @__PURE__ */ new Set(), r = [];
|
|
2884
2903
|
for (const l of t)
|
|
2885
2904
|
a.has(l) || (a.add(l), r.push(l));
|
|
2886
2905
|
return r;
|
|
2887
2906
|
};
|
|
2888
|
-
function
|
|
2889
|
-
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] = _(() => {
|
|
2890
2909
|
if (typeof window > "u") {
|
|
2891
|
-
const E =
|
|
2892
|
-
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) };
|
|
2893
2912
|
}
|
|
2894
|
-
const m = Ot(window.localStorage.getItem(a)), u =
|
|
2895
|
-
...
|
|
2896
|
-
...
|
|
2897
|
-
...d.filter((E) => !
|
|
2898
|
-
]),
|
|
2899
|
-
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($) };
|
|
2900
2919
|
});
|
|
2901
2920
|
J(() => {
|
|
2902
2921
|
if (!(typeof window > "u"))
|
|
@@ -2906,72 +2925,72 @@ function dr(t) {
|
|
|
2906
2925
|
}
|
|
2907
2926
|
}, [a, c]), J(() => {
|
|
2908
2927
|
C((m) => {
|
|
2909
|
-
const u =
|
|
2910
|
-
...m.order.filter((
|
|
2911
|
-
...d.filter((
|
|
2912
|
-
]),
|
|
2913
|
-
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 };
|
|
2914
2933
|
});
|
|
2915
2934
|
}, [d, s]);
|
|
2916
|
-
const k =
|
|
2935
|
+
const k = Z(() => new Set(c.hidden), [c.hidden]), D = Z(() => {
|
|
2917
2936
|
const m = /* @__PURE__ */ new Map();
|
|
2918
|
-
return c.order.forEach((
|
|
2919
|
-
const
|
|
2920
|
-
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;
|
|
2921
2940
|
});
|
|
2922
|
-
}, [r, k, c.order]), M =
|
|
2941
|
+
}, [r, k, c.order]), M = Z(
|
|
2923
2942
|
() => c.hidden.filter((m) => s.has(m)),
|
|
2924
2943
|
[c.hidden, s]
|
|
2925
|
-
), L =
|
|
2944
|
+
), L = R((m) => {
|
|
2926
2945
|
const u = String(m);
|
|
2927
|
-
C((
|
|
2928
|
-
const
|
|
2929
|
-
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) };
|
|
2930
2949
|
});
|
|
2931
|
-
}, []), F =
|
|
2932
|
-
C((
|
|
2933
|
-
const
|
|
2934
|
-
if (m < 0 || u < 0 || m >=
|
|
2935
|
-
const [
|
|
2936
|
-
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 };
|
|
2937
2956
|
});
|
|
2938
|
-
}, []),
|
|
2957
|
+
}, []), v = R(() => {
|
|
2939
2958
|
C(() => {
|
|
2940
|
-
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))) : [];
|
|
2941
2960
|
return { order: m, hidden: u };
|
|
2942
2961
|
});
|
|
2943
|
-
}, [
|
|
2962
|
+
}, [f, l, d]);
|
|
2944
2963
|
return {
|
|
2945
|
-
orderedColumns:
|
|
2964
|
+
orderedColumns: D,
|
|
2946
2965
|
hiddenKeys: M,
|
|
2947
2966
|
toggleColumn: L,
|
|
2948
2967
|
moveColumn: F,
|
|
2949
|
-
reset:
|
|
2968
|
+
reset: v
|
|
2950
2969
|
};
|
|
2951
2970
|
}
|
|
2952
2971
|
export {
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
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
|
|
2977
2996
|
};
|