@mci-ui/mci-ui 0.0.86 → 0.0.88
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 +107 -59
- package/dist/shared/ui/mciAccordion/MciAccordion.js +97 -64
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +23 -21
- package/dist/shared/ui/mciButton/MciButton.js +47 -32
- package/dist/shared/ui/mciCheck/MciCheck.js +116 -92
- package/dist/shared/ui/mciCollapse/MciCollapse.js +86 -54
- package/dist/shared/ui/mciDrawer/MciDrawer.js +82 -59
- package/dist/shared/ui/mciInput/MciInput.js +143 -130
- package/dist/shared/ui/mciInput/mci-input.utils.js +10 -10
- package/dist/shared/ui/mciPagination/MciPagination.js +85 -63
- package/dist/shared/ui/mciPhone/MciPhone.js +59 -54
- package/dist/shared/ui/mciPhone/mci-phone.utils.js +10 -10
- package/dist/shared/ui/mciPicker/MciPicker.js +349 -181
- package/dist/shared/ui/mciSelect/MciSelect.js +150 -131
- package/dist/shared/ui/mciSelect/mci-select.utils.js +12 -12
- package/dist/shared/ui/mciSkeleton/MciSkeleton.js +16 -14
- package/dist/shared/ui/mciTable/MciTable.js +165 -126
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +113 -106
- package/dist/shared/ui/mciTabs/MciTabs.js +73 -55
- package/dist/shared/ui/mciTag/MciTag.js +27 -18
- package/dist/shared/ui/mciTextarea/MciTextarea.js +47 -35
- package/dist/shared/ui/mciToast/MciToast.js +118 -72
- package/dist/shared/ui/mciToast/mci-toast.utils.js +40 -12
- package/dist/shared/ui/mciToggle/MciToggle.js +58 -36
- package/dist/shared/ui/mciTooltip/MciTooltip.js +2 -2
- package/dist/shared/ui/mciUpload/MciUpload.js +172 -149
- package/dist/types/shared/types/mci-table.types.d.ts +1 -0
- package/dist/types/shared/types/ui/accordion.types.d.ts +1 -0
- package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -0
- package/dist/types/shared/types/ui/button.types.d.ts +3 -7
- package/dist/types/shared/types/ui/check.types.d.ts +4 -9
- package/dist/types/shared/types/ui/collapse.types.d.ts +1 -0
- package/dist/types/shared/types/ui/drawer.types.d.ts +2 -0
- package/dist/types/shared/types/ui/input.types.d.ts +4 -15
- package/dist/types/shared/types/ui/modal.types.d.ts +1 -0
- package/dist/types/shared/types/ui/pagination.types.d.ts +1 -0
- package/dist/types/shared/types/ui/phone.types.d.ts +1 -0
- package/dist/types/shared/types/ui/picker.types.d.ts +1 -0
- package/dist/types/shared/types/ui/select.types.d.ts +1 -0
- package/dist/types/shared/types/ui/skeleton.types.d.ts +1 -0
- package/dist/types/shared/types/ui/tabs.types.d.ts +1 -0
- package/dist/types/shared/types/ui/tag.types.d.ts +1 -0
- package/dist/types/shared/types/ui/textarea.types.d.ts +3 -7
- package/dist/types/shared/types/ui/toast.types.d.ts +1 -0
- package/dist/types/shared/types/ui/toggle.types.d.ts +3 -2
- package/dist/types/shared/types/ui/upload.types.d.ts +1 -0
- package/dist/types/shared/ui/MciModal/MciModal.d.ts +1 -1
- package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +5 -3
- package/dist/types/shared/ui/mciBreadcrumb/MciBreadcrumb.d.ts +1 -1
- package/dist/types/shared/ui/mciButton/MciButton.d.ts +1 -1
- package/dist/types/shared/ui/mciCollapse/MciCollapse.d.ts +1 -1
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
- package/dist/types/shared/ui/mciInput/MciInput.d.ts +13 -2
- package/dist/types/shared/ui/mciInput/mci-input.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciPagination/MciPagination.d.ts +1 -1
- package/dist/types/shared/ui/mciPhone/mci-phone.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciSelect/mci-select.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciSkeleton/MciSkeleton.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +2 -1
- package/dist/types/shared/ui/mciTabs/MciTabs.d.ts +1 -1
- package/dist/types/shared/ui/mciTag/MciTag.d.ts +1 -1
- package/dist/types/shared/ui/mciTextarea/MciTextarea.d.ts +7 -2
- package/dist/types/shared/ui/mciToast/mci-toast.utils.d.ts +32 -4
- package/dist/types/shared/ui/mciToggle/MciToggle.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,256 +1,424 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { Calendar as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useClickOutside as
|
|
5
|
-
import { locales as
|
|
1
|
+
import { jsx as r, jsxs as h, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { Calendar as Oe, AltArrowLeft as X, AltArrowRight as Z, DoubleAltArrowLeft as Pe, DoubleAltArrowRight as Be } from "@solar-icons/react";
|
|
3
|
+
import { forwardRef as $e, useState as w, useRef as Te, useMemo as de, useCallback as N, useEffect as $ } from "react";
|
|
4
|
+
import { useClickOutside as Ke, useEscapeKey as Ve, cn as a } from "../../lib/utils.js";
|
|
5
|
+
import { locales as We } from "../../lib/locales.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
8
|
-
import { toSafeDate as
|
|
9
|
-
const
|
|
7
|
+
import _e from "../mciInput/MciInput.js";
|
|
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
|
+
const Ze = $e(
|
|
10
10
|
({
|
|
11
11
|
type: s = "date",
|
|
12
|
-
value:
|
|
13
|
-
onChange:
|
|
14
|
-
placeholder:
|
|
12
|
+
value: T,
|
|
13
|
+
onChange: u,
|
|
14
|
+
placeholder: K,
|
|
15
15
|
label: fe,
|
|
16
|
-
|
|
16
|
+
darkMode: l = !1,
|
|
17
|
+
disabled: A = !1,
|
|
17
18
|
required: me = !1,
|
|
18
|
-
className:
|
|
19
|
-
format:
|
|
20
|
-
minDate:
|
|
21
|
-
maxDate:
|
|
19
|
+
className: be,
|
|
20
|
+
format: k = "DD.MM.YYYY",
|
|
21
|
+
minDate: M,
|
|
22
|
+
maxDate: ee,
|
|
22
23
|
error: ge,
|
|
23
|
-
showClear:
|
|
24
|
-
allowManualInput:
|
|
25
|
-
locale:
|
|
26
|
-
startView:
|
|
27
|
-
iconPosition:
|
|
28
|
-
align:
|
|
24
|
+
showClear: pe = !0,
|
|
25
|
+
allowManualInput: te = !0,
|
|
26
|
+
locale: xe = "uz",
|
|
27
|
+
startView: y = "day",
|
|
28
|
+
iconPosition: ne = "left",
|
|
29
|
+
align: V = "auto"
|
|
29
30
|
}, ve) => {
|
|
30
|
-
const [
|
|
31
|
+
const [f, W] = w(!1), [re, p] = w(
|
|
31
32
|
s === "range" ? [null, null] : null
|
|
32
|
-
), [
|
|
33
|
-
const e =
|
|
34
|
-
if (s === "date") return
|
|
33
|
+
), [I, R] = w([null, null]), [m, b] = w(/* @__PURE__ */ new Date()), [le, Y] = w(y), [we, _] = w(0), [j, d] = w(""), [q, se] = w(!1), [G, oe] = w(V), E = Te(null), g = de(() => {
|
|
34
|
+
const e = T !== void 0 ? T : re;
|
|
35
|
+
if (s === "date") return D(e);
|
|
35
36
|
const t = e;
|
|
36
|
-
return [
|
|
37
|
-
}, [
|
|
38
|
-
(e) =>
|
|
39
|
-
[
|
|
40
|
-
),
|
|
41
|
-
(e) =>
|
|
42
|
-
[
|
|
43
|
-
),
|
|
44
|
-
if (s === "date") return
|
|
45
|
-
const [e, t] =
|
|
46
|
-
return !e && !t ? "" : e && t ? `${
|
|
47
|
-
}, [s,
|
|
48
|
-
|
|
49
|
-
(!
|
|
50
|
-
}, [
|
|
51
|
-
if (
|
|
37
|
+
return [D(t[0]), D(t[1])];
|
|
38
|
+
}, [T, re, s]), H = We[xe], c = N(
|
|
39
|
+
(e) => qe(e, k),
|
|
40
|
+
[k]
|
|
41
|
+
), S = N(
|
|
42
|
+
(e) => Ge(e, M, ee),
|
|
43
|
+
[M, ee]
|
|
44
|
+
), C = de(() => {
|
|
45
|
+
if (s === "date") return c(g);
|
|
46
|
+
const [e, t] = g;
|
|
47
|
+
return !e && !t ? "" : e && t ? `${c(e)} - ${c(t)}` : e ? `${c(e)} - ...` : "...";
|
|
48
|
+
}, [s, g, c]);
|
|
49
|
+
$(() => {
|
|
50
|
+
(!f && !q || j === "" && C !== "") && d(C);
|
|
51
|
+
}, [C, f, j, q]), $(() => {
|
|
52
|
+
if (f)
|
|
52
53
|
if (s === "range") {
|
|
53
|
-
const e =
|
|
54
|
-
|
|
54
|
+
const e = g;
|
|
55
|
+
R(e), e[0] ? b(e[0]) : e[1] ? b(e[1]) : b(/* @__PURE__ */ new Date());
|
|
55
56
|
} else {
|
|
56
|
-
const e =
|
|
57
|
-
|
|
57
|
+
const e = g;
|
|
58
|
+
b(e || /* @__PURE__ */ new Date());
|
|
58
59
|
}
|
|
59
|
-
}, [
|
|
60
|
-
if (
|
|
61
|
-
const e =
|
|
60
|
+
}, [f, s, g]), $(() => {
|
|
61
|
+
if (f && V === "auto" && E.current) {
|
|
62
|
+
const e = E.current.getBoundingClientRect(), t = window.innerWidth - e.right, n = e.left;
|
|
62
63
|
t < 300 && n > 300 ? oe("right") : oe("left");
|
|
63
64
|
}
|
|
64
|
-
}, [
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
}, [
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
return document.addEventListener("mousedown",
|
|
73
|
-
document.removeEventListener("mousedown",
|
|
65
|
+
}, [f, V]);
|
|
66
|
+
const x = N(() => {
|
|
67
|
+
W(!1), Y(y), _(0), d(C);
|
|
68
|
+
}, [y, C]), Ne = N((e) => {
|
|
69
|
+
A || (e.preventDefault(), e.stopPropagation(), W((t) => !t));
|
|
70
|
+
}, [A]), { handleClick: J } = Ke(E, x), { handleEscape: Q } = Ve(x);
|
|
71
|
+
$(() => {
|
|
72
|
+
if (f)
|
|
73
|
+
return document.addEventListener("mousedown", J), document.addEventListener("keydown", Q), () => {
|
|
74
|
+
document.removeEventListener("mousedown", J), document.removeEventListener("keydown", Q);
|
|
74
75
|
};
|
|
75
|
-
}, [
|
|
76
|
-
const
|
|
77
|
-
se(!0), !(
|
|
78
|
-
},
|
|
76
|
+
}, [f, J, Q]);
|
|
77
|
+
const De = () => {
|
|
78
|
+
se(!0), !(A || f) && (s === "range" || !te) && (W(!0), Y(y));
|
|
79
|
+
}, ye = () => {
|
|
79
80
|
if (se(!1), s !== "date") return;
|
|
80
|
-
const e =
|
|
81
|
+
const e = j.trim();
|
|
81
82
|
if (!e) {
|
|
82
|
-
|
|
83
|
+
p(null), u?.(null);
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
const t =
|
|
86
|
-
if (t && !
|
|
87
|
-
const n =
|
|
88
|
-
|
|
86
|
+
const t = he(e);
|
|
87
|
+
if (t && !S(t)) {
|
|
88
|
+
const n = F(t);
|
|
89
|
+
p(n), u?.(n), d(c(n)), b(n);
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
-
},
|
|
92
|
+
d(C);
|
|
93
|
+
}, Ie = (e) => {
|
|
93
94
|
if (s !== "date") return;
|
|
94
|
-
const t = e.target.value, n =
|
|
95
|
-
if (!(
|
|
96
|
-
if (
|
|
97
|
-
const o = Number.parseInt(
|
|
95
|
+
const t = e.target.value, n = Je(t), i = n.replace(/\D/g, "");
|
|
96
|
+
if (!(i.length >= 1 && Number.parseInt(i[0] ?? "0", 10) > 3)) {
|
|
97
|
+
if (i.length >= 2) {
|
|
98
|
+
const o = Number.parseInt(i.slice(0, 2), 10);
|
|
98
99
|
if (o < 1 || o > 31) return;
|
|
99
100
|
}
|
|
100
|
-
if (!(
|
|
101
|
-
if (
|
|
102
|
-
const o = Number.parseInt(
|
|
101
|
+
if (!(i.length >= 3 && Number.parseInt(i[2] ?? "0", 10) > 1)) {
|
|
102
|
+
if (i.length >= 4) {
|
|
103
|
+
const o = Number.parseInt(i.slice(2, 4), 10);
|
|
103
104
|
if (o < 1 || o > 12) return;
|
|
104
105
|
}
|
|
105
|
-
if (
|
|
106
|
-
const o =
|
|
107
|
-
o && !
|
|
108
|
-
} else n === "" && (
|
|
106
|
+
if (d(n), n.length === 10) {
|
|
107
|
+
const o = he(n);
|
|
108
|
+
o && !S(o) && (p(o), u?.(o), b(o));
|
|
109
|
+
} else n === "" && (p(null), u?.(null));
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
},
|
|
112
|
+
}, Ce = N(() => {
|
|
112
113
|
const e = s === "range" ? [null, null] : null;
|
|
113
|
-
|
|
114
|
-
}, [s,
|
|
114
|
+
p(e), R([null, null]), u?.(e), d("");
|
|
115
|
+
}, [s, u]), ze = N(
|
|
115
116
|
(e) => {
|
|
116
|
-
if (
|
|
117
|
-
const t =
|
|
117
|
+
if (S(e)) return;
|
|
118
|
+
const t = F(e);
|
|
118
119
|
if (s === "date")
|
|
119
|
-
|
|
120
|
+
p(t), u?.(t), d(c(t)), x();
|
|
120
121
|
else {
|
|
121
|
-
const [n,
|
|
122
|
-
if (!n && !
|
|
123
|
-
|
|
124
|
-
else if (n && !
|
|
122
|
+
const [n, i] = I;
|
|
123
|
+
if (!n && !i || n && i)
|
|
124
|
+
R([t, null]), d(`${c(t)} - ...`);
|
|
125
|
+
else if (n && !i) {
|
|
125
126
|
const o = t < n ? [t, n] : [n, t];
|
|
126
|
-
|
|
127
|
-
const [
|
|
128
|
-
|
|
127
|
+
R(o), p(o), u?.(o);
|
|
128
|
+
const [z, v] = o;
|
|
129
|
+
d(`${c(z)} - ${c(v)}`), x();
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
},
|
|
132
|
-
[s,
|
|
133
|
-
),
|
|
134
|
-
const t = new Date(
|
|
135
|
-
|
|
136
|
-
}, [
|
|
137
|
-
const t = new Date(e,
|
|
138
|
-
|
|
139
|
-
}, [
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
const t =
|
|
145
|
-
if (s === "date") return
|
|
146
|
-
const [n] =
|
|
147
|
-
return
|
|
148
|
-
},
|
|
133
|
+
[s, I, S, u, x, c]
|
|
134
|
+
), Fe = N((e) => {
|
|
135
|
+
const t = new Date(m.getFullYear(), e, 1);
|
|
136
|
+
b(t), y === "month" && s === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("day");
|
|
137
|
+
}, [m, y, u, x, s, c]), Ye = N((e) => {
|
|
138
|
+
const t = new Date(e, m.getMonth(), 1);
|
|
139
|
+
b(t), y === "year" && s === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("month");
|
|
140
|
+
}, [m, y, u, x, s, c]), ae = (e) => {
|
|
141
|
+
b((t) => Xe(t, e));
|
|
142
|
+
}, L = (e) => {
|
|
143
|
+
b((t) => Ue(t, e));
|
|
144
|
+
}, O = N((e, t) => He(e, t), []), Ae = (e) => {
|
|
145
|
+
const t = F(e);
|
|
146
|
+
if (s === "date") return g && O(t, g);
|
|
147
|
+
const [n] = I[0] ? I : g;
|
|
148
|
+
return D(n) && O(t, D(n));
|
|
149
|
+
}, Se = (e) => {
|
|
149
150
|
if (s !== "range") return !1;
|
|
150
|
-
const t =
|
|
151
|
-
return
|
|
152
|
-
},
|
|
151
|
+
const t = F(e), [, n] = I[1] ? I : g;
|
|
152
|
+
return D(n) && O(t, D(n));
|
|
153
|
+
}, Re = (e) => {
|
|
153
154
|
if (s !== "range") return !1;
|
|
154
|
-
const t =
|
|
155
|
-
return o && !
|
|
156
|
-
},
|
|
157
|
-
const
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */ r("div", { className: "flex gap-2 w-16", children: t && /* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */ r(
|
|
162
|
-
|
|
155
|
+
const t = F(e), [n, i] = I[0] ? I : g, o = D(n), z = D(i);
|
|
156
|
+
return o && !z ? !1 : o && z && t > F(o) && t < F(z);
|
|
157
|
+
}, ie = (e, t, n) => {
|
|
158
|
+
const i = Qe(e);
|
|
159
|
+
return /* @__PURE__ */ h("div", { className: "w-[300px] p-2 select-none", children: [
|
|
160
|
+
/* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-4 py-1", children: [
|
|
161
|
+
/* @__PURE__ */ r("div", { className: "flex gap-2 w-16", children: t && /* @__PURE__ */ h(U, { children: [
|
|
162
|
+
/* @__PURE__ */ r(
|
|
163
|
+
"button",
|
|
164
|
+
{
|
|
165
|
+
onClick: () => L(-1),
|
|
166
|
+
type: "button",
|
|
167
|
+
className: a(
|
|
168
|
+
"rounded p-1 transition-colors",
|
|
169
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
170
|
+
),
|
|
171
|
+
children: /* @__PURE__ */ r(Pe, { size: 18 })
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ r(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
onClick: () => ae(-1),
|
|
178
|
+
type: "button",
|
|
179
|
+
className: a(
|
|
180
|
+
"rounded p-1 transition-colors",
|
|
181
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
182
|
+
),
|
|
183
|
+
children: /* @__PURE__ */ r(X, { size: 18 })
|
|
184
|
+
}
|
|
185
|
+
)
|
|
163
186
|
] }) }),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
187
|
+
/* @__PURE__ */ h(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
className: a(
|
|
191
|
+
"flex gap-1 text-sm font-semibold whitespace-nowrap",
|
|
192
|
+
l ? "text-neutral-50" : "text-slate-700"
|
|
193
|
+
),
|
|
194
|
+
children: [
|
|
195
|
+
/* @__PURE__ */ r(
|
|
196
|
+
"span",
|
|
197
|
+
{
|
|
198
|
+
className: a(
|
|
199
|
+
"cursor-pointer rounded p-1 transition-colors",
|
|
200
|
+
l ? "hover:bg-neutral-300 hover:text-white" : "hover:bg-slate-50 hover:text-blue-600"
|
|
201
|
+
),
|
|
202
|
+
onClick: () => Y("month"),
|
|
203
|
+
children: H.months[e.getMonth()]
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ r(
|
|
207
|
+
"span",
|
|
208
|
+
{
|
|
209
|
+
className: a(
|
|
210
|
+
"cursor-pointer rounded p-1 transition-colors",
|
|
211
|
+
l ? "hover:bg-neutral-300 hover:text-white" : "hover:bg-slate-50 hover:text-blue-600"
|
|
212
|
+
),
|
|
213
|
+
onClick: () => Y("year"),
|
|
214
|
+
children: e.getFullYear()
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
/* @__PURE__ */ r("div", { className: "flex gap-2 w-16 justify-end", children: n && /* @__PURE__ */ h(U, { children: [
|
|
221
|
+
/* @__PURE__ */ r(
|
|
222
|
+
"button",
|
|
223
|
+
{
|
|
224
|
+
onClick: () => ae(1),
|
|
225
|
+
type: "button",
|
|
226
|
+
className: a(
|
|
227
|
+
"rounded p-1 transition-colors",
|
|
228
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
229
|
+
),
|
|
230
|
+
children: /* @__PURE__ */ r(Z, { size: 18 })
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ r(
|
|
234
|
+
"button",
|
|
235
|
+
{
|
|
236
|
+
onClick: () => L(1),
|
|
237
|
+
type: "button",
|
|
238
|
+
className: a(
|
|
239
|
+
"rounded p-1 transition-colors",
|
|
240
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
241
|
+
),
|
|
242
|
+
children: /* @__PURE__ */ r(Be, { size: 18 })
|
|
243
|
+
}
|
|
244
|
+
)
|
|
171
245
|
] }) })
|
|
172
246
|
] }),
|
|
173
|
-
/* @__PURE__ */ r(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
247
|
+
/* @__PURE__ */ r(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
className: a(
|
|
251
|
+
"mb-1 grid grid-cols-7 text-center text-[11px] font-bold uppercase",
|
|
252
|
+
l ? "text-blue-500" : "text-blue-600"
|
|
253
|
+
),
|
|
254
|
+
children: H.weekdaysShort.map((o) => /* @__PURE__ */ r("div", { className: "py-1", children: o }, o))
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-7 gap-y-1 relative", children: i.map((o, z) => {
|
|
258
|
+
const v = o.date, ue = S(v), P = Ae(v), B = Se(v), Le = Re(v);
|
|
259
|
+
return /* @__PURE__ */ r(
|
|
260
|
+
"div",
|
|
261
|
+
{
|
|
262
|
+
className: a(
|
|
263
|
+
"relative flex h-10 items-center justify-center",
|
|
264
|
+
Le && (l ? "bg-blue-500/15" : "bg-blue-50"),
|
|
265
|
+
P && s === "range" && B ? l ? "rounded-full bg-blue-500" : "rounded-full bg-blue-50" : P && s === "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 && s === "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
|
+
),
|
|
268
|
+
children: /* @__PURE__ */ r(
|
|
269
|
+
"button",
|
|
270
|
+
{
|
|
271
|
+
type: "button",
|
|
272
|
+
onClick: () => ze(v),
|
|
273
|
+
disabled: ue,
|
|
274
|
+
className: a(
|
|
275
|
+
"z-10 flex h-9 w-9 cursor-pointer items-center justify-center rounded-full text-sm font-medium transition-all",
|
|
276
|
+
o.isCurrentMonth ? l ? "text-neutral-50" : "text-slate-700" : l ? "text-neutral-100/40" : "text-slate-300",
|
|
277
|
+
ue && "cursor-not-allowed opacity-20",
|
|
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
|
+
O(v, /* @__PURE__ */ new Date()) && !P && !B && (l ? "border border-blue-500 text-blue-500" : "border border-blue-600 text-blue-600")
|
|
280
|
+
),
|
|
281
|
+
children: v.getDate()
|
|
282
|
+
}
|
|
283
|
+
)
|
|
284
|
+
},
|
|
285
|
+
z
|
|
286
|
+
);
|
|
177
287
|
}) })
|
|
178
288
|
] });
|
|
179
|
-
},
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */ r(
|
|
182
|
-
|
|
183
|
-
|
|
289
|
+
}, je = () => /* @__PURE__ */ h("div", { className: "w-[300px] p-3", children: [
|
|
290
|
+
/* @__PURE__ */ h("div", { className: "flex justify-between items-center mb-4 px-2", children: [
|
|
291
|
+
/* @__PURE__ */ r(
|
|
292
|
+
"button",
|
|
293
|
+
{
|
|
294
|
+
type: "button",
|
|
295
|
+
onClick: () => L(-1),
|
|
296
|
+
className: a(
|
|
297
|
+
"rounded p-1",
|
|
298
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
299
|
+
),
|
|
300
|
+
children: /* @__PURE__ */ r(X, { size: 20 })
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
/* @__PURE__ */ r("span", { className: a("font-bold", l ? "text-neutral-50" : "text-slate-800"), children: m.getFullYear() }),
|
|
304
|
+
/* @__PURE__ */ r(
|
|
305
|
+
"button",
|
|
306
|
+
{
|
|
307
|
+
type: "button",
|
|
308
|
+
onClick: () => L(1),
|
|
309
|
+
className: a(
|
|
310
|
+
"rounded p-1",
|
|
311
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
312
|
+
),
|
|
313
|
+
children: /* @__PURE__ */ r(Z, { size: 20 })
|
|
314
|
+
}
|
|
315
|
+
)
|
|
184
316
|
] }),
|
|
185
|
-
/* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children:
|
|
186
|
-
] }),
|
|
187
|
-
const e = Math.floor(
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */ r(
|
|
191
|
-
|
|
317
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: H.monthsShort.map((e, t) => /* @__PURE__ */ r("button", { type: "button", onClick: () => Fe(t), className: a("py-3 rounded-lg text-sm font-semibold transition-colors hover:cursor-pointer", m.getMonth() === t ? "bg-blue-600 text-white" : l ? "text-neutral-50 hover:bg-neutral-300 hover:text-white" : "text-slate-600 hover:bg-blue-50"), children: e }, e)) })
|
|
318
|
+
] }), Ee = () => {
|
|
319
|
+
const e = Math.floor(m.getFullYear() / 12) * 12 + we * 12, t = Array.from({ length: 12 }, (n, i) => e + i);
|
|
320
|
+
return /* @__PURE__ */ h("div", { className: "w-[300px] p-3", children: [
|
|
321
|
+
/* @__PURE__ */ h("div", { className: "flex justify-between items-center mb-4 px-2", children: [
|
|
322
|
+
/* @__PURE__ */ r(
|
|
323
|
+
"button",
|
|
324
|
+
{
|
|
325
|
+
type: "button",
|
|
326
|
+
onClick: () => _((n) => n - 1),
|
|
327
|
+
className: a(
|
|
328
|
+
"rounded p-1",
|
|
329
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
330
|
+
),
|
|
331
|
+
children: /* @__PURE__ */ r(X, { size: 20 })
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ h("span", { className: a("font-bold", l ? "text-neutral-50" : "text-slate-800"), children: [
|
|
192
335
|
t[0],
|
|
193
336
|
" - ",
|
|
194
337
|
t[11]
|
|
195
338
|
] }),
|
|
196
|
-
/* @__PURE__ */ r(
|
|
339
|
+
/* @__PURE__ */ r(
|
|
340
|
+
"button",
|
|
341
|
+
{
|
|
342
|
+
type: "button",
|
|
343
|
+
onClick: () => _((n) => n + 1),
|
|
344
|
+
className: a(
|
|
345
|
+
"rounded p-1",
|
|
346
|
+
l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
|
|
347
|
+
),
|
|
348
|
+
children: /* @__PURE__ */ r(Z, { size: 20 })
|
|
349
|
+
}
|
|
350
|
+
)
|
|
197
351
|
] }),
|
|
198
|
-
/* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: t.map((n) => /* @__PURE__ */ r("button", { type: "button", onClick: () =>
|
|
352
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: t.map((n) => /* @__PURE__ */ r("button", { type: "button", onClick: () => Ye(n), className: a("py-3 rounded-lg text-sm font-semibold transition-colors hover:cursor-pointer", m.getFullYear() === n ? "bg-blue-600 text-white" : l ? "text-neutral-50 hover:bg-neutral-300 hover:text-white" : "text-slate-600 hover:bg-blue-50"), children: n }, n)) })
|
|
199
353
|
] });
|
|
200
|
-
},
|
|
354
|
+
}, ce = /* @__PURE__ */ r(
|
|
201
355
|
"div",
|
|
202
356
|
{
|
|
203
|
-
onClick:
|
|
204
|
-
className:
|
|
205
|
-
"cursor-pointer
|
|
206
|
-
|
|
357
|
+
onClick: Ne,
|
|
358
|
+
className: a(
|
|
359
|
+
"flex cursor-pointer items-center justify-center rounded-md p-1 transition-colors",
|
|
360
|
+
A ? "pointer-events-none opacity-50" : l ? "hover:bg-neutral-300 active:bg-neutral-200" : "hover:bg-slate-100 active:bg-slate-200"
|
|
207
361
|
),
|
|
208
|
-
children: /* @__PURE__ */ r(
|
|
362
|
+
children: /* @__PURE__ */ r(
|
|
363
|
+
Oe,
|
|
364
|
+
{
|
|
365
|
+
weight: "Linear",
|
|
366
|
+
size: 20,
|
|
367
|
+
className: a(
|
|
368
|
+
l ? f || q ? "text-white" : "text-neutral-100" : "text-slate-400"
|
|
369
|
+
)
|
|
370
|
+
}
|
|
371
|
+
)
|
|
209
372
|
}
|
|
210
373
|
);
|
|
211
|
-
return /* @__PURE__ */
|
|
374
|
+
return /* @__PURE__ */ h("div", { ref: E, className: a("relative w-full group", be), children: [
|
|
212
375
|
/* @__PURE__ */ r("div", { ref: ve, children: /* @__PURE__ */ r(
|
|
213
|
-
|
|
376
|
+
_e,
|
|
214
377
|
{
|
|
215
378
|
label: fe,
|
|
216
|
-
placeholder: Array.isArray(
|
|
217
|
-
value:
|
|
218
|
-
onChange:
|
|
219
|
-
icon:
|
|
220
|
-
rightIcon:
|
|
221
|
-
disabled:
|
|
379
|
+
placeholder: Array.isArray(K) ? K[0] : K,
|
|
380
|
+
value: j,
|
|
381
|
+
onChange: Ie,
|
|
382
|
+
icon: ne === "left" ? ce : void 0,
|
|
383
|
+
rightIcon: ne === "right" ? ce : void 0,
|
|
384
|
+
disabled: A,
|
|
222
385
|
required: me,
|
|
223
386
|
error: ge,
|
|
387
|
+
darkMode: l,
|
|
224
388
|
maxLength: s === "date" ? 10 : void 0,
|
|
225
|
-
onFocus:
|
|
226
|
-
onBlur:
|
|
227
|
-
readOnly: !
|
|
228
|
-
showClearButton:
|
|
229
|
-
onClear:
|
|
389
|
+
onFocus: De,
|
|
390
|
+
onBlur: ye,
|
|
391
|
+
readOnly: !te || s === "range",
|
|
392
|
+
showClearButton: pe,
|
|
393
|
+
onClear: Ce
|
|
230
394
|
}
|
|
231
395
|
) }),
|
|
232
|
-
|
|
396
|
+
f && /* @__PURE__ */ r(
|
|
233
397
|
"div",
|
|
234
398
|
{
|
|
235
|
-
className:
|
|
236
|
-
"absolute top-[calc(100%+4px)] z-[100]
|
|
237
|
-
"flex flex-col
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
399
|
+
className: a(
|
|
400
|
+
"absolute top-[calc(100%+4px)] z-[100] rounded-xl border shadow-xl",
|
|
401
|
+
"flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200 md:flex-row",
|
|
402
|
+
l ? "border-neutral-200 bg-[#1F2025]" : "border-slate-200 bg-white",
|
|
403
|
+
G === "right" && "right-0 origin-top-right",
|
|
404
|
+
G === "left" && "left-0 origin-top-left",
|
|
405
|
+
G === "center" && "left-1/2 -translate-x-1/2 origin-top"
|
|
241
406
|
),
|
|
242
407
|
style: { width: "max-content" },
|
|
243
408
|
onMouseDown: (e) => e.stopPropagation(),
|
|
244
|
-
children:
|
|
245
|
-
|
|
246
|
-
s === "range" && /* @__PURE__ */ r("div", { className:
|
|
247
|
-
|
|
409
|
+
children: le === "day" ? /* @__PURE__ */ h(U, { children: [
|
|
410
|
+
ie(m, !0, s !== "range"),
|
|
411
|
+
s === "range" && /* @__PURE__ */ r("div", { className: a(
|
|
412
|
+
"hidden border-l md:block",
|
|
413
|
+
l ? "border-neutral-200" : "border-slate-100"
|
|
414
|
+
), children: ie(new Date(m.getFullYear(), m.getMonth() + 1, 1), !1, !0) })
|
|
415
|
+
] }) : le === "month" ? je() : Ee()
|
|
248
416
|
}
|
|
249
417
|
)
|
|
250
418
|
] });
|
|
251
419
|
}
|
|
252
420
|
);
|
|
253
|
-
|
|
421
|
+
Ze.displayName = "MciPicker";
|
|
254
422
|
export {
|
|
255
|
-
|
|
423
|
+
Ze as default
|
|
256
424
|
};
|