@mci-ui/mci-ui 0.0.74 → 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 +501 -491
- package/dist/index.umd.js +1 -1
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -23,7 +23,7 @@ function qt({
|
|
|
23
23
|
variant: a = "blue",
|
|
24
24
|
className: r
|
|
25
25
|
}) {
|
|
26
|
-
const l = a === "blue",
|
|
26
|
+
const l = a === "blue", p = l ? "hover:text-blue-600" : "hover:text-yellow-500", d = l ? "text-blue-600" : "text-yellow-500";
|
|
27
27
|
return /* @__PURE__ */ e("nav", { className: n("flex items-center", r), "aria-label": "Breadcrumb", children: t.map((s, c) => {
|
|
28
28
|
const C = c === t.length - 1;
|
|
29
29
|
return /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
@@ -39,7 +39,7 @@ function qt({
|
|
|
39
39
|
},
|
|
40
40
|
className: n(
|
|
41
41
|
"flex items-center gap-x-2 transition-all text-sm font-normal text-slate-500",
|
|
42
|
-
|
|
42
|
+
p
|
|
43
43
|
),
|
|
44
44
|
children: [
|
|
45
45
|
s.icon,
|
|
@@ -56,20 +56,20 @@ function Kt({
|
|
|
56
56
|
text: a,
|
|
57
57
|
icon: r,
|
|
58
58
|
iconPosition: l = "left",
|
|
59
|
-
size:
|
|
59
|
+
size: p = "base",
|
|
60
60
|
variant: d = "primary",
|
|
61
61
|
color: s = "yellow",
|
|
62
62
|
loading: c = !1,
|
|
63
63
|
disabled: C = !1,
|
|
64
64
|
onClick: k,
|
|
65
|
-
className:
|
|
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)]",
|
|
@@ -87,20 +87,20 @@ function Kt({
|
|
|
87
87
|
return /* @__PURE__ */ i(
|
|
88
88
|
"button",
|
|
89
89
|
{
|
|
90
|
-
type:
|
|
90
|
+
type: D,
|
|
91
91
|
onClick: k,
|
|
92
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
|
-
!b &&
|
|
95
|
+
E[p],
|
|
96
|
+
m,
|
|
97
|
+
!b && m,
|
|
98
98
|
w,
|
|
99
|
-
|
|
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
105
|
c && /* @__PURE__ */ e(We, { weight: "Linear", size: 20, className: "animate-spin" })
|
|
106
106
|
]
|
|
@@ -124,51 +124,51 @@ const kt = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w
|
|
|
124
124
|
type: a = "checkbox",
|
|
125
125
|
label: r,
|
|
126
126
|
supportText: l,
|
|
127
|
-
checked:
|
|
127
|
+
checked: p,
|
|
128
128
|
onChange: d,
|
|
129
129
|
error: s,
|
|
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
|
-
() =>
|
|
139
|
-
[
|
|
137
|
+
const [E, v] = _(!1), u = a === "radio", m = Z(
|
|
138
|
+
() => p ?? E,
|
|
139
|
+
[p, E]
|
|
140
140
|
), b = R(
|
|
141
141
|
(y) => {
|
|
142
|
-
c || (
|
|
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 y = Ct[
|
|
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
|
-
!
|
|
162
|
+
m ? y.border : "border-slate-400",
|
|
163
|
+
!m && y.hover,
|
|
164
164
|
y.focus,
|
|
165
|
-
|
|
165
|
+
m && ""
|
|
166
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:
|
|
171
|
+
container: L,
|
|
172
172
|
dot: j,
|
|
173
173
|
check: ""
|
|
174
174
|
};
|
|
@@ -176,14 +176,14 @@ const kt = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w
|
|
|
176
176
|
return {
|
|
177
177
|
container: n(
|
|
178
178
|
"border transition-all duration-200",
|
|
179
|
-
|
|
180
|
-
!
|
|
179
|
+
m ? n(y.bg, y.border) : "border-slate-400",
|
|
180
|
+
!m && y.hover,
|
|
181
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 kt = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w
|
|
|
222
222
|
"input",
|
|
223
223
|
{
|
|
224
224
|
type: a,
|
|
225
|
-
checked:
|
|
225
|
+
checked: m,
|
|
226
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,16 +238,16 @@ const kt = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w
|
|
|
238
238
|
{
|
|
239
239
|
className: n(
|
|
240
240
|
"relative flex items-center justify-center",
|
|
241
|
-
|
|
241
|
+
u ? "w-5 h-5 rounded-full" : "w-5 h-5 rounded",
|
|
242
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
249
|
w.dot,
|
|
250
|
-
|
|
250
|
+
m ? "opacity-100 scale-100" : "opacity-0 scale-50"
|
|
251
251
|
)
|
|
252
252
|
}
|
|
253
253
|
) }) : /* @__PURE__ */ e(
|
|
@@ -256,17 +256,17 @@ const kt = (t) => /* @__PURE__ */ re.createElement("svg", { xmlns: "http://www.w
|
|
|
256
256
|
className: n(
|
|
257
257
|
"w-4 h-4 stroke-[2.5px] transition-opacity duration-200",
|
|
258
258
|
w.check,
|
|
259
|
-
|
|
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
272
|
Me.displayName = "MciCheck";
|
|
@@ -275,13 +275,13 @@ function Jt({
|
|
|
275
275
|
children: a,
|
|
276
276
|
defaultOpen: r = !1,
|
|
277
277
|
icon: l,
|
|
278
|
-
className:
|
|
278
|
+
className: p,
|
|
279
279
|
contentClassName: d
|
|
280
280
|
}) {
|
|
281
|
-
const [s, c] = _(r), [C, k] = _(0),
|
|
281
|
+
const [s, c] = _(r), [C, k] = _(0), M = le(null);
|
|
282
282
|
return J(() => {
|
|
283
|
-
|
|
284
|
-
}, [s]), /* @__PURE__ */ i("div", { className: n("overflow-hidden rounded-xl border border-slate-200",
|
|
283
|
+
M.current && k(s ? M.current.scrollHeight : 0);
|
|
284
|
+
}, [s]), /* @__PURE__ */ i("div", { className: n("overflow-hidden rounded-xl border border-slate-200", p), children: [
|
|
285
285
|
/* @__PURE__ */ i(
|
|
286
286
|
"button",
|
|
287
287
|
{
|
|
@@ -318,7 +318,7 @@ function Jt({
|
|
|
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
|
] });
|
|
@@ -329,28 +329,29 @@ function Gt({
|
|
|
329
329
|
onClose: a,
|
|
330
330
|
position: r = "right",
|
|
331
331
|
children: l,
|
|
332
|
-
footer:
|
|
332
|
+
footer: p,
|
|
333
333
|
title: d,
|
|
334
334
|
description: s,
|
|
335
335
|
showCloseButton: c = !0,
|
|
336
336
|
drawerClassName: C,
|
|
337
|
-
|
|
337
|
+
contentClassName: k,
|
|
338
|
+
closeOnOverlayClick: M = !0,
|
|
338
339
|
closeOnEscape: D = !0,
|
|
339
|
-
width:
|
|
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
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
|
-
),
|
|
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";
|
|
354
355
|
return /* @__PURE__ */ i(he, { children: [
|
|
355
356
|
/* @__PURE__ */ e(
|
|
356
357
|
"div",
|
|
@@ -359,24 +360,24 @@ function Gt({
|
|
|
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 Gt({
|
|
|
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,14 +402,23 @@ function Gt({
|
|
|
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
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
|
-
|
|
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
|
+
),
|
|
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
|
)
|
|
@@ -420,33 +430,33 @@ const Le = fe(
|
|
|
420
430
|
placeholder: a,
|
|
421
431
|
type: r = "text",
|
|
422
432
|
icon: l,
|
|
423
|
-
rightIcon:
|
|
433
|
+
rightIcon: p,
|
|
424
434
|
iconPosition: d = "left",
|
|
425
435
|
size: s = "base",
|
|
426
436
|
error: c,
|
|
427
437
|
disabled: C = !1,
|
|
428
438
|
required: k = !1,
|
|
429
|
-
value:
|
|
430
|
-
onChange:
|
|
431
|
-
onFocus:
|
|
432
|
-
onBlur:
|
|
439
|
+
value: M,
|
|
440
|
+
onChange: D,
|
|
441
|
+
onFocus: A,
|
|
442
|
+
onBlur: E,
|
|
433
443
|
className: v,
|
|
434
|
-
name:
|
|
435
|
-
maxLength:
|
|
444
|
+
name: u,
|
|
445
|
+
maxLength: m = 250,
|
|
436
446
|
onClear: b,
|
|
437
447
|
showClearButton: w = !1,
|
|
438
|
-
step:
|
|
448
|
+
step: h,
|
|
439
449
|
autoComplete: y = "off"
|
|
440
450
|
}, $) => {
|
|
441
|
-
const [
|
|
442
|
-
j(!0),
|
|
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?.();
|
|
443
453
|
}, ae = () => {
|
|
444
|
-
j(!1),
|
|
454
|
+
j(!1), E?.();
|
|
445
455
|
}, ce = (g) => {
|
|
446
456
|
let I = g.target.value;
|
|
447
|
-
r === "number" &&
|
|
457
|
+
r === "number" && m && I.length > m && (I = I.slice(0, m), g.target.value = I), M === void 0 && N(I), D?.(g);
|
|
448
458
|
}, ee = () => Y((g) => !g), de = () => {
|
|
449
|
-
|
|
459
|
+
M === void 0 && N(""), b?.();
|
|
450
460
|
}, z = Z(
|
|
451
461
|
() => ({
|
|
452
462
|
sm: {
|
|
@@ -478,12 +488,12 @@ const Le = fe(
|
|
|
478
488
|
}
|
|
479
489
|
}),
|
|
480
490
|
[W, Q]
|
|
481
|
-
), G = Z(() => c ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600", [c]), oe = Z(() => C ? "text-slate-400" : c ? "text-red-600" :
|
|
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]);
|
|
482
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",
|
|
@@ -500,7 +510,7 @@ const Le = fe(
|
|
|
500
510
|
"input",
|
|
501
511
|
{
|
|
502
512
|
ref: $,
|
|
503
|
-
name:
|
|
513
|
+
name: u,
|
|
504
514
|
type: B && T ? "text" : r,
|
|
505
515
|
value: q,
|
|
506
516
|
onChange: ce,
|
|
@@ -510,7 +520,7 @@ const Le = fe(
|
|
|
510
520
|
required: k,
|
|
511
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",
|
|
@@ -520,7 +530,7 @@ const Le = fe(
|
|
|
520
530
|
z[s].padding,
|
|
521
531
|
G
|
|
522
532
|
),
|
|
523
|
-
maxLength:
|
|
533
|
+
maxLength: m
|
|
524
534
|
}
|
|
525
535
|
),
|
|
526
536
|
W && /* @__PURE__ */ e(
|
|
@@ -564,7 +574,7 @@ const Le = fe(
|
|
|
564
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
580
|
className: n("flex items-center justify-center", z[s].iconWrapper),
|
|
@@ -576,13 +586,13 @@ const Le = fe(
|
|
|
576
586
|
z[s].icon,
|
|
577
587
|
oe
|
|
578
588
|
),
|
|
579
|
-
children:
|
|
589
|
+
children: p
|
|
580
590
|
}
|
|
581
591
|
)
|
|
582
592
|
}
|
|
583
593
|
),
|
|
584
594
|
B && /* @__PURE__ */ i(he, { children: [
|
|
585
|
-
|
|
595
|
+
p && /* @__PURE__ */ e(
|
|
586
596
|
"div",
|
|
587
597
|
{
|
|
588
598
|
className: n(
|
|
@@ -597,7 +607,7 @@ const Le = fe(
|
|
|
597
607
|
z[s].icon,
|
|
598
608
|
oe
|
|
599
609
|
),
|
|
600
|
-
children:
|
|
610
|
+
children: p
|
|
601
611
|
}
|
|
602
612
|
)
|
|
603
613
|
}
|
|
@@ -751,151 +761,151 @@ const Mt = {
|
|
|
751
761
|
value: a,
|
|
752
762
|
onChange: r,
|
|
753
763
|
placeholder: l,
|
|
754
|
-
label:
|
|
764
|
+
label: p,
|
|
755
765
|
disabled: d = !1,
|
|
756
766
|
required: s = !1,
|
|
757
767
|
className: c,
|
|
758
768
|
format: C = "DD.MM.YYYY",
|
|
759
769
|
minDate: k,
|
|
760
|
-
maxDate:
|
|
761
|
-
error:
|
|
762
|
-
showClear:
|
|
763
|
-
allowManualInput:
|
|
770
|
+
maxDate: M,
|
|
771
|
+
error: D,
|
|
772
|
+
showClear: A = !0,
|
|
773
|
+
allowManualInput: E = !0,
|
|
764
774
|
locale: v = "uz",
|
|
765
|
-
startView:
|
|
766
|
-
iconPosition:
|
|
775
|
+
startView: u = "day",
|
|
776
|
+
iconPosition: m = "left",
|
|
767
777
|
align: b = "auto"
|
|
768
778
|
}, w) => {
|
|
769
|
-
const [
|
|
779
|
+
const [h, y] = _(!1), [$, L] = _(
|
|
770
780
|
t === "range" ? [null, null] : null
|
|
771
|
-
), [j, o] = _([null, null]), N = R((
|
|
772
|
-
if (!
|
|
773
|
-
const x = new Date(
|
|
781
|
+
), [j, o] = _([null, null]), N = R((f) => {
|
|
782
|
+
if (!f) return null;
|
|
783
|
+
const x = new Date(f);
|
|
774
784
|
return isNaN(x.getTime()) ? null : x;
|
|
775
|
-
}, []), [T, Y] = _(/* @__PURE__ */ new Date()), [q, B] = _(
|
|
776
|
-
const
|
|
777
|
-
if (t === "date") return N(
|
|
778
|
-
const 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;
|
|
779
789
|
return [N(x[0]), N(x[1])];
|
|
780
|
-
}, [a, $, t, N]), de = Mt[v], z = R((
|
|
781
|
-
(
|
|
782
|
-
if (!
|
|
783
|
-
const x =
|
|
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();
|
|
784
794
|
return C.replace("DD", x).replace("MM", S).replace("YYYY", H.toString());
|
|
785
795
|
},
|
|
786
796
|
[C]
|
|
787
|
-
), oe = R((
|
|
788
|
-
if (!
|
|
789
|
-
const x =
|
|
797
|
+
), oe = R((f) => {
|
|
798
|
+
if (!f || f.length !== 10) return null;
|
|
799
|
+
const x = f.replace(/\D/g, "");
|
|
790
800
|
if (x.length !== 8) return null;
|
|
791
801
|
const S = parseInt(x.slice(0, 2), 10), H = parseInt(x.slice(2, 4), 10), V = parseInt(x.slice(4, 8), 10);
|
|
792
802
|
if (V < 1e3 || H < 1 || H > 12 || S < 1 || S > 31) return null;
|
|
793
803
|
const te = new Date(V, H - 1, S);
|
|
794
804
|
return te.getFullYear() !== V || te.getMonth() !== H - 1 || te.getDate() !== S ? null : te;
|
|
795
805
|
}, []), g = R(
|
|
796
|
-
(
|
|
797
|
-
const x = z(
|
|
798
|
-
return !!(k && x < z(k) ||
|
|
806
|
+
(f) => {
|
|
807
|
+
const x = z(f);
|
|
808
|
+
return !!(k && x < z(k) || M && x > z(M));
|
|
799
809
|
},
|
|
800
|
-
[k,
|
|
810
|
+
[k, M, z]
|
|
801
811
|
), I = Z(() => {
|
|
802
812
|
if (t === "date") return G(ee);
|
|
803
|
-
const [
|
|
804
|
-
return !
|
|
813
|
+
const [f, x] = ee;
|
|
814
|
+
return !f && !x ? "" : f && x ? `${G(f)} - ${G(x)}` : f ? `${G(f)} - ...` : "...";
|
|
805
815
|
}, [t, ee, G]);
|
|
806
816
|
J(() => {
|
|
807
|
-
|
|
808
|
-
}, [I,
|
|
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
|
-
Y(
|
|
824
|
+
const f = ee;
|
|
825
|
+
Y(f || /* @__PURE__ */ new Date());
|
|
816
826
|
}
|
|
817
|
-
}, [
|
|
818
|
-
if (
|
|
819
|
-
const
|
|
827
|
+
}, [h]), J(() => {
|
|
828
|
+
if (h && b === "auto" && ce.current) {
|
|
829
|
+
const f = ce.current.getBoundingClientRect(), x = window.innerWidth - f.right, S = f.left;
|
|
820
830
|
x < 300 && S > 300 ? ae("right") : ae("left");
|
|
821
831
|
}
|
|
822
|
-
}, [
|
|
832
|
+
}, [h, b]);
|
|
823
833
|
const O = R(() => {
|
|
824
|
-
y(!1), B(
|
|
825
|
-
}, [
|
|
826
|
-
d || (
|
|
827
|
-
}, [d]), { handleClick:
|
|
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
|
-
}, [
|
|
843
|
+
}, [h, F, X]);
|
|
834
844
|
const me = () => {
|
|
835
|
-
d ||
|
|
836
|
-
}, xe = (
|
|
845
|
+
d || h || (t === "range" || !E) && (y(!0), B(u));
|
|
846
|
+
}, xe = (f) => {
|
|
837
847
|
if (t !== "date") return;
|
|
838
|
-
let S =
|
|
848
|
+
let S = f.target.value.replace(/\D/g, "");
|
|
839
849
|
S.length > 8 && (S = S.slice(0, 8));
|
|
840
850
|
let H = "";
|
|
841
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) {
|
|
842
852
|
const V = oe(H);
|
|
843
|
-
V && !g(V) && (
|
|
844
|
-
} else H === "" && (
|
|
853
|
+
V && !g(V) && (L(V), r?.(V), Y(V));
|
|
854
|
+
} else H === "" && (L(null), r?.(null));
|
|
845
855
|
}, Ye = R(() => {
|
|
846
|
-
const
|
|
847
|
-
|
|
856
|
+
const f = t === "range" ? [null, null] : null;
|
|
857
|
+
L(f), o([null, null]), r?.(f), ne("");
|
|
848
858
|
}, [t, r]), Ue = R(
|
|
849
|
-
(
|
|
850
|
-
if (g(
|
|
851
|
-
const x = z(
|
|
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
865
|
const [S, H] = j;
|
|
856
866
|
if (!S && !H || S && H)
|
|
857
867
|
o([x, null]), ne(`${G(x)} - ...`);
|
|
858
868
|
else if (S && !H) {
|
|
859
869
|
const V = x < S ? [x, S] : [S, x];
|
|
860
|
-
o(V),
|
|
870
|
+
o(V), L(V), r?.(V);
|
|
861
871
|
const [te, ue] = V;
|
|
862
872
|
ne(`${G(te)} - ${G(ue)}`), O();
|
|
863
873
|
}
|
|
864
874
|
}
|
|
865
875
|
},
|
|
866
876
|
[t, j, g, z, r, O, G]
|
|
867
|
-
), _e = R((
|
|
868
|
-
const x = new Date(T.getFullYear(),
|
|
869
|
-
Y(x),
|
|
870
|
-
}, [T,
|
|
871
|
-
const x = new Date(
|
|
872
|
-
Y(x),
|
|
873
|
-
}, [T,
|
|
874
|
-
Y((x) => new Date(x.getFullYear(), x.getMonth() +
|
|
875
|
-
}, we = (
|
|
876
|
-
Y((x) => new Date(x.getFullYear() +
|
|
877
|
-
}, Ve = R((
|
|
878
|
-
const x =
|
|
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 = [];
|
|
879
889
|
for (let se = H; se > 0; se--) te.push({ date: new Date(x, S, 1 - se), isCurrentMonth: !1 });
|
|
880
890
|
for (let se = 1; se <= V; se++) te.push({ date: new Date(x, S, se), isCurrentMonth: !0 });
|
|
881
891
|
const ue = 42 - te.length;
|
|
882
892
|
for (let se = 1; se <= ue; se++) te.push({ date: new Date(x, S + 1, se), isCurrentMonth: !1 });
|
|
883
893
|
return te;
|
|
884
|
-
}, []), ve = R((
|
|
885
|
-
const x = z(
|
|
894
|
+
}, []), ve = R((f, x) => z(f).getTime() === z(x).getTime(), [z]), Ze = (f) => {
|
|
895
|
+
const x = z(f);
|
|
886
896
|
if (t === "date") return ee && ve(x, ee);
|
|
887
897
|
const [S] = j[0] ? j : ee;
|
|
888
898
|
return N(S) && ve(x, N(S));
|
|
889
|
-
}, qe = (
|
|
899
|
+
}, qe = (f) => {
|
|
890
900
|
if (t !== "range") return !1;
|
|
891
|
-
const x = z(
|
|
901
|
+
const x = z(f), [, S] = j[1] ? j : ee;
|
|
892
902
|
return N(S) && ve(x, N(S));
|
|
893
|
-
}, Ke = (
|
|
903
|
+
}, Ke = (f) => {
|
|
894
904
|
if (t !== "range") return !1;
|
|
895
|
-
const x = z(
|
|
905
|
+
const x = z(f), [S, H] = j[0] ? j : ee, V = N(S), te = N(H);
|
|
896
906
|
return V && !te ? !1 : V && te && x > z(V) && x < z(te);
|
|
897
|
-
}, Ie = (
|
|
898
|
-
const H = Ve(
|
|
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
911
|
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16", children: x && /* @__PURE__ */ i(he, { children: [
|
|
@@ -903,8 +913,8 @@ const Mt = {
|
|
|
903
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: de.months[
|
|
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
919
|
/* @__PURE__ */ e("div", { className: "flex gap-2 w-16 justify-end", children: S && /* @__PURE__ */ i(he, { children: [
|
|
910
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 }) }),
|
|
@@ -923,9 +933,9 @@ const Mt = {
|
|
|
923
933
|
/* @__PURE__ */ e("span", { className: "font-bold text-slate-800", children: T.getFullYear() }),
|
|
924
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: de.monthsShort.map((
|
|
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
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 }) }),
|
|
@@ -953,23 +963,23 @@ const Mt = {
|
|
|
953
963
|
/* @__PURE__ */ e("div", { ref: w, children: /* @__PURE__ */ e(
|
|
954
964
|
Le,
|
|
955
965
|
{
|
|
956
|
-
label:
|
|
966
|
+
label: p,
|
|
957
967
|
placeholder: Array.isArray(l) ? l[0] : l,
|
|
958
968
|
value: Q,
|
|
959
969
|
onChange: xe,
|
|
960
|
-
icon:
|
|
961
|
-
rightIcon:
|
|
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
976
|
onFocus: me,
|
|
967
|
-
readOnly: !
|
|
968
|
-
showClearButton:
|
|
977
|
+
readOnly: !E || t === "range",
|
|
978
|
+
showClearButton: A,
|
|
969
979
|
onClear: Ye
|
|
970
980
|
}
|
|
971
981
|
) }),
|
|
972
|
-
|
|
982
|
+
h && /* @__PURE__ */ e(
|
|
973
983
|
"div",
|
|
974
984
|
{
|
|
975
985
|
className: n(
|
|
@@ -980,7 +990,7 @@ const Mt = {
|
|
|
980
990
|
K === "center" && "left-1/2 -translate-x-1/2 origin-top"
|
|
981
991
|
),
|
|
982
992
|
style: { width: "max-content" },
|
|
983
|
-
onMouseDown: (
|
|
993
|
+
onMouseDown: (f) => f.stopPropagation(),
|
|
984
994
|
children: q === "day" ? /* @__PURE__ */ i(he, { children: [
|
|
985
995
|
Ie(T, !0, t !== "range"),
|
|
986
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) })
|
|
@@ -1031,83 +1041,83 @@ const St = {
|
|
|
1031
1041
|
placeholder: a = "Выберите...",
|
|
1032
1042
|
options: r = [],
|
|
1033
1043
|
icon: l,
|
|
1034
|
-
iconPosition:
|
|
1044
|
+
iconPosition: p = "left",
|
|
1035
1045
|
size: d = "base",
|
|
1036
1046
|
error: s,
|
|
1037
1047
|
disabled: c = !1,
|
|
1038
1048
|
required: C = !1,
|
|
1039
1049
|
value: k,
|
|
1040
|
-
onChange:
|
|
1041
|
-
onFocus:
|
|
1042
|
-
onBlur:
|
|
1043
|
-
className:
|
|
1050
|
+
onChange: M,
|
|
1051
|
+
onFocus: D,
|
|
1052
|
+
onBlur: A,
|
|
1053
|
+
className: E,
|
|
1044
1054
|
clearable: v = !1,
|
|
1045
|
-
searchable:
|
|
1046
|
-
onSearch:
|
|
1055
|
+
searchable: u = !1,
|
|
1056
|
+
onSearch: m,
|
|
1047
1057
|
name: b
|
|
1048
1058
|
}, w) => {
|
|
1049
|
-
const [
|
|
1050
|
-
if (!
|
|
1051
|
-
const
|
|
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
|
-
(X) => X.label.toLowerCase().includes(
|
|
1063
|
+
(X) => X.label.toLowerCase().includes(F)
|
|
1054
1064
|
);
|
|
1055
|
-
}, [r, N,
|
|
1056
|
-
y(!1),
|
|
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 (
|
|
1069
|
+
if (h)
|
|
1060
1070
|
return document.addEventListener("mousedown", ee), document.addEventListener("keydown", de), () => {
|
|
1061
1071
|
document.removeEventListener("mousedown", ee), document.removeEventListener("keydown", de);
|
|
1062
1072
|
};
|
|
1063
|
-
}, [
|
|
1064
|
-
|
|
1065
|
-
}, [
|
|
1073
|
+
}, [h, ee, de]), J(() => {
|
|
1074
|
+
h && u && P.current && P.current.focus();
|
|
1075
|
+
}, [h, u]);
|
|
1066
1076
|
const z = R(
|
|
1067
|
-
(
|
|
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
|
-
|
|
1086
|
+
F.preventDefault(), q(
|
|
1077
1087
|
(X) => X < ae.length - 1 ? X + 1 : 0
|
|
1078
1088
|
);
|
|
1079
1089
|
break;
|
|
1080
1090
|
case "ArrowUp":
|
|
1081
|
-
|
|
1091
|
+
F.preventDefault(), q(
|
|
1082
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
|
-
[
|
|
1101
|
+
[h, ae, Y, c]
|
|
1092
1102
|
), G = R(() => {
|
|
1093
|
-
c || (y((
|
|
1094
|
-
}, [c,
|
|
1095
|
-
(
|
|
1096
|
-
k === void 0 && o(
|
|
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,
|
|
1108
|
+
[k, M, A]
|
|
1099
1109
|
), g = R(
|
|
1100
|
-
(
|
|
1101
|
-
|
|
1110
|
+
(F) => {
|
|
1111
|
+
F.stopPropagation(), !c && (k === void 0 && o(""), M?.(""), T(""), q(-1));
|
|
1102
1112
|
},
|
|
1103
|
-
[k,
|
|
1113
|
+
[k, M, c]
|
|
1104
1114
|
), I = R(
|
|
1105
|
-
(
|
|
1106
|
-
T(
|
|
1115
|
+
(F) => {
|
|
1116
|
+
T(F), m?.(F), q(0);
|
|
1107
1117
|
},
|
|
1108
|
-
[
|
|
1109
|
-
), O = Z(() => c ? "border-slate-200 bg-slate-100 text-slate-400 cursor-not-allowed" : s ? "border-red-600 focus:border-red-600 shadow-red bg-white" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600 bg-white", [s, c]), U = Z(() => c ? "text-slate-400" : s ? "text-red-600" :
|
|
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
|
{
|
|
@@ -1134,7 +1144,7 @@ const St = {
|
|
|
1134
1144
|
"div",
|
|
1135
1145
|
{
|
|
1136
1146
|
role: "combobox",
|
|
1137
|
-
"aria-expanded":
|
|
1147
|
+
"aria-expanded": h,
|
|
1138
1148
|
"aria-haspopup": "listbox",
|
|
1139
1149
|
"aria-controls": `${b}-listbox`,
|
|
1140
1150
|
"aria-disabled": c,
|
|
@@ -1144,7 +1154,7 @@ const St = {
|
|
|
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
1156
|
K.container,
|
|
1147
|
-
l ?
|
|
1157
|
+
l ? p === "left" ? K.iconPaddingLeft : K.iconPaddingRight : K.padding,
|
|
1148
1158
|
O,
|
|
1149
1159
|
!c && $ && "shadow-blue border-blue-600"
|
|
1150
1160
|
),
|
|
@@ -1154,22 +1164,22 @@ const St = {
|
|
|
1154
1164
|
{
|
|
1155
1165
|
className: n(
|
|
1156
1166
|
"absolute top-1/2 -translate-y-1/2 pointer-events-none transition-colors duration-300",
|
|
1157
|
-
|
|
1167
|
+
p === "left" ? K.iconWrapper : K.rightIconWrapper,
|
|
1158
1168
|
U
|
|
1159
1169
|
),
|
|
1160
1170
|
children: l
|
|
1161
1171
|
}
|
|
1162
1172
|
),
|
|
1163
|
-
|
|
1173
|
+
u && h ? /* @__PURE__ */ e(
|
|
1164
1174
|
"input",
|
|
1165
1175
|
{
|
|
1166
1176
|
ref: P,
|
|
1167
1177
|
type: "text",
|
|
1168
1178
|
value: N,
|
|
1169
|
-
onChange: (
|
|
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",
|
|
@@ -1188,7 +1198,7 @@ const St = {
|
|
|
1188
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
|
-
l &&
|
|
1201
|
+
l && p === "left" ? "right-8" : "right-10"
|
|
1192
1202
|
),
|
|
1193
1203
|
"aria-label": "Очистить",
|
|
1194
1204
|
children: /* @__PURE__ */ e(pe, { className: K.iconSize })
|
|
@@ -1199,7 +1209,7 @@ const St = {
|
|
|
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
|
-
|
|
1212
|
+
h && "rotate-180",
|
|
1203
1213
|
U
|
|
1204
1214
|
),
|
|
1205
1215
|
children: /* @__PURE__ */ e(Fe, { className: K.iconSize })
|
|
@@ -1208,7 +1218,7 @@ const St = {
|
|
|
1208
1218
|
]
|
|
1209
1219
|
}
|
|
1210
1220
|
),
|
|
1211
|
-
|
|
1221
|
+
h && !c && /* @__PURE__ */ e(
|
|
1212
1222
|
"div",
|
|
1213
1223
|
{
|
|
1214
1224
|
id: `${b}-listbox`,
|
|
@@ -1217,19 +1227,19 @@ const St = {
|
|
|
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: ae.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-center text-base font-normal text-slate-500", children: "Ничего не найдено" }) : ae.map((
|
|
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": W ===
|
|
1225
|
-
onClick: () => oe(
|
|
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
|
-
W ===
|
|
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
|
)
|
|
@@ -1253,51 +1263,51 @@ function Xt({
|
|
|
1253
1263
|
data: a = [],
|
|
1254
1264
|
loading: r = !1,
|
|
1255
1265
|
skeletonRows: l = 5,
|
|
1256
|
-
noDataText:
|
|
1266
|
+
noDataText: p = "",
|
|
1257
1267
|
sort: d,
|
|
1258
1268
|
onSortChange: s,
|
|
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
|
-
), v = d ??
|
|
1277
|
+
), v = d ?? A, u = Z(() => Array.isArray(a) ? a : [], [a]), m = Z(() => !v || d ? u : [...u].sort((o, N) => {
|
|
1268
1278
|
const T = o[v.key], Y = N[v.key];
|
|
1269
1279
|
return T == null ? 1 : Y == null ? -1 : T < Y ? v.direction === "asc" ? -1 : 1 : T > Y ? v.direction === "asc" ? 1 : -1 : 0;
|
|
1270
|
-
}), [
|
|
1280
|
+
}), [u, v, d]);
|
|
1271
1281
|
J(() => {
|
|
1272
|
-
d !== void 0 &&
|
|
1282
|
+
d !== void 0 && E(null);
|
|
1273
1283
|
}, [d]);
|
|
1274
|
-
const b = r ? [] : d ?
|
|
1284
|
+
const b = r ? [] : d ? u : m, w = R(
|
|
1275
1285
|
(o) => {
|
|
1276
1286
|
if (!o.sortable) return;
|
|
1277
1287
|
let N = null;
|
|
1278
|
-
v?.key !== o.key ? N = { key: o.key, direction: "asc" } : v.direction === "asc" && (N = { key: o.key, direction: "desc" }), d !== void 0 ? s?.(N) :
|
|
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
1290
|
[v, d, s]
|
|
1281
|
-
),
|
|
1282
|
-
if (!
|
|
1283
|
-
const { onChange: N, getCheckboxProps: T } =
|
|
1291
|
+
), h = (o) => {
|
|
1292
|
+
if (!D) return;
|
|
1293
|
+
const { onChange: N, getCheckboxProps: T } = D;
|
|
1284
1294
|
if (o.target.checked) {
|
|
1285
|
-
const B = b.filter((P) => !T?.(P)?.disabled).map((P) => P[
|
|
1295
|
+
const B = b.filter((P) => !T?.(P)?.disabled).map((P) => P[M]);
|
|
1286
1296
|
N(B);
|
|
1287
1297
|
} else
|
|
1288
1298
|
N([]);
|
|
1289
1299
|
}, y = (o, N) => {
|
|
1290
|
-
if (!
|
|
1291
|
-
const { selectedRowKeys: T, onChange: Y } =
|
|
1300
|
+
if (!D) return;
|
|
1301
|
+
const { selectedRowKeys: T, onChange: Y } = D, q = o[M], B = N ? [...T, q] : T.filter((P) => P !== q);
|
|
1292
1302
|
Y(B);
|
|
1293
1303
|
}, $ = Z(() => {
|
|
1294
|
-
if (!
|
|
1295
|
-
const o = b.filter((N) => !
|
|
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
|
-
(N) =>
|
|
1307
|
+
(N) => D.selectedRowKeys.includes(N[M])
|
|
1298
1308
|
);
|
|
1299
|
-
}, [
|
|
1300
|
-
|
|
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 } }),
|
|
1301
1311
|
t.map((o) => /* @__PURE__ */ e("col", { style: { width: Ft(o.width) ?? "auto" } }, o.key))
|
|
1302
1312
|
] });
|
|
1303
1313
|
return /* @__PURE__ */ e(
|
|
@@ -1316,11 +1326,11 @@ function Xt({
|
|
|
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
|
-
|
|
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(
|
|
1320
1330
|
Me,
|
|
1321
1331
|
{
|
|
1322
1332
|
checked: $,
|
|
1323
|
-
onChange:
|
|
1333
|
+
onChange: h,
|
|
1324
1334
|
variant: "yellow",
|
|
1325
1335
|
disabled: r || b.length === 0
|
|
1326
1336
|
}
|
|
@@ -1339,7 +1349,7 @@ function Xt({
|
|
|
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
|
|
@@ -1349,15 +1359,15 @@ function Xt({
|
|
|
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
1360
|
j(),
|
|
1351
1361
|
/* @__PURE__ */ e("tbody", { className: "divide-y divide-slate-200", children: r ? Array.from({ length: l }).map((o, N) => /* @__PURE__ */ i("tr", { children: [
|
|
1352
|
-
|
|
1362
|
+
D && /* @__PURE__ */ e("td", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ e($e, { height: 20, width: 20, variant: "rounded" }) }),
|
|
1353
1363
|
t.map((T) => /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ e($e, { height: 30, variant: "rounded" }) }, T.key))
|
|
1354
|
-
] }, N)) : b.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: t.length + (
|
|
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
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-slate-400", children:
|
|
1366
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-slate-400", children: p })
|
|
1357
1367
|
] }) }) }) : b.map((o, N) => {
|
|
1358
|
-
const T = o[
|
|
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
|
-
|
|
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(
|
|
1361
1371
|
Me,
|
|
1362
1372
|
{
|
|
1363
1373
|
checked: Y,
|
|
@@ -1469,20 +1479,20 @@ const Lt = {
|
|
|
1469
1479
|
accept: a = "*/*",
|
|
1470
1480
|
maxSize: r = 10,
|
|
1471
1481
|
maxFiles: l = 5,
|
|
1472
|
-
disabled:
|
|
1482
|
+
disabled: p = !1,
|
|
1473
1483
|
label: d,
|
|
1474
1484
|
required: s = !1,
|
|
1475
1485
|
error: c,
|
|
1476
1486
|
className: C,
|
|
1477
1487
|
onFilesChange: k,
|
|
1478
|
-
onUpload:
|
|
1479
|
-
showPreview:
|
|
1480
|
-
locale:
|
|
1481
|
-
showFileTypeIcon:
|
|
1488
|
+
onUpload: M,
|
|
1489
|
+
showPreview: D = !0,
|
|
1490
|
+
locale: A = "uz",
|
|
1491
|
+
showFileTypeIcon: E = !0,
|
|
1482
1492
|
variant: v = "yellow",
|
|
1483
|
-
customValidator:
|
|
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",
|
|
@@ -1550,7 +1560,7 @@ const Lt = {
|
|
|
1550
1560
|
async (g) => {
|
|
1551
1561
|
const I = Array.from(g), O = [];
|
|
1552
1562
|
for (const U of I) {
|
|
1553
|
-
if (
|
|
1563
|
+
if (m.length + O.length >= l) {
|
|
1554
1564
|
alert(j.maxFilesError(l));
|
|
1555
1565
|
break;
|
|
1556
1566
|
}
|
|
@@ -1562,44 +1572,44 @@ const Lt = {
|
|
|
1562
1572
|
alert(j.fileTypeError(U.name));
|
|
1563
1573
|
continue;
|
|
1564
1574
|
}
|
|
1565
|
-
if (
|
|
1566
|
-
const xe =
|
|
1575
|
+
if (u) {
|
|
1576
|
+
const xe = u(U);
|
|
1567
1577
|
if (xe) {
|
|
1568
1578
|
alert(xe);
|
|
1569
1579
|
continue;
|
|
1570
1580
|
}
|
|
1571
1581
|
}
|
|
1572
|
-
const
|
|
1582
|
+
const F = await B(U), X = M ? "uploading" : "success", me = M ? 0 : 100;
|
|
1573
1583
|
O.push({
|
|
1574
1584
|
id: Math.random().toString(36).substr(2, 9),
|
|
1575
1585
|
file: U,
|
|
1576
|
-
preview:
|
|
1586
|
+
preview: F,
|
|
1577
1587
|
progress: me,
|
|
1578
1588
|
status: X
|
|
1579
1589
|
});
|
|
1580
1590
|
}
|
|
1581
1591
|
if (O.length > 0) {
|
|
1582
|
-
const U = t ? [...
|
|
1583
|
-
if (b(U), k?.(U.map((
|
|
1592
|
+
const U = t ? [...m, ...O] : O;
|
|
1593
|
+
if (b(U), k?.(U.map((F) => F.file)), M) {
|
|
1584
1594
|
$(!0);
|
|
1585
1595
|
try {
|
|
1586
|
-
const
|
|
1596
|
+
const F = U.map((X, me) => ({
|
|
1587
1597
|
...X,
|
|
1588
1598
|
progress: Math.min(100, (me + 1) / U.length * 100)
|
|
1589
1599
|
}));
|
|
1590
|
-
b(
|
|
1600
|
+
b(F), await M(F), b(
|
|
1591
1601
|
(X) => X.map((me) => ({
|
|
1592
1602
|
...me,
|
|
1593
1603
|
status: "success",
|
|
1594
1604
|
progress: 100
|
|
1595
1605
|
}))
|
|
1596
1606
|
);
|
|
1597
|
-
} catch (
|
|
1607
|
+
} catch (F) {
|
|
1598
1608
|
b(
|
|
1599
1609
|
(X) => X.map((me) => ({
|
|
1600
1610
|
...me,
|
|
1601
1611
|
status: "error",
|
|
1602
|
-
error:
|
|
1612
|
+
error: F instanceof Error ? F.message : j.uploadFailed
|
|
1603
1613
|
}))
|
|
1604
1614
|
);
|
|
1605
1615
|
} finally {
|
|
@@ -1609,35 +1619,35 @@ const Lt = {
|
|
|
1609
1619
|
}
|
|
1610
1620
|
},
|
|
1611
1621
|
[
|
|
1612
|
-
|
|
1622
|
+
m,
|
|
1613
1623
|
l,
|
|
1614
1624
|
Y,
|
|
1615
1625
|
q,
|
|
1616
|
-
|
|
1626
|
+
u,
|
|
1617
1627
|
j,
|
|
1618
1628
|
r,
|
|
1619
1629
|
t,
|
|
1620
1630
|
k,
|
|
1621
|
-
|
|
1631
|
+
M
|
|
1622
1632
|
]
|
|
1623
1633
|
), ae = R(
|
|
1624
1634
|
(g) => {
|
|
1625
|
-
g.preventDefault(),
|
|
1635
|
+
g.preventDefault(), p || h(!0);
|
|
1626
1636
|
},
|
|
1627
|
-
[
|
|
1637
|
+
[p]
|
|
1628
1638
|
), ce = R((g) => {
|
|
1629
|
-
g.preventDefault(),
|
|
1639
|
+
g.preventDefault(), h(!1);
|
|
1630
1640
|
}, []), ee = R(
|
|
1631
1641
|
(g) => {
|
|
1632
|
-
if (g.preventDefault(),
|
|
1642
|
+
if (g.preventDefault(), h(!1), p) return;
|
|
1633
1643
|
const I = g.dataTransfer.files;
|
|
1634
1644
|
I.length > 0 && K(I);
|
|
1635
1645
|
},
|
|
1636
|
-
[
|
|
1646
|
+
[p, K]
|
|
1637
1647
|
), de = R(
|
|
1638
1648
|
(g) => {
|
|
1639
1649
|
const I = g.target.files;
|
|
1640
|
-
I && I.length > 0 && (K(I),
|
|
1650
|
+
I && I.length > 0 && (K(I), L.current && (L.current.value = ""));
|
|
1641
1651
|
},
|
|
1642
1652
|
[K]
|
|
1643
1653
|
), z = R(
|
|
@@ -1651,7 +1661,7 @@ const Lt = {
|
|
|
1651
1661
|
), G = R(() => {
|
|
1652
1662
|
Q(), b([]), k?.([]);
|
|
1653
1663
|
}, [k, Q]), oe = R(() => {
|
|
1654
|
-
|
|
1664
|
+
L.current?.click();
|
|
1655
1665
|
}, []);
|
|
1656
1666
|
return /* @__PURE__ */ i("div", { className: n("w-full", C), children: [
|
|
1657
1667
|
d && /* @__PURE__ */ i(
|
|
@@ -1675,7 +1685,7 @@ const Lt = {
|
|
|
1675
1685
|
o.dropBorder,
|
|
1676
1686
|
o.dropBg,
|
|
1677
1687
|
w && o.dropActive,
|
|
1678
|
-
|
|
1688
|
+
p && "cursor-not-allowed opacity-60",
|
|
1679
1689
|
c && "border-red-600 bg-red-50/30"
|
|
1680
1690
|
),
|
|
1681
1691
|
onDragOver: ae,
|
|
@@ -1686,12 +1696,12 @@ const Lt = {
|
|
|
1686
1696
|
/* @__PURE__ */ e(
|
|
1687
1697
|
"input",
|
|
1688
1698
|
{
|
|
1689
|
-
ref:
|
|
1699
|
+
ref: L,
|
|
1690
1700
|
type: "file",
|
|
1691
1701
|
multiple: t,
|
|
1692
1702
|
accept: a,
|
|
1693
1703
|
onChange: de,
|
|
1694
|
-
disabled:
|
|
1704
|
+
disabled: p,
|
|
1695
1705
|
className: "hidden"
|
|
1696
1706
|
}
|
|
1697
1707
|
),
|
|
@@ -1703,27 +1713,27 @@ const Lt = {
|
|
|
1703
1713
|
]
|
|
1704
1714
|
}
|
|
1705
1715
|
),
|
|
1706
|
-
|
|
1716
|
+
m.length > 0 && /* @__PURE__ */ i("div", { className: "mt-4 space-y-3", children: [
|
|
1707
1717
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1708
1718
|
/* @__PURE__ */ i("span", { className: "text-sm font-medium text-slate-700", children: [
|
|
1709
1719
|
j.selectedFiles,
|
|
1710
1720
|
" (",
|
|
1711
|
-
|
|
1721
|
+
m.length,
|
|
1712
1722
|
")"
|
|
1713
1723
|
] }),
|
|
1714
|
-
|
|
1724
|
+
m.length > 1 && /* @__PURE__ */ e(
|
|
1715
1725
|
"button",
|
|
1716
1726
|
{
|
|
1717
1727
|
type: "button",
|
|
1718
1728
|
onClick: G,
|
|
1719
|
-
disabled:
|
|
1729
|
+
disabled: p || y,
|
|
1720
1730
|
className: "text-sm font-medium text-red-600 disabled:opacity-50",
|
|
1721
1731
|
children: j.clearAll
|
|
1722
1732
|
}
|
|
1723
1733
|
)
|
|
1724
1734
|
] }),
|
|
1725
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children:
|
|
1726
|
-
const O = !!g.preview ? o.fileIconImg : o.fileIconDoc, U =
|
|
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";
|
|
1727
1737
|
return /* @__PURE__ */ i(
|
|
1728
1738
|
"div",
|
|
1729
1739
|
{
|
|
@@ -1740,14 +1750,14 @@ const Lt = {
|
|
|
1740
1750
|
"flex h-14 w-14 items-center justify-center rounded-2xl",
|
|
1741
1751
|
O
|
|
1742
1752
|
),
|
|
1743
|
-
children:
|
|
1753
|
+
children: D && g.preview ? /* @__PURE__ */ e(
|
|
1744
1754
|
"img",
|
|
1745
1755
|
{
|
|
1746
1756
|
src: g.preview,
|
|
1747
1757
|
alt: g.file.name,
|
|
1748
1758
|
className: "h-10 w-10 rounded-xl object-cover"
|
|
1749
1759
|
}
|
|
1750
|
-
) :
|
|
1760
|
+
) : E ? N(g.file) : /* @__PURE__ */ e(Te, { className: "h-6 w-6 text-slate-500" })
|
|
1751
1761
|
}
|
|
1752
1762
|
),
|
|
1753
1763
|
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
@@ -1784,8 +1794,8 @@ const Lt = {
|
|
|
1784
1794
|
"button",
|
|
1785
1795
|
{
|
|
1786
1796
|
type: "button",
|
|
1787
|
-
onClick: (
|
|
1788
|
-
|
|
1797
|
+
onClick: (F) => {
|
|
1798
|
+
F.stopPropagation(), U || ne(g);
|
|
1789
1799
|
},
|
|
1790
1800
|
disabled: U,
|
|
1791
1801
|
className: "rounded-xl p-2 hover:bg-slate-100 hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -1797,10 +1807,10 @@ const Lt = {
|
|
|
1797
1807
|
"button",
|
|
1798
1808
|
{
|
|
1799
1809
|
type: "button",
|
|
1800
|
-
onClick: (
|
|
1801
|
-
|
|
1810
|
+
onClick: (F) => {
|
|
1811
|
+
F.stopPropagation(), z(g.id);
|
|
1802
1812
|
},
|
|
1803
|
-
disabled:
|
|
1813
|
+
disabled: p || y,
|
|
1804
1814
|
className: "rounded-xl p-2 text-slate-base hover:bg-slate-100 disabled:opacity-50 hover:cursor-pointer",
|
|
1805
1815
|
title: j.remove,
|
|
1806
1816
|
children: /* @__PURE__ */ e(pe, { className: "h-6 w-6" })
|
|
@@ -1821,24 +1831,24 @@ function er({
|
|
|
1821
1831
|
setShow: a,
|
|
1822
1832
|
title: r,
|
|
1823
1833
|
description: l,
|
|
1824
|
-
Header:
|
|
1834
|
+
Header: p,
|
|
1825
1835
|
Body: d,
|
|
1826
1836
|
footer: s,
|
|
1827
1837
|
handleClickOutside: c = !1,
|
|
1828
1838
|
showCloseIcon: C = !0,
|
|
1829
1839
|
showHeader: k = !0,
|
|
1830
|
-
overlayClassName:
|
|
1831
|
-
containerClassName:
|
|
1832
|
-
bodyClassName:
|
|
1833
|
-
footerClassName:
|
|
1840
|
+
overlayClassName: M,
|
|
1841
|
+
containerClassName: D,
|
|
1842
|
+
bodyClassName: A,
|
|
1843
|
+
footerClassName: E
|
|
1834
1844
|
}) {
|
|
1835
|
-
const v = le(null), { handleEscape:
|
|
1836
|
-
J(() => (t ? (document.addEventListener("keydown",
|
|
1837
|
-
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, () => {
|
|
1838
1848
|
c && a(!1);
|
|
1839
1849
|
});
|
|
1840
|
-
J(() => (t && c && document.addEventListener("mousedown",
|
|
1841
|
-
const w = k && !!(
|
|
1850
|
+
J(() => (t && c && document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m)), [t, m, c]);
|
|
1851
|
+
const w = k && !!(p || r || l);
|
|
1842
1852
|
return /* @__PURE__ */ e(
|
|
1843
1853
|
"div",
|
|
1844
1854
|
{
|
|
@@ -1846,7 +1856,7 @@ function er({
|
|
|
1846
1856
|
"bg-black/40 fixed inset-0 z-50 flex justify-center transition-all duration-500 ease-in-out",
|
|
1847
1857
|
"items-end sm:items-center",
|
|
1848
1858
|
t ? "opacity-100" : "pointer-events-none opacity-0",
|
|
1849
|
-
|
|
1859
|
+
M
|
|
1850
1860
|
),
|
|
1851
1861
|
children: /* @__PURE__ */ i(
|
|
1852
1862
|
"div",
|
|
@@ -1858,11 +1868,11 @@ function er({
|
|
|
1858
1868
|
"rounded-t-2xl sm:rounded-2xl",
|
|
1859
1869
|
"transition-all duration-500 ease-out",
|
|
1860
1870
|
t ? "scale-100 opacity-100" : "scale-95 opacity-0",
|
|
1861
|
-
|
|
1871
|
+
D
|
|
1862
1872
|
),
|
|
1863
1873
|
children: [
|
|
1864
1874
|
w && /* @__PURE__ */ i("div", { className: "border-b border-slate-200 flex items-start justify-between p-4 sm:p-6 mb-4", children: [
|
|
1865
|
-
|
|
1875
|
+
p || /* @__PURE__ */ i("div", { className: "block", children: [
|
|
1866
1876
|
/* @__PURE__ */ e("h2", { className: "text-h3 font-semibold text-black", children: r }),
|
|
1867
1877
|
l && /* @__PURE__ */ e("p", { className: "text-base text-slate-base font-normal mt-2", children: l })
|
|
1868
1878
|
] }),
|
|
@@ -1884,7 +1894,7 @@ function er({
|
|
|
1884
1894
|
"scrollbar-thin scrollbar-thumb-slate-200 overflow-y-auto",
|
|
1885
1895
|
"max-h-[70dvh] sm:max-h-96",
|
|
1886
1896
|
"px-4 sm:px-6 mb-2",
|
|
1887
|
-
|
|
1897
|
+
A
|
|
1888
1898
|
),
|
|
1889
1899
|
children: d
|
|
1890
1900
|
}
|
|
@@ -1895,7 +1905,7 @@ function er({
|
|
|
1895
1905
|
className: n(
|
|
1896
1906
|
"flex items-center justify-end gap-3 border-t border-slate-200",
|
|
1897
1907
|
"p-4 sm:p-6",
|
|
1898
|
-
|
|
1908
|
+
E
|
|
1899
1909
|
),
|
|
1900
1910
|
children: s
|
|
1901
1911
|
}
|
|
@@ -1911,24 +1921,24 @@ function tr({
|
|
|
1911
1921
|
currentPage: a,
|
|
1912
1922
|
perPage: r,
|
|
1913
1923
|
onPageChange: l,
|
|
1914
|
-
onPerPageChange:
|
|
1924
|
+
onPerPageChange: p,
|
|
1915
1925
|
siblingCount: d = 1,
|
|
1916
1926
|
perPageOptions: s = [10, 30, 50, 100],
|
|
1917
1927
|
showPerPage: c = !0,
|
|
1918
1928
|
variant: C = "yellow",
|
|
1919
1929
|
size: k = "large",
|
|
1920
|
-
paginationClassName:
|
|
1930
|
+
paginationClassName: M
|
|
1921
1931
|
}) {
|
|
1922
|
-
const
|
|
1923
|
-
if (v <= 1 ||
|
|
1924
|
-
const
|
|
1925
|
-
const
|
|
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;
|
|
1926
1936
|
if (v <= y)
|
|
1927
1937
|
return Array.from({ length: v }, (j, o) => o + 1);
|
|
1928
|
-
const $ = Math.max(
|
|
1929
|
-
|
|
1930
|
-
for (let j = $; j <=
|
|
1931
|
-
return
|
|
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;
|
|
1932
1942
|
})(), b = {
|
|
1933
1943
|
medium: "h-9 text-sm",
|
|
1934
1944
|
large: "h-10 text-base"
|
|
@@ -1948,9 +1958,9 @@ function tr({
|
|
|
1948
1958
|
}[C ?? "yellow"];
|
|
1949
1959
|
return /* @__PURE__ */ i("div", { className: n(
|
|
1950
1960
|
"flex items-center justify-between gap-4 w-full",
|
|
1951
|
-
|
|
1961
|
+
M
|
|
1952
1962
|
), children: [
|
|
1953
|
-
c &&
|
|
1963
|
+
c && p && /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1954
1964
|
/* @__PURE__ */ e(
|
|
1955
1965
|
"span",
|
|
1956
1966
|
{
|
|
@@ -1962,14 +1972,14 @@ function tr({
|
|
|
1962
1972
|
/* @__PURE__ */ e(
|
|
1963
1973
|
"select",
|
|
1964
1974
|
{
|
|
1965
|
-
value:
|
|
1966
|
-
onChange: (
|
|
1975
|
+
value: A,
|
|
1976
|
+
onChange: (h) => p(Number(h.target.value)),
|
|
1967
1977
|
className: n(
|
|
1968
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",
|
|
1969
1979
|
k === "large" ? "h-10" : "h-9"
|
|
1970
1980
|
),
|
|
1971
1981
|
"aria-label": "Количество строк на странице",
|
|
1972
|
-
children: s.map((
|
|
1982
|
+
children: s.map((h) => /* @__PURE__ */ e("option", { value: h, children: h }, h))
|
|
1973
1983
|
}
|
|
1974
1984
|
),
|
|
1975
1985
|
/* @__PURE__ */ e(
|
|
@@ -1986,19 +1996,19 @@ function tr({
|
|
|
1986
1996
|
/* @__PURE__ */ e(
|
|
1987
1997
|
"button",
|
|
1988
1998
|
{
|
|
1989
|
-
onClick: () => l(
|
|
1990
|
-
disabled:
|
|
1999
|
+
onClick: () => l(E - 1),
|
|
2000
|
+
disabled: E === 1,
|
|
1991
2001
|
"aria-label": "Предыдущая страница",
|
|
1992
2002
|
className: n(
|
|
1993
2003
|
"flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
|
|
1994
2004
|
b,
|
|
1995
|
-
|
|
2005
|
+
E === 1 ? n("cursor-not-allowed opacity-50", w.disabled) : n("hover:cursor-pointer", w.arrow, "border-slate-200")
|
|
1996
2006
|
),
|
|
1997
2007
|
children: /* @__PURE__ */ e(ke, { weight: "Linear", size: 20 })
|
|
1998
2008
|
}
|
|
1999
2009
|
),
|
|
2000
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children:
|
|
2001
|
-
if (
|
|
2010
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: m.map((h, y) => {
|
|
2011
|
+
if (h === "...")
|
|
2002
2012
|
return /* @__PURE__ */ e(
|
|
2003
2013
|
"span",
|
|
2004
2014
|
{
|
|
@@ -2008,19 +2018,19 @@ function tr({
|
|
|
2008
2018
|
},
|
|
2009
2019
|
y
|
|
2010
2020
|
);
|
|
2011
|
-
const $ =
|
|
2021
|
+
const $ = h === E;
|
|
2012
2022
|
return /* @__PURE__ */ e(
|
|
2013
2023
|
"button",
|
|
2014
2024
|
{
|
|
2015
|
-
onClick: () => l(
|
|
2016
|
-
"aria-label": `Страница ${
|
|
2025
|
+
onClick: () => l(h),
|
|
2026
|
+
"aria-label": `Страница ${h}${$ ? ", текущая" : ""}`,
|
|
2017
2027
|
"aria-current": $ ? "page" : void 0,
|
|
2018
2028
|
className: n(
|
|
2019
2029
|
"flex items-center justify-center rounded-lg border font-medium transition-all hover:cursor-pointer min-w-10 px-2",
|
|
2020
2030
|
b,
|
|
2021
2031
|
$ ? w.active : w.inactive
|
|
2022
2032
|
),
|
|
2023
|
-
children:
|
|
2033
|
+
children: h
|
|
2024
2034
|
},
|
|
2025
2035
|
y
|
|
2026
2036
|
);
|
|
@@ -2028,13 +2038,13 @@ function tr({
|
|
|
2028
2038
|
/* @__PURE__ */ e(
|
|
2029
2039
|
"button",
|
|
2030
2040
|
{
|
|
2031
|
-
onClick: () => l(
|
|
2032
|
-
disabled:
|
|
2041
|
+
onClick: () => l(E + 1),
|
|
2042
|
+
disabled: E === v,
|
|
2033
2043
|
"aria-label": "Следующая страница",
|
|
2034
2044
|
className: n(
|
|
2035
2045
|
"flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
|
|
2036
2046
|
b,
|
|
2037
|
-
|
|
2047
|
+
E === v ? n("cursor-not-allowed opacity-50", w.disabled) : n("hover:cursor-pointer", w.arrow, "border-slate-200")
|
|
2038
2048
|
),
|
|
2039
2049
|
children: /* @__PURE__ */ e(be, { size: 20, weight: "Linear" })
|
|
2040
2050
|
}
|
|
@@ -2071,35 +2081,35 @@ function rr({
|
|
|
2071
2081
|
defaultTab: a,
|
|
2072
2082
|
position: r = "top",
|
|
2073
2083
|
className: l,
|
|
2074
|
-
tabListClassName:
|
|
2084
|
+
tabListClassName: p,
|
|
2075
2085
|
contentClassName: d,
|
|
2076
2086
|
extra: s,
|
|
2077
2087
|
onChange: c
|
|
2078
2088
|
}) {
|
|
2079
|
-
const [C, k] = _(a || t[0]?.id), [
|
|
2089
|
+
const [C, k] = _(a || t[0]?.id), [M, D] = _({}), A = le([]), E = () => {
|
|
2080
2090
|
requestAnimationFrame(() => {
|
|
2081
|
-
const w = t.findIndex((y) => y?.id === C),
|
|
2082
|
-
if (
|
|
2083
|
-
const { offsetLeft: y, offsetTop: $, offsetWidth:
|
|
2084
|
-
|
|
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({
|
|
2085
2095
|
left: `${y}px`,
|
|
2086
2096
|
top: `${$}px`,
|
|
2087
|
-
width: `${
|
|
2097
|
+
width: `${L}px`,
|
|
2088
2098
|
height: `${j}px`,
|
|
2089
2099
|
transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
|
|
2090
2100
|
});
|
|
2091
2101
|
}
|
|
2092
2102
|
});
|
|
2093
2103
|
};
|
|
2094
|
-
J(() => (
|
|
2095
|
-
|
|
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);
|
|
2096
2106
|
}, [t]);
|
|
2097
|
-
const v = r === "left" || r === "right",
|
|
2107
|
+
const v = r === "left" || r === "right", u = {
|
|
2098
2108
|
top: "flex-col",
|
|
2099
2109
|
bottom: "flex-col-reverse",
|
|
2100
2110
|
left: "flex-row",
|
|
2101
2111
|
right: "flex-row-reverse"
|
|
2102
|
-
},
|
|
2112
|
+
}, m = {
|
|
2103
2113
|
top: "flex-row",
|
|
2104
2114
|
bottom: "flex-row",
|
|
2105
2115
|
left: "flex-col",
|
|
@@ -2110,7 +2120,7 @@ function rr({
|
|
|
2110
2120
|
left: "ml-4",
|
|
2111
2121
|
right: "mr-4"
|
|
2112
2122
|
};
|
|
2113
|
-
return /* @__PURE__ */ i("div", { className: n("flex w-full",
|
|
2123
|
+
return /* @__PURE__ */ i("div", { className: n("flex w-full", u[r], l), children: [
|
|
2114
2124
|
/* @__PURE__ */ i(
|
|
2115
2125
|
"div",
|
|
2116
2126
|
{
|
|
@@ -2131,26 +2141,26 @@ function rr({
|
|
|
2131
2141
|
{
|
|
2132
2142
|
className: n(
|
|
2133
2143
|
"relative flex rounded-xl bg-slate-100 p-1",
|
|
2134
|
-
|
|
2144
|
+
m[r],
|
|
2135
2145
|
!v && "w-full overflow-hidden",
|
|
2136
2146
|
v ? "min-w-48" : "",
|
|
2137
|
-
|
|
2147
|
+
p
|
|
2138
2148
|
),
|
|
2139
2149
|
children: [
|
|
2140
2150
|
/* @__PURE__ */ e(
|
|
2141
2151
|
"div",
|
|
2142
2152
|
{
|
|
2143
2153
|
className: n("absolute rounded-lg bg-white", v ? "w-full" : "h-full"),
|
|
2144
|
-
style:
|
|
2154
|
+
style: M
|
|
2145
2155
|
}
|
|
2146
2156
|
),
|
|
2147
|
-
t?.map((w,
|
|
2157
|
+
t?.map((w, h) => {
|
|
2148
2158
|
const y = C === w.id;
|
|
2149
2159
|
return /* @__PURE__ */ i(
|
|
2150
2160
|
"button",
|
|
2151
2161
|
{
|
|
2152
2162
|
ref: ($) => {
|
|
2153
|
-
|
|
2163
|
+
A.current[h] = $;
|
|
2154
2164
|
},
|
|
2155
2165
|
onClick: () => {
|
|
2156
2166
|
w?.disabled || (k(w?.id), c?.(w?.id));
|
|
@@ -2210,7 +2220,7 @@ function nr({
|
|
|
2210
2220
|
variant: a = "success",
|
|
2211
2221
|
size: r = "lg",
|
|
2212
2222
|
icon: l,
|
|
2213
|
-
iconPosition:
|
|
2223
|
+
iconPosition: p = "left",
|
|
2214
2224
|
className: d
|
|
2215
2225
|
}) {
|
|
2216
2226
|
return /* @__PURE__ */ i(
|
|
@@ -2224,9 +2234,9 @@ function nr({
|
|
|
2224
2234
|
d
|
|
2225
2235
|
),
|
|
2226
2236
|
children: [
|
|
2227
|
-
l &&
|
|
2237
|
+
l && p === "left" && /* @__PURE__ */ e("span", { className: `flex items-center ${n(Be[r])}`, children: l }),
|
|
2228
2238
|
/* @__PURE__ */ e("span", { children: t }),
|
|
2229
|
-
l &&
|
|
2239
|
+
l && p === "right" && /* @__PURE__ */ e("span", { className: `flex items-center ${n(Be[r])}`, children: l })
|
|
2230
2240
|
]
|
|
2231
2241
|
}
|
|
2232
2242
|
);
|
|
@@ -2237,14 +2247,14 @@ const Rt = fe(
|
|
|
2237
2247
|
placeholder: a,
|
|
2238
2248
|
value: r = "",
|
|
2239
2249
|
onChange: l,
|
|
2240
|
-
required:
|
|
2250
|
+
required: p = !1,
|
|
2241
2251
|
disabled: d = !1,
|
|
2242
2252
|
error: s,
|
|
2243
2253
|
className: c,
|
|
2244
2254
|
rows: C = 4,
|
|
2245
2255
|
name: k
|
|
2246
|
-
},
|
|
2247
|
-
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]);
|
|
2248
2258
|
return /* @__PURE__ */ i("div", { className: n("relative w-full", c), children: [
|
|
2249
2259
|
t && /* @__PURE__ */ i(
|
|
2250
2260
|
"label",
|
|
@@ -2255,24 +2265,24 @@ const Rt = fe(
|
|
|
2255
2265
|
),
|
|
2256
2266
|
children: [
|
|
2257
2267
|
t,
|
|
2258
|
-
|
|
2268
|
+
p && /* @__PURE__ */ e("span", { className: "ml-1 text-red-600", children: "*" })
|
|
2259
2269
|
]
|
|
2260
2270
|
}
|
|
2261
2271
|
),
|
|
2262
2272
|
/* @__PURE__ */ e(
|
|
2263
2273
|
"textarea",
|
|
2264
2274
|
{
|
|
2265
|
-
ref:
|
|
2275
|
+
ref: M,
|
|
2266
2276
|
name: k,
|
|
2267
2277
|
rows: C,
|
|
2268
2278
|
value: r,
|
|
2269
|
-
onChange: (
|
|
2279
|
+
onChange: (A) => l?.(A.target.value),
|
|
2270
2280
|
disabled: d,
|
|
2271
2281
|
placeholder: a,
|
|
2272
2282
|
className: n(
|
|
2273
2283
|
"w-full resize-none rounded-xl border bg-white text-base font-normal transition-all duration-300 ease-in-out outline-none",
|
|
2274
2284
|
"p-3 disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
|
|
2275
|
-
|
|
2285
|
+
D
|
|
2276
2286
|
)
|
|
2277
2287
|
}
|
|
2278
2288
|
),
|
|
@@ -2296,7 +2306,7 @@ function Bt({
|
|
|
2296
2306
|
description: a,
|
|
2297
2307
|
type: r = "info",
|
|
2298
2308
|
duration: l = 3e3,
|
|
2299
|
-
action:
|
|
2309
|
+
action: p,
|
|
2300
2310
|
onClose: d
|
|
2301
2311
|
}) {
|
|
2302
2312
|
const [s, c] = _(100);
|
|
@@ -2305,13 +2315,13 @@ function Bt({
|
|
|
2305
2315
|
c(100);
|
|
2306
2316
|
return;
|
|
2307
2317
|
}
|
|
2308
|
-
let
|
|
2309
|
-
const
|
|
2310
|
-
|
|
2311
|
-
const v =
|
|
2312
|
-
c(
|
|
2313
|
-
},
|
|
2314
|
-
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);
|
|
2315
2325
|
}, [l, d]);
|
|
2316
2326
|
const C = {
|
|
2317
2327
|
success: /* @__PURE__ */ e(gt, { weight: "Bold", className: "w-5 h-5" }),
|
|
@@ -2373,7 +2383,7 @@ function Bt({
|
|
|
2373
2383
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
2374
2384
|
/* @__PURE__ */ e("h4", { className: "text-base font-medium mb-1", children: t }),
|
|
2375
2385
|
a && /* @__PURE__ */ e("p", { className: "text-sm text-[#82828C]", children: a }),
|
|
2376
|
-
|
|
2386
|
+
p && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e("div", { className: n("underline font-medium text-sm", k.action[r]), children: p }) })
|
|
2377
2387
|
] }),
|
|
2378
2388
|
/* @__PURE__ */ e(
|
|
2379
2389
|
"button",
|
|
@@ -2390,8 +2400,8 @@ function Bt({
|
|
|
2390
2400
|
}
|
|
2391
2401
|
const ge = (t) => {
|
|
2392
2402
|
const a = $t++, r = () => {
|
|
2393
|
-
const
|
|
2394
|
-
|
|
2403
|
+
const p = Ce.findIndex((d) => d?.id === a);
|
|
2404
|
+
p !== -1 && (Ce.splice(p, 1), ze());
|
|
2395
2405
|
}, l = /* @__PURE__ */ e(Bt, { ...t, onClose: r });
|
|
2396
2406
|
return Ce.push({ id: a, element: l }), ze(), t.duration !== 1 / 0 && setTimeout(r, (t.duration || 3e3) + 300), { close: r };
|
|
2397
2407
|
}, lr = {
|
|
@@ -2423,7 +2433,7 @@ function ar({
|
|
|
2423
2433
|
children: a,
|
|
2424
2434
|
position: r = "top",
|
|
2425
2435
|
delay: l = 200,
|
|
2426
|
-
className:
|
|
2436
|
+
className: p
|
|
2427
2437
|
}) {
|
|
2428
2438
|
const d = {
|
|
2429
2439
|
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
@@ -2446,7 +2456,7 @@ function ar({
|
|
|
2446
2456
|
"scale-95 opacity-0 transition-all group-hover:scale-100 group-hover:opacity-100",
|
|
2447
2457
|
"duration-200 ease-out group-hover:delay-200",
|
|
2448
2458
|
d[r],
|
|
2449
|
-
|
|
2459
|
+
p
|
|
2450
2460
|
),
|
|
2451
2461
|
style: { transitionDelay: `${l}ms` },
|
|
2452
2462
|
children: [
|
|
@@ -2470,7 +2480,7 @@ function sr({
|
|
|
2470
2480
|
onChange: a,
|
|
2471
2481
|
disabled: r = !1,
|
|
2472
2482
|
variant: l = "yellow",
|
|
2473
|
-
label:
|
|
2483
|
+
label: p,
|
|
2474
2484
|
supportText: d,
|
|
2475
2485
|
className: s
|
|
2476
2486
|
}) {
|
|
@@ -2520,14 +2530,14 @@ function sr({
|
|
|
2520
2530
|
)
|
|
2521
2531
|
}
|
|
2522
2532
|
),
|
|
2523
|
-
(
|
|
2524
|
-
|
|
2533
|
+
(p || d) && /* @__PURE__ */ i("div", { className: "flex flex-col leading-tight", children: [
|
|
2534
|
+
p && /* @__PURE__ */ e(
|
|
2525
2535
|
"span",
|
|
2526
2536
|
{
|
|
2527
2537
|
className: n(
|
|
2528
2538
|
"text-base font-medium text-black"
|
|
2529
2539
|
),
|
|
2530
|
-
children:
|
|
2540
|
+
children: p
|
|
2531
2541
|
}
|
|
2532
2542
|
),
|
|
2533
2543
|
d && /* @__PURE__ */ e("span", { className: "text-sm font-normal text-slate-500", children: d })
|
|
@@ -2542,14 +2552,14 @@ function or({
|
|
|
2542
2552
|
size: a = 150,
|
|
2543
2553
|
iconClassName: r,
|
|
2544
2554
|
isLoading: l = !1,
|
|
2545
|
-
isFullPage:
|
|
2555
|
+
isFullPage: p = !0
|
|
2546
2556
|
}) {
|
|
2547
2557
|
return l ? /* @__PURE__ */ e(
|
|
2548
2558
|
"div",
|
|
2549
2559
|
{
|
|
2550
2560
|
className: n(
|
|
2551
2561
|
"z-[99px] flex flex-col items-center justify-center transition-all duration-300",
|
|
2552
|
-
|
|
2562
|
+
p ? "fixed inset-0 backdrop-blur-[2px]" : "absolute inset-0 w-full h-full rounded-[inherit]",
|
|
2553
2563
|
t
|
|
2554
2564
|
),
|
|
2555
2565
|
children: /* @__PURE__ */ e(
|
|
@@ -2574,17 +2584,17 @@ const Pt = fe(
|
|
|
2574
2584
|
placeholder: a = "+998 (__) ___ __ __",
|
|
2575
2585
|
size: r = "base",
|
|
2576
2586
|
error: l,
|
|
2577
|
-
disabled:
|
|
2587
|
+
disabled: p = !1,
|
|
2578
2588
|
required: d = !1,
|
|
2579
2589
|
value: s = "",
|
|
2580
2590
|
onChange: c,
|
|
2581
2591
|
onFocus: C,
|
|
2582
2592
|
onBlur: k,
|
|
2583
|
-
className:
|
|
2584
|
-
name:
|
|
2585
|
-
showIcon:
|
|
2586
|
-
},
|
|
2587
|
-
const [v,
|
|
2593
|
+
className: M,
|
|
2594
|
+
name: D,
|
|
2595
|
+
showIcon: A = !1
|
|
2596
|
+
}, E) => {
|
|
2597
|
+
const [v, u] = _(!1), m = R((j) => {
|
|
2588
2598
|
let o = j.replace(/\D/g, "");
|
|
2589
2599
|
o.startsWith("998") || (o = "998" + o), o = o.substring(0, 12);
|
|
2590
2600
|
let N = "+998";
|
|
@@ -2595,16 +2605,16 @@ const Pt = fe(
|
|
|
2595
2605
|
c?.("+998");
|
|
2596
2606
|
return;
|
|
2597
2607
|
}
|
|
2598
|
-
const N =
|
|
2608
|
+
const N = m(o);
|
|
2599
2609
|
c?.(N);
|
|
2600
2610
|
}, w = () => {
|
|
2601
|
-
|
|
2602
|
-
},
|
|
2603
|
-
|
|
2611
|
+
u(!0), (!s || s === "") && c?.("+998"), C?.();
|
|
2612
|
+
}, h = () => {
|
|
2613
|
+
u(!1), k?.();
|
|
2604
2614
|
}, y = Z(() => ({
|
|
2605
2615
|
sm: {
|
|
2606
2616
|
input: "h-9 text-sm",
|
|
2607
|
-
padding:
|
|
2617
|
+
padding: A ? "pl-8 pr-2" : "px-2",
|
|
2608
2618
|
iconSize: "w-4 h-4",
|
|
2609
2619
|
iconLeft: "left-2",
|
|
2610
2620
|
labelFont: "text-sm",
|
|
@@ -2612,7 +2622,7 @@ const Pt = fe(
|
|
|
2612
2622
|
},
|
|
2613
2623
|
md: {
|
|
2614
2624
|
input: "h-10 text-sm",
|
|
2615
|
-
padding:
|
|
2625
|
+
padding: A ? "pl-10 pr-4" : "px-4",
|
|
2616
2626
|
iconSize: "w-4 h-4",
|
|
2617
2627
|
iconLeft: "left-3",
|
|
2618
2628
|
labelFont: "text-base",
|
|
@@ -2620,14 +2630,14 @@ const Pt = fe(
|
|
|
2620
2630
|
},
|
|
2621
2631
|
base: {
|
|
2622
2632
|
input: "h-12 text-base",
|
|
2623
|
-
padding:
|
|
2633
|
+
padding: A ? "pl-11 pr-4" : "px-4",
|
|
2624
2634
|
iconSize: "w-5 h-5",
|
|
2625
2635
|
iconLeft: "left-3",
|
|
2626
2636
|
labelFont: "text-base",
|
|
2627
2637
|
iconWrapper: "h-5"
|
|
2628
2638
|
}
|
|
2629
|
-
}), [
|
|
2630
|
-
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: [
|
|
2631
2641
|
t && /* @__PURE__ */ i("label", { className: n(
|
|
2632
2642
|
"mb-2 block font-medium transition-colors duration-200",
|
|
2633
2643
|
l ? "text-red-600" : v ? "text-blue-600" : "text-slate-700",
|
|
@@ -2637,22 +2647,22 @@ const Pt = fe(
|
|
|
2637
2647
|
d && /* @__PURE__ */ e("span", { className: "text-red-600 ml-1", children: "*" })
|
|
2638
2648
|
] }),
|
|
2639
2649
|
/* @__PURE__ */ i("div", { className: "relative flex items-center", children: [
|
|
2640
|
-
|
|
2650
|
+
A && /* @__PURE__ */ e("div", { className: n(
|
|
2641
2651
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center transition-all duration-300",
|
|
2642
2652
|
y[r].iconLeft,
|
|
2643
|
-
|
|
2653
|
+
L
|
|
2644
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" }) }) }),
|
|
2645
2655
|
/* @__PURE__ */ e(
|
|
2646
2656
|
"input",
|
|
2647
2657
|
{
|
|
2648
|
-
ref:
|
|
2649
|
-
name:
|
|
2658
|
+
ref: E,
|
|
2659
|
+
name: D,
|
|
2650
2660
|
type: "tel",
|
|
2651
2661
|
value: s,
|
|
2652
2662
|
onChange: b,
|
|
2653
2663
|
onFocus: w,
|
|
2654
|
-
onBlur:
|
|
2655
|
-
disabled:
|
|
2664
|
+
onBlur: h,
|
|
2665
|
+
disabled: p,
|
|
2656
2666
|
placeholder: a,
|
|
2657
2667
|
className: n(
|
|
2658
2668
|
"w-full border bg-white font-normal transition-all duration-300 outline-none",
|
|
@@ -2671,23 +2681,23 @@ const Pt = fe(
|
|
|
2671
2681
|
);
|
|
2672
2682
|
Pt.displayName = "MciPhone";
|
|
2673
2683
|
const Wt = fe(
|
|
2674
|
-
({ mode: t, onChange: a, value: r, ...l },
|
|
2684
|
+
({ mode: t, onChange: a, value: r, ...l }, p) => {
|
|
2675
2685
|
const [d, s] = _(""), c = r !== void 0 ? r : d, C = (v) => {
|
|
2676
|
-
const
|
|
2677
|
-
let
|
|
2678
|
-
for (let b = 0; b <
|
|
2679
|
-
const w =
|
|
2680
|
-
if (
|
|
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;
|
|
2681
2691
|
}
|
|
2682
|
-
return
|
|
2683
|
-
}, k = (v) => v.replace(/\D/g, "").slice(0, 14),
|
|
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(
|
|
2684
2694
|
(v) => {
|
|
2685
|
-
const
|
|
2686
|
-
let
|
|
2687
|
-
t === "passport" ?
|
|
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);
|
|
2688
2698
|
},
|
|
2689
2699
|
[t, a, r]
|
|
2690
|
-
),
|
|
2700
|
+
), A = () => {
|
|
2691
2701
|
if (l.placeholder) return l.placeholder;
|
|
2692
2702
|
switch (t) {
|
|
2693
2703
|
case "passport":
|
|
@@ -2703,10 +2713,10 @@ const Wt = fe(
|
|
|
2703
2713
|
return /* @__PURE__ */ e(
|
|
2704
2714
|
Le,
|
|
2705
2715
|
{
|
|
2706
|
-
ref:
|
|
2716
|
+
ref: p,
|
|
2707
2717
|
...l,
|
|
2708
2718
|
value: c,
|
|
2709
|
-
onChange:
|
|
2719
|
+
onChange: D,
|
|
2710
2720
|
maxLength: (() => {
|
|
2711
2721
|
if (l.maxLength) return l.maxLength;
|
|
2712
2722
|
switch (t) {
|
|
@@ -2720,7 +2730,7 @@ const Wt = fe(
|
|
|
2720
2730
|
return 255;
|
|
2721
2731
|
}
|
|
2722
2732
|
})(),
|
|
2723
|
-
placeholder:
|
|
2733
|
+
placeholder: A()
|
|
2724
2734
|
}
|
|
2725
2735
|
);
|
|
2726
2736
|
}
|
|
@@ -2731,7 +2741,7 @@ function ir({
|
|
|
2731
2741
|
onClose: a,
|
|
2732
2742
|
columns: r,
|
|
2733
2743
|
hidden: l,
|
|
2734
|
-
onToggle:
|
|
2744
|
+
onToggle: p,
|
|
2735
2745
|
onMove: d,
|
|
2736
2746
|
minVisible: s = 5
|
|
2737
2747
|
}) {
|
|
@@ -2740,13 +2750,13 @@ function ir({
|
|
|
2740
2750
|
if (t)
|
|
2741
2751
|
return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
|
|
2742
2752
|
}, [t, C]);
|
|
2743
|
-
const k = Z(() => new Set(l), [l]),
|
|
2753
|
+
const k = Z(() => new Set(l), [l]), M = Z(() => {
|
|
2744
2754
|
let o = 0;
|
|
2745
2755
|
for (const N of r) k.has(N.key) || o++;
|
|
2746
2756
|
return o;
|
|
2747
|
-
}, [r, k]),
|
|
2748
|
-
|
|
2749
|
-
w.current = null,
|
|
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);
|
|
2750
2760
|
}));
|
|
2751
2761
|
}, []);
|
|
2752
2762
|
J(() => () => {
|
|
@@ -2754,23 +2764,23 @@ function ir({
|
|
|
2754
2764
|
}, []);
|
|
2755
2765
|
const y = R(
|
|
2756
2766
|
(o) => {
|
|
2757
|
-
|
|
2767
|
+
E.current = !0, D.current = o, b(r[o]?.key ?? null);
|
|
2758
2768
|
},
|
|
2759
2769
|
[r]
|
|
2760
2770
|
), $ = R(() => {
|
|
2761
|
-
|
|
2771
|
+
E.current = !1;
|
|
2762
2772
|
}, []);
|
|
2763
2773
|
J(() => {
|
|
2764
2774
|
if (t)
|
|
2765
2775
|
return document.addEventListener("mouseup", $), () => document.removeEventListener("mouseup", $);
|
|
2766
2776
|
}, [t, $]);
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2769
|
-
}, [
|
|
2777
|
+
const L = R(() => {
|
|
2778
|
+
D.current = null, E.current = !1, b(null), h(null);
|
|
2779
|
+
}, [h]), j = R(
|
|
2770
2780
|
(o, N) => {
|
|
2771
|
-
N ||
|
|
2781
|
+
N || p(o);
|
|
2772
2782
|
},
|
|
2773
|
-
[
|
|
2783
|
+
[p]
|
|
2774
2784
|
);
|
|
2775
2785
|
return t ? /* @__PURE__ */ i(
|
|
2776
2786
|
"div",
|
|
@@ -2808,33 +2818,33 @@ function ir({
|
|
|
2808
2818
|
"hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
|
|
2809
2819
|
),
|
|
2810
2820
|
children: r.map((o, N) => {
|
|
2811
|
-
const T = !k.has(o.key), Y = T &&
|
|
2821
|
+
const T = !k.has(o.key), Y = T && M <= s, q = v === N, B = m === o.key;
|
|
2812
2822
|
return /* @__PURE__ */ i("div", { children: [
|
|
2813
2823
|
/* @__PURE__ */ i(
|
|
2814
2824
|
"div",
|
|
2815
2825
|
{
|
|
2816
2826
|
draggable: !0,
|
|
2817
2827
|
onDragStart: (P) => {
|
|
2818
|
-
if (!
|
|
2828
|
+
if (!E.current) {
|
|
2819
2829
|
P.preventDefault();
|
|
2820
2830
|
return;
|
|
2821
2831
|
}
|
|
2822
|
-
P.dataTransfer.setData("text/plain", String(N)), P.dataTransfer.effectAllowed = "move", b(o.key),
|
|
2832
|
+
P.dataTransfer.setData("text/plain", String(N)), P.dataTransfer.effectAllowed = "move", b(o.key), h(null);
|
|
2823
2833
|
const W = new Image();
|
|
2824
2834
|
W.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", P.dataTransfer.setDragImage(W, 0, 0);
|
|
2825
2835
|
},
|
|
2826
2836
|
onDragOver: (P) => {
|
|
2827
|
-
|
|
2837
|
+
D.current != null && (P.preventDefault(), P.dataTransfer.dropEffect = "move", h(N));
|
|
2828
2838
|
},
|
|
2829
2839
|
onDragLeave: () => {
|
|
2830
|
-
|
|
2840
|
+
A.current === N && h(null);
|
|
2831
2841
|
},
|
|
2832
2842
|
onDrop: (P) => {
|
|
2833
2843
|
P.preventDefault();
|
|
2834
|
-
const W =
|
|
2835
|
-
Number.isFinite(W) && W !== N && d(W, N),
|
|
2844
|
+
const W = D.current ?? Number(P.dataTransfer.getData("text/plain"));
|
|
2845
|
+
Number.isFinite(W) && W !== N && d(W, N), L();
|
|
2836
2846
|
},
|
|
2837
|
-
onDragEnd:
|
|
2847
|
+
onDragEnd: L,
|
|
2838
2848
|
className: n(
|
|
2839
2849
|
"group flex items-center py-2 px-1 gap-4",
|
|
2840
2850
|
"rounded-md box-border overflow-visible",
|
|
@@ -2905,17 +2915,17 @@ const Pe = (t) => Array.isArray(t) && t.every((a) => typeof a == "string"), Ot =
|
|
|
2905
2915
|
return r;
|
|
2906
2916
|
};
|
|
2907
2917
|
function cr(t) {
|
|
2908
|
-
const { storageKey: a, columns: r, defaultVisibleKeys: l, defaultOrder:
|
|
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] = _(() => {
|
|
2909
2919
|
if (typeof window > "u") {
|
|
2910
|
-
const
|
|
2911
|
-
return { order: ie(
|
|
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) };
|
|
2912
2922
|
}
|
|
2913
|
-
const
|
|
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([
|
|
2914
2924
|
...w,
|
|
2915
|
-
...b.filter((
|
|
2916
|
-
...d.filter((
|
|
2917
|
-
]), y = ie((
|
|
2918
|
-
return { order:
|
|
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($) };
|
|
2919
2929
|
});
|
|
2920
2930
|
J(() => {
|
|
2921
2931
|
if (!(typeof window > "u"))
|
|
@@ -2924,47 +2934,47 @@ function cr(t) {
|
|
|
2924
2934
|
} catch {
|
|
2925
2935
|
}
|
|
2926
2936
|
}, [a, c]), J(() => {
|
|
2927
|
-
C((
|
|
2928
|
-
const
|
|
2929
|
-
...
|
|
2930
|
-
...d.filter((y) => !
|
|
2931
|
-
]), b = ie(
|
|
2932
|
-
return w &&
|
|
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 };
|
|
2933
2943
|
});
|
|
2934
2944
|
}, [d, s]);
|
|
2935
|
-
const k = Z(() => new Set(c.hidden), [c.hidden]),
|
|
2936
|
-
const
|
|
2937
|
-
return c.order.forEach((b, w) =>
|
|
2938
|
-
const
|
|
2939
|
-
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;
|
|
2940
2950
|
});
|
|
2941
|
-
}, [r, k, c.order]),
|
|
2942
|
-
() => c.hidden.filter((
|
|
2951
|
+
}, [r, k, c.order]), D = Z(
|
|
2952
|
+
() => c.hidden.filter((u) => s.has(u)),
|
|
2943
2953
|
[c.hidden, s]
|
|
2944
|
-
),
|
|
2945
|
-
const
|
|
2954
|
+
), A = R((u) => {
|
|
2955
|
+
const m = String(u);
|
|
2946
2956
|
C((b) => {
|
|
2947
|
-
const
|
|
2948
|
-
return { ...b, hidden: ie(
|
|
2957
|
+
const h = b.hidden.includes(m) ? b.hidden.filter((y) => y !== m) : [...b.hidden, m];
|
|
2958
|
+
return { ...b, hidden: ie(h) };
|
|
2949
2959
|
});
|
|
2950
|
-
}, []),
|
|
2960
|
+
}, []), E = R((u, m) => {
|
|
2951
2961
|
C((b) => {
|
|
2952
2962
|
const w = b.order.slice();
|
|
2953
|
-
if (
|
|
2954
|
-
const [
|
|
2955
|
-
return w.splice(
|
|
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 };
|
|
2956
2966
|
});
|
|
2957
2967
|
}, []), v = R(() => {
|
|
2958
2968
|
C(() => {
|
|
2959
|
-
const
|
|
2960
|
-
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 };
|
|
2961
2971
|
});
|
|
2962
|
-
}, [
|
|
2972
|
+
}, [p, l, d]);
|
|
2963
2973
|
return {
|
|
2964
|
-
orderedColumns:
|
|
2965
|
-
hiddenKeys:
|
|
2966
|
-
toggleColumn:
|
|
2967
|
-
moveColumn:
|
|
2974
|
+
orderedColumns: M,
|
|
2975
|
+
hiddenKeys: D,
|
|
2976
|
+
toggleColumn: A,
|
|
2977
|
+
moveColumn: E,
|
|
2968
2978
|
reset: v
|
|
2969
2979
|
};
|
|
2970
2980
|
}
|