@mci-ui/mci-ui 0.0.88 → 0.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/shared/ui/MciModal/MciModal.js +30 -28
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +45 -25
- package/dist/shared/ui/mciButton/MciButton.js +39 -31
- package/dist/shared/ui/mciCheck/MciCheck.js +86 -76
- package/dist/shared/ui/mciDrawer/MciDrawer.js +78 -59
- package/dist/shared/ui/mciInput/MciInput.js +39 -40
- package/dist/shared/ui/mciLoader/MciLoader.js +14 -14
- package/dist/shared/ui/mciPagination/MciPagination.js +28 -18
- package/dist/shared/ui/mciPicker/MciPicker.js +53 -53
- package/dist/shared/ui/mciSelect/MciSelect.js +42 -41
- package/dist/shared/ui/mciTable/MciTable.js +97 -90
- package/dist/shared/ui/mciTable/MciTableClamp2.js +4 -3
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +100 -79
- package/dist/shared/ui/mciToggle/MciToggle.js +51 -43
- package/dist/shared/ui/mciUpload/MciUpload.js +129 -107
- package/dist/types/shared/types/mci-table.types.d.ts +2 -0
- package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -1
- package/dist/types/shared/types/ui/button.types.d.ts +1 -1
- package/dist/types/shared/types/ui/check.types.d.ts +1 -1
- package/dist/types/shared/types/ui/drawer.types.d.ts +1 -0
- package/dist/types/shared/types/ui/loader.types.d.ts +1 -1
- package/dist/types/shared/types/ui/pagination.types.d.ts +1 -1
- package/dist/types/shared/types/ui/toggle.types.d.ts +1 -1
- package/dist/types/shared/types/ui/upload.types.d.ts +1 -1
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as p, jsx as l, Fragment as z } from "react/jsx-runtime";
|
|
2
2
|
import { EyeClosed as ee, Eye as te } from "@solar-icons/react";
|
|
3
3
|
import { forwardRef as le, useState as v, useMemo as h } from "react";
|
|
4
|
-
import
|
|
4
|
+
import ne from "../../../assets/icons/close.svg.js";
|
|
5
5
|
import { cn as e } from "../../lib/utils.js";
|
|
6
|
-
import { getInputSizes as
|
|
6
|
+
import { getInputSizes as se, getInputStateStyles as ae, getInputIconColor as re, getInputRightPaddingClass as ce } from "./mci-input.utils.js";
|
|
7
7
|
const ie = le(
|
|
8
8
|
({
|
|
9
9
|
label: C,
|
|
@@ -30,24 +30,24 @@ const ie = le(
|
|
|
30
30
|
autoComplete: K = "off",
|
|
31
31
|
...L
|
|
32
32
|
}, O) => {
|
|
33
|
-
const [
|
|
34
|
-
let
|
|
35
|
-
return b && (
|
|
36
|
-
}, [b, o, r, c, u]), X = (
|
|
37
|
-
S(!0), _?.(
|
|
38
|
-
}, Y = (
|
|
39
|
-
S(!1), D?.(
|
|
40
|
-
}, Z = (
|
|
41
|
-
let m =
|
|
42
|
-
w === "number" && x && m.length > x && (m = m.slice(0, x),
|
|
43
|
-
}, $ = () => T((
|
|
33
|
+
const [g, S] = v(!1), [Q, W] = v(""), [R, T] = v(!1), B = N ?? Q, o = w === "password", b = H && !!B && !f, y = c && u === "left", j = c && u === "right" || r || o, U = j || b, V = h(() => {
|
|
34
|
+
let s = 0;
|
|
35
|
+
return b && (s += 1), o ? (s += 1, r && (s += 1), s) : (r && (s += 1), c && u === "right" && (s += 1), s);
|
|
36
|
+
}, [b, o, r, c, u]), X = (s) => {
|
|
37
|
+
S(!0), _?.(s);
|
|
38
|
+
}, Y = (s) => {
|
|
39
|
+
S(!1), D?.(s);
|
|
40
|
+
}, Z = (s) => {
|
|
41
|
+
let m = s.target.value;
|
|
42
|
+
w === "number" && x && m.length > x && (m = m.slice(0, x), s.target.value = m), N === void 0 && W(m), P?.(s);
|
|
43
|
+
}, $ = () => T((s) => !s), q = () => {
|
|
44
44
|
N === void 0 && W(""), G?.();
|
|
45
|
-
},
|
|
46
|
-
() =>
|
|
47
|
-
[
|
|
45
|
+
}, n = h(
|
|
46
|
+
() => se(!!y, !!j),
|
|
47
|
+
[y, j]
|
|
48
48
|
), k = h(() => ae(i, a), [i, a]), d = h(
|
|
49
|
-
() => re(f, i,
|
|
50
|
-
[i,
|
|
49
|
+
() => re(f, i, g, a),
|
|
50
|
+
[i, g, f, a]
|
|
51
51
|
), M = h(
|
|
52
52
|
() => ce(t, V),
|
|
53
53
|
[t, V]
|
|
@@ -60,7 +60,7 @@ const ie = le(
|
|
|
60
60
|
className: e(
|
|
61
61
|
"mb-2 block text-base font-medium",
|
|
62
62
|
i ? a ? "text-red-500" : "text-red-600" : a ? "text-neutral-50" : "text-slate-700",
|
|
63
|
-
|
|
63
|
+
n[t].labelFont
|
|
64
64
|
),
|
|
65
65
|
children: [
|
|
66
66
|
C,
|
|
@@ -89,30 +89,30 @@ const ie = le(
|
|
|
89
89
|
"w-full border font-normal transition-all duration-300 ease-in-out outline-none",
|
|
90
90
|
t === "base" ? "rounded-xl" : "rounded-lg",
|
|
91
91
|
a ? "text-neutral-50 placeholder:text-neutral-100 disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-300 disabled:text-neutral-100/50 disabled:placeholder:text-neutral-100/50" : "bg-white disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
|
|
92
|
-
a &&
|
|
92
|
+
a && g && !f && "text-white",
|
|
93
93
|
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
n[t].input,
|
|
95
|
+
n[t].padding,
|
|
96
96
|
M,
|
|
97
97
|
k
|
|
98
98
|
),
|
|
99
99
|
maxLength: x
|
|
100
100
|
}
|
|
101
101
|
),
|
|
102
|
-
|
|
102
|
+
y && /* @__PURE__ */ l(
|
|
103
103
|
"div",
|
|
104
104
|
{
|
|
105
105
|
className: e(
|
|
106
106
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center",
|
|
107
107
|
"transition-all duration-300",
|
|
108
|
-
|
|
108
|
+
n[t].leftIcon,
|
|
109
109
|
d
|
|
110
110
|
),
|
|
111
111
|
children: /* @__PURE__ */ l(
|
|
112
112
|
"div",
|
|
113
113
|
{
|
|
114
|
-
className: e("flex items-center justify-center",
|
|
115
|
-
children: /* @__PURE__ */ l("span", { className: e("flex items-center justify-center",
|
|
114
|
+
className: e("flex items-center justify-center", n[t].iconWrapper),
|
|
115
|
+
children: /* @__PURE__ */ l("span", { className: e("flex items-center justify-center", n[t].icon), children: c })
|
|
116
116
|
}
|
|
117
117
|
)
|
|
118
118
|
}
|
|
@@ -123,7 +123,7 @@ const ie = le(
|
|
|
123
123
|
className: e(
|
|
124
124
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center gap-2",
|
|
125
125
|
"transition-all duration-300",
|
|
126
|
-
|
|
126
|
+
n[t].rightIcon
|
|
127
127
|
),
|
|
128
128
|
children: [
|
|
129
129
|
b && /* @__PURE__ */ l(
|
|
@@ -132,24 +132,23 @@ const ie = le(
|
|
|
132
132
|
type: "button",
|
|
133
133
|
onClick: q,
|
|
134
134
|
className: e(
|
|
135
|
-
"flex items-center justify-center",
|
|
136
|
-
|
|
135
|
+
"flex cursor-pointer items-center justify-center",
|
|
136
|
+
n[t].iconWrapper,
|
|
137
137
|
a ? "text-neutral-100 hover:text-white" : "text-slate-base hover:text-black"
|
|
138
138
|
),
|
|
139
|
-
|
|
140
|
-
children: /* @__PURE__ */ l("span", { className: e("flex items-center justify-center", s[t].icon), children: /* @__PURE__ */ l(se, { className: e("h-full w-full") }) })
|
|
139
|
+
children: /* @__PURE__ */ l("span", { className: e("flex items-center justify-center", n[t].icon), children: /* @__PURE__ */ l(ne, { className: e("h-full w-full") }) })
|
|
141
140
|
}
|
|
142
141
|
),
|
|
143
142
|
r && !o && /* @__PURE__ */ l(
|
|
144
143
|
"div",
|
|
145
144
|
{
|
|
146
|
-
className: e("flex items-center justify-center",
|
|
145
|
+
className: e("flex items-center justify-center", n[t].iconWrapper),
|
|
147
146
|
children: /* @__PURE__ */ l(
|
|
148
147
|
"span",
|
|
149
148
|
{
|
|
150
149
|
className: e(
|
|
151
150
|
"flex items-center justify-center",
|
|
152
|
-
|
|
151
|
+
n[t].icon,
|
|
153
152
|
d
|
|
154
153
|
),
|
|
155
154
|
children: r
|
|
@@ -163,14 +162,14 @@ const ie = le(
|
|
|
163
162
|
{
|
|
164
163
|
className: e(
|
|
165
164
|
"flex items-center justify-center",
|
|
166
|
-
|
|
165
|
+
n[t].iconWrapper
|
|
167
166
|
),
|
|
168
167
|
children: /* @__PURE__ */ l(
|
|
169
168
|
"span",
|
|
170
169
|
{
|
|
171
170
|
className: e(
|
|
172
171
|
"flex items-center justify-center",
|
|
173
|
-
|
|
172
|
+
n[t].icon,
|
|
174
173
|
d
|
|
175
174
|
),
|
|
176
175
|
children: r
|
|
@@ -184,14 +183,14 @@ const ie = le(
|
|
|
184
183
|
type: "button",
|
|
185
184
|
onClick: $,
|
|
186
185
|
className: e(
|
|
187
|
-
"flex items-center justify-center",
|
|
188
|
-
|
|
186
|
+
"flex cursor-pointer items-center justify-center",
|
|
187
|
+
n[t].iconWrapper,
|
|
189
188
|
d
|
|
190
189
|
),
|
|
191
190
|
children: /* @__PURE__ */ l(
|
|
192
191
|
"span",
|
|
193
192
|
{
|
|
194
|
-
className: e("flex items-center justify-center
|
|
193
|
+
className: e("flex items-center justify-center", n[t].icon),
|
|
195
194
|
children: R ? /* @__PURE__ */ l(ee, { weight: "Linear", className: e("h-full w-full") }) : /* @__PURE__ */ l(te, { weight: "Linear", className: e("h-full w-full") })
|
|
196
195
|
}
|
|
197
196
|
)
|
|
@@ -201,13 +200,13 @@ const ie = le(
|
|
|
201
200
|
c && u === "right" && !o && /* @__PURE__ */ l(
|
|
202
201
|
"div",
|
|
203
202
|
{
|
|
204
|
-
className: e("flex items-center justify-center",
|
|
203
|
+
className: e("flex items-center justify-center", n[t].iconWrapper),
|
|
205
204
|
children: /* @__PURE__ */ l(
|
|
206
205
|
"span",
|
|
207
206
|
{
|
|
208
207
|
className: e(
|
|
209
208
|
"flex items-center justify-center",
|
|
210
|
-
|
|
209
|
+
n[t].icon,
|
|
211
210
|
d
|
|
212
211
|
),
|
|
213
212
|
children: c
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { cn as o } from "../../lib/utils.js";
|
|
3
3
|
import a from "../../../assets/icons/loaderIcon.svg.js";
|
|
4
4
|
function d({
|
|
5
|
-
className:
|
|
5
|
+
className: n,
|
|
6
6
|
size: e = 150,
|
|
7
|
-
iconClassName:
|
|
7
|
+
iconClassName: r,
|
|
8
8
|
isLoading: i = !1,
|
|
9
|
-
isFullPage:
|
|
10
|
-
variant:
|
|
9
|
+
isFullPage: u = !0,
|
|
10
|
+
variant: t = "orange"
|
|
11
11
|
}) {
|
|
12
|
-
return i ? /* @__PURE__ */
|
|
12
|
+
return i ? /* @__PURE__ */ l(
|
|
13
13
|
"div",
|
|
14
14
|
{
|
|
15
|
-
className:
|
|
15
|
+
className: o(
|
|
16
16
|
"z-[99px] flex flex-col items-center justify-center transition-all duration-300",
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
u ? "fixed inset-0 backdrop-blur-[2px]" : "absolute inset-0 w-full h-full rounded-[inherit]",
|
|
18
|
+
n
|
|
19
19
|
),
|
|
20
|
-
children: /* @__PURE__ */
|
|
20
|
+
children: /* @__PURE__ */ l(
|
|
21
21
|
a,
|
|
22
22
|
{
|
|
23
23
|
width: e,
|
|
24
24
|
height: e,
|
|
25
|
-
className:
|
|
25
|
+
className: o(
|
|
26
26
|
"animate-spin",
|
|
27
|
-
!
|
|
28
|
-
|
|
27
|
+
!r && (t === "blue" ? "text-blue-600" : t === "orange" ? "text-orange-600" : "text-yellow-500"),
|
|
28
|
+
r
|
|
29
29
|
),
|
|
30
30
|
style: { fill: "currentColor", stroke: "currentColor" }
|
|
31
31
|
}
|
|
@@ -26,6 +26,16 @@ const _ = {
|
|
|
26
26
|
darkInactive: "bg-neutral-300 border-neutral-200 text-white hover:bg-neutral-200",
|
|
27
27
|
darkDisabled: "text-neutral-100/50 border-neutral-200 bg-neutral-300/60",
|
|
28
28
|
darkArrow: "text-neutral-50"
|
|
29
|
+
},
|
|
30
|
+
orange: {
|
|
31
|
+
active: "bg-orange-600 text-white border-orange-600",
|
|
32
|
+
inactive: "bg-slate-100 border-slate-200 text-black hover:bg-slate-200",
|
|
33
|
+
disabled: "text-slate-400 border-slate-300",
|
|
34
|
+
arrow: "text-black",
|
|
35
|
+
darkActive: "bg-orange-600 text-white border-orange-600",
|
|
36
|
+
darkInactive: "bg-neutral-300 border-neutral-200 text-white hover:bg-neutral-200",
|
|
37
|
+
darkDisabled: "text-neutral-100/50 border-neutral-200 bg-neutral-300/60",
|
|
38
|
+
darkArrow: "text-neutral-50"
|
|
29
39
|
}
|
|
30
40
|
};
|
|
31
41
|
function P({
|
|
@@ -34,20 +44,20 @@ function P({
|
|
|
34
44
|
perPage: b,
|
|
35
45
|
onPageChange: u,
|
|
36
46
|
onPerPageChange: h,
|
|
37
|
-
siblingCount:
|
|
38
|
-
perPageOptions:
|
|
39
|
-
showPerPage:
|
|
40
|
-
variant:
|
|
41
|
-
size:
|
|
47
|
+
siblingCount: x = 1,
|
|
48
|
+
perPageOptions: N = [10, 30, 50, 100],
|
|
49
|
+
showPerPage: k = !0,
|
|
50
|
+
variant: y = "orange",
|
|
51
|
+
size: g = "large",
|
|
42
52
|
darkMode: e = !1,
|
|
43
|
-
paginationClassName:
|
|
53
|
+
paginationClassName: I
|
|
44
54
|
}) {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
55
|
+
const w = Number.isFinite(c) && c > 0 ? c : 0, v = Number.isFinite(b) && b > 0 ? b : 10, l = Math.max(1, Number.isFinite(m) ? m : 1), i = Math.ceil(w / v), j = T(() => F(l, x, i), [l, x, i]), s = _[g], n = G[y ?? "yellow"], C = e ? n.darkActive : n.active, D = e ? n.darkInactive : n.inactive, f = e ? n.darkDisabled : n.disabled, p = e ? n.darkArrow : n.arrow;
|
|
56
|
+
return i <= 1 || w === 0 ? null : /* @__PURE__ */ o("div", { className: r(
|
|
47
57
|
"flex items-center justify-between gap-4 w-full",
|
|
48
|
-
|
|
58
|
+
I
|
|
49
59
|
), children: [
|
|
50
|
-
|
|
60
|
+
k && h && /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
51
61
|
/* @__PURE__ */ t(
|
|
52
62
|
"span",
|
|
53
63
|
{
|
|
@@ -67,10 +77,10 @@ function P({
|
|
|
67
77
|
className: r(
|
|
68
78
|
"appearance-none rounded-lg border pl-3 pr-8 text-base font-medium focus:outline-none cursor-pointer",
|
|
69
79
|
e ? "border-neutral-200 bg-neutral-300 text-white" : "border-slate-200 bg-white text-black",
|
|
70
|
-
|
|
80
|
+
g === "large" ? "h-10" : "h-9"
|
|
71
81
|
),
|
|
72
82
|
"aria-label": "Количество строк на странице",
|
|
73
|
-
children:
|
|
83
|
+
children: N.map((a) => /* @__PURE__ */ t("option", { value: a, children: a }, a))
|
|
74
84
|
}
|
|
75
85
|
),
|
|
76
86
|
/* @__PURE__ */ t(
|
|
@@ -102,7 +112,7 @@ function P({
|
|
|
102
112
|
children: /* @__PURE__ */ t(z, { weight: "Linear", size: 20 })
|
|
103
113
|
}
|
|
104
114
|
),
|
|
105
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children:
|
|
115
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: j.map((a, A) => {
|
|
106
116
|
if (a === "...")
|
|
107
117
|
return /* @__PURE__ */ t(
|
|
108
118
|
"span",
|
|
@@ -115,7 +125,7 @@ function P({
|
|
|
115
125
|
"aria-hidden": "true",
|
|
116
126
|
children: /* @__PURE__ */ t(E, { weight: "Bold", size: 20 })
|
|
117
127
|
},
|
|
118
|
-
|
|
128
|
+
A
|
|
119
129
|
);
|
|
120
130
|
const d = a === l;
|
|
121
131
|
return /* @__PURE__ */ t(
|
|
@@ -127,24 +137,24 @@ function P({
|
|
|
127
137
|
className: r(
|
|
128
138
|
"flex items-center justify-center rounded-lg border font-medium transition-all hover:cursor-pointer min-w-10 px-2",
|
|
129
139
|
s,
|
|
130
|
-
d ?
|
|
140
|
+
d ? C : D
|
|
131
141
|
),
|
|
132
142
|
children: a
|
|
133
143
|
},
|
|
134
|
-
|
|
144
|
+
A
|
|
135
145
|
);
|
|
136
146
|
}) }),
|
|
137
147
|
/* @__PURE__ */ t(
|
|
138
148
|
"button",
|
|
139
149
|
{
|
|
140
150
|
onClick: () => u(l + 1),
|
|
141
|
-
disabled: l ===
|
|
151
|
+
disabled: l === i,
|
|
142
152
|
"aria-label": "Следующая страница",
|
|
143
153
|
className: r(
|
|
144
154
|
"flex items-center justify-center rounded-lg border transition-all min-w-10",
|
|
145
155
|
e ? "bg-neutral-300 border-neutral-200" : "bg-slate-100",
|
|
146
156
|
s,
|
|
147
|
-
l ===
|
|
157
|
+
l === i ? r("cursor-not-allowed opacity-50", f) : r("hover:cursor-pointer", p, e ? "hover:bg-neutral-200" : "border-slate-200")
|
|
148
158
|
),
|
|
149
159
|
children: /* @__PURE__ */ t(S, { size: 20, weight: "Linear" })
|
|
150
160
|
}
|
|
@@ -8,7 +8,7 @@ import _e from "../mciInput/MciInput.js";
|
|
|
8
8
|
import { toSafeDate as D, formatDateByPattern as qe, isDateOutsideBounds as Ge, normalizeDate as F, isSameCalendarDay as He, parseDateFromInput as he, formatManualDateInput as Je, getCalendarDays as Qe, shiftYear as Ue, shiftMonth as Xe } from "./mci-picker.utils.js";
|
|
9
9
|
const Ze = $e(
|
|
10
10
|
({
|
|
11
|
-
type:
|
|
11
|
+
type: o = "date",
|
|
12
12
|
value: T,
|
|
13
13
|
onChange: u,
|
|
14
14
|
placeholder: K,
|
|
@@ -29,38 +29,38 @@ const Ze = $e(
|
|
|
29
29
|
align: V = "auto"
|
|
30
30
|
}, ve) => {
|
|
31
31
|
const [f, W] = w(!1), [re, p] = w(
|
|
32
|
-
|
|
33
|
-
), [I, R] = w([null, null]), [m, b] = w(/* @__PURE__ */ new Date()), [le, Y] = w(y), [we, _] = w(0), [j, d] = w(""), [q,
|
|
32
|
+
o === "range" ? [null, null] : null
|
|
33
|
+
), [I, R] = w([null, null]), [m, b] = w(/* @__PURE__ */ new Date()), [le, Y] = w(y), [we, _] = w(0), [j, d] = w(""), [q, oe] = w(!1), [G, se] = w(V), E = Te(null), g = de(() => {
|
|
34
34
|
const e = T !== void 0 ? T : re;
|
|
35
|
-
if (
|
|
35
|
+
if (o === "date") return D(e);
|
|
36
36
|
const t = e;
|
|
37
37
|
return [D(t[0]), D(t[1])];
|
|
38
|
-
}, [T, re,
|
|
38
|
+
}, [T, re, o]), H = We[xe], c = N(
|
|
39
39
|
(e) => qe(e, k),
|
|
40
40
|
[k]
|
|
41
41
|
), S = N(
|
|
42
42
|
(e) => Ge(e, M, ee),
|
|
43
43
|
[M, ee]
|
|
44
44
|
), C = de(() => {
|
|
45
|
-
if (
|
|
45
|
+
if (o === "date") return c(g);
|
|
46
46
|
const [e, t] = g;
|
|
47
47
|
return !e && !t ? "" : e && t ? `${c(e)} - ${c(t)}` : e ? `${c(e)} - ...` : "...";
|
|
48
|
-
}, [
|
|
48
|
+
}, [o, g, c]);
|
|
49
49
|
$(() => {
|
|
50
50
|
(!f && !q || j === "" && C !== "") && d(C);
|
|
51
51
|
}, [C, f, j, q]), $(() => {
|
|
52
52
|
if (f)
|
|
53
|
-
if (
|
|
53
|
+
if (o === "range") {
|
|
54
54
|
const e = g;
|
|
55
55
|
R(e), e[0] ? b(e[0]) : e[1] ? b(e[1]) : b(/* @__PURE__ */ new Date());
|
|
56
56
|
} else {
|
|
57
57
|
const e = g;
|
|
58
58
|
b(e || /* @__PURE__ */ new Date());
|
|
59
59
|
}
|
|
60
|
-
}, [f,
|
|
60
|
+
}, [f, o, g]), $(() => {
|
|
61
61
|
if (f && V === "auto" && E.current) {
|
|
62
62
|
const e = E.current.getBoundingClientRect(), t = window.innerWidth - e.right, n = e.left;
|
|
63
|
-
t < 300 && n > 300 ?
|
|
63
|
+
t < 300 && n > 300 ? se("right") : se("left");
|
|
64
64
|
}
|
|
65
65
|
}, [f, V]);
|
|
66
66
|
const x = N(() => {
|
|
@@ -75,9 +75,9 @@ const Ze = $e(
|
|
|
75
75
|
};
|
|
76
76
|
}, [f, J, Q]);
|
|
77
77
|
const De = () => {
|
|
78
|
-
|
|
78
|
+
oe(!0), !(A || f) && (o === "range" || !te) && (W(!0), Y(y));
|
|
79
79
|
}, ye = () => {
|
|
80
|
-
if (
|
|
80
|
+
if (oe(!1), o !== "date") return;
|
|
81
81
|
const e = j.trim();
|
|
82
82
|
if (!e) {
|
|
83
83
|
p(null), u?.(null);
|
|
@@ -91,69 +91,69 @@ const Ze = $e(
|
|
|
91
91
|
}
|
|
92
92
|
d(C);
|
|
93
93
|
}, Ie = (e) => {
|
|
94
|
-
if (
|
|
94
|
+
if (o !== "date") return;
|
|
95
95
|
const t = e.target.value, n = Je(t), i = n.replace(/\D/g, "");
|
|
96
96
|
if (!(i.length >= 1 && Number.parseInt(i[0] ?? "0", 10) > 3)) {
|
|
97
97
|
if (i.length >= 2) {
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
98
|
+
const s = Number.parseInt(i.slice(0, 2), 10);
|
|
99
|
+
if (s < 1 || s > 31) return;
|
|
100
100
|
}
|
|
101
101
|
if (!(i.length >= 3 && Number.parseInt(i[2] ?? "0", 10) > 1)) {
|
|
102
102
|
if (i.length >= 4) {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
103
|
+
const s = Number.parseInt(i.slice(2, 4), 10);
|
|
104
|
+
if (s < 1 || s > 12) return;
|
|
105
105
|
}
|
|
106
106
|
if (d(n), n.length === 10) {
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const s = he(n);
|
|
108
|
+
s && !S(s) && (p(s), u?.(s), b(s));
|
|
109
109
|
} else n === "" && (p(null), u?.(null));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}, Ce = N(() => {
|
|
113
|
-
const e =
|
|
113
|
+
const e = o === "range" ? [null, null] : null;
|
|
114
114
|
p(e), R([null, null]), u?.(e), d("");
|
|
115
|
-
}, [
|
|
115
|
+
}, [o, u]), ze = N(
|
|
116
116
|
(e) => {
|
|
117
117
|
if (S(e)) return;
|
|
118
118
|
const t = F(e);
|
|
119
|
-
if (
|
|
119
|
+
if (o === "date")
|
|
120
120
|
p(t), u?.(t), d(c(t)), x();
|
|
121
121
|
else {
|
|
122
122
|
const [n, i] = I;
|
|
123
123
|
if (!n && !i || n && i)
|
|
124
124
|
R([t, null]), d(`${c(t)} - ...`);
|
|
125
125
|
else if (n && !i) {
|
|
126
|
-
const
|
|
127
|
-
R(
|
|
128
|
-
const [z, v] =
|
|
126
|
+
const s = t < n ? [t, n] : [n, t];
|
|
127
|
+
R(s), p(s), u?.(s);
|
|
128
|
+
const [z, v] = s;
|
|
129
129
|
d(`${c(z)} - ${c(v)}`), x();
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
|
-
[
|
|
133
|
+
[o, I, S, u, x, c]
|
|
134
134
|
), Fe = N((e) => {
|
|
135
135
|
const t = new Date(m.getFullYear(), e, 1);
|
|
136
|
-
b(t), y === "month" &&
|
|
137
|
-
}, [m, y, u, x,
|
|
136
|
+
b(t), y === "month" && o === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("day");
|
|
137
|
+
}, [m, y, u, x, o, c]), Ye = N((e) => {
|
|
138
138
|
const t = new Date(e, m.getMonth(), 1);
|
|
139
|
-
b(t), y === "year" &&
|
|
140
|
-
}, [m, y, u, x,
|
|
139
|
+
b(t), y === "year" && o === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("month");
|
|
140
|
+
}, [m, y, u, x, o, c]), ae = (e) => {
|
|
141
141
|
b((t) => Xe(t, e));
|
|
142
142
|
}, L = (e) => {
|
|
143
143
|
b((t) => Ue(t, e));
|
|
144
144
|
}, O = N((e, t) => He(e, t), []), Ae = (e) => {
|
|
145
145
|
const t = F(e);
|
|
146
|
-
if (
|
|
146
|
+
if (o === "date") return g && O(t, g);
|
|
147
147
|
const [n] = I[0] ? I : g;
|
|
148
148
|
return D(n) && O(t, D(n));
|
|
149
149
|
}, Se = (e) => {
|
|
150
|
-
if (
|
|
150
|
+
if (o !== "range") return !1;
|
|
151
151
|
const t = F(e), [, n] = I[1] ? I : g;
|
|
152
152
|
return D(n) && O(t, D(n));
|
|
153
153
|
}, Re = (e) => {
|
|
154
|
-
if (
|
|
155
|
-
const t = F(e), [n, i] = I[0] ? I : g,
|
|
156
|
-
return
|
|
154
|
+
if (o !== "range") return !1;
|
|
155
|
+
const t = F(e), [n, i] = I[0] ? I : g, s = D(n), z = D(i);
|
|
156
|
+
return s && !z ? !1 : s && z && t > F(s) && t < F(z);
|
|
157
157
|
}, ie = (e, t, n) => {
|
|
158
158
|
const i = Qe(e);
|
|
159
159
|
return /* @__PURE__ */ h("div", { className: "w-[300px] p-2 select-none", children: [
|
|
@@ -165,7 +165,7 @@ const Ze = $e(
|
|
|
165
165
|
onClick: () => L(-1),
|
|
166
166
|
type: "button",
|
|
167
167
|
className: a(
|
|
168
|
-
"rounded p-1 transition-colors",
|
|
168
|
+
"cursor-pointer rounded p-1 transition-colors",
|
|
169
169
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
170
170
|
),
|
|
171
171
|
children: /* @__PURE__ */ r(Pe, { size: 18 })
|
|
@@ -177,7 +177,7 @@ const Ze = $e(
|
|
|
177
177
|
onClick: () => ae(-1),
|
|
178
178
|
type: "button",
|
|
179
179
|
className: a(
|
|
180
|
-
"rounded p-1 transition-colors",
|
|
180
|
+
"cursor-pointer rounded p-1 transition-colors",
|
|
181
181
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
182
182
|
),
|
|
183
183
|
children: /* @__PURE__ */ r(X, { size: 18 })
|
|
@@ -224,7 +224,7 @@ const Ze = $e(
|
|
|
224
224
|
onClick: () => ae(1),
|
|
225
225
|
type: "button",
|
|
226
226
|
className: a(
|
|
227
|
-
"rounded p-1 transition-colors",
|
|
227
|
+
"cursor-pointer rounded p-1 transition-colors",
|
|
228
228
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
229
229
|
),
|
|
230
230
|
children: /* @__PURE__ */ r(Z, { size: 18 })
|
|
@@ -236,7 +236,7 @@ const Ze = $e(
|
|
|
236
236
|
onClick: () => L(1),
|
|
237
237
|
type: "button",
|
|
238
238
|
className: a(
|
|
239
|
-
"rounded p-1 transition-colors",
|
|
239
|
+
"cursor-pointer rounded p-1 transition-colors",
|
|
240
240
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
241
241
|
),
|
|
242
242
|
children: /* @__PURE__ */ r(Be, { size: 18 })
|
|
@@ -251,19 +251,19 @@ const Ze = $e(
|
|
|
251
251
|
"mb-1 grid grid-cols-7 text-center text-[11px] font-bold uppercase",
|
|
252
252
|
l ? "text-blue-500" : "text-blue-600"
|
|
253
253
|
),
|
|
254
|
-
children: H.weekdaysShort.map((
|
|
254
|
+
children: H.weekdaysShort.map((s) => /* @__PURE__ */ r("div", { className: "py-1", children: s }, s))
|
|
255
255
|
}
|
|
256
256
|
),
|
|
257
|
-
/* @__PURE__ */ r("div", { className: "grid grid-cols-7 gap-y-1 relative", children: i.map((
|
|
258
|
-
const v =
|
|
257
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-7 gap-y-1 relative", children: i.map((s, z) => {
|
|
258
|
+
const v = s.date, ue = S(v), P = Ae(v), B = Se(v), Le = Re(v);
|
|
259
259
|
return /* @__PURE__ */ r(
|
|
260
260
|
"div",
|
|
261
261
|
{
|
|
262
262
|
className: a(
|
|
263
263
|
"relative flex h-10 items-center justify-center",
|
|
264
264
|
Le && (l ? "bg-blue-500/15" : "bg-blue-50"),
|
|
265
|
-
P &&
|
|
266
|
-
B &&
|
|
265
|
+
P && o === "range" && B ? l ? "rounded-full bg-blue-500" : "rounded-full bg-blue-50" : P && o === "range" ? l ? "rounded-l-full bg-gradient-to-r from-transparent to-blue-500/15" : "rounded-l-full bg-gradient-to-r from-transparent to-blue-50" : "",
|
|
266
|
+
B && o === "range" ? l ? "rounded-r-full bg-gradient-to-l from-transparent to-blue-500/15" : "rounded-r-full bg-gradient-to-l from-transparent to-blue-50" : ""
|
|
267
267
|
),
|
|
268
268
|
children: /* @__PURE__ */ r(
|
|
269
269
|
"button",
|
|
@@ -273,7 +273,7 @@ const Ze = $e(
|
|
|
273
273
|
disabled: ue,
|
|
274
274
|
className: a(
|
|
275
275
|
"z-10 flex h-9 w-9 cursor-pointer items-center justify-center rounded-full text-sm font-medium transition-all",
|
|
276
|
-
|
|
276
|
+
s.isCurrentMonth ? l ? "text-neutral-50" : "text-slate-700" : l ? "text-neutral-100/40" : "text-slate-300",
|
|
277
277
|
ue && "cursor-not-allowed opacity-20",
|
|
278
278
|
P || B ? "bg-blue-600 text-white shadow-md shadow-blue-200 hover:bg-blue-700" : l ? "hover:bg-neutral-300 hover:text-white" : "hover:bg-blue-50",
|
|
279
279
|
O(v, /* @__PURE__ */ new Date()) && !P && !B && (l ? "border border-blue-500 text-blue-500" : "border border-blue-600 text-blue-600")
|
|
@@ -294,7 +294,7 @@ const Ze = $e(
|
|
|
294
294
|
type: "button",
|
|
295
295
|
onClick: () => L(-1),
|
|
296
296
|
className: a(
|
|
297
|
-
"rounded p-1",
|
|
297
|
+
"cursor-pointer rounded p-1",
|
|
298
298
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
299
299
|
),
|
|
300
300
|
children: /* @__PURE__ */ r(X, { size: 20 })
|
|
@@ -307,7 +307,7 @@ const Ze = $e(
|
|
|
307
307
|
type: "button",
|
|
308
308
|
onClick: () => L(1),
|
|
309
309
|
className: a(
|
|
310
|
-
"rounded p-1",
|
|
310
|
+
"cursor-pointer rounded p-1",
|
|
311
311
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
312
312
|
),
|
|
313
313
|
children: /* @__PURE__ */ r(Z, { size: 20 })
|
|
@@ -325,7 +325,7 @@ const Ze = $e(
|
|
|
325
325
|
type: "button",
|
|
326
326
|
onClick: () => _((n) => n - 1),
|
|
327
327
|
className: a(
|
|
328
|
-
"rounded p-1",
|
|
328
|
+
"cursor-pointer rounded p-1",
|
|
329
329
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
330
330
|
),
|
|
331
331
|
children: /* @__PURE__ */ r(X, { size: 20 })
|
|
@@ -342,7 +342,7 @@ const Ze = $e(
|
|
|
342
342
|
type: "button",
|
|
343
343
|
onClick: () => _((n) => n + 1),
|
|
344
344
|
className: a(
|
|
345
|
-
"rounded p-1",
|
|
345
|
+
"cursor-pointer rounded p-1",
|
|
346
346
|
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
347
347
|
),
|
|
348
348
|
children: /* @__PURE__ */ r(Z, { size: 20 })
|
|
@@ -385,10 +385,10 @@ const Ze = $e(
|
|
|
385
385
|
required: me,
|
|
386
386
|
error: ge,
|
|
387
387
|
darkMode: l,
|
|
388
|
-
maxLength:
|
|
388
|
+
maxLength: o === "date" ? 10 : void 0,
|
|
389
389
|
onFocus: De,
|
|
390
390
|
onBlur: ye,
|
|
391
|
-
readOnly: !te ||
|
|
391
|
+
readOnly: !te || o === "range",
|
|
392
392
|
showClearButton: pe,
|
|
393
393
|
onClear: Ce
|
|
394
394
|
}
|
|
@@ -407,8 +407,8 @@ const Ze = $e(
|
|
|
407
407
|
style: { width: "max-content" },
|
|
408
408
|
onMouseDown: (e) => e.stopPropagation(),
|
|
409
409
|
children: le === "day" ? /* @__PURE__ */ h(U, { children: [
|
|
410
|
-
ie(m, !0,
|
|
411
|
-
|
|
410
|
+
ie(m, !0, o !== "range"),
|
|
411
|
+
o === "range" && /* @__PURE__ */ r("div", { className: a(
|
|
412
412
|
"hidden border-l md:block",
|
|
413
413
|
l ? "border-neutral-200" : "border-slate-100"
|
|
414
414
|
), children: ie(new Date(m.getFullYear(), m.getMonth() + 1, 1), !1, !0) })
|