@mci-ui/mci-ui 0.0.83 → 0.0.85
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/assets/icons/check.svg.js +5 -0
- package/dist/assets/icons/close.svg.js +5 -0
- package/dist/assets/icons/loaderIcon.svg.js +5 -0
- package/dist/index.css +1 -1
- package/dist/index.js +53 -0
- package/dist/shared/lib/hooks/useTableColumnSettings.js +132 -0
- package/dist/shared/lib/locales.js +101 -0
- package/dist/shared/lib/uploadLanguage.js +80 -0
- package/dist/shared/lib/utils.js +20 -0
- package/dist/shared/ui/MciModal/MciModal.js +97 -0
- package/dist/shared/ui/mciAccordion/MciAccordion.js +74 -0
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +39 -0
- package/dist/shared/ui/mciButton/MciButton.js +63 -0
- package/dist/shared/ui/mciCheck/MciCheck.js +170 -0
- package/dist/shared/ui/mciCollapse/MciCollapse.js +60 -0
- package/dist/shared/ui/mciDrawer/MciDrawer.js +108 -0
- package/dist/shared/ui/mciIdentityInput/MciIdentityInput.js +30 -0
- package/dist/shared/ui/mciIdentityInput/mci-identity-input.utils.js +32 -0
- package/dist/shared/ui/mciInput/MciInput.js +225 -0
- package/dist/shared/ui/mciInput/mci-input.utils.js +49 -0
- package/dist/shared/ui/mciLoader/MciLoader.js +38 -0
- package/dist/shared/ui/mciPagination/MciPagination.js +135 -0
- package/dist/shared/ui/mciPagination/mci-pagination.utils.js +12 -0
- package/dist/shared/ui/mciPhone/MciPhone.js +83 -0
- package/dist/shared/ui/mciPhone/mci-phone.utils.js +47 -0
- package/dist/shared/ui/mciPicker/MciPicker.js +256 -0
- package/dist/shared/ui/mciPicker/mci-picker.utils.js +62 -0
- package/dist/shared/ui/mciSelect/MciSelect.js +226 -0
- package/dist/shared/ui/mciSelect/mci-select.utils.js +52 -0
- package/dist/shared/ui/mciSkeleton/MciSkeleton.js +29 -0
- package/dist/shared/ui/mciTable/MciTable.js +153 -0
- package/dist/shared/ui/mciTable/MciTableClamp2.js +7 -0
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +184 -0
- package/dist/shared/ui/mciTable/mci-table.utils.js +14 -0
- package/dist/shared/ui/mciTabs/MciTabs.js +131 -0
- package/dist/shared/ui/mciTag/MciTag.js +46 -0
- package/dist/shared/ui/mciTextarea/MciTextarea.js +56 -0
- package/dist/shared/ui/mciToast/MciToast.js +106 -0
- package/dist/shared/ui/mciToast/mci-toast.utils.js +47 -0
- package/dist/shared/ui/mciToggle/MciToggle.js +77 -0
- package/dist/shared/ui/mciTooltip/MciTooltip.js +52 -0
- package/dist/shared/ui/mciUpload/MciUpload.js +337 -0
- package/dist/shared/ui/mciUpload/mci-upload.utils.js +186 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/shared/types/ui/accordion.types.d.ts +7 -0
- package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +22 -0
- package/package.json +15 -12
- package/dist/index.es.js +0 -3319
- package/dist/index.umd.js +0 -2
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { jsxs as f, jsx as s, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { EyeClosed as q, Eye as z } from "@solar-icons/react";
|
|
3
|
+
import { forwardRef as ee, useState as w, useMemo as m } from "react";
|
|
4
|
+
import te from "../../../assets/icons/close.svg.js";
|
|
5
|
+
import { cn as t } from "../../lib/utils.js";
|
|
6
|
+
import { getInputSizes as se, getInputStateStyles as ne, getInputIconColor as le, getInputRightPaddingClass as ae } from "./mci-input.utils.js";
|
|
7
|
+
const re = ee(
|
|
8
|
+
({
|
|
9
|
+
label: j,
|
|
10
|
+
placeholder: B,
|
|
11
|
+
type: b = "text",
|
|
12
|
+
icon: r,
|
|
13
|
+
rightIcon: a,
|
|
14
|
+
iconPosition: i = "left",
|
|
15
|
+
size: e = "base",
|
|
16
|
+
error: c,
|
|
17
|
+
disabled: p = !1,
|
|
18
|
+
required: v = !1,
|
|
19
|
+
value: N,
|
|
20
|
+
onChange: M,
|
|
21
|
+
onFocus: V,
|
|
22
|
+
onBlur: E,
|
|
23
|
+
className: P,
|
|
24
|
+
name: C,
|
|
25
|
+
maxLength: h = 250,
|
|
26
|
+
onClear: _,
|
|
27
|
+
showClearButton: D = !1,
|
|
28
|
+
step: A,
|
|
29
|
+
autoComplete: G = "off"
|
|
30
|
+
}, H) => {
|
|
31
|
+
const [k, F] = w(!1), [J, I] = w(""), [S, K] = w(!1), W = N ?? J, o = b === "password", x = D && !!W && !p, y = r && i === "left", g = r && i === "right" || a || o, L = g || x, R = m(() => {
|
|
32
|
+
let l = 0;
|
|
33
|
+
return x && (l += 1), o ? (l += 1, a && (l += 1), l) : (a && (l += 1), r && i === "right" && (l += 1), l);
|
|
34
|
+
}, [x, o, a, r, i]), O = () => {
|
|
35
|
+
F(!0), V?.();
|
|
36
|
+
}, Q = () => {
|
|
37
|
+
F(!1), E?.();
|
|
38
|
+
}, T = (l) => {
|
|
39
|
+
let d = l.target.value;
|
|
40
|
+
b === "number" && h && d.length > h && (d = d.slice(0, h), l.target.value = d), N === void 0 && I(d), M?.(l);
|
|
41
|
+
}, U = () => K((l) => !l), X = () => {
|
|
42
|
+
N === void 0 && I(""), _?.();
|
|
43
|
+
}, n = m(
|
|
44
|
+
() => se(!!y, !!g),
|
|
45
|
+
[y, g]
|
|
46
|
+
), Y = m(() => ne(c), [c]), u = m(
|
|
47
|
+
() => le(p, c, k),
|
|
48
|
+
[c, k, p]
|
|
49
|
+
), Z = m(
|
|
50
|
+
() => ae(e, R),
|
|
51
|
+
[e, R]
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ f("div", { className: t("w-full", P), children: [
|
|
54
|
+
j && /* @__PURE__ */ f(
|
|
55
|
+
"label",
|
|
56
|
+
{
|
|
57
|
+
htmlFor: C,
|
|
58
|
+
className: t(
|
|
59
|
+
"mb-2 block text-base font-medium",
|
|
60
|
+
c ? "text-red-600" : "text-slate-700",
|
|
61
|
+
n[e].labelFont
|
|
62
|
+
),
|
|
63
|
+
children: [
|
|
64
|
+
j,
|
|
65
|
+
v && /* @__PURE__ */ s("span", { className: "text-extra-small text-red-600 ml-1", children: "*" })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ f("div", { className: "relative flex items-center", children: [
|
|
70
|
+
/* @__PURE__ */ s(
|
|
71
|
+
"input",
|
|
72
|
+
{
|
|
73
|
+
ref: H,
|
|
74
|
+
name: C,
|
|
75
|
+
type: o && S ? "text" : b,
|
|
76
|
+
value: W,
|
|
77
|
+
onChange: T,
|
|
78
|
+
onFocus: O,
|
|
79
|
+
onBlur: Q,
|
|
80
|
+
disabled: p,
|
|
81
|
+
required: v,
|
|
82
|
+
autoComplete: G,
|
|
83
|
+
placeholder: B,
|
|
84
|
+
step: A,
|
|
85
|
+
className: t(
|
|
86
|
+
"w-full border bg-white font-normal transition-all duration-300 ease-in-out outline-none",
|
|
87
|
+
e === "base" ? "rounded-xl" : "rounded-lg",
|
|
88
|
+
"disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
|
|
89
|
+
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
90
|
+
n[e].input,
|
|
91
|
+
n[e].padding,
|
|
92
|
+
Z,
|
|
93
|
+
Y
|
|
94
|
+
),
|
|
95
|
+
maxLength: h
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
y && /* @__PURE__ */ s(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: t(
|
|
102
|
+
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center",
|
|
103
|
+
"transition-all duration-300",
|
|
104
|
+
n[e].leftIcon,
|
|
105
|
+
u
|
|
106
|
+
),
|
|
107
|
+
children: /* @__PURE__ */ s(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: t("flex items-center justify-center", n[e].iconWrapper),
|
|
111
|
+
children: /* @__PURE__ */ s("span", { className: t("flex items-center justify-center", n[e].icon), children: r })
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
L && /* @__PURE__ */ f(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
className: t(
|
|
120
|
+
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center gap-2",
|
|
121
|
+
"transition-all duration-300",
|
|
122
|
+
n[e].rightIcon
|
|
123
|
+
),
|
|
124
|
+
children: [
|
|
125
|
+
x && /* @__PURE__ */ s(
|
|
126
|
+
"button",
|
|
127
|
+
{
|
|
128
|
+
type: "button",
|
|
129
|
+
onClick: X,
|
|
130
|
+
className: t(
|
|
131
|
+
"flex items-center justify-center",
|
|
132
|
+
n[e].iconWrapper,
|
|
133
|
+
"text-slate-base hover:text-black"
|
|
134
|
+
),
|
|
135
|
+
style: { cursor: "pointer" },
|
|
136
|
+
children: /* @__PURE__ */ s("span", { className: t("flex items-center justify-center", n[e].icon), children: /* @__PURE__ */ s(te, { className: t("h-full w-full") }) })
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
a && !o && /* @__PURE__ */ s(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
className: t("flex items-center justify-center", n[e].iconWrapper),
|
|
143
|
+
children: /* @__PURE__ */ s(
|
|
144
|
+
"span",
|
|
145
|
+
{
|
|
146
|
+
className: t(
|
|
147
|
+
"flex items-center justify-center",
|
|
148
|
+
n[e].icon,
|
|
149
|
+
u
|
|
150
|
+
),
|
|
151
|
+
children: a
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
o && /* @__PURE__ */ f($, { children: [
|
|
157
|
+
a && /* @__PURE__ */ s(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
className: t(
|
|
161
|
+
"flex items-center justify-center",
|
|
162
|
+
n[e].iconWrapper
|
|
163
|
+
),
|
|
164
|
+
children: /* @__PURE__ */ s(
|
|
165
|
+
"span",
|
|
166
|
+
{
|
|
167
|
+
className: t(
|
|
168
|
+
"flex items-center justify-center",
|
|
169
|
+
n[e].icon,
|
|
170
|
+
u
|
|
171
|
+
),
|
|
172
|
+
children: a
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ s(
|
|
178
|
+
"button",
|
|
179
|
+
{
|
|
180
|
+
type: "button",
|
|
181
|
+
onClick: U,
|
|
182
|
+
className: t(
|
|
183
|
+
"flex items-center justify-center",
|
|
184
|
+
n[e].iconWrapper,
|
|
185
|
+
u
|
|
186
|
+
),
|
|
187
|
+
children: /* @__PURE__ */ s(
|
|
188
|
+
"span",
|
|
189
|
+
{
|
|
190
|
+
className: t("flex items-center justify-center cursor-pointer", n[e].icon),
|
|
191
|
+
children: S ? /* @__PURE__ */ s(q, { weight: "Linear", className: t("h-full w-full") }) : /* @__PURE__ */ s(z, { weight: "Linear", className: t("h-full w-full") })
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] }),
|
|
197
|
+
r && i === "right" && !o && /* @__PURE__ */ s(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: t("flex items-center justify-center", n[e].iconWrapper),
|
|
201
|
+
children: /* @__PURE__ */ s(
|
|
202
|
+
"span",
|
|
203
|
+
{
|
|
204
|
+
className: t(
|
|
205
|
+
"flex items-center justify-center",
|
|
206
|
+
n[e].icon,
|
|
207
|
+
u
|
|
208
|
+
),
|
|
209
|
+
children: r
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
] }),
|
|
218
|
+
c && /* @__PURE__ */ s("p", { className: "mt-2 animate-[slideDown_0.3s_ease-out] text-sm font-normal text-red-600", children: c })
|
|
219
|
+
] });
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
re.displayName = "MciInput";
|
|
223
|
+
export {
|
|
224
|
+
re as default
|
|
225
|
+
};
|
|
@@ -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
|
+
};
|