@mci-ui/mci-ui 0.0.84 → 0.0.86

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 (47) hide show
  1. package/dist/assets/icons/check.svg.js +5 -0
  2. package/dist/assets/icons/close.svg.js +5 -0
  3. package/dist/assets/icons/loaderIcon.svg.js +5 -0
  4. package/dist/index.js +53 -0
  5. package/dist/shared/lib/hooks/useTableColumnSettings.js +132 -0
  6. package/dist/shared/lib/locales.js +101 -0
  7. package/dist/shared/lib/uploadLanguage.js +80 -0
  8. package/dist/shared/lib/utils.js +20 -0
  9. package/dist/shared/ui/MciModal/MciModal.js +97 -0
  10. package/dist/shared/ui/mciAccordion/MciAccordion.js +74 -0
  11. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +39 -0
  12. package/dist/shared/ui/mciButton/MciButton.js +63 -0
  13. package/dist/shared/ui/mciCheck/MciCheck.js +170 -0
  14. package/dist/shared/ui/mciCollapse/MciCollapse.js +60 -0
  15. package/dist/shared/ui/mciDrawer/MciDrawer.js +108 -0
  16. package/dist/shared/ui/mciIdentityInput/MciIdentityInput.js +30 -0
  17. package/dist/shared/ui/mciIdentityInput/mci-identity-input.utils.js +32 -0
  18. package/dist/shared/ui/mciInput/MciInput.js +225 -0
  19. package/dist/shared/ui/mciInput/mci-input.utils.js +49 -0
  20. package/dist/shared/ui/mciLoader/MciLoader.js +38 -0
  21. package/dist/shared/ui/mciPagination/MciPagination.js +135 -0
  22. package/dist/shared/ui/mciPagination/mci-pagination.utils.js +12 -0
  23. package/dist/shared/ui/mciPhone/MciPhone.js +83 -0
  24. package/dist/shared/ui/mciPhone/mci-phone.utils.js +47 -0
  25. package/dist/shared/ui/mciPicker/MciPicker.js +256 -0
  26. package/dist/shared/ui/mciPicker/mci-picker.utils.js +62 -0
  27. package/dist/shared/ui/mciSelect/MciSelect.js +226 -0
  28. package/dist/shared/ui/mciSelect/mci-select.utils.js +52 -0
  29. package/dist/shared/ui/mciSkeleton/MciSkeleton.js +29 -0
  30. package/dist/shared/ui/mciTable/MciTable.js +153 -0
  31. package/dist/shared/ui/mciTable/MciTableClamp2.js +7 -0
  32. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +198 -0
  33. package/dist/shared/ui/mciTable/mci-table.utils.js +14 -0
  34. package/dist/shared/ui/mciTabs/MciTabs.js +131 -0
  35. package/dist/shared/ui/mciTag/MciTag.js +46 -0
  36. package/dist/shared/ui/mciTextarea/MciTextarea.js +56 -0
  37. package/dist/shared/ui/mciToast/MciToast.js +106 -0
  38. package/dist/shared/ui/mciToast/mci-toast.utils.js +47 -0
  39. package/dist/shared/ui/mciToggle/MciToggle.js +77 -0
  40. package/dist/shared/ui/mciTooltip/MciTooltip.js +52 -0
  41. package/dist/shared/ui/mciUpload/MciUpload.js +337 -0
  42. package/dist/shared/ui/mciUpload/mci-upload.utils.js +186 -0
  43. package/dist/types/shared/types/mci-table.types.d.ts +1 -0
  44. package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
  45. package/package.json +15 -12
  46. package/dist/index.es.js +0 -3387
  47. package/dist/index.umd.js +0 -2
