@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.
Files changed (67) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared/ui/MciModal/MciModal.js +107 -59
  3. package/dist/shared/ui/mciAccordion/MciAccordion.js +97 -64
  4. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +23 -21
  5. package/dist/shared/ui/mciButton/MciButton.js +47 -32
  6. package/dist/shared/ui/mciCheck/MciCheck.js +116 -92
  7. package/dist/shared/ui/mciCollapse/MciCollapse.js +86 -54
  8. package/dist/shared/ui/mciDrawer/MciDrawer.js +82 -59
  9. package/dist/shared/ui/mciInput/MciInput.js +143 -130
  10. package/dist/shared/ui/mciInput/mci-input.utils.js +10 -10
  11. package/dist/shared/ui/mciPagination/MciPagination.js +85 -63
  12. package/dist/shared/ui/mciPhone/MciPhone.js +59 -54
  13. package/dist/shared/ui/mciPhone/mci-phone.utils.js +10 -10
  14. package/dist/shared/ui/mciPicker/MciPicker.js +349 -181
  15. package/dist/shared/ui/mciSelect/MciSelect.js +150 -131
  16. package/dist/shared/ui/mciSelect/mci-select.utils.js +12 -12
  17. package/dist/shared/ui/mciSkeleton/MciSkeleton.js +16 -14
  18. package/dist/shared/ui/mciTable/MciTable.js +165 -126
  19. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +113 -106
  20. package/dist/shared/ui/mciTabs/MciTabs.js +73 -55
  21. package/dist/shared/ui/mciTag/MciTag.js +27 -18
  22. package/dist/shared/ui/mciTextarea/MciTextarea.js +47 -35
  23. package/dist/shared/ui/mciToast/MciToast.js +118 -72
  24. package/dist/shared/ui/mciToast/mci-toast.utils.js +40 -12
  25. package/dist/shared/ui/mciToggle/MciToggle.js +58 -36
  26. package/dist/shared/ui/mciTooltip/MciTooltip.js +2 -2
  27. package/dist/shared/ui/mciUpload/MciUpload.js +172 -149
  28. package/dist/types/shared/types/mci-table.types.d.ts +1 -0
  29. package/dist/types/shared/types/ui/accordion.types.d.ts +1 -0
  30. package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -0
  31. package/dist/types/shared/types/ui/button.types.d.ts +3 -7
  32. package/dist/types/shared/types/ui/check.types.d.ts +4 -9
  33. package/dist/types/shared/types/ui/collapse.types.d.ts +1 -0
  34. package/dist/types/shared/types/ui/drawer.types.d.ts +2 -0
  35. package/dist/types/shared/types/ui/input.types.d.ts +4 -15
  36. package/dist/types/shared/types/ui/modal.types.d.ts +1 -0
  37. package/dist/types/shared/types/ui/pagination.types.d.ts +1 -0
  38. package/dist/types/shared/types/ui/phone.types.d.ts +1 -0
  39. package/dist/types/shared/types/ui/picker.types.d.ts +1 -0
  40. package/dist/types/shared/types/ui/select.types.d.ts +1 -0
  41. package/dist/types/shared/types/ui/skeleton.types.d.ts +1 -0
  42. package/dist/types/shared/types/ui/tabs.types.d.ts +1 -0
  43. package/dist/types/shared/types/ui/tag.types.d.ts +1 -0
  44. package/dist/types/shared/types/ui/textarea.types.d.ts +3 -7
  45. package/dist/types/shared/types/ui/toast.types.d.ts +1 -0
  46. package/dist/types/shared/types/ui/toggle.types.d.ts +3 -2
  47. package/dist/types/shared/types/ui/upload.types.d.ts +1 -0
  48. package/dist/types/shared/ui/MciModal/MciModal.d.ts +1 -1
  49. package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +5 -3
  50. package/dist/types/shared/ui/mciBreadcrumb/MciBreadcrumb.d.ts +1 -1
  51. package/dist/types/shared/ui/mciButton/MciButton.d.ts +1 -1
  52. package/dist/types/shared/ui/mciCollapse/MciCollapse.d.ts +1 -1
  53. package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
  54. package/dist/types/shared/ui/mciInput/MciInput.d.ts +13 -2
  55. package/dist/types/shared/ui/mciInput/mci-input.utils.d.ts +2 -2
  56. package/dist/types/shared/ui/mciPagination/MciPagination.d.ts +1 -1
  57. package/dist/types/shared/ui/mciPhone/mci-phone.utils.d.ts +2 -2
  58. package/dist/types/shared/ui/mciSelect/mci-select.utils.d.ts +2 -2
  59. package/dist/types/shared/ui/mciSkeleton/MciSkeleton.d.ts +1 -1
  60. package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
  61. package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +2 -1
  62. package/dist/types/shared/ui/mciTabs/MciTabs.d.ts +1 -1
  63. package/dist/types/shared/ui/mciTag/MciTag.d.ts +1 -1
  64. package/dist/types/shared/ui/mciTextarea/MciTextarea.d.ts +7 -2
  65. package/dist/types/shared/ui/mciToast/mci-toast.utils.d.ts +32 -4
  66. package/dist/types/shared/ui/mciToggle/MciToggle.d.ts +1 -1
  67. package/package.json +1 -1
