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