@@ -0,0 +1,49 @@
1
+ const p = {
2
+ sm: {
3
+ input: "h-9 text-sm",
4
+ icon: "w-4 h-4",
5
+ leftIcon: "left-2",
6
+ rightIcon: "right-2",
7
+ labelFont: "text-sm",
8
+ iconWrapper: "h-4"
9
+ },
10
+ md: {
11
+ input: "h-10 text-sm",
12
+ icon: "w-4 h-4",
13
+ leftIcon: "left-2",
14
+ rightIcon: "right-2",
15
+ labelFont: "text-base",
16
+ iconWrapper: "h-4"
17
+ },
18
+ base: {
19
+ input: "h-12 text-base",
20
+ icon: "w-5 h-5",
21
+ leftIcon: "left-3",
22
+ rightIcon: "right-3",
23
+ labelFont: "text-base",
24
+ iconWrapper: "h-5"
25
+ }
26
+ };
27
+ function u(e, r) {
28
+ const t = (n) => n === "sm" ? e && r ? "pl-7 pr-7" : e ? "pl-7 pr-2" : r ? "pl-2 pr-7" : "px-2" : n === "md" ? e && r ? "pl-8 pr-8" : e ? "pl-8 pr-2" : r ? "pl-2 pr-8" : "px-4" : e && r ? "pl-9 pr-9" : e ? "pl-9 pr-3" : r ? "pl-3 pr-9" : "px-4";
29
+ return {
30
+ sm: { ...p.sm, padding: t("sm") },
31
+ md: { ...p.md, padding: t("md") },
32
+ base: { ...p.base, padding: t("base") }
33
+ };
34
+ }
35
+ function i(e) {
36
+ return e ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600";
37
+ }
38
+ function f(e, r, t) {
39
+ return e ? "text-slate-400" : r ? "text-red-600" : t ? "text-black" : "text-slate-400";
40
+ }
41
+ function d(e, r) {
42
+ return r <= 0 ? "" : e === "sm" ? r >= 3 ? "pr-14" : r === 2 ? "pr-11" : "pr-7" : e === "md" ? r >= 3 ? "pr-16" : r === 2 ? "pr-12" : "pr-8" : r >= 3 ? "pr-20" : r === 2 ? "pr-16" : "pr-10";
43
+ }
44
+ export {
45
+ f as getInputIconColor,
46
+ d as getInputRightPaddingClass,
47
+ u as getInputSizes,
48
+ i as getInputStateStyles
49
+ };
@@ -0,0 +1,38 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { cn as l } from "../../lib/utils.js";
3
+ import a from "../../../assets/icons/loaderIcon.svg.js";
4
+ function d({
5
+ className: o,
6
+ size: e = 150,
7
+ iconClassName: t,
8
+ isLoading: i = !1,
9
+ isFullPage: n = !0,
10
+ variant: u = "yellow"
11
+ }) {
12
+ return i ? /* @__PURE__ */ r(
13
+ "div",
14
+ {
15
+ className: l(
16
+ "z-[99px] flex flex-col items-center justify-center transition-all duration-300",
17
+ n ? "fixed inset-0 backdrop-blur-[2px]" : "absolute inset-0 w-full h-full rounded-[inherit]",
18
+ o
19
+ ),
20
+ children: /* @__PURE__ */ r(
21
+ a,
22
+ {
23
+ width: e,
24
+ height: e,
25
+ className: l(
26
+ "animate-spin",
27
+ !t && (u === "blue" ? "text-blue-600" : "text-yellow-500"),
28
+ t
29
+ ),
30
+ style: { fill: "currentColor", stroke: "currentColor" }
31
+ }
32
+ )
33
+ }
34
+ ) : null;
35
+ }
36
+ export {
37
+ d as default
38
+ };
@@ -0,0 +1,135 @@
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { AltArrowDown as k, AltArrowLeft as j, MenuDots as M, AltArrowRight as L } from "@solar-icons/react";
3
+ import { useMemo as z } from "react";
4
+ import { cn as r } from "../../lib/utils.js";
5
+ import { createPageRange as E } from "./mci-pagination.utils.js";
6
+ const I = {
7
+ medium: "h-9 text-sm",
8
+ large: "h-10 text-base"
9
+ }, S = {
10
+ yellow: {
11
+ active: "bg-yellow-500 text-white border-yellow-500",
12
+ inactive: "bg-slate-100 border-slate-200 text-black hover:bg-slate-200",
13
+ disabled: "text-slate-400 border-slate-200",
14
+ arrow: "text-black"
15
+ },
16
+ blue: {
17
+ active: "bg-blue-600 text-white border-blue-600",
18
+ inactive: "bg-slate-100 border-slate-200 text-black hover:bg-slate-200",
19
+ disabled: "text-slate-400 border-slate-300",
20
+ arrow: "text-black"
21
+ }
22
+ };
23
+ function G({
24
+ totalItems: o,
25
+ currentPage: m,
26
+ perPage: c,
27
+ onPageChange: d,
28
+ onPerPageChange: u,
29
+ siblingCount: h = 1,
30
+ perPageOptions: v = [10, 30, 50, 100],
31
+ showPerPage: g = !0,
32
+ variant: N = "yellow",
33
+ size: f = "large",
34
+ paginationClassName: y
35
+ }) {
36
+ const w = Number.isFinite(o) && o > 0 ? o : 0, x = Number.isFinite(c) && c > 0 ? c : 10, a = Math.max(1, Number.isFinite(m) ? m : 1), i = Math.ceil(w / x), A = z(() => E(a, h, i), [a, h, i]), s = I[f], l = S[N ?? "yellow"];
37
+ return i <= 1 || w === 0 ? null : /* @__PURE__ */ n("div", { className: r(
38
+ "flex items-center justify-between gap-4 w-full",
39
+ y
40
+ ), children: [
41
+ g && u && /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
42
+ /* @__PURE__ */ e(
43
+ "span",
44
+ {
45
+ className: "whitespace-nowrap text-extra-small text-slate-base font-normal",
46
+ children: "Строк на странице:"
47
+ }
48
+ ),
49
+ /* @__PURE__ */ n("div", { className: "relative", children: [
50
+ /* @__PURE__ */ e(
51
+ "select",
52
+ {
53
+ value: x,
54
+ onChange: (t) => u(Number(t.target.value)),
55
+ className: r(
56
+ "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",
57
+ f === "large" ? "h-10" : "h-9"
58
+ ),
59
+ "aria-label": "Количество строк на странице",
60
+ children: v.map((t) => /* @__PURE__ */ e("option", { value: t, children: t }, t))
61
+ }
62
+ ),
63
+ /* @__PURE__ */ e(
64
+ k,
65
+ {
66
+ className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400",
67
+ weight: "Linear",
68
+ size: 20
69
+ }
70
+ )
71
+ ] })
72
+ ] }),
73
+ /* @__PURE__ */ n("nav", { "aria-label": "Пагинация", className: "flex items-center gap-1 shrink-0 whitespace-nowrap", children: [
74
+ /* @__PURE__ */ e(
75
+ "button",
76
+ {
77
+ onClick: () => d(a - 1),
78
+ disabled: a === 1,
79
+ "aria-label": "Предыдущая страница",
80
+ className: r(
81
+ "flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
82
+ s,
83
+ a === 1 ? r("cursor-not-allowed opacity-50", l.disabled) : r("hover:cursor-pointer", l.arrow, "border-slate-200")
84
+ ),
85
+ children: /* @__PURE__ */ e(j, { weight: "Linear", size: 20 })
86
+ }
87
+ ),
88
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: A.map((t, p) => {
89
+ if (t === "...")
90
+ return /* @__PURE__ */ e(
91
+ "span",
92
+ {
93
+ className: r("flex items-center justify-center text-black font-medium min-w-10", s),
94
+ "aria-hidden": "true",
95
+ children: /* @__PURE__ */ e(M, { weight: "Bold", size: 20 })
96
+ },
97
+ p
98
+ );
99
+ const b = t === a;
100
+ return /* @__PURE__ */ e(
101
+ "button",
102
+ {
103
+ onClick: () => d(t),
104
+ "aria-label": `Страница ${t}${b ? ", текущая" : ""}`,
105
+ "aria-current": b ? "page" : void 0,
106
+ className: r(
107
+ "flex items-center justify-center rounded-lg border font-medium transition-all hover:cursor-pointer min-w-10 px-2",
108
+ s,
109
+ b ? l.active : l.inactive
110
+ ),
111
+ children: t
112
+ },
113
+ p
114
+ );
115
+ }) }),
116
+ /* @__PURE__ */ e(
117
+ "button",
118
+ {
119
+ onClick: () => d(a + 1),
120
+ disabled: a === i,
121
+ "aria-label": "Следующая страница",
122
+ className: r(
123
+ "flex items-center justify-center rounded-lg border transition-all bg-slate-100 min-w-10",
124
+ s,
125
+ a === i ? r("cursor-not-allowed opacity-50", l.disabled) : r("hover:cursor-pointer", l.arrow, "border-slate-200")
126
+ ),
127
+ children: /* @__PURE__ */ e(L, { size: 20, weight: "Linear" })
128
+ }
129
+ )
130
+ ] })
131
+ ] });
132
+ }
133
+ export {
134
+ G as default
135
+ };
@@ -0,0 +1,12 @@
1
+ function m(n, i, r) {
2
+ const h = [], u = i * 2 + 5;
3
+ if (r <= u)
4
+ return Array.from({ length: r }, (f, c) => c + 1);
5
+ const p = Math.max(n - i, 2), e = Math.min(n + i, r - 1);
6
+ h.push(1), p > 2 && h.push("...");
7
+ for (let f = p; f <= e; f += 1) h.push(f);
8
+ return e < r - 1 && h.push("..."), r > 1 && h.push(r), h;
9
+ }
10
+ export {
11
+ m as createPageRange
12
+ };
@@ -0,0 +1,83 @@
1
+ import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as B, useState as E, useMemo as h } from "react";
3
+ import { cn as s } from "../../lib/utils.js";
4
+ import { Phone as I } from "@solar-icons/react";
5
+ import { PHONE_SIZES as L, getPhoneStateStyles as V, getPhoneIconColor as k, formatPhoneValue as z } from "./mci-phone.utils.js";
6
+ const H = B(
7
+ ({
8
+ label: d,
9
+ placeholder: p = "+998 (__) ___ __ __",
10
+ size: r = "base",
11
+ error: e,
12
+ disabled: a = !1,
13
+ required: x = !1,
14
+ value: l = "",
15
+ onChange: o,
16
+ onFocus: g,
17
+ onBlur: b,
18
+ className: N,
19
+ name: P,
20
+ showIcon: m = !1
21
+ }, _) => {
22
+ const [i, u] = E(!1), y = (C) => {
23
+ const f = C.target.value;
24
+ if (f.length < 5) {
25
+ o?.("+998");
26
+ return;
27
+ }
28
+ const M = z(f);
29
+ o?.(M);
30
+ }, S = () => {
31
+ u(!0), (!l || l === "") && o?.("+998"), g?.();
32
+ }, w = () => {
33
+ u(!1), b?.();
34
+ }, t = L[r], F = m ? t.iconPadding : t.defaultPadding, j = h(() => V(e), [e]), v = h(
35
+ () => k(a, e, i),
36
+ [e, i, a]
37
+ );
38
+ return /* @__PURE__ */ c("div", { className: s("w-full", N), children: [
39
+ d && /* @__PURE__ */ c("label", { className: s(
40
+ "mb-2 block font-medium transition-colors duration-200",
41
+ e ? "text-red-600" : i ? "text-blue-600" : "text-slate-700",
42
+ t.labelFont
43
+ ), children: [
44
+ d,
45
+ x && /* @__PURE__ */ n("span", { className: "text-red-600 ml-1", children: "*" })
46
+ ] }),
47
+ /* @__PURE__ */ c("div", { className: "relative flex items-center", children: [
48
+ m && /* @__PURE__ */ n("div", { className: s(
49
+ "absolute top-1/2 flex -translate-y-1/2 items-center justify-center transition-all duration-300",
50
+ t.iconLeft,
51
+ v
52
+ ), children: /* @__PURE__ */ n("div", { className: s("flex items-center justify-center", t.iconWrapper), children: /* @__PURE__ */ n(I, { className: s(t.iconSize), weight: "Linear" }) }) }),
53
+ /* @__PURE__ */ n(
54
+ "input",
55
+ {
56
+ ref: _,
57
+ name: P,
58
+ type: "tel",
59
+ value: l,
60
+ onChange: y,
61
+ onFocus: S,
62
+ onBlur: w,
63
+ disabled: a,
64
+ placeholder: p,
65
+ className: s(
66
+ "w-full border bg-white font-normal transition-all duration-300 outline-none",
67
+ r === "base" ? "rounded-xl" : "rounded-lg",
68
+ "disabled:bg-slate-100 disabled:text-slate-400 disabled:cursor-not-allowed",
69
+ t.input,
70
+ F,
71
+ j
72
+ )
73
+ }
74
+ )
75
+ ] }),
76
+ e && /* @__PURE__ */ n("p", { className: "mt-2 animate-slide-up text-sm font-normal text-red-600", children: e })
77
+ ] });
78
+ }
79
+ );
80
+ H.displayName = "MciPhone";
81
+ export {
82
+ H as default
83
+ };
@@ -0,0 +1,47 @@
1
+ const r = {
2
+ sm: {
3
+ input: "h-9 text-sm",
4
+ iconPadding: "pl-8 pr-2",
5
+ defaultPadding: "px-2",
6
+ iconSize: "w-4 h-4",
7
+ iconLeft: "left-2",
8
+ labelFont: "text-sm",
9
+ iconWrapper: "h-4"
10
+ },
11
+ md: {
12
+ input: "h-10 text-sm",
13
+ iconPadding: "pl-10 pr-4",
14
+ defaultPadding: "px-4",
15
+ iconSize: "w-4 h-4",
16
+ iconLeft: "left-3",
17
+ labelFont: "text-base",
18
+ iconWrapper: "h-4"
19
+ },
20
+ base: {
21
+ input: "h-12 text-base",
22
+ iconPadding: "pl-11 pr-4",
23
+ defaultPadding: "px-4",
24
+ iconSize: "w-5 h-5",
25
+ iconLeft: "left-3",
26
+ labelFont: "text-base",
27
+ iconWrapper: "h-5"
28
+ }
29
+ };
30
+ function i(n) {
31
+ let e = n.replace(/\D/g, "");
32
+ e.startsWith("998") || (e = `998${e}`), e = e.substring(0, 12);
33
+ let t = "+998";
34
+ return e.length > 3 && (t += ` (${e.substring(3, 5)}`), e.length > 5 && (t += `) ${e.substring(5, 8)}`), e.length > 8 && (t += ` ${e.substring(8, 10)}`), e.length > 10 && (t += ` ${e.substring(10, 12)}`), t;
35
+ }
36
+ function o(n) {
37
+ return n ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600";
38
+ }
39
+ function l(n, e, t) {
40
+ return n ? "text-slate-400" : e ? "text-red-600" : t ? "text-black" : "text-slate-400";
41
+ }
42
+ export {
43
+ r as PHONE_SIZES,
44
+ i as formatPhoneValue,
45
+ l as getPhoneIconColor,
46
+ o as getPhoneStateStyles
47
+ };
@@ -0,0 +1,256 @@
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";
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(
10
+ ({
11
+ type: s = "date",
12
+ value: P,
13
+ onChange: i,
14
+ placeholder: B,
15
+ label: fe,
16
+ disabled: z = !1,
17
+ required: me = !1,
18
+ className: he,
19
+ format: Q = "DD.MM.YYYY",
20
+ minDate: U,
21
+ maxDate: X,
22
+ 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"
29
+ }, ve) => {
30
+ const [h, T] = v(!1), [te, g] = v(
31
+ 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);
35
+ 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)
52
+ if (s === "range") {
53
+ const e = m;
54
+ Y(e), e[0] ? f(e[0]) : e[1] ? f(e[1]) : f(/* @__PURE__ */ new Date());
55
+ } else {
56
+ const e = m;
57
+ f(e || /* @__PURE__ */ new Date());
58
+ }
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;
62
+ t < 300 && n > 300 ? oe("right") : oe("left");
63
+ }
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);
74
+ };
75
+ }, [h, _, q]);
76
+ const Ne = () => {
77
+ se(!0), !(z || h) && (s === "range" || !Z) && (T(!0), C(N));
78
+ }, De = () => {
79
+ if (se(!1), s !== "date") return;
80
+ const e = A.trim();
81
+ if (!e) {
82
+ g(null), i?.(null);
83
+ return;
84
+ }
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);
89
+ return;
90
+ }
91
+ c(k);
92
+ }, ke = (e) => {
93
+ 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);
98
+ if (o < 1 || o > 31) return;
99
+ }
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);
103
+ if (o < 1 || o > 12) return;
104
+ }
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));
109
+ }
110
+ }
111
+ }, ye = x(() => {
112
+ const e = s === "range" ? [null, null] : null;
113
+ g(e), Y([null, null]), i?.(e), c("");
114
+ }, [s, i]), Me = x(
115
+ (e) => {
116
+ if (F(e)) return;
117
+ const t = I(e);
118
+ if (s === "date")
119
+ g(t), i?.(t), c(a(t)), b();
120
+ else {
121
+ const [n, l] = D;
122
+ if (!n && !l || n && l)
123
+ Y([t, null]), c(`${a(t)} - ...`);
124
+ else if (n && !l) {
125
+ 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();
129
+ }
130
+ }
131
+ },
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) => {
149
+ 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) => {
153
+ 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 }) })
163
+ ] }) }),
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 }) })
171
+ ] }) })
172
+ ] }),
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);
177
+ }) })
178
+ ] });
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 }) })
184
+ ] }),
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: [
192
+ t[0],
193
+ " - ",
194
+ t[11]
195
+ ] }),
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 }) })
197
+ ] }),
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)) })
199
+ ] });
200
+ }, ie = /* @__PURE__ */ r(
201
+ "div",
202
+ {
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"
207
+ ),
208
+ children: /* @__PURE__ */ r(je, { weight: "Linear", size: 20, className: "text-slate-400" })
209
+ }
210
+ );
211
+ return /* @__PURE__ */ d("div", { ref: S, className: M("relative w-full group", he), children: [
212
+ /* @__PURE__ */ r("div", { ref: ve, children: /* @__PURE__ */ r(
213
+ Ke,
214
+ {
215
+ 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,
222
+ required: me,
223
+ error: ge,
224
+ maxLength: s === "date" ? 10 : void 0,
225
+ onFocus: Ne,
226
+ onBlur: De,
227
+ readOnly: !Z || s === "range",
228
+ showClearButton: be,
229
+ onClear: ye
230
+ }
231
+ ) }),
232
+ h && /* @__PURE__ */ r(
233
+ "div",
234
+ {
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"
241
+ ),
242
+ style: { width: "max-content" },
243
+ 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()
248
+ }
249
+ )
250
+ ] });
251
+ }
252
+ );
253
+ Qe.displayName = "MciPicker";
254
+ export {
255
+ Qe as default
256
+ };