@mci-ui/mci-ui 0.0.86 → 0.0.87
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/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 +70 -52
- 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 +52 -45
- 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/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 +1 -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/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,212 +1,216 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { EyeClosed as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import { cn as
|
|
6
|
-
import { getInputSizes as
|
|
7
|
-
const
|
|
1
|
+
import { jsxs as p, jsx as l, Fragment as z } from "react/jsx-runtime";
|
|
2
|
+
import { EyeClosed as ee, Eye as te } from "@solar-icons/react";
|
|
3
|
+
import { forwardRef as le, useState as v, useMemo as h } from "react";
|
|
4
|
+
import se from "../../../assets/icons/close.svg.js";
|
|
5
|
+
import { cn as e } from "../../lib/utils.js";
|
|
6
|
+
import { getInputSizes as ne, getInputStateStyles as ae, getInputIconColor as re, getInputRightPaddingClass as ce } from "./mci-input.utils.js";
|
|
7
|
+
const ie = le(
|
|
8
8
|
({
|
|
9
|
-
label:
|
|
10
|
-
placeholder:
|
|
11
|
-
type:
|
|
12
|
-
icon:
|
|
13
|
-
rightIcon:
|
|
14
|
-
iconPosition:
|
|
15
|
-
size:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
label: C,
|
|
10
|
+
placeholder: E,
|
|
11
|
+
type: w = "text",
|
|
12
|
+
icon: c,
|
|
13
|
+
rightIcon: r,
|
|
14
|
+
iconPosition: u = "left",
|
|
15
|
+
size: t = "base",
|
|
16
|
+
darkMode: a = !1,
|
|
17
|
+
error: i,
|
|
18
|
+
disabled: f = !1,
|
|
19
|
+
required: F = !1,
|
|
19
20
|
value: N,
|
|
20
|
-
onChange:
|
|
21
|
-
onFocus:
|
|
22
|
-
onBlur:
|
|
23
|
-
className:
|
|
24
|
-
name:
|
|
25
|
-
maxLength:
|
|
26
|
-
onClear:
|
|
27
|
-
showClearButton:
|
|
28
|
-
step:
|
|
29
|
-
autoComplete:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
21
|
+
onChange: P,
|
|
22
|
+
onFocus: _,
|
|
23
|
+
onBlur: D,
|
|
24
|
+
className: A,
|
|
25
|
+
name: I,
|
|
26
|
+
maxLength: x = 250,
|
|
27
|
+
onClear: G,
|
|
28
|
+
showClearButton: H = !1,
|
|
29
|
+
step: J,
|
|
30
|
+
autoComplete: K = "off",
|
|
31
|
+
...L
|
|
32
|
+
}, O) => {
|
|
33
|
+
const [y, S] = v(!1), [Q, W] = v(""), [R, T] = v(!1), B = N ?? Q, o = w === "password", b = H && !!B && !f, g = c && u === "left", j = c && u === "right" || r || o, U = j || b, V = h(() => {
|
|
34
|
+
let n = 0;
|
|
35
|
+
return b && (n += 1), o ? (n += 1, r && (n += 1), n) : (r && (n += 1), c && u === "right" && (n += 1), n);
|
|
36
|
+
}, [b, o, r, c, u]), X = (n) => {
|
|
37
|
+
S(!0), _?.(n);
|
|
38
|
+
}, Y = (n) => {
|
|
39
|
+
S(!1), D?.(n);
|
|
40
|
+
}, Z = (n) => {
|
|
41
|
+
let m = n.target.value;
|
|
42
|
+
w === "number" && x && m.length > x && (m = m.slice(0, x), n.target.value = m), N === void 0 && W(m), P?.(n);
|
|
43
|
+
}, $ = () => T((n) => !n), q = () => {
|
|
44
|
+
N === void 0 && W(""), G?.();
|
|
45
|
+
}, s = h(
|
|
46
|
+
() => ne(!!g, !!j),
|
|
47
|
+
[g, j]
|
|
48
|
+
), k = h(() => ae(i, a), [i, a]), d = h(
|
|
49
|
+
() => re(f, i, y, a),
|
|
50
|
+
[i, y, f, a]
|
|
51
|
+
), M = h(
|
|
52
|
+
() => ce(t, V),
|
|
53
|
+
[t, V]
|
|
52
54
|
);
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
55
|
+
return /* @__PURE__ */ p("div", { className: e("w-full", A), children: [
|
|
56
|
+
C && /* @__PURE__ */ p(
|
|
55
57
|
"label",
|
|
56
58
|
{
|
|
57
|
-
htmlFor:
|
|
58
|
-
className:
|
|
59
|
+
htmlFor: I,
|
|
60
|
+
className: e(
|
|
59
61
|
"mb-2 block text-base font-medium",
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
i ? a ? "text-red-500" : "text-red-600" : a ? "text-neutral-50" : "text-slate-700",
|
|
63
|
+
s[t].labelFont
|
|
62
64
|
),
|
|
63
65
|
children: [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
C,
|
|
67
|
+
F && /* @__PURE__ */ l("span", { className: "text-extra-small text-red-600 ml-1", children: "*" })
|
|
66
68
|
]
|
|
67
69
|
}
|
|
68
70
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ p("div", { className: "relative flex items-center", children: [
|
|
72
|
+
/* @__PURE__ */ l(
|
|
71
73
|
"input",
|
|
72
74
|
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
75
|
+
...L,
|
|
76
|
+
ref: O,
|
|
77
|
+
name: I,
|
|
78
|
+
type: o && R ? "text" : w,
|
|
79
|
+
value: B,
|
|
80
|
+
onChange: Z,
|
|
81
|
+
onFocus: X,
|
|
82
|
+
onBlur: Y,
|
|
83
|
+
disabled: f,
|
|
84
|
+
required: F,
|
|
85
|
+
autoComplete: K,
|
|
86
|
+
placeholder: E,
|
|
87
|
+
step: J,
|
|
88
|
+
className: e(
|
|
89
|
+
"w-full border font-normal transition-all duration-300 ease-in-out outline-none",
|
|
90
|
+
t === "base" ? "rounded-xl" : "rounded-lg",
|
|
91
|
+
a ? "text-neutral-50 placeholder:text-neutral-100 disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-300 disabled:text-neutral-100/50 disabled:placeholder:text-neutral-100/50" : "bg-white disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
|
|
92
|
+
a && y && !f && "text-white",
|
|
89
93
|
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
s[t].input,
|
|
95
|
+
s[t].padding,
|
|
96
|
+
M,
|
|
97
|
+
k
|
|
94
98
|
),
|
|
95
|
-
maxLength:
|
|
99
|
+
maxLength: x
|
|
96
100
|
}
|
|
97
101
|
),
|
|
98
|
-
|
|
102
|
+
g && /* @__PURE__ */ l(
|
|
99
103
|
"div",
|
|
100
104
|
{
|
|
101
|
-
className:
|
|
105
|
+
className: e(
|
|
102
106
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center",
|
|
103
107
|
"transition-all duration-300",
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
s[t].leftIcon,
|
|
109
|
+
d
|
|
106
110
|
),
|
|
107
|
-
children: /* @__PURE__ */
|
|
111
|
+
children: /* @__PURE__ */ l(
|
|
108
112
|
"div",
|
|
109
113
|
{
|
|
110
|
-
className:
|
|
111
|
-
children: /* @__PURE__ */
|
|
114
|
+
className: e("flex items-center justify-center", s[t].iconWrapper),
|
|
115
|
+
children: /* @__PURE__ */ l("span", { className: e("flex items-center justify-center", s[t].icon), children: c })
|
|
112
116
|
}
|
|
113
117
|
)
|
|
114
118
|
}
|
|
115
119
|
),
|
|
116
|
-
|
|
120
|
+
U && /* @__PURE__ */ p(
|
|
117
121
|
"div",
|
|
118
122
|
{
|
|
119
|
-
className:
|
|
123
|
+
className: e(
|
|
120
124
|
"absolute top-1/2 flex -translate-y-1/2 items-center justify-center gap-2",
|
|
121
125
|
"transition-all duration-300",
|
|
122
|
-
|
|
126
|
+
s[t].rightIcon
|
|
123
127
|
),
|
|
124
128
|
children: [
|
|
125
|
-
|
|
129
|
+
b && /* @__PURE__ */ l(
|
|
126
130
|
"button",
|
|
127
131
|
{
|
|
128
132
|
type: "button",
|
|
129
|
-
onClick:
|
|
130
|
-
className:
|
|
133
|
+
onClick: q,
|
|
134
|
+
className: e(
|
|
131
135
|
"flex items-center justify-center",
|
|
132
|
-
|
|
133
|
-
"text-slate-base hover:text-black"
|
|
136
|
+
s[t].iconWrapper,
|
|
137
|
+
a ? "text-neutral-100 hover:text-white" : "text-slate-base hover:text-black"
|
|
134
138
|
),
|
|
135
139
|
style: { cursor: "pointer" },
|
|
136
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ l("span", { className: e("flex items-center justify-center", s[t].icon), children: /* @__PURE__ */ l(se, { className: e("h-full w-full") }) })
|
|
137
141
|
}
|
|
138
142
|
),
|
|
139
|
-
|
|
143
|
+
r && !o && /* @__PURE__ */ l(
|
|
140
144
|
"div",
|
|
141
145
|
{
|
|
142
|
-
className:
|
|
143
|
-
children: /* @__PURE__ */
|
|
146
|
+
className: e("flex items-center justify-center", s[t].iconWrapper),
|
|
147
|
+
children: /* @__PURE__ */ l(
|
|
144
148
|
"span",
|
|
145
149
|
{
|
|
146
|
-
className:
|
|
150
|
+
className: e(
|
|
147
151
|
"flex items-center justify-center",
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
s[t].icon,
|
|
153
|
+
d
|
|
150
154
|
),
|
|
151
|
-
children:
|
|
155
|
+
children: r
|
|
152
156
|
}
|
|
153
157
|
)
|
|
154
158
|
}
|
|
155
159
|
),
|
|
156
|
-
o && /* @__PURE__ */
|
|
157
|
-
|
|
160
|
+
o && /* @__PURE__ */ p(z, { children: [
|
|
161
|
+
r && /* @__PURE__ */ l(
|
|
158
162
|
"div",
|
|
159
163
|
{
|
|
160
|
-
className:
|
|
164
|
+
className: e(
|
|
161
165
|
"flex items-center justify-center",
|
|
162
|
-
|
|
166
|
+
s[t].iconWrapper
|
|
163
167
|
),
|
|
164
|
-
children: /* @__PURE__ */
|
|
168
|
+
children: /* @__PURE__ */ l(
|
|
165
169
|
"span",
|
|
166
170
|
{
|
|
167
|
-
className:
|
|
171
|
+
className: e(
|
|
168
172
|
"flex items-center justify-center",
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
s[t].icon,
|
|
174
|
+
d
|
|
171
175
|
),
|
|
172
|
-
children:
|
|
176
|
+
children: r
|
|
173
177
|
}
|
|
174
178
|
)
|
|
175
179
|
}
|
|
176
180
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ l(
|
|
178
182
|
"button",
|
|
179
183
|
{
|
|
180
184
|
type: "button",
|
|
181
|
-
onClick:
|
|
182
|
-
className:
|
|
185
|
+
onClick: $,
|
|
186
|
+
className: e(
|
|
183
187
|
"flex items-center justify-center",
|
|
184
|
-
|
|
185
|
-
|
|
188
|
+
s[t].iconWrapper,
|
|
189
|
+
d
|
|
186
190
|
),
|
|
187
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ l(
|
|
188
192
|
"span",
|
|
189
193
|
{
|
|
190
|
-
className:
|
|
191
|
-
children:
|
|
194
|
+
className: e("flex items-center justify-center cursor-pointer", s[t].icon),
|
|
195
|
+
children: R ? /* @__PURE__ */ l(ee, { weight: "Linear", className: e("h-full w-full") }) : /* @__PURE__ */ l(te, { weight: "Linear", className: e("h-full w-full") })
|
|
192
196
|
}
|
|
193
197
|
)
|
|
194
198
|
}
|
|
195
199
|
)
|
|
196
200
|
] }),
|
|
197
|
-
|
|
201
|
+
c && u === "right" && !o && /* @__PURE__ */ l(
|
|
198
202
|
"div",
|
|
199
203
|
{
|
|
200
|
-
className:
|
|
201
|
-
children: /* @__PURE__ */
|
|
204
|
+
className: e("flex items-center justify-center", s[t].iconWrapper),
|
|
205
|
+
children: /* @__PURE__ */ l(
|
|
202
206
|
"span",
|
|
203
207
|
{
|
|
204
|
-
className:
|
|
208
|
+
className: e(
|
|
205
209
|
"flex items-center justify-center",
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
s[t].icon,
|
|
211
|
+
d
|
|
208
212
|
),
|
|
209
|
-
children:
|
|
213
|
+
children: c
|
|
210
214
|
}
|
|
211
215
|
)
|
|
212
216
|
}
|
|
@@ -215,11 +219,20 @@ const re = ee(
|
|
|
215
219
|
}
|
|
216
220
|
)
|
|
217
221
|
] }),
|
|
218
|
-
|
|
222
|
+
i && /* @__PURE__ */ l(
|
|
223
|
+
"p",
|
|
224
|
+
{
|
|
225
|
+
className: e(
|
|
226
|
+
"mt-2 animate-[slideDown_0.3s_ease-out] text-sm font-normal",
|
|
227
|
+
a ? "text-red-500" : "text-red-600"
|
|
228
|
+
),
|
|
229
|
+
children: i
|
|
230
|
+
}
|
|
231
|
+
)
|
|
219
232
|
] });
|
|
220
233
|
}
|
|
221
234
|
);
|
|
222
|
-
|
|
235
|
+
ie.displayName = "MciInput";
|
|
223
236
|
export {
|
|
224
|
-
|
|
237
|
+
ie as default
|
|
225
238
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = {
|
|
2
2
|
sm: {
|
|
3
3
|
input: "h-9 text-sm",
|
|
4
4
|
icon: "w-4 h-4",
|
|
@@ -24,19 +24,19 @@ const p = {
|
|
|
24
24
|
iconWrapper: "h-5"
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function p(e, r) {
|
|
28
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
29
|
return {
|
|
30
|
-
sm: { ...
|
|
31
|
-
md: { ...
|
|
32
|
-
base: { ...
|
|
30
|
+
sm: { ...u.sm, padding: t("sm") },
|
|
31
|
+
md: { ...u.md, padding: t("md") },
|
|
32
|
+
base: { ...u.base, padding: t("base") }
|
|
33
33
|
};
|
|
34
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";
|
|
35
|
+
function i(e, r) {
|
|
36
|
+
return r ? e ? "border-red-500 hover:border-red-500 focus:border-red-500 focus:shadow-[0_0_0_2px_rgba(231,0,11,0.25)]" : "border-neutral-200 hover:border-neutral-100 focus:border-blue-500 focus:shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))]" : 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
37
|
}
|
|
38
|
-
function f(e, r, t) {
|
|
39
|
-
return e ? "text-slate-400" : r ? "text-red-600" : t ? "text-black" : "text-slate-400";
|
|
38
|
+
function f(e, r, t, n) {
|
|
39
|
+
return n ? e ? "text-neutral-100/50" : r ? "text-red-500" : t ? "text-white" : "text-neutral-100" : e ? "text-slate-400" : r ? "text-red-600" : t ? "text-black" : "text-slate-400";
|
|
40
40
|
}
|
|
41
41
|
function d(e, r) {
|
|
42
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";
|
|
@@ -44,6 +44,6 @@ function d(e, r) {
|
|
|
44
44
|
export {
|
|
45
45
|
f as getInputIconColor,
|
|
46
46
|
d as getInputRightPaddingClass,
|
|
47
|
-
|
|
47
|
+
p as getInputSizes,
|
|
48
48
|
i as getInputStateStyles
|
|
49
49
|
};
|
|
@@ -1,135 +1,157 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { AltArrowDown as
|
|
3
|
-
import { useMemo as
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { AltArrowDown as L, AltArrowLeft as z, MenuDots as E, AltArrowRight as S } from "@solar-icons/react";
|
|
3
|
+
import { useMemo as T } from "react";
|
|
4
4
|
import { cn as r } from "../../lib/utils.js";
|
|
5
|
-
import { createPageRange as
|
|
6
|
-
const
|
|
5
|
+
import { createPageRange as F } from "./mci-pagination.utils.js";
|
|
6
|
+
const _ = {
|
|
7
7
|
medium: "h-9 text-sm",
|
|
8
8
|
large: "h-10 text-base"
|
|
9
|
-
},
|
|
9
|
+
}, G = {
|
|
10
10
|
yellow: {
|
|
11
11
|
active: "bg-yellow-500 text-white border-yellow-500",
|
|
12
12
|
inactive: "bg-slate-100 border-slate-200 text-black hover:bg-slate-200",
|
|
13
13
|
disabled: "text-slate-400 border-slate-200",
|
|
14
|
-
arrow: "text-black"
|
|
14
|
+
arrow: "text-black",
|
|
15
|
+
darkActive: "bg-yellow-500 text-white border-yellow-500",
|
|
16
|
+
darkInactive: "bg-neutral-300 border-neutral-200 text-neutral-50 hover:bg-neutral-200",
|
|
17
|
+
darkDisabled: "text-white border-neutral-200 bg-neutral-300/60",
|
|
18
|
+
darkArrow: "text-neutral-50"
|
|
15
19
|
},
|
|
16
20
|
blue: {
|
|
17
21
|
active: "bg-blue-600 text-white border-blue-600",
|
|
18
22
|
inactive: "bg-slate-100 border-slate-200 text-black hover:bg-slate-200",
|
|
19
23
|
disabled: "text-slate-400 border-slate-300",
|
|
20
|
-
arrow: "text-black"
|
|
24
|
+
arrow: "text-black",
|
|
25
|
+
darkActive: "bg-blue-500 text-white border-blue-500",
|
|
26
|
+
darkInactive: "bg-neutral-300 border-neutral-200 text-white hover:bg-neutral-200",
|
|
27
|
+
darkDisabled: "text-neutral-100/50 border-neutral-200 bg-neutral-300/60",
|
|
28
|
+
darkArrow: "text-neutral-50"
|
|
21
29
|
}
|
|
22
30
|
};
|
|
23
|
-
function
|
|
24
|
-
totalItems:
|
|
31
|
+
function P({
|
|
32
|
+
totalItems: c,
|
|
25
33
|
currentPage: m,
|
|
26
|
-
perPage:
|
|
27
|
-
onPageChange:
|
|
28
|
-
onPerPageChange:
|
|
29
|
-
siblingCount:
|
|
30
|
-
perPageOptions:
|
|
31
|
-
showPerPage:
|
|
32
|
-
variant:
|
|
33
|
-
size:
|
|
34
|
-
|
|
34
|
+
perPage: b,
|
|
35
|
+
onPageChange: u,
|
|
36
|
+
onPerPageChange: h,
|
|
37
|
+
siblingCount: w = 1,
|
|
38
|
+
perPageOptions: A = [10, 30, 50, 100],
|
|
39
|
+
showPerPage: y = !0,
|
|
40
|
+
variant: k = "yellow",
|
|
41
|
+
size: x = "large",
|
|
42
|
+
darkMode: e = !1,
|
|
43
|
+
paginationClassName: j
|
|
35
44
|
}) {
|
|
36
|
-
const
|
|
37
|
-
return
|
|
45
|
+
const g = Number.isFinite(c) && c > 0 ? c : 0, v = Number.isFinite(b) && b > 0 ? b : 10, l = Math.max(1, Number.isFinite(m) ? m : 1), n = Math.ceil(g / v), C = T(() => F(l, w, n), [l, w, n]), s = _[x], i = G[k ?? "yellow"], I = e ? i.darkActive : i.active, D = e ? i.darkInactive : i.inactive, f = e ? i.darkDisabled : i.disabled, p = e ? i.darkArrow : i.arrow;
|
|
46
|
+
return n <= 1 || g === 0 ? null : /* @__PURE__ */ o("div", { className: r(
|
|
38
47
|
"flex items-center justify-between gap-4 w-full",
|
|
39
|
-
|
|
48
|
+
j
|
|
40
49
|
), children: [
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */
|
|
50
|
+
y && h && /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
51
|
+
/* @__PURE__ */ t(
|
|
43
52
|
"span",
|
|
44
53
|
{
|
|
45
|
-
className:
|
|
54
|
+
className: r(
|
|
55
|
+
"whitespace-nowrap text-extra-small font-normal",
|
|
56
|
+
e ? "text-neutral-100" : "text-slate-base"
|
|
57
|
+
),
|
|
46
58
|
children: "Строк на странице:"
|
|
47
59
|
}
|
|
48
60
|
),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ o("div", { className: "relative", children: [
|
|
62
|
+
/* @__PURE__ */ t(
|
|
51
63
|
"select",
|
|
52
64
|
{
|
|
53
|
-
value:
|
|
54
|
-
onChange: (
|
|
65
|
+
value: v,
|
|
66
|
+
onChange: (a) => h(Number(a.target.value)),
|
|
55
67
|
className: r(
|
|
56
|
-
"appearance-none
|
|
57
|
-
|
|
68
|
+
"appearance-none rounded-lg border pl-3 pr-8 text-base font-medium focus:outline-none cursor-pointer",
|
|
69
|
+
e ? "border-neutral-200 bg-neutral-300 text-white" : "border-slate-200 bg-white text-black",
|
|
70
|
+
x === "large" ? "h-10" : "h-9"
|
|
58
71
|
),
|
|
59
72
|
"aria-label": "Количество строк на странице",
|
|
60
|
-
children:
|
|
73
|
+
children: A.map((a) => /* @__PURE__ */ t("option", { value: a, children: a }, a))
|
|
61
74
|
}
|
|
62
75
|
),
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
76
|
+
/* @__PURE__ */ t(
|
|
77
|
+
L,
|
|
65
78
|
{
|
|
66
|
-
className:
|
|
79
|
+
className: r(
|
|
80
|
+
"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
81
|
+
e ? "text-neutral-100" : "text-slate-400"
|
|
82
|
+
),
|
|
67
83
|
weight: "Linear",
|
|
68
84
|
size: 20
|
|
69
85
|
}
|
|
70
86
|
)
|
|
71
87
|
] })
|
|
72
88
|
] }),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ o("nav", { "aria-label": "Пагинация", className: "flex items-center gap-1 shrink-0 whitespace-nowrap", children: [
|
|
90
|
+
/* @__PURE__ */ t(
|
|
75
91
|
"button",
|
|
76
92
|
{
|
|
77
|
-
onClick: () =>
|
|
78
|
-
disabled:
|
|
93
|
+
onClick: () => u(l - 1),
|
|
94
|
+
disabled: l === 1,
|
|
79
95
|
"aria-label": "Предыдущая страница",
|
|
80
96
|
className: r(
|
|
81
|
-
"flex items-center justify-center rounded-lg border transition-all
|
|
97
|
+
"flex items-center justify-center rounded-lg border transition-all min-w-10",
|
|
98
|
+
e ? "bg-neutral-300 border-neutral-200" : "bg-slate-100",
|
|
82
99
|
s,
|
|
83
|
-
|
|
100
|
+
l === 1 ? r("cursor-not-allowed opacity-50", f) : r("hover:cursor-pointer", p, e ? "hover:bg-neutral-200" : "border-slate-200")
|
|
84
101
|
),
|
|
85
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ t(z, { weight: "Linear", size: 20 })
|
|
86
103
|
}
|
|
87
104
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
if (
|
|
90
|
-
return /* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: C.map((a, N) => {
|
|
106
|
+
if (a === "...")
|
|
107
|
+
return /* @__PURE__ */ t(
|
|
91
108
|
"span",
|
|
92
109
|
{
|
|
93
|
-
className: r(
|
|
110
|
+
className: r(
|
|
111
|
+
"flex items-center justify-center font-medium min-w-10",
|
|
112
|
+
e ? "text-neutral-50" : "text-black",
|
|
113
|
+
s
|
|
114
|
+
),
|
|
94
115
|
"aria-hidden": "true",
|
|
95
|
-
children: /* @__PURE__ */
|
|
116
|
+
children: /* @__PURE__ */ t(E, { weight: "Bold", size: 20 })
|
|
96
117
|
},
|
|
97
|
-
|
|
118
|
+
N
|
|
98
119
|
);
|
|
99
|
-
const
|
|
100
|
-
return /* @__PURE__ */
|
|
120
|
+
const d = a === l;
|
|
121
|
+
return /* @__PURE__ */ t(
|
|
101
122
|
"button",
|
|
102
123
|
{
|
|
103
|
-
onClick: () =>
|
|
104
|
-
"aria-label": `Страница ${
|
|
105
|
-
"aria-current":
|
|
124
|
+
onClick: () => u(a),
|
|
125
|
+
"aria-label": `Страница ${a}${d ? ", текущая" : ""}`,
|
|
126
|
+
"aria-current": d ? "page" : void 0,
|
|
106
127
|
className: r(
|
|
107
128
|
"flex items-center justify-center rounded-lg border font-medium transition-all hover:cursor-pointer min-w-10 px-2",
|
|
108
129
|
s,
|
|
109
|
-
|
|
130
|
+
d ? I : D
|
|
110
131
|
),
|
|
111
|
-
children:
|
|
132
|
+
children: a
|
|
112
133
|
},
|
|
113
|
-
|
|
134
|
+
N
|
|
114
135
|
);
|
|
115
136
|
}) }),
|
|
116
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ t(
|
|
117
138
|
"button",
|
|
118
139
|
{
|
|
119
|
-
onClick: () =>
|
|
120
|
-
disabled:
|
|
140
|
+
onClick: () => u(l + 1),
|
|
141
|
+
disabled: l === n,
|
|
121
142
|
"aria-label": "Следующая страница",
|
|
122
143
|
className: r(
|
|
123
|
-
"flex items-center justify-center rounded-lg border transition-all
|
|
144
|
+
"flex items-center justify-center rounded-lg border transition-all min-w-10",
|
|
145
|
+
e ? "bg-neutral-300 border-neutral-200" : "bg-slate-100",
|
|
124
146
|
s,
|
|
125
|
-
|
|
147
|
+
l === n ? r("cursor-not-allowed opacity-50", f) : r("hover:cursor-pointer", p, e ? "hover:bg-neutral-200" : "border-slate-200")
|
|
126
148
|
),
|
|
127
|
-
children: /* @__PURE__ */
|
|
149
|
+
children: /* @__PURE__ */ t(S, { size: 20, weight: "Linear" })
|
|
128
150
|
}
|
|
129
151
|
)
|
|
130
152
|
] })
|
|
131
153
|
] });
|
|
132
154
|
}
|
|
133
155
|
export {
|
|
134
|
-
|
|
156
|
+
P as default
|
|
135
157
|
};
|