@mci-ui/mci-ui 0.0.57 → 0.0.59
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 +251 -250
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as e, jsxs as o, Fragment as
|
|
2
|
-
import { AltArrowRight as
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import { AltArrowRight as me, Star2 as Re, AltArrowDown as Me, EyeClosed as He, Eye as Ke, Calendar as Xe, AltArrowLeft as ve, DoubleAltArrowLeft as Ge, DoubleAltArrowRight as Qe, ConfoundedSquare as et, SortVertical as tt, SortFromTopToBottom as rt, SortFromBottomToTop as nt, Upload as lt, FileText as Ne, File as at, MusicNote as st, VideoFramePlayHorizontal as ot, Gallery as it, MenuDots as ct, Refresh as dt, InfoCircle as ut, DangerCircle as ft, CloseCircle as ht, CheckCircle as mt, Phone as pt } from "@solar-icons/react";
|
|
3
3
|
import { clsx as bt } from "clsx";
|
|
4
4
|
import { twMerge as gt } from "tailwind-merge";
|
|
5
5
|
import * as Q from "react";
|
|
6
|
-
import { memo as xt, useState as V, useMemo as J, useCallback as T, useRef as ce, useEffect as
|
|
6
|
+
import { memo as xt, useState as V, useMemo as J, useCallback as T, useRef as ce, useEffect as ne, forwardRef as de } from "react";
|
|
7
7
|
import { createRoot as wt } from "react-dom/client";
|
|
8
8
|
function n(...t) {
|
|
9
9
|
return gt(bt(t));
|
|
@@ -47,7 +47,7 @@ function Vt({
|
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
),
|
|
50
|
-
!M && /* @__PURE__ */ e("span", { className: "mx-2 flex items-center", children: /* @__PURE__ */ e(
|
|
50
|
+
!M && /* @__PURE__ */ e("span", { className: "mx-2 flex items-center", children: /* @__PURE__ */ e(me, { weight: "Linear", size: 20, className: "text-slate-500" }) })
|
|
51
51
|
] }, c);
|
|
52
52
|
}) });
|
|
53
53
|
}
|
|
@@ -65,11 +65,11 @@ function _t({
|
|
|
65
65
|
className: k,
|
|
66
66
|
type: g = "button"
|
|
67
67
|
}) {
|
|
68
|
-
const
|
|
68
|
+
const E = t ?? a, w = {
|
|
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
|
+
}, F = u === "primary" || u === "secondary" || u === "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)]",
|
|
@@ -93,14 +93,14 @@ function _t({
|
|
|
93
93
|
className: n(
|
|
94
94
|
"inline-flex items-center justify-center font-medium transition-all duration-200 cursor-pointer",
|
|
95
95
|
w[f],
|
|
96
|
-
|
|
97
|
-
!B &&
|
|
96
|
+
F,
|
|
97
|
+
!B && F,
|
|
98
98
|
D,
|
|
99
99
|
k
|
|
100
100
|
),
|
|
101
101
|
children: [
|
|
102
102
|
r && l === "left" && !c && /* @__PURE__ */ e("span", { className: "flex items-center", children: r }),
|
|
103
|
-
|
|
103
|
+
E && /* @__PURE__ */ e("span", { children: E }),
|
|
104
104
|
r && l === "right" && !c && /* @__PURE__ */ e("span", { className: "flex items-center", children: r }),
|
|
105
105
|
c && /* @__PURE__ */ e(Re, { weight: "Linear", size: 20, className: "animate-spin" })
|
|
106
106
|
]
|
|
@@ -132,14 +132,14 @@ const vt = (t) => /* @__PURE__ */ Q.createElement("svg", { xmlns: "http://www.w3
|
|
|
132
132
|
className: x,
|
|
133
133
|
variant: k = "yellow",
|
|
134
134
|
name: g,
|
|
135
|
-
value:
|
|
135
|
+
value: E
|
|
136
136
|
}) {
|
|
137
|
-
const [w, v] = V(!1), y = a === "radio",
|
|
137
|
+
const [w, v] = V(!1), y = a === "radio", F = J(
|
|
138
138
|
() => f ?? w,
|
|
139
139
|
[f, w]
|
|
140
140
|
), B = T(
|
|
141
|
-
(
|
|
142
|
-
c || (f === void 0 && v(
|
|
141
|
+
(S) => {
|
|
142
|
+
c || (f === void 0 && v(S.target.checked), u?.(S));
|
|
143
143
|
},
|
|
144
144
|
[f, u, c]
|
|
145
145
|
), D = J(() => {
|
|
@@ -147,25 +147,25 @@ const vt = (t) => /* @__PURE__ */ Q.createElement("svg", { xmlns: "http://www.w3
|
|
|
147
147
|
const L = "border-slate-200 bg-slate-100";
|
|
148
148
|
return y ? {
|
|
149
149
|
container: L,
|
|
150
|
-
dot:
|
|
150
|
+
dot: F ? "bg-slate-300" : "bg-transparent",
|
|
151
151
|
check: "text-slate-400"
|
|
152
152
|
} : {
|
|
153
153
|
container: L,
|
|
154
154
|
dot: "",
|
|
155
|
-
check:
|
|
155
|
+
check: F ? "text-slate-400" : "text-transparent"
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
const
|
|
158
|
+
const S = yt[k];
|
|
159
159
|
if (y) {
|
|
160
160
|
const L = n(
|
|
161
161
|
"border transition-all duration-200",
|
|
162
|
-
|
|
163
|
-
!
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
F ? S.border : "border-slate-400",
|
|
163
|
+
!F && S.hover,
|
|
164
|
+
S.focus,
|
|
165
|
+
F && ""
|
|
166
166
|
), R = n(
|
|
167
167
|
"transition-all duration-200 rounded-full",
|
|
168
|
-
|
|
168
|
+
F ? S.bg : "bg-transparent"
|
|
169
169
|
);
|
|
170
170
|
return {
|
|
171
171
|
container: L,
|
|
@@ -176,14 +176,14 @@ const vt = (t) => /* @__PURE__ */ Q.createElement("svg", { xmlns: "http://www.w3
|
|
|
176
176
|
return {
|
|
177
177
|
container: n(
|
|
178
178
|
"border transition-all duration-200",
|
|
179
|
-
|
|
180
|
-
!
|
|
181
|
-
|
|
179
|
+
F ? n(S.bg, S.border) : "border-slate-400",
|
|
180
|
+
!F && S.hover,
|
|
181
|
+
S.focus
|
|
182
182
|
),
|
|
183
183
|
dot: "",
|
|
184
|
-
check:
|
|
184
|
+
check: F ? "text-white" : "text-transparent"
|
|
185
185
|
};
|
|
186
|
-
}, [y,
|
|
186
|
+
}, [y, F, c, k]), m = J(() => !r && !l ? null : /* @__PURE__ */ o("div", { className: "flex flex-col", children: [
|
|
187
187
|
r && /* @__PURE__ */ o(
|
|
188
188
|
"span",
|
|
189
189
|
{
|
|
@@ -222,7 +222,7 @@ const vt = (t) => /* @__PURE__ */ Q.createElement("svg", { xmlns: "http://www.w3
|
|
|
222
222
|
"input",
|
|
223
223
|
{
|
|
224
224
|
type: a,
|
|
225
|
-
checked:
|
|
225
|
+
checked: F,
|
|
226
226
|
onChange: B,
|
|
227
227
|
disabled: c,
|
|
228
228
|
required: M,
|
|
@@ -230,7 +230,7 @@ const vt = (t) => /* @__PURE__ */ Q.createElement("svg", { xmlns: "http://www.w3
|
|
|
230
230
|
"aria-invalid": !!s,
|
|
231
231
|
"aria-describedby": s ? `${g}-error` : void 0,
|
|
232
232
|
name: g,
|
|
233
|
-
value:
|
|
233
|
+
value: E
|
|
234
234
|
}
|
|
235
235
|
),
|
|
236
236
|
/* @__PURE__ */ e(
|
|
@@ -247,7 +247,7 @@ const vt = (t) => /* @__PURE__ */ Q.createElement("svg", { xmlns: "http://www.w3
|
|
|
247
247
|
className: n(
|
|
248
248
|
"w-3 h-3 rounded-full transition-all duration-200",
|
|
249
249
|
D.dot,
|
|
250
|
-
|
|
250
|
+
F ? "opacity-100 scale-100" : "opacity-0 scale-50"
|
|
251
251
|
)
|
|
252
252
|
}
|
|
253
253
|
) }) : /* @__PURE__ */ e(
|
|
@@ -256,13 +256,13 @@ const vt = (t) => /* @__PURE__ */ Q.createElement("svg", { xmlns: "http://www.w3
|
|
|
256
256
|
className: n(
|
|
257
257
|
"w-4 h-4 stroke-[2.5px] transition-opacity duration-200",
|
|
258
258
|
D.check,
|
|
259
|
-
|
|
259
|
+
F ? "opacity-100" : "opacity-0"
|
|
260
260
|
)
|
|
261
261
|
}
|
|
262
262
|
)
|
|
263
263
|
}
|
|
264
264
|
),
|
|
265
|
-
|
|
265
|
+
m
|
|
266
266
|
]
|
|
267
267
|
}
|
|
268
268
|
),
|
|
@@ -279,7 +279,7 @@ function Zt({
|
|
|
279
279
|
contentClassName: u
|
|
280
280
|
}) {
|
|
281
281
|
const [s, c] = V(r), [M, x] = V(0), k = ce(null);
|
|
282
|
-
return
|
|
282
|
+
return ne(() => {
|
|
283
283
|
k.current && x(s ? k.current.scrollHeight : 0);
|
|
284
284
|
}, [s]), /* @__PURE__ */ o("div", { className: n("overflow-hidden rounded-xl border border-slate-200", f), children: [
|
|
285
285
|
/* @__PURE__ */ o(
|
|
@@ -338,22 +338,22 @@ function Ot({
|
|
|
338
338
|
closeOnEscape: k = !0,
|
|
339
339
|
width: g = 572
|
|
340
340
|
}) {
|
|
341
|
-
const
|
|
341
|
+
const E = ce(null), w = ce(null), v = T(() => {
|
|
342
342
|
a();
|
|
343
343
|
}, [a]);
|
|
344
|
-
|
|
345
|
-
t ? (w.current = document.activeElement,
|
|
346
|
-
}, [t]),
|
|
344
|
+
ne(() => {
|
|
345
|
+
t ? (w.current = document.activeElement, E.current?.focus()) : w.current?.focus();
|
|
346
|
+
}, [t]), ne(() => (t && (document.body.style.overflow = "hidden"), () => {
|
|
347
347
|
document.body.style.overflow = "unset";
|
|
348
348
|
}), [t]);
|
|
349
349
|
const y = J(() => ({
|
|
350
350
|
width: typeof g == "number" ? `${g}px` : g,
|
|
351
351
|
transform: t ? "translateX(0)" : r === "right" ? "translateX(calc(100% + 48px))" : "translateX(calc(-100% - 48px))"
|
|
352
|
-
}), [t, g, r]),
|
|
352
|
+
}), [t, g, r]), F = {
|
|
353
353
|
left: "top-6 left-6 bottom-6",
|
|
354
354
|
right: "top-6 right-6 bottom-6"
|
|
355
355
|
};
|
|
356
|
-
return /* @__PURE__ */ o(
|
|
356
|
+
return /* @__PURE__ */ o(he, { children: [
|
|
357
357
|
/* @__PURE__ */ e(
|
|
358
358
|
"div",
|
|
359
359
|
{
|
|
@@ -368,12 +368,12 @@ function Ot({
|
|
|
368
368
|
/* @__PURE__ */ o(
|
|
369
369
|
"div",
|
|
370
370
|
{
|
|
371
|
-
ref:
|
|
371
|
+
ref: E,
|
|
372
372
|
tabIndex: -1,
|
|
373
373
|
style: y,
|
|
374
374
|
className: n(
|
|
375
375
|
"fixed flex flex-col z-50 w-full rounded-2xl bg-white transition-transform duration-300 ease-in-out outline-none",
|
|
376
|
-
|
|
376
|
+
F[r],
|
|
377
377
|
M
|
|
378
378
|
),
|
|
379
379
|
role: "dialog",
|
|
@@ -416,29 +416,30 @@ const Se = de(
|
|
|
416
416
|
required: x = !1,
|
|
417
417
|
value: k,
|
|
418
418
|
onChange: g,
|
|
419
|
-
onFocus:
|
|
419
|
+
onFocus: E,
|
|
420
420
|
onBlur: w,
|
|
421
421
|
className: v,
|
|
422
422
|
name: y,
|
|
423
|
-
maxLength:
|
|
423
|
+
maxLength: F = 250,
|
|
424
424
|
onClear: B,
|
|
425
425
|
showClearButton: D = !1,
|
|
426
|
-
step:
|
|
427
|
-
autoComplete:
|
|
426
|
+
step: m,
|
|
427
|
+
autoComplete: S = "off"
|
|
428
428
|
}, P) => {
|
|
429
|
-
const [L, R] = V(!1), [
|
|
430
|
-
R(!0),
|
|
431
|
-
},
|
|
429
|
+
const [L, R] = V(!1), [h, C] = V(""), [$, z] = V(!1), O = k ?? h, I = r === "password", H = D && !!O && !M, q = l && u === "left", re = l && u === "right" || f || I, ee = re || H, K = () => {
|
|
430
|
+
R(!0), E?.();
|
|
431
|
+
}, le = () => {
|
|
432
432
|
R(!1), w?.();
|
|
433
433
|
}, p = (U) => {
|
|
434
|
-
|
|
434
|
+
let te = U.target.value;
|
|
435
|
+
r === "number" && F && te.length > F && (te = te.slice(0, F), U.target.value = te), k === void 0 && C(te), g?.(U);
|
|
435
436
|
}, A = () => z((U) => !U), W = () => {
|
|
436
437
|
k === void 0 && C(""), B?.();
|
|
437
438
|
}, b = J(
|
|
438
439
|
() => ({
|
|
439
440
|
sm: {
|
|
440
441
|
input: "h-9 text-sm",
|
|
441
|
-
padding: q &&
|
|
442
|
+
padding: q && re ? "pl-7 pr-7" : q ? "pl-7 pr-2" : re ? "pl-2 pr-7" : "px-2",
|
|
442
443
|
icon: "w-4 h-4",
|
|
443
444
|
leftIcon: "left-2",
|
|
444
445
|
rightIcon: "right-2",
|
|
@@ -447,7 +448,7 @@ const Se = de(
|
|
|
447
448
|
},
|
|
448
449
|
md: {
|
|
449
450
|
input: "h-10 text-sm",
|
|
450
|
-
padding: q &&
|
|
451
|
+
padding: q && re ? "pl-8 pr-8" : q ? "pl-8 pr-2" : re ? "pl-2 pr-8" : "px-4",
|
|
451
452
|
icon: "w-4 h-4",
|
|
452
453
|
leftIcon: "left-2",
|
|
453
454
|
rightIcon: "right-2",
|
|
@@ -456,7 +457,7 @@ const Se = de(
|
|
|
456
457
|
},
|
|
457
458
|
base: {
|
|
458
459
|
input: "h-12 text-base",
|
|
459
|
-
padding: q &&
|
|
460
|
+
padding: q && re ? "pl-9 pr-9" : q ? "pl-9 pr-3" : re ? "pl-3 pr-9" : "px-4",
|
|
460
461
|
icon: "w-5 h-5",
|
|
461
462
|
leftIcon: "left-3",
|
|
462
463
|
rightIcon: "right-3",
|
|
@@ -464,7 +465,7 @@ const Se = de(
|
|
|
464
465
|
iconWrapper: "h-5"
|
|
465
466
|
}
|
|
466
467
|
}),
|
|
467
|
-
[q,
|
|
468
|
+
[q, re]
|
|
468
469
|
), Y = J(() => 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]), X = J(() => M ? "text-slate-400" : c ? "text-red-600" : L ? "text-black" : "text-slate-400", [c, L, M]);
|
|
469
470
|
return /* @__PURE__ */ o("div", { className: n("w-full", v), children: [
|
|
470
471
|
t && /* @__PURE__ */ o(
|
|
@@ -492,12 +493,12 @@ const Se = de(
|
|
|
492
493
|
value: O,
|
|
493
494
|
onChange: p,
|
|
494
495
|
onFocus: K,
|
|
495
|
-
onBlur:
|
|
496
|
+
onBlur: le,
|
|
496
497
|
disabled: M,
|
|
497
498
|
required: x,
|
|
498
|
-
autoComplete:
|
|
499
|
+
autoComplete: S,
|
|
499
500
|
placeholder: a,
|
|
500
|
-
step:
|
|
501
|
+
step: m,
|
|
501
502
|
className: n(
|
|
502
503
|
"w-full border bg-white font-normal transition-all duration-300 ease-in-out outline-none",
|
|
503
504
|
s === "base" ? "rounded-xl" : "rounded-lg",
|
|
@@ -507,7 +508,7 @@ const Se = de(
|
|
|
507
508
|
b[s].padding,
|
|
508
509
|
Y
|
|
509
510
|
),
|
|
510
|
-
maxLength:
|
|
511
|
+
maxLength: F
|
|
511
512
|
}
|
|
512
513
|
),
|
|
513
514
|
q && /* @__PURE__ */ e(
|
|
@@ -568,7 +569,7 @@ const Se = de(
|
|
|
568
569
|
)
|
|
569
570
|
}
|
|
570
571
|
),
|
|
571
|
-
I && /* @__PURE__ */ o(
|
|
572
|
+
I && /* @__PURE__ */ o(he, { children: [
|
|
572
573
|
f && /* @__PURE__ */ e(
|
|
573
574
|
"div",
|
|
574
575
|
{
|
|
@@ -746,20 +747,20 @@ const Nt = {
|
|
|
746
747
|
minDate: x,
|
|
747
748
|
maxDate: k,
|
|
748
749
|
error: g,
|
|
749
|
-
showClear:
|
|
750
|
+
showClear: E = !0,
|
|
750
751
|
allowManualInput: w = !0,
|
|
751
752
|
locale: v = "uz",
|
|
752
753
|
startView: y = "day",
|
|
753
|
-
iconPosition:
|
|
754
|
+
iconPosition: F = "left",
|
|
754
755
|
align: B = "auto"
|
|
755
756
|
}, D) => {
|
|
756
|
-
const [
|
|
757
|
+
const [m, S] = V(!1), [P, L] = V(
|
|
757
758
|
t === "range" ? [null, null] : null
|
|
758
|
-
), [R,
|
|
759
|
+
), [R, h] = V([null, null]), C = T((i) => {
|
|
759
760
|
if (!i) return null;
|
|
760
761
|
const d = new Date(i);
|
|
761
762
|
return isNaN(d.getTime()) ? null : d;
|
|
762
|
-
}, []), [$, z] = V(/* @__PURE__ */ new Date()), [O, I] = V(y), [H, q] = V(0), [
|
|
763
|
+
}, []), [$, z] = V(/* @__PURE__ */ new Date()), [O, I] = V(y), [H, q] = V(0), [re, ee] = V(""), [K, le] = V(B), p = ce(null), A = J(() => {
|
|
763
764
|
const i = a !== void 0 ? a : P;
|
|
764
765
|
if (t === "date") return C(i);
|
|
765
766
|
const d = i;
|
|
@@ -785,41 +786,41 @@ const Nt = {
|
|
|
785
786
|
return !!(x && d < b(x) || k && d > b(k));
|
|
786
787
|
},
|
|
787
788
|
[x, k, b]
|
|
788
|
-
),
|
|
789
|
+
), te = J(() => {
|
|
789
790
|
if (t === "date") return Y(A);
|
|
790
791
|
const [i, d] = A;
|
|
791
792
|
return !i && !d ? "" : i && d ? `${Y(i)} - ${Y(d)}` : i ? `${Y(i)} - ...` : "...";
|
|
792
793
|
}, [t, A, Y]);
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}, [
|
|
796
|
-
if (
|
|
794
|
+
ne(() => {
|
|
795
|
+
m ? re === "" && te !== "" && ee(te) : ee(te);
|
|
796
|
+
}, [te, m]), ne(() => {
|
|
797
|
+
if (m)
|
|
797
798
|
if (t === "range") {
|
|
798
799
|
const i = A;
|
|
799
|
-
|
|
800
|
+
h(i), i[0] ? z(i[0]) : i[1] ? z(i[1]) : z(/* @__PURE__ */ new Date());
|
|
800
801
|
} else {
|
|
801
802
|
const i = A;
|
|
802
803
|
z(i || /* @__PURE__ */ new Date());
|
|
803
804
|
}
|
|
804
|
-
}, [
|
|
805
|
-
if (
|
|
805
|
+
}, [m]), ne(() => {
|
|
806
|
+
if (m && B === "auto" && p.current) {
|
|
806
807
|
const i = p.current.getBoundingClientRect(), d = window.innerWidth - i.right, N = i.left;
|
|
807
|
-
d < 300 && N > 300 ?
|
|
808
|
+
d < 300 && N > 300 ? le("right") : le("left");
|
|
808
809
|
}
|
|
809
|
-
}, [
|
|
810
|
+
}, [m, B]);
|
|
810
811
|
const se = T(() => {
|
|
811
|
-
|
|
812
|
-
}, [y,
|
|
813
|
-
u || (i.preventDefault(), i.stopPropagation(),
|
|
812
|
+
S(!1), I(y), q(0), ee(te);
|
|
813
|
+
}, [y, te]), pe = T((i) => {
|
|
814
|
+
u || (i.preventDefault(), i.stopPropagation(), S((d) => !d));
|
|
814
815
|
}, [u]), { handleClick: j } = Fe(p, se), { handleEscape: oe } = De(se);
|
|
815
|
-
|
|
816
|
-
if (
|
|
816
|
+
ne(() => {
|
|
817
|
+
if (m)
|
|
817
818
|
return document.addEventListener("mousedown", j), document.addEventListener("keydown", oe), () => {
|
|
818
819
|
document.removeEventListener("mousedown", j), document.removeEventListener("keydown", oe);
|
|
819
820
|
};
|
|
820
|
-
}, [
|
|
821
|
+
}, [m, j, oe]);
|
|
821
822
|
const Te = () => {
|
|
822
|
-
u ||
|
|
823
|
+
u || m || (t === "range" || !w) && (S(!0), I(y));
|
|
823
824
|
}, ze = (i) => {
|
|
824
825
|
if (t !== "date") return;
|
|
825
826
|
let N = i.target.value.replace(/\D/g, "");
|
|
@@ -831,7 +832,7 @@ const Nt = {
|
|
|
831
832
|
} else _ === "" && (L(null), r?.(null));
|
|
832
833
|
}, We = T(() => {
|
|
833
834
|
const i = t === "range" ? [null, null] : null;
|
|
834
|
-
L(i),
|
|
835
|
+
L(i), h([null, null]), r?.(i), ee("");
|
|
835
836
|
}, [t, r]), Pe = T(
|
|
836
837
|
(i) => {
|
|
837
838
|
if (U(i)) return;
|
|
@@ -841,10 +842,10 @@ const Nt = {
|
|
|
841
842
|
else {
|
|
842
843
|
const [N, _] = R;
|
|
843
844
|
if (!N && !_ || N && _)
|
|
844
|
-
|
|
845
|
+
h([d, null]), ee(`${Y(d)} - ...`);
|
|
845
846
|
else if (N && !_) {
|
|
846
847
|
const Z = d < N ? [d, N] : [N, d];
|
|
847
|
-
|
|
848
|
+
h(Z), L(Z), r?.(Z);
|
|
848
849
|
const [G, ie] = Z;
|
|
849
850
|
ee(`${Y(G)} - ${Y(ie)}`), se();
|
|
850
851
|
}
|
|
@@ -863,10 +864,10 @@ const Nt = {
|
|
|
863
864
|
z((d) => new Date(d.getFullYear() + i, d.getMonth(), 1));
|
|
864
865
|
}, Ve = T((i) => {
|
|
865
866
|
const d = i.getFullYear(), N = i.getMonth(), _ = new Date(d, N, 1).getDay(), Z = new Date(d, N + 1, 0).getDate(), G = [];
|
|
866
|
-
for (let
|
|
867
|
-
for (let
|
|
867
|
+
for (let ae = _; ae > 0; ae--) G.push({ date: new Date(d, N, 1 - ae), isCurrentMonth: !1 });
|
|
868
|
+
for (let ae = 1; ae <= Z; ae++) G.push({ date: new Date(d, N, ae), isCurrentMonth: !0 });
|
|
868
869
|
const ie = 42 - G.length;
|
|
869
|
-
for (let
|
|
870
|
+
for (let ae = 1; ae <= ie; ae++) G.push({ date: new Date(d, N + 1, ae), isCurrentMonth: !1 });
|
|
870
871
|
return G;
|
|
871
872
|
}, []), ge = T((i, d) => b(i).getTime() === b(d).getTime(), [b]), _e = (i) => {
|
|
872
873
|
const d = b(i);
|
|
@@ -885,7 +886,7 @@ const Nt = {
|
|
|
885
886
|
const _ = Ve(i);
|
|
886
887
|
return /* @__PURE__ */ o("div", { className: "w-[300px] p-2 select-none", children: [
|
|
887
888
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4 py-1", children: [
|
|
888
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16", children: d && /* @__PURE__ */ o(
|
|
889
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16", children: d && /* @__PURE__ */ o(he, { children: [
|
|
889
890
|
/* @__PURE__ */ e("button", { onClick: () => be(-1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(Ge, { size: 18 }) }),
|
|
890
891
|
/* @__PURE__ */ e("button", { onClick: () => Ee(-1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(ve, { size: 18 }) })
|
|
891
892
|
] }) }),
|
|
@@ -893,22 +894,22 @@ const Nt = {
|
|
|
893
894
|
/* @__PURE__ */ e("span", { className: "cursor-pointer hover:text-blue-600 transition-colors p-1 rounded hover:bg-slate-50", onClick: () => I("month"), children: W.months[i.getMonth()] }),
|
|
894
895
|
/* @__PURE__ */ e("span", { className: "cursor-pointer hover:text-blue-600 transition-colors p-1 rounded hover:bg-slate-50", onClick: () => I("year"), children: i.getFullYear() })
|
|
895
896
|
] }),
|
|
896
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16 justify-end", children: N && /* @__PURE__ */ o(
|
|
897
|
-
/* @__PURE__ */ e("button", { onClick: () => Ee(1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(
|
|
897
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16 justify-end", children: N && /* @__PURE__ */ o(he, { children: [
|
|
898
|
+
/* @__PURE__ */ e("button", { onClick: () => Ee(1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(me, { size: 18 }) }),
|
|
898
899
|
/* @__PURE__ */ e("button", { onClick: () => be(1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ e(Qe, { size: 18 }) })
|
|
899
900
|
] }) })
|
|
900
901
|
] }),
|
|
901
902
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 mb-1 text-center text-[11px] font-bold text-blue-600 uppercase", children: W.weekdaysShort.map((Z) => /* @__PURE__ */ e("div", { className: "py-1", children: Z }, Z)) }),
|
|
902
903
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-y-1 relative", children: _.map((Z, G) => {
|
|
903
|
-
const ie = Z.date,
|
|
904
|
-
return /* @__PURE__ */ e("div", { className: n("h-10 flex items-center justify-center relative", Je && "bg-blue-50", xe && t === "range" && we ? "bg-blue-50 rounded-full" : xe && t === "range" ? "bg-gradient-to-r from-transparent to-blue-50 rounded-l-full" : "", we && t === "range" ? "bg-gradient-to-l from-transparent to-blue-50 rounded-r-full" : ""), children: /* @__PURE__ */ e("button", { type: "button", onClick: () => Pe(ie), disabled:
|
|
904
|
+
const ie = Z.date, ae = U(ie), xe = _e(ie), we = Ze(ie), Je = Oe(ie);
|
|
905
|
+
return /* @__PURE__ */ e("div", { className: n("h-10 flex items-center justify-center relative", Je && "bg-blue-50", xe && t === "range" && we ? "bg-blue-50 rounded-full" : xe && t === "range" ? "bg-gradient-to-r from-transparent to-blue-50 rounded-l-full" : "", we && t === "range" ? "bg-gradient-to-l from-transparent to-blue-50 rounded-r-full" : ""), children: /* @__PURE__ */ e("button", { type: "button", onClick: () => Pe(ie), disabled: ae, className: n("w-9 h-9 cursor-pointer rounded-full flex items-center justify-center text-sm font-medium transition-all z-10", Z.isCurrentMonth ? "text-slate-700" : "text-slate-300", ae && "opacity-20 cursor-not-allowed", xe || we ? "bg-blue-600 text-white shadow-md shadow-blue-200 hover:bg-blue-700" : "hover:bg-blue-50", ge(ie, /* @__PURE__ */ new Date()) && !xe && !we && "text-blue-600 border border-blue-600"), children: ie.getDate() }) }, G);
|
|
905
906
|
}) })
|
|
906
907
|
] });
|
|
907
908
|
}, qe = () => /* @__PURE__ */ o("div", { className: "w-[300px] p-3", children: [
|
|
908
909
|
/* @__PURE__ */ o("div", { className: "flex justify-between items-center mb-4 px-2", children: [
|
|
909
910
|
/* @__PURE__ */ e("button", { type: "button", onClick: () => be(-1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(ve, { size: 20 }) }),
|
|
910
911
|
/* @__PURE__ */ e("span", { className: "font-bold text-slate-800", children: $.getFullYear() }),
|
|
911
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => be(1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(
|
|
912
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => be(1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(me, { size: 20 }) })
|
|
912
913
|
] }),
|
|
913
914
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-2", children: W.monthsShort.map((i, d) => /* @__PURE__ */ e("button", { type: "button", onClick: () => Be(d), className: n("hover:cursor-pointer py-3 rounded-lg text-sm font-semibold transition-colors", $.getMonth() === d ? "bg-blue-600 text-white" : "hover:bg-blue-50 text-slate-600"), children: i }, i)) })
|
|
914
915
|
] }), Ue = () => {
|
|
@@ -921,7 +922,7 @@ const Nt = {
|
|
|
921
922
|
" - ",
|
|
922
923
|
d[11]
|
|
923
924
|
] }),
|
|
924
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => q((N) => N + 1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(
|
|
925
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => q((N) => N + 1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ e(me, { size: 20 }) })
|
|
925
926
|
] }),
|
|
926
927
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-2", children: d.map((N) => /* @__PURE__ */ e("button", { type: "button", onClick: () => Ye(N), className: n("hover:cursor-pointer py-3 rounded-lg text-sm font-semibold transition-colors", $.getFullYear() === N ? "bg-blue-600 text-white" : "hover:bg-blue-50 text-slate-600"), children: N }, N)) })
|
|
927
928
|
] });
|
|
@@ -942,21 +943,21 @@ const Nt = {
|
|
|
942
943
|
{
|
|
943
944
|
label: f,
|
|
944
945
|
placeholder: Array.isArray(l) ? l[0] : l,
|
|
945
|
-
value:
|
|
946
|
+
value: re,
|
|
946
947
|
onChange: ze,
|
|
947
|
-
icon:
|
|
948
|
-
rightIcon:
|
|
948
|
+
icon: F === "left" ? Ae : void 0,
|
|
949
|
+
rightIcon: F === "right" ? Ae : void 0,
|
|
949
950
|
disabled: u,
|
|
950
951
|
required: s,
|
|
951
952
|
error: g,
|
|
952
953
|
maxLength: t === "date" ? 10 : void 0,
|
|
953
954
|
onFocus: Te,
|
|
954
955
|
readOnly: !w || t === "range",
|
|
955
|
-
showClearButton:
|
|
956
|
+
showClearButton: E,
|
|
956
957
|
onClear: We
|
|
957
958
|
}
|
|
958
959
|
) }),
|
|
959
|
-
|
|
960
|
+
m && /* @__PURE__ */ e(
|
|
960
961
|
"div",
|
|
961
962
|
{
|
|
962
963
|
className: n(
|
|
@@ -968,7 +969,7 @@ const Nt = {
|
|
|
968
969
|
),
|
|
969
970
|
style: { width: "max-content" },
|
|
970
971
|
onMouseDown: (i) => i.stopPropagation(),
|
|
971
|
-
children: O === "day" ? /* @__PURE__ */ o(
|
|
972
|
+
children: O === "day" ? /* @__PURE__ */ o(he, { children: [
|
|
972
973
|
Le($, !0, t !== "range"),
|
|
973
974
|
t === "range" && /* @__PURE__ */ e("div", { className: "hidden md:block border-l border-slate-100", children: Le(new Date($.getFullYear(), $.getMonth() + 1, 1), !1, !0) })
|
|
974
975
|
] }) : O === "month" ? qe() : Ue()
|
|
@@ -1026,74 +1027,74 @@ const Ct = {
|
|
|
1026
1027
|
value: x,
|
|
1027
1028
|
onChange: k,
|
|
1028
1029
|
onFocus: g,
|
|
1029
|
-
onBlur:
|
|
1030
|
+
onBlur: E,
|
|
1030
1031
|
className: w,
|
|
1031
1032
|
clearable: v = !1,
|
|
1032
1033
|
searchable: y = !1,
|
|
1033
|
-
onSearch:
|
|
1034
|
+
onSearch: F,
|
|
1034
1035
|
name: B
|
|
1035
1036
|
}, D) => {
|
|
1036
|
-
const [
|
|
1037
|
-
if (!y ||
|
|
1037
|
+
const [m, S] = V(!1), [P, L] = V(!1), [R, h] = V(""), [C, $] = V(""), [z, O] = V(-1), I = ce(null), H = ce(null), q = x !== void 0 ? x : R, re = r.find((j) => j.value === q), ee = q !== "" && q !== void 0, K = Ct[u], le = J(() => {
|
|
1038
|
+
if (!y || F) return r;
|
|
1038
1039
|
const j = C.toLowerCase();
|
|
1039
1040
|
return r.filter(
|
|
1040
1041
|
(oe) => oe.label.toLowerCase().includes(j)
|
|
1041
1042
|
);
|
|
1042
|
-
}, [r, C, y,
|
|
1043
|
-
|
|
1044
|
-
}, [
|
|
1045
|
-
|
|
1046
|
-
if (
|
|
1043
|
+
}, [r, C, y, F]), p = T(() => {
|
|
1044
|
+
S(!1), L(!1), $(""), O(-1), E?.();
|
|
1045
|
+
}, [E]), { handleClick: A } = Fe(I, p), { handleEscape: W } = De(p);
|
|
1046
|
+
ne(() => {
|
|
1047
|
+
if (m)
|
|
1047
1048
|
return document.addEventListener("mousedown", A), document.addEventListener("keydown", W), () => {
|
|
1048
1049
|
document.removeEventListener("mousedown", A), document.removeEventListener("keydown", W);
|
|
1049
1050
|
};
|
|
1050
|
-
}, [
|
|
1051
|
-
|
|
1052
|
-
}, [
|
|
1051
|
+
}, [m, A, W]), ne(() => {
|
|
1052
|
+
m && y && H.current && H.current.focus();
|
|
1053
|
+
}, [m, y]);
|
|
1053
1054
|
const b = T(
|
|
1054
1055
|
(j) => {
|
|
1055
1056
|
if (!c) {
|
|
1056
|
-
if (!
|
|
1057
|
-
j.preventDefault(),
|
|
1057
|
+
if (!m && (j.key === "ArrowDown" || j.key === "ArrowUp" || j.key === "Enter")) {
|
|
1058
|
+
j.preventDefault(), S(!0);
|
|
1058
1059
|
return;
|
|
1059
1060
|
}
|
|
1060
|
-
if (
|
|
1061
|
+
if (m)
|
|
1061
1062
|
switch (j.key) {
|
|
1062
1063
|
case "ArrowDown":
|
|
1063
1064
|
j.preventDefault(), O(
|
|
1064
|
-
(oe) => oe <
|
|
1065
|
+
(oe) => oe < le.length - 1 ? oe + 1 : 0
|
|
1065
1066
|
);
|
|
1066
1067
|
break;
|
|
1067
1068
|
case "ArrowUp":
|
|
1068
1069
|
j.preventDefault(), O(
|
|
1069
|
-
(oe) => oe > 0 ? oe - 1 :
|
|
1070
|
+
(oe) => oe > 0 ? oe - 1 : le.length - 1
|
|
1070
1071
|
);
|
|
1071
1072
|
break;
|
|
1072
1073
|
case "Enter":
|
|
1073
|
-
j.preventDefault(), z >= 0 &&
|
|
1074
|
+
j.preventDefault(), z >= 0 && le[z] && X(le[z].value);
|
|
1074
1075
|
break;
|
|
1075
1076
|
}
|
|
1076
1077
|
}
|
|
1077
1078
|
},
|
|
1078
|
-
[
|
|
1079
|
+
[m, le, z, c]
|
|
1079
1080
|
), Y = T(() => {
|
|
1080
|
-
c || (
|
|
1081
|
-
}, [c,
|
|
1081
|
+
c || (S((j) => !j), m ? ($(""), O(-1)) : (L(!0), g?.()));
|
|
1082
|
+
}, [c, m, g]), X = T(
|
|
1082
1083
|
(j) => {
|
|
1083
|
-
x === void 0 &&
|
|
1084
|
+
x === void 0 && h(j), k?.(j), S(!1), L(!1), $(""), O(-1), E?.();
|
|
1084
1085
|
},
|
|
1085
|
-
[x, k,
|
|
1086
|
+
[x, k, E]
|
|
1086
1087
|
), U = T(
|
|
1087
1088
|
(j) => {
|
|
1088
|
-
j.stopPropagation(), !c && (x === void 0 &&
|
|
1089
|
+
j.stopPropagation(), !c && (x === void 0 && h(""), k?.(""), $(""), O(-1));
|
|
1089
1090
|
},
|
|
1090
1091
|
[x, k, c]
|
|
1091
|
-
),
|
|
1092
|
+
), te = T(
|
|
1092
1093
|
(j) => {
|
|
1093
|
-
$(j),
|
|
1094
|
+
$(j), F?.(j), O(0);
|
|
1094
1095
|
},
|
|
1095
|
-
[
|
|
1096
|
-
), se = J(() => 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]), pe = J(() => c ? "text-slate-400" : s ? "text-red-600" :
|
|
1096
|
+
[F]
|
|
1097
|
+
), se = J(() => 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]), pe = J(() => c ? "text-slate-400" : s ? "text-red-600" : m || P ? "text-black" : "text-slate-400", [c, s, m, P]);
|
|
1097
1098
|
return /* @__PURE__ */ o("div", { className: n("w-full", w), ref: D, children: [
|
|
1098
1099
|
t && /* @__PURE__ */ o(
|
|
1099
1100
|
"label",
|
|
@@ -1121,7 +1122,7 @@ const Ct = {
|
|
|
1121
1122
|
"div",
|
|
1122
1123
|
{
|
|
1123
1124
|
role: "combobox",
|
|
1124
|
-
"aria-expanded":
|
|
1125
|
+
"aria-expanded": m,
|
|
1125
1126
|
"aria-haspopup": "listbox",
|
|
1126
1127
|
"aria-controls": `${B}-listbox`,
|
|
1127
1128
|
"aria-disabled": c,
|
|
@@ -1147,13 +1148,13 @@ const Ct = {
|
|
|
1147
1148
|
children: l
|
|
1148
1149
|
}
|
|
1149
1150
|
),
|
|
1150
|
-
y &&
|
|
1151
|
+
y && m ? /* @__PURE__ */ e(
|
|
1151
1152
|
"input",
|
|
1152
1153
|
{
|
|
1153
1154
|
ref: H,
|
|
1154
1155
|
type: "text",
|
|
1155
1156
|
value: C,
|
|
1156
|
-
onChange: (j) =>
|
|
1157
|
+
onChange: (j) => te(j.target.value),
|
|
1157
1158
|
placeholder: a,
|
|
1158
1159
|
className: "w-full bg-transparent outline-none",
|
|
1159
1160
|
onClick: (j) => j.stopPropagation()
|
|
@@ -1165,7 +1166,7 @@ const Ct = {
|
|
|
1165
1166
|
"block truncate select-none",
|
|
1166
1167
|
!ee && !c && "text-slate-400"
|
|
1167
1168
|
),
|
|
1168
|
-
children:
|
|
1169
|
+
children: re?.label || a
|
|
1169
1170
|
}
|
|
1170
1171
|
),
|
|
1171
1172
|
v && ee && !c && /* @__PURE__ */ e(
|
|
@@ -1186,7 +1187,7 @@ const Ct = {
|
|
|
1186
1187
|
{
|
|
1187
1188
|
className: n(
|
|
1188
1189
|
"absolute top-1/2 right-3 -translate-y-1/2 pointer-events-none transition-all duration-300",
|
|
1189
|
-
|
|
1190
|
+
m && "rotate-180",
|
|
1190
1191
|
pe
|
|
1191
1192
|
),
|
|
1192
1193
|
children: /* @__PURE__ */ e(Me, { className: K.iconSize })
|
|
@@ -1195,7 +1196,7 @@ const Ct = {
|
|
|
1195
1196
|
]
|
|
1196
1197
|
}
|
|
1197
1198
|
),
|
|
1198
|
-
|
|
1199
|
+
m && !c && /* @__PURE__ */ e(
|
|
1199
1200
|
"div",
|
|
1200
1201
|
{
|
|
1201
1202
|
id: `${B}-listbox`,
|
|
@@ -1204,7 +1205,7 @@ const Ct = {
|
|
|
1204
1205
|
"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",
|
|
1205
1206
|
K.dropdown
|
|
1206
1207
|
),
|
|
1207
|
-
children:
|
|
1208
|
+
children: le.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-center text-base font-normal text-slate-500", children: "Ничего не найдено" }) : le.map((j) => /* @__PURE__ */ e(
|
|
1208
1209
|
"div",
|
|
1209
1210
|
{
|
|
1210
1211
|
role: "option",
|
|
@@ -1242,43 +1243,43 @@ function qt({
|
|
|
1242
1243
|
rowKey: k = "id",
|
|
1243
1244
|
rowSelection: g
|
|
1244
1245
|
}) {
|
|
1245
|
-
const [
|
|
1246
|
+
const [E, w] = V(
|
|
1246
1247
|
null
|
|
1247
|
-
), v = u ??
|
|
1248
|
-
const $ =
|
|
1248
|
+
), v = u ?? E, y = J(() => Array.isArray(a) ? a : [], [a]), F = J(() => !v || u ? y : [...y].sort((h, C) => {
|
|
1249
|
+
const $ = h[v.key], z = C[v.key];
|
|
1249
1250
|
return $ == null ? 1 : z == null ? -1 : $ < z ? v.direction === "asc" ? -1 : 1 : $ > z ? v.direction === "asc" ? 1 : -1 : 0;
|
|
1250
|
-
}), [y, v, u]), B = (
|
|
1251
|
-
if (!
|
|
1251
|
+
}), [y, v, u]), B = (h) => {
|
|
1252
|
+
if (!h.sortable) return;
|
|
1252
1253
|
let C = null;
|
|
1253
|
-
v?.key !==
|
|
1254
|
+
v?.key !== h.key ? C = { key: h.key, direction: "asc" } : v.direction === "asc" && (C = { key: h.key, direction: "desc" }), u !== void 0 ? s?.(C) : w(C);
|
|
1254
1255
|
};
|
|
1255
|
-
|
|
1256
|
+
ne(() => {
|
|
1256
1257
|
u !== void 0 && w(null);
|
|
1257
1258
|
}, [u]);
|
|
1258
|
-
const D = r ? [] : u ? y :
|
|
1259
|
+
const D = r ? [] : u ? y : F, m = (h) => {
|
|
1259
1260
|
if (!g) return;
|
|
1260
1261
|
const { onChange: C, getCheckboxProps: $ } = g;
|
|
1261
|
-
if (
|
|
1262
|
+
if (h.target.checked) {
|
|
1262
1263
|
const I = D.filter((H) => !$?.(H)?.disabled).map((H) => H[k]);
|
|
1263
1264
|
C(I);
|
|
1264
1265
|
} else
|
|
1265
1266
|
C([]);
|
|
1266
|
-
},
|
|
1267
|
+
}, S = (h, C) => {
|
|
1267
1268
|
if (!g) return;
|
|
1268
|
-
const { selectedRowKeys: $, onChange: z } = g, O =
|
|
1269
|
+
const { selectedRowKeys: $, onChange: z } = g, O = h[k];
|
|
1269
1270
|
let I;
|
|
1270
1271
|
C ? I = [...$, O] : I = $.filter((H) => H !== O), z(I);
|
|
1271
1272
|
}, P = J(() => {
|
|
1272
1273
|
if (!g || D.length === 0) return !1;
|
|
1273
|
-
const
|
|
1274
|
+
const h = D.filter(
|
|
1274
1275
|
(C) => !g.getCheckboxProps?.(C)?.disabled
|
|
1275
1276
|
);
|
|
1276
|
-
return
|
|
1277
|
+
return h.length === 0 ? !1 : h.every(
|
|
1277
1278
|
(C) => g.selectedRowKeys.includes(C[k])
|
|
1278
1279
|
);
|
|
1279
|
-
}, [g, D, k]), L = (
|
|
1280
|
+
}, [g, D, k]), L = (h) => h.sortable ? !v || v.key !== h.key ? /* @__PURE__ */ e(tt, { weight: "Linear", size: 20, className: "text-slate-base" }) : v.direction === "asc" ? /* @__PURE__ */ e(rt, { weight: "Linear", size: 20, className: "text-slate-base" }) : /* @__PURE__ */ e(nt, { weight: "Linear", size: 20, className: "text-slate-base" }) : null, R = () => /* @__PURE__ */ o("colgroup", { children: [
|
|
1280
1281
|
g && /* @__PURE__ */ e("col", { style: { width: 48 } }),
|
|
1281
|
-
t.map((
|
|
1282
|
+
t.map((h, C) => /* @__PURE__ */ e("col", { style: { width: h.width || "auto" } }, C))
|
|
1282
1283
|
] });
|
|
1283
1284
|
return /* @__PURE__ */ e(
|
|
1284
1285
|
"div",
|
|
@@ -1304,34 +1305,34 @@ function qt({
|
|
|
1304
1305
|
Ce,
|
|
1305
1306
|
{
|
|
1306
1307
|
checked: P,
|
|
1307
|
-
onChange:
|
|
1308
|
+
onChange: m,
|
|
1308
1309
|
variant: "yellow",
|
|
1309
1310
|
disabled: r || D.length === 0
|
|
1310
1311
|
}
|
|
1311
1312
|
) }) }),
|
|
1312
|
-
t?.map((
|
|
1313
|
+
t?.map((h, C) => /* @__PURE__ */ e(
|
|
1313
1314
|
"th",
|
|
1314
1315
|
{
|
|
1315
|
-
onClick: () => B(
|
|
1316
|
+
onClick: () => B(h),
|
|
1316
1317
|
className: n(
|
|
1317
1318
|
"px-4 py-3 text-left text-sm font-medium text-slate-700 transition-colors",
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1319
|
+
h.align === "center" && "text-center",
|
|
1320
|
+
h.align === "right" && "text-right",
|
|
1321
|
+
h.sortable && "cursor-pointer hover:bg-slate-200",
|
|
1321
1322
|
M
|
|
1322
1323
|
),
|
|
1323
1324
|
children: /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
1324
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", title:
|
|
1325
|
-
L(
|
|
1325
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", title: h.title, children: h.title }),
|
|
1326
|
+
L(h)
|
|
1326
1327
|
] })
|
|
1327
1328
|
},
|
|
1328
1329
|
C
|
|
1329
1330
|
))
|
|
1330
1331
|
] }) })
|
|
1331
1332
|
] }) }),
|
|
1332
|
-
/* @__PURE__ */ e("div", { className: "rounded-xl border border-t-0 border-slate-200 bg-white", children: /* @__PURE__ */ o("table", { className: "w-full table-fixed", children: [
|
|
1333
|
+
/* @__PURE__ */ e("div", { className: "rounded-xl border border-t-0 border-slate-200 bg-white overflow-hidden", children: /* @__PURE__ */ o("table", { className: "w-full table-fixed", children: [
|
|
1333
1334
|
R(),
|
|
1334
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-slate-200", children: r ? Array.from({ length: l }).map((
|
|
1335
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-slate-200", children: r ? Array.from({ length: l }).map((h, C) => /* @__PURE__ */ o("tr", { children: [
|
|
1335
1336
|
g && /* @__PURE__ */ e("td", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ e(je, { height: 20, width: 20, variant: "rounded" }) }),
|
|
1336
1337
|
t?.map(($, z) => /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ e(je, { height: 30, variant: "rounded" }) }, z))
|
|
1337
1338
|
] }, C)) : D.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: t.length + (g ? 1 : 0), className: "py-20", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center justify-center", children: [
|
|
@@ -1344,8 +1345,8 @@ function qt({
|
|
|
1344
1345
|
}
|
|
1345
1346
|
) }),
|
|
1346
1347
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-slate-400", children: f })
|
|
1347
|
-
] }) }) }) : D.map((
|
|
1348
|
-
const $ =
|
|
1348
|
+
] }) }) }) : D.map((h, C) => {
|
|
1349
|
+
const $ = h[k], z = g?.selectedRowKeys.includes($), O = g?.getCheckboxProps?.(h)?.disabled;
|
|
1349
1350
|
return /* @__PURE__ */ o(
|
|
1350
1351
|
"tr",
|
|
1351
1352
|
{
|
|
@@ -1357,11 +1358,11 @@ function qt({
|
|
|
1357
1358
|
checked: z,
|
|
1358
1359
|
disabled: O,
|
|
1359
1360
|
variant: "yellow",
|
|
1360
|
-
onChange: (I) =>
|
|
1361
|
+
onChange: (I) => S(h, I.target.checked)
|
|
1361
1362
|
}
|
|
1362
1363
|
) }) }),
|
|
1363
1364
|
t?.map((I, H) => {
|
|
1364
|
-
const q =
|
|
1365
|
+
const q = h[I.key];
|
|
1365
1366
|
return /* @__PURE__ */ e(
|
|
1366
1367
|
"td",
|
|
1367
1368
|
{
|
|
@@ -1377,7 +1378,7 @@ function qt({
|
|
|
1377
1378
|
{
|
|
1378
1379
|
className: "min-w-0 break-words whitespace-normal",
|
|
1379
1380
|
style: { overflowWrap: "break-word" },
|
|
1380
|
-
children: I.render ? I.render(q,
|
|
1381
|
+
children: I.render ? I.render(q, h) : String(q ?? "-")
|
|
1381
1382
|
}
|
|
1382
1383
|
)
|
|
1383
1384
|
},
|
|
@@ -1468,11 +1469,11 @@ const Dt = {
|
|
|
1468
1469
|
onFilesChange: x,
|
|
1469
1470
|
onUpload: k,
|
|
1470
1471
|
showPreview: g = !0,
|
|
1471
|
-
locale:
|
|
1472
|
+
locale: E = "uz",
|
|
1472
1473
|
showFileTypeIcon: w = !0,
|
|
1473
1474
|
customValidator: v
|
|
1474
1475
|
}) => {
|
|
1475
|
-
const [y,
|
|
1476
|
+
const [y, F] = V([]), [B, D] = V(!1), [m, S] = V(!1), P = ce(null), L = Dt[E], R = (p) => {
|
|
1476
1477
|
switch (p.type.split("/")[0]) {
|
|
1477
1478
|
case "image":
|
|
1478
1479
|
return /* @__PURE__ */ e(it, { className: "h-5 w-5 text-blue-500" });
|
|
@@ -1483,7 +1484,7 @@ const Dt = {
|
|
|
1483
1484
|
default:
|
|
1484
1485
|
return p.type.includes("pdf") ? /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-red-500" }) : p.type.includes("word") || p.type.includes("document") ? /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-blue-600" }) : p.type.includes("excel") || p.type.includes("spreadsheet") ? /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-green-600" }) : /* @__PURE__ */ e(at, { className: "h-5 w-5 text-gray-500" });
|
|
1485
1486
|
}
|
|
1486
|
-
},
|
|
1487
|
+
}, h = (p) => {
|
|
1487
1488
|
if (p === 0) return "0 Bytes";
|
|
1488
1489
|
const A = 1024, W = ["Bytes", "KB", "MB", "GB"], b = Math.floor(Math.log(p) / Math.log(A));
|
|
1489
1490
|
return parseFloat((p / Math.pow(A, b)).toFixed(2)) + " " + W[b];
|
|
@@ -1519,9 +1520,9 @@ const Dt = {
|
|
|
1519
1520
|
continue;
|
|
1520
1521
|
}
|
|
1521
1522
|
if (v) {
|
|
1522
|
-
const
|
|
1523
|
-
if (
|
|
1524
|
-
alert(
|
|
1523
|
+
const te = v(b);
|
|
1524
|
+
if (te) {
|
|
1525
|
+
alert(te);
|
|
1525
1526
|
continue;
|
|
1526
1527
|
}
|
|
1527
1528
|
}
|
|
@@ -1536,14 +1537,14 @@ const Dt = {
|
|
|
1536
1537
|
}
|
|
1537
1538
|
if (W.length > 0) {
|
|
1538
1539
|
const b = t ? [...y, ...W] : W;
|
|
1539
|
-
if (
|
|
1540
|
-
|
|
1540
|
+
if (F(b), x?.(b.map((Y) => Y.file)), k) {
|
|
1541
|
+
S(!0);
|
|
1541
1542
|
try {
|
|
1542
1543
|
const Y = b.map((X, U) => ({
|
|
1543
1544
|
...X,
|
|
1544
1545
|
progress: Math.min(100, (U + 1) / b.length * 100)
|
|
1545
1546
|
}));
|
|
1546
|
-
|
|
1547
|
+
F(Y), await k(Y), F(
|
|
1547
1548
|
(X) => X.map((U) => ({
|
|
1548
1549
|
...U,
|
|
1549
1550
|
status: "success",
|
|
@@ -1551,7 +1552,7 @@ const Dt = {
|
|
|
1551
1552
|
}))
|
|
1552
1553
|
);
|
|
1553
1554
|
} catch (Y) {
|
|
1554
|
-
|
|
1555
|
+
F(
|
|
1555
1556
|
(X) => X.map((U) => ({
|
|
1556
1557
|
...U,
|
|
1557
1558
|
status: "error",
|
|
@@ -1559,7 +1560,7 @@ const Dt = {
|
|
|
1559
1560
|
}))
|
|
1560
1561
|
);
|
|
1561
1562
|
} finally {
|
|
1562
|
-
|
|
1563
|
+
S(!1);
|
|
1563
1564
|
}
|
|
1564
1565
|
}
|
|
1565
1566
|
}
|
|
@@ -1590,7 +1591,7 @@ const Dt = {
|
|
|
1590
1591
|
A.length > 0 && O(A);
|
|
1591
1592
|
},
|
|
1592
1593
|
[f, O]
|
|
1593
|
-
),
|
|
1594
|
+
), re = T(
|
|
1594
1595
|
(p) => {
|
|
1595
1596
|
const A = p.target.files;
|
|
1596
1597
|
A && A.length > 0 && (O(A), P.current && (P.current.value = ""));
|
|
@@ -1598,15 +1599,15 @@ const Dt = {
|
|
|
1598
1599
|
[O]
|
|
1599
1600
|
), ee = T(
|
|
1600
1601
|
(p) => {
|
|
1601
|
-
|
|
1602
|
+
F((A) => {
|
|
1602
1603
|
const W = A.filter((b) => b.id !== p);
|
|
1603
1604
|
return x?.(W.map((b) => b.file)), W;
|
|
1604
1605
|
});
|
|
1605
1606
|
},
|
|
1606
1607
|
[x]
|
|
1607
1608
|
), K = T(() => {
|
|
1608
|
-
|
|
1609
|
-
}, [x]),
|
|
1609
|
+
F([]), x?.([]);
|
|
1610
|
+
}, [x]), le = T(() => {
|
|
1610
1611
|
P.current?.click();
|
|
1611
1612
|
}, []);
|
|
1612
1613
|
return /* @__PURE__ */ o("div", { className: n("w-full", M), children: [
|
|
@@ -1633,7 +1634,7 @@ const Dt = {
|
|
|
1633
1634
|
onDragOver: I,
|
|
1634
1635
|
onDragLeave: H,
|
|
1635
1636
|
onDrop: q,
|
|
1636
|
-
onClick:
|
|
1637
|
+
onClick: le,
|
|
1637
1638
|
children: [
|
|
1638
1639
|
/* @__PURE__ */ e(
|
|
1639
1640
|
"input",
|
|
@@ -1642,7 +1643,7 @@ const Dt = {
|
|
|
1642
1643
|
type: "file",
|
|
1643
1644
|
multiple: t,
|
|
1644
1645
|
accept: a,
|
|
1645
|
-
onChange:
|
|
1646
|
+
onChange: re,
|
|
1646
1647
|
disabled: f,
|
|
1647
1648
|
className: "hidden"
|
|
1648
1649
|
}
|
|
@@ -1685,7 +1686,7 @@ const Dt = {
|
|
|
1685
1686
|
{
|
|
1686
1687
|
type: "button",
|
|
1687
1688
|
onClick: K,
|
|
1688
|
-
disabled: f ||
|
|
1689
|
+
disabled: f || m,
|
|
1689
1690
|
className: "text-sm text-red-600 disabled:opacity-50",
|
|
1690
1691
|
children: L.clearAll
|
|
1691
1692
|
}
|
|
@@ -1711,7 +1712,7 @@ const Dt = {
|
|
|
1711
1712
|
/* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: [
|
|
1712
1713
|
/* @__PURE__ */ e("p", { className: "truncate text-sm font-medium text-slate-700", children: p.file.name }),
|
|
1713
1714
|
/* @__PURE__ */ o("div", { className: "flex items-center space-x-2 text-sm text-slate-400", children: [
|
|
1714
|
-
/* @__PURE__ */ e("span", { children:
|
|
1715
|
+
/* @__PURE__ */ e("span", { children: h(p.file.size) }),
|
|
1715
1716
|
p.status === "uploading" && /* @__PURE__ */ o("span", { className: "flex items-center", children: [
|
|
1716
1717
|
/* @__PURE__ */ e(Re, { className: "h-5 w-5 mr-1 animate-spin" }),
|
|
1717
1718
|
L.uploading
|
|
@@ -1741,7 +1742,7 @@ const Dt = {
|
|
|
1741
1742
|
onClick: (A) => {
|
|
1742
1743
|
A.stopPropagation(), ee(p.id);
|
|
1743
1744
|
},
|
|
1744
|
-
disabled: f ||
|
|
1745
|
+
disabled: f || m,
|
|
1745
1746
|
className: "text-slate-base transition-colors active:rotate-180 hover:cursor-pointer disabled:opacity-50",
|
|
1746
1747
|
children: /* @__PURE__ */ e(ue, { className: "h-6 w-6" })
|
|
1747
1748
|
}
|
|
@@ -1765,11 +1766,11 @@ function Jt({
|
|
|
1765
1766
|
handleClickOutside: c = !1
|
|
1766
1767
|
}) {
|
|
1767
1768
|
const M = ce(null), { handleEscape: x } = De(() => a(!1));
|
|
1768
|
-
|
|
1769
|
+
ne(() => (t ? (document.addEventListener("keydown", x), document.body.style.overflow = "hidden") : document.body.style.overflow = "unset", () => document.removeEventListener("keydown", x)), [t, x]);
|
|
1769
1770
|
const { handleClick: k } = Fe(M, () => {
|
|
1770
1771
|
c && a(!1);
|
|
1771
1772
|
});
|
|
1772
|
-
return
|
|
1773
|
+
return ne(() => (t && c && document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k)), [t, k, c]), /* @__PURE__ */ e(
|
|
1773
1774
|
"div",
|
|
1774
1775
|
{
|
|
1775
1776
|
className: n(
|
|
@@ -1821,16 +1822,16 @@ function Ht({
|
|
|
1821
1822
|
size: x = "large",
|
|
1822
1823
|
paginationClassName: k
|
|
1823
1824
|
}) {
|
|
1824
|
-
const g = Number.isFinite(t) && t > 0 ? t : 0,
|
|
1825
|
+
const g = Number.isFinite(t) && t > 0 ? t : 0, E = Number.isFinite(r) && r > 0 ? r : 10, w = Math.max(1, Number.isFinite(a) ? a : 1), v = Math.ceil(g / E);
|
|
1825
1826
|
if (v <= 1 || g === 0) return null;
|
|
1826
|
-
const
|
|
1827
|
-
const
|
|
1828
|
-
if (v <=
|
|
1829
|
-
return Array.from({ length: v }, (R,
|
|
1827
|
+
const F = (() => {
|
|
1828
|
+
const m = [], S = u * 2 + 5;
|
|
1829
|
+
if (v <= S)
|
|
1830
|
+
return Array.from({ length: v }, (R, h) => h + 1);
|
|
1830
1831
|
const P = Math.max(w - u, 2), L = Math.min(w + u, v - 1);
|
|
1831
|
-
|
|
1832
|
-
for (let R = P; R <= L; R++)
|
|
1833
|
-
return L < v - 1 &&
|
|
1832
|
+
m.push(1), P > 2 && m.push("...");
|
|
1833
|
+
for (let R = P; R <= L; R++) m.push(R);
|
|
1834
|
+
return L < v - 1 && m.push("..."), v > 1 && m.push(v), m;
|
|
1834
1835
|
})(), B = {
|
|
1835
1836
|
medium: "h-9 text-sm",
|
|
1836
1837
|
large: "h-10 text-base"
|
|
@@ -1864,14 +1865,14 @@ function Ht({
|
|
|
1864
1865
|
/* @__PURE__ */ e(
|
|
1865
1866
|
"select",
|
|
1866
1867
|
{
|
|
1867
|
-
value:
|
|
1868
|
-
onChange: (
|
|
1868
|
+
value: E,
|
|
1869
|
+
onChange: (m) => f(Number(m.target.value)),
|
|
1869
1870
|
className: n(
|
|
1870
1871
|
"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",
|
|
1871
1872
|
x === "large" ? "h-10" : "h-9"
|
|
1872
1873
|
),
|
|
1873
1874
|
"aria-label": "Количество строк на странице",
|
|
1874
|
-
children: s.map((
|
|
1875
|
+
children: s.map((m) => /* @__PURE__ */ e("option", { value: m, children: m }, m))
|
|
1875
1876
|
}
|
|
1876
1877
|
),
|
|
1877
1878
|
/* @__PURE__ */ e(
|
|
@@ -1899,8 +1900,8 @@ function Ht({
|
|
|
1899
1900
|
children: /* @__PURE__ */ e(ve, { weight: "Linear", size: 20 })
|
|
1900
1901
|
}
|
|
1901
1902
|
),
|
|
1902
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children:
|
|
1903
|
-
if (
|
|
1903
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: F.map((m, S) => {
|
|
1904
|
+
if (m === "...")
|
|
1904
1905
|
return /* @__PURE__ */ e(
|
|
1905
1906
|
"span",
|
|
1906
1907
|
{
|
|
@@ -1908,23 +1909,23 @@ function Ht({
|
|
|
1908
1909
|
"aria-hidden": "true",
|
|
1909
1910
|
children: /* @__PURE__ */ e(ct, { weight: "Bold", size: 20 })
|
|
1910
1911
|
},
|
|
1911
|
-
|
|
1912
|
+
S
|
|
1912
1913
|
);
|
|
1913
|
-
const P =
|
|
1914
|
+
const P = m === w;
|
|
1914
1915
|
return /* @__PURE__ */ e(
|
|
1915
1916
|
"button",
|
|
1916
1917
|
{
|
|
1917
|
-
onClick: () => l(
|
|
1918
|
-
"aria-label": `Страница ${
|
|
1918
|
+
onClick: () => l(m),
|
|
1919
|
+
"aria-label": `Страница ${m}${P ? ", текущая" : ""}`,
|
|
1919
1920
|
"aria-current": P ? "page" : void 0,
|
|
1920
1921
|
className: n(
|
|
1921
1922
|
"flex items-center justify-center rounded-lg border font-medium transition-all hover:cursor-pointer min-w-10 px-2",
|
|
1922
1923
|
B,
|
|
1923
1924
|
P ? D.active : D.inactive
|
|
1924
1925
|
),
|
|
1925
|
-
children:
|
|
1926
|
+
children: m
|
|
1926
1927
|
},
|
|
1927
|
-
|
|
1928
|
+
S
|
|
1928
1929
|
);
|
|
1929
1930
|
}) }),
|
|
1930
1931
|
/* @__PURE__ */ e(
|
|
@@ -1938,7 +1939,7 @@ function Ht({
|
|
|
1938
1939
|
B,
|
|
1939
1940
|
w === v ? n("cursor-not-allowed opacity-50", D.disabled) : n("hover:cursor-pointer", D.arrow, "border-slate-200")
|
|
1940
1941
|
),
|
|
1941
|
-
children: /* @__PURE__ */ e(
|
|
1942
|
+
children: /* @__PURE__ */ e(me, { size: 20, weight: "Linear" })
|
|
1942
1943
|
}
|
|
1943
1944
|
)
|
|
1944
1945
|
] })
|
|
@@ -1978,13 +1979,13 @@ function Kt({
|
|
|
1978
1979
|
extra: s,
|
|
1979
1980
|
onChange: c
|
|
1980
1981
|
}) {
|
|
1981
|
-
const [M, x] = V(a || t[0]?.id), [k, g] = V({}),
|
|
1982
|
+
const [M, x] = V(a || t[0]?.id), [k, g] = V({}), E = ce([]), w = () => {
|
|
1982
1983
|
requestAnimationFrame(() => {
|
|
1983
|
-
const D = t.findIndex((
|
|
1984
|
-
if (
|
|
1985
|
-
const { offsetLeft:
|
|
1984
|
+
const D = t.findIndex((S) => S?.id === M), m = E.current[D];
|
|
1985
|
+
if (m) {
|
|
1986
|
+
const { offsetLeft: S, offsetTop: P, offsetWidth: L, offsetHeight: R } = m;
|
|
1986
1987
|
g({
|
|
1987
|
-
left: `${
|
|
1988
|
+
left: `${S}px`,
|
|
1988
1989
|
top: `${P}px`,
|
|
1989
1990
|
width: `${L}px`,
|
|
1990
1991
|
height: `${R}px`,
|
|
@@ -1993,15 +1994,15 @@ function Kt({
|
|
|
1993
1994
|
}
|
|
1994
1995
|
});
|
|
1995
1996
|
};
|
|
1996
|
-
|
|
1997
|
-
|
|
1997
|
+
ne(() => (w(), window.addEventListener("resize", w), "fonts" in document && document.fonts.ready.then(w), () => window.removeEventListener("resize", w)), [M, r, t]), ne(() => {
|
|
1998
|
+
E.current = E.current.slice(0, t.length);
|
|
1998
1999
|
}, [t]);
|
|
1999
2000
|
const v = r === "left" || r === "right", y = {
|
|
2000
2001
|
top: "flex-col",
|
|
2001
2002
|
bottom: "flex-col-reverse",
|
|
2002
2003
|
left: "flex-row",
|
|
2003
2004
|
right: "flex-row-reverse"
|
|
2004
|
-
},
|
|
2005
|
+
}, F = {
|
|
2005
2006
|
top: "flex-row",
|
|
2006
2007
|
bottom: "flex-row",
|
|
2007
2008
|
left: "flex-col",
|
|
@@ -2022,7 +2023,7 @@ function Kt({
|
|
|
2022
2023
|
{
|
|
2023
2024
|
className: n(
|
|
2024
2025
|
"relative flex rounded-xl bg-slate-100 p-1",
|
|
2025
|
-
|
|
2026
|
+
F[r],
|
|
2026
2027
|
v ? "min-w-48" : "",
|
|
2027
2028
|
f
|
|
2028
2029
|
),
|
|
@@ -2037,13 +2038,13 @@ function Kt({
|
|
|
2037
2038
|
style: k
|
|
2038
2039
|
}
|
|
2039
2040
|
),
|
|
2040
|
-
t?.map((D,
|
|
2041
|
-
const
|
|
2041
|
+
t?.map((D, m) => {
|
|
2042
|
+
const S = M === D.id;
|
|
2042
2043
|
return /* @__PURE__ */ o(
|
|
2043
2044
|
"button",
|
|
2044
2045
|
{
|
|
2045
2046
|
ref: (P) => {
|
|
2046
|
-
|
|
2047
|
+
E.current[m] = P;
|
|
2047
2048
|
},
|
|
2048
2049
|
onClick: () => {
|
|
2049
2050
|
D?.disabled || (x(D?.id), c?.(D?.id));
|
|
@@ -2058,7 +2059,7 @@ function Kt({
|
|
|
2058
2059
|
D?.icon && /* @__PURE__ */ e(
|
|
2059
2060
|
"span",
|
|
2060
2061
|
{
|
|
2061
|
-
className: n("shrink-0 transition-transform duration-200",
|
|
2062
|
+
className: n("shrink-0 transition-transform duration-200", S && "scale-110"),
|
|
2062
2063
|
children: D?.icon
|
|
2063
2064
|
}
|
|
2064
2065
|
),
|
|
@@ -2152,7 +2153,7 @@ const Et = de(
|
|
|
2152
2153
|
name: x,
|
|
2153
2154
|
rows: M,
|
|
2154
2155
|
value: r,
|
|
2155
|
-
onChange: (
|
|
2156
|
+
onChange: (E) => l?.(E.target.value),
|
|
2156
2157
|
disabled: u,
|
|
2157
2158
|
placeholder: a,
|
|
2158
2159
|
className: n(
|
|
@@ -2186,7 +2187,7 @@ function jt({
|
|
|
2186
2187
|
onClose: u
|
|
2187
2188
|
}) {
|
|
2188
2189
|
const [s, c] = V(100);
|
|
2189
|
-
|
|
2190
|
+
ne(() => {
|
|
2190
2191
|
if (l === 1 / 0) {
|
|
2191
2192
|
c(100);
|
|
2192
2193
|
return;
|
|
@@ -2196,12 +2197,12 @@ function jt({
|
|
|
2196
2197
|
k || (k = w);
|
|
2197
2198
|
const v = w - k, y = Math.max(0, (l - v) / l * 100);
|
|
2198
2199
|
c(y), y > 0 ? requestAnimationFrame(g) : u?.();
|
|
2199
|
-
},
|
|
2200
|
-
return () => cancelAnimationFrame(
|
|
2200
|
+
}, E = requestAnimationFrame(g);
|
|
2201
|
+
return () => cancelAnimationFrame(E);
|
|
2201
2202
|
}, [l, u]);
|
|
2202
2203
|
const M = {
|
|
2203
|
-
success: /* @__PURE__ */ e(
|
|
2204
|
-
error: /* @__PURE__ */ e(
|
|
2204
|
+
success: /* @__PURE__ */ e(mt, { weight: "Bold", className: "w-5 h-5" }),
|
|
2205
|
+
error: /* @__PURE__ */ e(ht, { weight: "Bold", className: "w-5 h-5" }),
|
|
2205
2206
|
warning: /* @__PURE__ */ e(ft, { weight: "Bold", className: "w-5 h-5" }),
|
|
2206
2207
|
info: /* @__PURE__ */ e(ut, { weight: "Bold", className: "w-5 h-5" }),
|
|
2207
2208
|
loading: /* @__PURE__ */ e(dt, { weight: "Bold", className: "w-5 h-5 animate-spin" })
|
|
@@ -2468,29 +2469,29 @@ const It = de(
|
|
|
2468
2469
|
onBlur: x,
|
|
2469
2470
|
className: k,
|
|
2470
2471
|
name: g,
|
|
2471
|
-
showIcon:
|
|
2472
|
+
showIcon: E = !1
|
|
2472
2473
|
}, w) => {
|
|
2473
|
-
const [v, y] = V(!1),
|
|
2474
|
-
let
|
|
2475
|
-
|
|
2474
|
+
const [v, y] = V(!1), F = T((R) => {
|
|
2475
|
+
let h = R.replace(/\D/g, "");
|
|
2476
|
+
h.startsWith("998") || (h = "998" + h), h = h.substring(0, 12);
|
|
2476
2477
|
let C = "+998";
|
|
2477
|
-
return
|
|
2478
|
+
return h.length > 3 && (C += " (" + h.substring(3, 5)), h.length > 5 && (C += ") " + h.substring(5, 8)), h.length > 8 && (C += " " + h.substring(8, 10)), h.length > 10 && (C += " " + h.substring(10, 12)), C;
|
|
2478
2479
|
}, []), B = (R) => {
|
|
2479
|
-
const
|
|
2480
|
-
if (
|
|
2480
|
+
const h = R.target.value;
|
|
2481
|
+
if (h.length < 5) {
|
|
2481
2482
|
c?.("+998");
|
|
2482
2483
|
return;
|
|
2483
2484
|
}
|
|
2484
|
-
const C =
|
|
2485
|
+
const C = F(h);
|
|
2485
2486
|
c?.(C);
|
|
2486
2487
|
}, D = () => {
|
|
2487
2488
|
y(!0), (!s || s === "") && c?.("+998"), M?.();
|
|
2488
|
-
},
|
|
2489
|
+
}, m = () => {
|
|
2489
2490
|
y(!1), x?.();
|
|
2490
|
-
},
|
|
2491
|
+
}, S = J(() => ({
|
|
2491
2492
|
sm: {
|
|
2492
2493
|
input: "h-9 text-sm",
|
|
2493
|
-
padding:
|
|
2494
|
+
padding: E ? "pl-8 pr-2" : "px-2",
|
|
2494
2495
|
iconSize: "w-4 h-4",
|
|
2495
2496
|
iconLeft: "left-2",
|
|
2496
2497
|
labelFont: "text-sm",
|
|
@@ -2498,7 +2499,7 @@ const It = de(
|
|
|
2498
2499
|
},
|
|
2499
2500
|
md: {
|
|
2500
2501
|
input: "h-10 text-sm",
|
|
2501
|
-
padding:
|
|
2502
|
+
padding: E ? "pl-10 pr-4" : "px-4",
|
|
2502
2503
|
iconSize: "w-4 h-4",
|
|
2503
2504
|
iconLeft: "left-3",
|
|
2504
2505
|
labelFont: "text-base",
|
|
@@ -2506,28 +2507,28 @@ const It = de(
|
|
|
2506
2507
|
},
|
|
2507
2508
|
base: {
|
|
2508
2509
|
input: "h-12 text-base",
|
|
2509
|
-
padding:
|
|
2510
|
+
padding: E ? "pl-11 pr-4" : "px-4",
|
|
2510
2511
|
iconSize: "w-5 h-5",
|
|
2511
2512
|
iconLeft: "left-3",
|
|
2512
2513
|
labelFont: "text-base",
|
|
2513
2514
|
iconWrapper: "h-5"
|
|
2514
2515
|
}
|
|
2515
|
-
}), [
|
|
2516
|
+
}), [E]), P = J(() => 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 = J(() => f ? "text-slate-400" : l ? "text-red-600" : v ? "text-black" : "text-slate-400", [l, v, f]);
|
|
2516
2517
|
return /* @__PURE__ */ o("div", { className: n("w-full", k), children: [
|
|
2517
2518
|
t && /* @__PURE__ */ o("label", { className: n(
|
|
2518
2519
|
"mb-2 block font-medium transition-colors duration-200",
|
|
2519
2520
|
l ? "text-red-600" : v ? "text-blue-600" : "text-slate-700",
|
|
2520
|
-
|
|
2521
|
+
S[r].labelFont
|
|
2521
2522
|
), children: [
|
|
2522
2523
|
t,
|
|
2523
2524
|
u && /* @__PURE__ */ e("span", { className: "text-red-600 ml-1", children: "*" })
|
|
2524
2525
|
] }),
|
|
2525
2526
|
/* @__PURE__ */ o("div", { className: "relative flex items-center", children: [
|
|
2526
|
-
|
|
2527
|
+
E && /* @__PURE__ */ e("div", { className: n(
|
|
2527
2528
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center transition-all duration-300",
|
|
2528
|
-
|
|
2529
|
+
S[r].iconLeft,
|
|
2529
2530
|
L
|
|
2530
|
-
), children: /* @__PURE__ */ e("div", { className: n("flex items-center justify-center",
|
|
2531
|
+
), children: /* @__PURE__ */ e("div", { className: n("flex items-center justify-center", S[r].iconWrapper), children: /* @__PURE__ */ e(pt, { className: n(S[r].iconSize), weight: "Linear" }) }) }),
|
|
2531
2532
|
/* @__PURE__ */ e(
|
|
2532
2533
|
"input",
|
|
2533
2534
|
{
|
|
@@ -2537,15 +2538,15 @@ const It = de(
|
|
|
2537
2538
|
value: s,
|
|
2538
2539
|
onChange: B,
|
|
2539
2540
|
onFocus: D,
|
|
2540
|
-
onBlur:
|
|
2541
|
+
onBlur: m,
|
|
2541
2542
|
disabled: f,
|
|
2542
2543
|
placeholder: a,
|
|
2543
2544
|
className: n(
|
|
2544
2545
|
"w-full border bg-white font-normal transition-all duration-300 outline-none",
|
|
2545
2546
|
r === "base" ? "rounded-xl" : "rounded-lg",
|
|
2546
2547
|
"disabled:bg-slate-100 disabled:text-slate-400 disabled:cursor-not-allowed",
|
|
2547
|
-
|
|
2548
|
-
|
|
2548
|
+
S[r].input,
|
|
2549
|
+
S[r].padding,
|
|
2549
2550
|
P
|
|
2550
2551
|
)
|
|
2551
2552
|
}
|
|
@@ -2559,17 +2560,17 @@ It.displayName = "MciPhone";
|
|
|
2559
2560
|
const Rt = de(
|
|
2560
2561
|
({ mode: t, onChange: a, value: r, ...l }, f) => {
|
|
2561
2562
|
const [u, s] = V(""), c = r !== void 0 ? r : u, M = (g) => {
|
|
2562
|
-
const
|
|
2563
|
+
const E = g.replace(/\s/g, "").toUpperCase();
|
|
2563
2564
|
let w = "";
|
|
2564
|
-
for (let v = 0; v <
|
|
2565
|
-
const y =
|
|
2565
|
+
for (let v = 0; v < E.length; v++) {
|
|
2566
|
+
const y = E[v];
|
|
2566
2567
|
if (w.length < 2 ? /[A-Z]/.test(y) && (w += y) : /[0-9]/.test(y) && (w += y), w.length >= 9) break;
|
|
2567
2568
|
}
|
|
2568
2569
|
return w.length > 2 ? w.slice(0, 2) + " " + w.slice(2) : w;
|
|
2569
2570
|
}, x = (g) => g.replace(/\D/g, "").slice(0, 14), k = T((g) => {
|
|
2570
|
-
const
|
|
2571
|
+
const E = g.target.value;
|
|
2571
2572
|
let w = "";
|
|
2572
|
-
t === "passport" ? w = M(
|
|
2573
|
+
t === "passport" ? w = M(E) : w = x(E), r === void 0 && s(w), g.target.value = w, a?.(w, g);
|
|
2573
2574
|
}, [t, a, r]);
|
|
2574
2575
|
return /* @__PURE__ */ e(
|
|
2575
2576
|
Se,
|