@@ -1,256 +1,424 @@
1
- import { jsx as r, jsxs as d, Fragment as G } from "react/jsx-runtime";
2
- import { Calendar as je, AltArrowLeft as H, AltArrowRight as J, DoubleAltArrowLeft as Ee, DoubleAltArrowRight as Le } from "@solar-icons/react";
3
- import { forwardRef as Oe, useState as v, useRef as Pe, useMemo as de, useCallback as x, useEffect as O } from "react";
4
- import { useClickOutside as Be, useEscapeKey as $e, cn as M } from "../../lib/utils.js";
5
- import { locales as Te } from "../../lib/locales.js";
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 Ke from "../mciInput/MciInput.js";
8
- import { toSafeDate as w, formatDateByPattern as Ve, isDateOutsideBounds as We, normalizeDate as I, isSameCalendarDay as _e, parseDateFromInput as ue, formatManualDateInput as qe, getCalendarDays as Ge, shiftYear as He, shiftMonth as Je } from "./mci-picker.utils.js";
9
- const Qe = Oe(
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: P,
13
- onChange: i,
14
- placeholder: B,
12
+ value: T,
13
+ onChange: u,
14
+ placeholder: K,
15
15
  label: fe,
16
- disabled: z = !1,
16
+ darkMode: l = !1,
17
+ disabled: A = !1,
17
18
  required: me = !1,
18
- className: he,
19
- format: Q = "DD.MM.YYYY",
20
- minDate: U,
21
- maxDate: X,
19
+ className: be,
20
+ format: k = "DD.MM.YYYY",
21
+ minDate: M,
22
+ maxDate: ee,
22
23
  error: ge,
23
- showClear: be = !0,
24
- allowManualInput: Z = !0,
25
- locale: pe = "uz",
26
- startView: N = "day",
27
- iconPosition: ee = "left",
28
- align: $ = "auto"
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 [h, T] = v(!1), [te, g] = v(
31
+ const [f, W] = w(!1), [re, p] = w(
31
32
  s === "range" ? [null, null] : null
32
- ), [D, Y] = v([null, null]), [u, f] = v(/* @__PURE__ */ new Date()), [ne, C] = v(N), [xe, K] = v(0), [A, c] = v(""), [re, se] = v(!1), [V, oe] = v($), S = Pe(null), m = de(() => {
33
- const e = P !== void 0 ? P : te;
34
- if (s === "date") return w(e);
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 [w(t[0]), w(t[1])];
37
- }, [P, te, s]), W = Te[pe], a = x(
38
- (e) => Ve(e, Q),
39
- [Q]
40
- ), F = x(
41
- (e) => We(e, U, X),
42
- [U, X]
43
- ), k = de(() => {
44
- if (s === "date") return a(m);
45
- const [e, t] = m;
46
- return !e && !t ? "" : e && t ? `${a(e)} - ${a(t)}` : e ? `${a(e)} - ...` : "...";
47
- }, [s, m, a]);
48
- O(() => {
49
- (!h && !re || A === "" && k !== "") && c(k);
50
- }, [k, h, A, re]), O(() => {
51
- if (h)
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 = m;
54
- Y(e), e[0] ? f(e[0]) : e[1] ? f(e[1]) : f(/* @__PURE__ */ new Date());
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 = m;
57
- f(e || /* @__PURE__ */ new Date());
57
+ const e = g;
58
+ b(e || /* @__PURE__ */ new Date());
58
59
  }
59
- }, [h, s, m]), O(() => {
60
- if (h && $ === "auto" && S.current) {
61
- const e = S.current.getBoundingClientRect(), t = window.innerWidth - e.right, n = e.left;
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
- }, [h, $]);
65
- const b = x(() => {
66
- T(!1), C(N), K(0), c(k);
67
- }, [N, k]), we = x((e) => {
68
- z || (e.preventDefault(), e.stopPropagation(), T((t) => !t));
69
- }, [z]), { handleClick: _ } = Be(S, b), { handleEscape: q } = $e(b);
70
- O(() => {
71
- if (h)
72
- return document.addEventListener("mousedown", _), document.addEventListener("keydown", q), () => {
73
- document.removeEventListener("mousedown", _), document.removeEventListener("keydown", q);
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
- }, [h, _, q]);
76
- const Ne = () => {
77
- se(!0), !(z || h) && (s === "range" || !Z) && (T(!0), C(N));
78
- }, De = () => {
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 = A.trim();
81
+ const e = j.trim();
81
82
  if (!e) {
82
- g(null), i?.(null);
83
+ p(null), u?.(null);
83
84
  return;
84
85
  }
85
- const t = ue(e);
86
- if (t && !F(t)) {
87
- const n = I(t);
88
- g(n), i?.(n), c(a(n)), f(n);
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
- c(k);
92
- }, ke = (e) => {
92
+ d(C);
93
+ }, Ie = (e) => {
93
94
  if (s !== "date") return;
94
- const t = e.target.value, n = qe(t), l = n.replace(/\D/g, "");
95
- if (!(l.length >= 1 && Number.parseInt(l[0] ?? "0", 10) > 3)) {
96
- if (l.length >= 2) {
97
- const o = Number.parseInt(l.slice(0, 2), 10);
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 (!(l.length >= 3 && Number.parseInt(l[2] ?? "0", 10) > 1)) {
101
- if (l.length >= 4) {
102
- const o = Number.parseInt(l.slice(2, 4), 10);
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 (c(n), n.length === 10) {
106
- const o = ue(n);
107
- o && !F(o) && (g(o), i?.(o), f(o));
108
- } else n === "" && (g(null), i?.(null));
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
- }, ye = x(() => {
112
+ }, Ce = N(() => {
112
113
  const e = s === "range" ? [null, null] : null;
113
- g(e), Y([null, null]), i?.(e), c("");
114
- }, [s, i]), Me = x(
114
+ p(e), R([null, null]), u?.(e), d("");
115
+ }, [s, u]), ze = N(
115
116
  (e) => {
116
- if (F(e)) return;
117
- const t = I(e);
117
+ if (S(e)) return;
118
+ const t = F(e);
118
119
  if (s === "date")
119
- g(t), i?.(t), c(a(t)), b();
120
+ p(t), u?.(t), d(c(t)), x();
120
121
  else {
121
- const [n, l] = D;
122
- if (!n && !l || n && l)
123
- Y([t, null]), c(`${a(t)} - ...`);
124
- else if (n && !l) {
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
- Y(o), g(o), i?.(o);
127
- const [y, p] = o;
128
- c(`${a(y)} - ${a(p)}`), b();
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, D, F, i, b, a]
133
- ), Ie = x((e) => {
134
- const t = new Date(u.getFullYear(), e, 1);
135
- f(t), N === "month" && s === "date" ? (g(t), i?.(t), c(a(t)), b()) : C("day");
136
- }, [u, N, i, b, s, a]), Ce = x((e) => {
137
- const t = new Date(e, u.getMonth(), 1);
138
- f(t), N === "year" && s === "date" ? (g(t), i?.(t), c(a(t)), b()) : C("month");
139
- }, [u, N, i, b, s, a]), le = (e) => {
140
- f((t) => Je(t, e));
141
- }, R = (e) => {
142
- f((t) => He(t, e));
143
- }, j = x((e, t) => _e(e, t), []), ze = (e) => {
144
- const t = I(e);
145
- if (s === "date") return m && j(t, m);
146
- const [n] = D[0] ? D : m;
147
- return w(n) && j(t, w(n));
148
- }, Fe = (e) => {
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 = I(e), [, n] = D[1] ? D : m;
151
- return w(n) && j(t, w(n));
152
- }, Ye = (e) => {
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 = I(e), [n, l] = D[0] ? D : m, o = w(n), y = w(l);
155
- return o && !y ? !1 : o && y && t > I(o) && t < I(y);
156
- }, ae = (e, t, n) => {
157
- const l = Ge(e);
158
- return /* @__PURE__ */ d("div", { className: "w-[300px] p-2 select-none", children: [
159
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-4 py-1", children: [
160
- /* @__PURE__ */ r("div", { className: "flex gap-2 w-16", children: t && /* @__PURE__ */ d(G, { children: [
161
- /* @__PURE__ */ r("button", { onClick: () => R(-1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ r(Ee, { size: 18 }) }),
162
- /* @__PURE__ */ r("button", { onClick: () => le(-1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ r(H, { size: 18 }) })
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__ */ d("div", { className: "flex gap-1 font-semibold text-slate-700 text-sm whitespace-nowrap", children: [
165
- /* @__PURE__ */ r("span", { className: "cursor-pointer hover:text-blue-600 transition-colors p-1 rounded hover:bg-slate-50", onClick: () => C("month"), children: W.months[e.getMonth()] }),
166
- /* @__PURE__ */ r("span", { className: "cursor-pointer hover:text-blue-600 transition-colors p-1 rounded hover:bg-slate-50", onClick: () => C("year"), children: e.getFullYear() })
167
- ] }),
168
- /* @__PURE__ */ r("div", { className: "flex gap-2 w-16 justify-end", children: n && /* @__PURE__ */ d(G, { children: [
169
- /* @__PURE__ */ r("button", { onClick: () => le(1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ r(J, { size: 18 }) }),
170
- /* @__PURE__ */ r("button", { onClick: () => R(1), type: "button", className: "hover:bg-slate-100 p-1 rounded transition-colors text-slate-500", children: /* @__PURE__ */ r(Le, { size: 18 }) })
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("div", { className: "grid grid-cols-7 mb-1 text-center text-[11px] font-bold text-blue-600 uppercase", children: W.weekdaysShort.map((o) => /* @__PURE__ */ r("div", { className: "py-1", children: o }, o)) }),
174
- /* @__PURE__ */ r("div", { className: "grid grid-cols-7 gap-y-1 relative", children: l.map((o, y) => {
175
- const p = o.date, ce = F(p), E = ze(p), L = Fe(p), Re = Ye(p);
176
- return /* @__PURE__ */ r("div", { className: M("h-10 flex items-center justify-center relative", Re && "bg-blue-50", E && s === "range" && L ? "bg-blue-50 rounded-full" : E && s === "range" ? "bg-gradient-to-r from-transparent to-blue-50 rounded-l-full" : "", L && s === "range" ? "bg-gradient-to-l from-transparent to-blue-50 rounded-r-full" : ""), children: /* @__PURE__ */ r("button", { type: "button", onClick: () => Me(p), disabled: ce, className: M("w-9 h-9 cursor-pointer rounded-full flex items-center justify-center text-sm font-medium transition-all z-10", o.isCurrentMonth ? "text-slate-700" : "text-slate-300", ce && "opacity-20 cursor-not-allowed", E || L ? "bg-blue-600 text-white shadow-md shadow-blue-200 hover:bg-blue-700" : "hover:bg-blue-50", j(p, /* @__PURE__ */ new Date()) && !E && !L && "text-blue-600 border border-blue-600"), children: p.getDate() }) }, y);
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
- }, Ae = () => /* @__PURE__ */ d("div", { className: "w-[300px] p-3", children: [
180
- /* @__PURE__ */ d("div", { className: "flex justify-between items-center mb-4 px-2", children: [
181
- /* @__PURE__ */ r("button", { type: "button", onClick: () => R(-1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ r(H, { size: 20 }) }),
182
- /* @__PURE__ */ r("span", { className: "font-bold text-slate-800", children: u.getFullYear() }),
183
- /* @__PURE__ */ r("button", { type: "button", onClick: () => R(1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ r(J, { size: 20 }) })
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: W.monthsShort.map((e, t) => /* @__PURE__ */ r("button", { type: "button", onClick: () => Ie(t), className: M("hover:cursor-pointer py-3 rounded-lg text-sm font-semibold transition-colors", u.getMonth() === t ? "bg-blue-600 text-white" : "hover:bg-blue-50 text-slate-600"), children: e }, e)) })
186
- ] }), Se = () => {
187
- const e = Math.floor(u.getFullYear() / 12) * 12 + xe * 12, t = Array.from({ length: 12 }, (n, l) => e + l);
188
- return /* @__PURE__ */ d("div", { className: "w-[300px] p-3", children: [
189
- /* @__PURE__ */ d("div", { className: "flex justify-between items-center mb-4 px-2", children: [
190
- /* @__PURE__ */ r("button", { type: "button", onClick: () => K((n) => n - 1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ r(H, { size: 20 }) }),
191
- /* @__PURE__ */ d("span", { className: "font-bold text-slate-800", children: [
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("button", { type: "button", onClick: () => K((n) => n + 1), className: "p-1 hover:bg-slate-100 rounded text-slate-500", children: /* @__PURE__ */ r(J, { size: 20 }) })
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: () => Ce(n), className: M("hover:cursor-pointer py-3 rounded-lg text-sm font-semibold transition-colors", u.getFullYear() === n ? "bg-blue-600 text-white" : "hover:bg-blue-50 text-slate-600"), children: n }, n)) })
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
- }, ie = /* @__PURE__ */ r(
354
+ }, ce = /* @__PURE__ */ r(
201
355
  "div",
202
356
  {
203
- onClick: we,
204
- className: M(
205
- "cursor-pointer flex items-center justify-center p-1 rounded-md transition-colors",
206
- z ? "pointer-events-none opacity-50" : "hover:bg-slate-100 active:bg-slate-200"
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(je, { weight: "Linear", size: 20, className: "text-slate-400" })
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__ */ d("div", { ref: S, className: M("relative w-full group", he), children: [
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
- Ke,
376
+ _e,
214
377
  {
215
378
  label: fe,
216
- placeholder: Array.isArray(B) ? B[0] : B,
217
- value: A,
218
- onChange: ke,
219
- icon: ee === "left" ? ie : void 0,
220
- rightIcon: ee === "right" ? ie : void 0,
221
- disabled: z,
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: Ne,
226
- onBlur: De,
227
- readOnly: !Z || s === "range",
228
- showClearButton: be,
229
- onClear: ye
389
+ onFocus: De,
390
+ onBlur: ye,
391
+ readOnly: !te || s === "range",
392
+ showClearButton: pe,
393
+ onClear: Ce
230
394
  }
231
395
  ) }),
232
- h && /* @__PURE__ */ r(
396
+ f && /* @__PURE__ */ r(
233
397
  "div",
234
398
  {
235
- className: M(
236
- "absolute top-[calc(100%+4px)] z-[100] bg-white rounded-xl shadow-xl border border-slate-200",
237
- "flex flex-col md:flex-row overflow-hidden animate-in fade-in zoom-in-95 duration-200",
238
- V === "right" && "right-0 origin-top-right",
239
- V === "left" && "left-0 origin-top-left",
240
- V === "center" && "left-1/2 -translate-x-1/2 origin-top"
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: ne === "day" ? /* @__PURE__ */ d(G, { children: [
245
- ae(u, !0, s !== "range"),
246
- s === "range" && /* @__PURE__ */ r("div", { className: "hidden md:block border-l border-slate-100", children: ae(new Date(u.getFullYear(), u.getMonth() + 1, 1), !1, !0) })
247
- ] }) : ne === "month" ? Ae() : Se()
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
- Qe.displayName = "MciPicker";
421
+ Ze.displayName = "MciPicker";
254
422
  export {
255
- Qe as default
423
+ Ze as default
256
424
  };