@mci-ui/mci-ui 0.0.88 → 0.0.90
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/index.js +30 -28
- package/dist/shared/ui/MciModal/MciModal.js +30 -28
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +45 -25
- package/dist/shared/ui/mciButton/MciButton.js +39 -31
- package/dist/shared/ui/mciCheck/MciCheck.js +86 -76
- package/dist/shared/ui/mciDrawer/MciDrawer.js +78 -59
- package/dist/shared/ui/mciInput/MciInput.js +39 -40
- package/dist/shared/ui/mciLoader/MciLoader.js +14 -14
- package/dist/shared/ui/mciPagination/MciPagination.js +28 -18
- package/dist/shared/ui/mciPicker/MciPicker.js +54 -54
- package/dist/shared/ui/mciSelect/MciSelect.js +42 -41
- package/dist/shared/ui/mciStepper/MciStepper.js +136 -0
- package/dist/shared/ui/mciTable/MciTable.js +97 -90
- package/dist/shared/ui/mciTable/MciTableClamp2.js +4 -3
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +100 -79
- package/dist/shared/ui/mciTabs/FilledTabs.js +161 -0
- package/dist/shared/ui/mciTabs/MciTabs.js +5 -147
- package/dist/shared/ui/mciTabs/OutlinedTabs.js +86 -0
- package/dist/shared/ui/mciToggle/MciToggle.js +51 -43
- package/dist/shared/ui/mciUpload/MciUpload.js +129 -107
- package/dist/types/index.d.ts +1 -0
- package/dist/types/shared/types/mci-table.types.d.ts +2 -0
- package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -1
- package/dist/types/shared/types/ui/button.types.d.ts +1 -1
- package/dist/types/shared/types/ui/check.types.d.ts +1 -1
- package/dist/types/shared/types/ui/drawer.types.d.ts +1 -0
- package/dist/types/shared/types/ui/loader.types.d.ts +1 -1
- package/dist/types/shared/types/ui/pagination.types.d.ts +1 -1
- package/dist/types/shared/types/ui/stepper.types.d.ts +13 -0
- package/dist/types/shared/types/ui/tabs.types.d.ts +8 -2
- package/dist/types/shared/types/ui/toggle.types.d.ts +1 -1
- package/dist/types/shared/types/ui/upload.types.d.ts +1 -1
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
- package/dist/types/shared/ui/mciStepper/MciStepper.d.ts +3 -0
- package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
- package/dist/types/shared/ui/mciTabs/FilledTabs.d.ts +2 -0
- package/dist/types/shared/ui/mciTabs/MciTabs.d.ts +3 -2
- package/dist/types/shared/ui/mciTabs/OutlinedTabs.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,122 +1,142 @@
|
|
|
1
|
-
import { jsxs as g, jsx as
|
|
2
|
-
import { useRef as K, useEffect as
|
|
3
|
-
import { TransferVertical as
|
|
4
|
-
import { useClickOutside as
|
|
1
|
+
import { jsxs as g, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as K, useEffect as q, useMemo as Y, useState as p, useCallback as h } from "react";
|
|
3
|
+
import { TransferVertical as J } from "@solar-icons/react";
|
|
4
|
+
import { useClickOutside as U, cn as l } from "../../lib/utils.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import
|
|
7
|
-
const
|
|
6
|
+
import V from "../mciCheck/MciCheck.js";
|
|
7
|
+
const W = {
|
|
8
8
|
ru: {
|
|
9
9
|
title: "Настройки",
|
|
10
10
|
close: "Закрыть",
|
|
11
11
|
activeColumns: "Активные колонки",
|
|
12
|
-
minColumns: (
|
|
12
|
+
minColumns: (u) => `Минимум ${u} колонок`,
|
|
13
13
|
drag: "Перетащить"
|
|
14
14
|
},
|
|
15
15
|
uz: {
|
|
16
16
|
title: "Sozlamalar",
|
|
17
17
|
close: "Yopish",
|
|
18
18
|
activeColumns: "Aktiv ustunlar",
|
|
19
|
-
minColumns: (
|
|
19
|
+
minColumns: (u) => `Kamida ${u} ta ustun`,
|
|
20
20
|
drag: "Sudrash"
|
|
21
21
|
}
|
|
22
|
+
}, X = {
|
|
23
|
+
blue: {
|
|
24
|
+
dropIndicator: "bg-blue-300",
|
|
25
|
+
darkDropIndicator: "bg-blue-500",
|
|
26
|
+
close: "hover:bg-blue-50 hover:text-blue-600 focus-visible:ring-2 focus-visible:ring-[rgba(21,93,252,0.25)]",
|
|
27
|
+
darkClose: "hover:bg-blue-500/20 hover:text-blue-400 focus-visible:ring-2 focus-visible:ring-[rgba(21,93,252,0.25)]"
|
|
28
|
+
},
|
|
29
|
+
yellow: {
|
|
30
|
+
dropIndicator: "bg-yellow-400",
|
|
31
|
+
darkDropIndicator: "bg-yellow-500",
|
|
32
|
+
close: "hover:bg-yellow-50 hover:text-yellow-600 focus-visible:ring-2 focus-visible:ring-yellow-200",
|
|
33
|
+
darkClose: "hover:bg-yellow-500/20 hover:text-yellow-300 focus-visible:ring-2 focus-visible:ring-yellow-300/40"
|
|
34
|
+
},
|
|
35
|
+
orange: {
|
|
36
|
+
dropIndicator: "bg-orange-400",
|
|
37
|
+
darkDropIndicator: "bg-orange-600",
|
|
38
|
+
close: "hover:bg-orange-50 hover:text-orange-600 focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]",
|
|
39
|
+
darkClose: "hover:bg-orange-600/20 hover:text-orange-400 focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]"
|
|
40
|
+
}
|
|
22
41
|
};
|
|
23
|
-
function
|
|
24
|
-
open:
|
|
25
|
-
onClose:
|
|
42
|
+
function ae({
|
|
43
|
+
open: u,
|
|
44
|
+
onClose: N,
|
|
26
45
|
columns: i,
|
|
27
|
-
hidden:
|
|
28
|
-
onToggle:
|
|
29
|
-
onMove:
|
|
46
|
+
hidden: k,
|
|
47
|
+
onToggle: I,
|
|
48
|
+
onMove: T,
|
|
30
49
|
onMoveByKey: x,
|
|
31
50
|
minVisible: S = 5,
|
|
32
|
-
locale:
|
|
33
|
-
darkMode: r = !1
|
|
51
|
+
locale: _ = "ru",
|
|
52
|
+
darkMode: r = !1,
|
|
53
|
+
variant: E = "orange"
|
|
34
54
|
}) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
return document.addEventListener("mousedown",
|
|
39
|
-
}, [
|
|
40
|
-
const
|
|
55
|
+
const L = K(null), { handleClick: w } = U(L, N), f = W[_], v = X[E];
|
|
56
|
+
q(() => {
|
|
57
|
+
if (u)
|
|
58
|
+
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
59
|
+
}, [u, w]);
|
|
60
|
+
const D = Y(() => new Set(k), [k]), O = Y(() => {
|
|
41
61
|
let e = 0;
|
|
42
|
-
for (const t of i)
|
|
62
|
+
for (const t of i) D.has(t.key) || e++;
|
|
43
63
|
return e;
|
|
44
|
-
}, [i,
|
|
64
|
+
}, [i, D]), [y, P] = p(null), [z, A] = p(null), [$, R] = p(null), [m, C] = p("before"), j = h(
|
|
45
65
|
(e, t, a) => {
|
|
46
66
|
let n = a === "after" ? t + 1 : t;
|
|
47
67
|
return e < n && (n -= 1), n;
|
|
48
68
|
},
|
|
49
69
|
[]
|
|
50
|
-
),
|
|
51
|
-
|
|
52
|
-
}, []),
|
|
70
|
+
), d = h(() => {
|
|
71
|
+
P(null), R(null), A(null), C("before");
|
|
72
|
+
}, []), B = h(
|
|
53
73
|
(e, t, a) => {
|
|
54
|
-
|
|
74
|
+
P(t), R(String(a)), A(null), C("before"), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(t));
|
|
55
75
|
const n = new Image();
|
|
56
76
|
n.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", e.dataTransfer.setDragImage(n, 0, 0);
|
|
57
77
|
},
|
|
58
78
|
[]
|
|
59
|
-
),
|
|
79
|
+
), G = h(
|
|
60
80
|
(e, t) => {
|
|
61
81
|
e.preventDefault();
|
|
62
|
-
const a =
|
|
82
|
+
const a = y ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
|
|
63
83
|
if (!Number.isFinite(a) || a < 0) {
|
|
64
|
-
|
|
84
|
+
d();
|
|
65
85
|
return;
|
|
66
86
|
}
|
|
67
87
|
const n = i[a], b = i[t];
|
|
68
88
|
if (!n || !b) {
|
|
69
|
-
|
|
89
|
+
d();
|
|
70
90
|
return;
|
|
71
91
|
}
|
|
72
|
-
const o =
|
|
73
|
-
o !== a && (x ? x(n.key, b.key,
|
|
92
|
+
const o = j(a, t, m);
|
|
93
|
+
o !== a && (x ? x(n.key, b.key, m) : T(a, o)), d();
|
|
74
94
|
},
|
|
75
|
-
[i,
|
|
76
|
-
),
|
|
95
|
+
[i, j, y, m, T, x, d]
|
|
96
|
+
), H = h(
|
|
77
97
|
(e, t) => {
|
|
78
|
-
t ||
|
|
98
|
+
t || I(e);
|
|
79
99
|
},
|
|
80
|
-
[
|
|
100
|
+
[I]
|
|
81
101
|
);
|
|
82
|
-
return
|
|
102
|
+
return u ? /* @__PURE__ */ g(
|
|
83
103
|
"div",
|
|
84
104
|
{
|
|
85
|
-
ref:
|
|
86
|
-
className:
|
|
105
|
+
ref: L,
|
|
106
|
+
className: l(
|
|
87
107
|
"absolute right-0 top-full z-50 mt-2 w-[320px]",
|
|
88
108
|
"rounded-2xl p-4",
|
|
89
109
|
r ? "border border-neutral-200 bg-[#22242A] shadow-xl" : "border border-slate-200 bg-white"
|
|
90
110
|
),
|
|
91
111
|
children: [
|
|
92
112
|
/* @__PURE__ */ g("div", { className: "flex items-center justify-between gap-4", children: [
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ s("h4", { className: l("text-large font-normal", r ? "text-neutral-50" : "text-slate-600"), children: f.title }),
|
|
114
|
+
/* @__PURE__ */ s(
|
|
95
115
|
"button",
|
|
96
116
|
{
|
|
97
117
|
type: "button",
|
|
98
|
-
onClick:
|
|
99
|
-
className:
|
|
100
|
-
"rounded-lg px-2 py-1",
|
|
101
|
-
r ? "text-neutral-100 hover:bg-neutral-300" : "text-slate-500 hover:bg-slate-100"
|
|
118
|
+
onClick: N,
|
|
119
|
+
className: l(
|
|
120
|
+
"cursor-pointer rounded-lg px-2 py-1",
|
|
121
|
+
r ? l("text-neutral-100 hover:bg-neutral-300", v.darkClose) : l("text-slate-500 hover:bg-slate-100", v.close)
|
|
102
122
|
),
|
|
103
|
-
"aria-label":
|
|
123
|
+
"aria-label": f.close,
|
|
104
124
|
children: "✕"
|
|
105
125
|
}
|
|
106
126
|
)
|
|
107
127
|
] }),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */ g("p", { className:
|
|
110
|
-
|
|
128
|
+
/* @__PURE__ */ s("div", { className: l("my-4 h-px", r ? "bg-neutral-200" : "bg-slate-100") }),
|
|
129
|
+
/* @__PURE__ */ g("p", { className: l("mb-3 text-xs", r ? "text-neutral-100" : "text-slate-500"), children: [
|
|
130
|
+
f.activeColumns,
|
|
111
131
|
": ",
|
|
112
132
|
O,
|
|
113
133
|
"/",
|
|
114
134
|
i.length
|
|
115
135
|
] }),
|
|
116
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ s(
|
|
117
137
|
"div",
|
|
118
138
|
{
|
|
119
|
-
className:
|
|
139
|
+
className: l(
|
|
120
140
|
"max-h-[275px] overflow-auto",
|
|
121
141
|
"[&::-webkit-scrollbar]:w-1.5",
|
|
122
142
|
"[&::-webkit-scrollbar-track]:bg-transparent",
|
|
@@ -125,15 +145,15 @@ function te({
|
|
|
125
145
|
r ? "hover:[&::-webkit-scrollbar-thumb]:bg-neutral-100" : "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
|
|
126
146
|
),
|
|
127
147
|
children: i.map((e, t) => {
|
|
128
|
-
const a = !
|
|
148
|
+
const a = !D.has(e.key), n = a && O <= S, b = z === t, o = $ === e.key;
|
|
129
149
|
return /* @__PURE__ */ g("div", { className: "relative", children: [
|
|
130
|
-
b && !o && /* @__PURE__ */
|
|
150
|
+
b && !o && /* @__PURE__ */ s(
|
|
131
151
|
"div",
|
|
132
152
|
{
|
|
133
|
-
className:
|
|
153
|
+
className: l(
|
|
134
154
|
"pointer-events-none absolute left-2 right-2 z-10 h-0.5 rounded-full",
|
|
135
|
-
r ?
|
|
136
|
-
|
|
155
|
+
r ? v.darkDropIndicator : v.dropIndicator,
|
|
156
|
+
m === "before" ? "top-0" : "bottom-0"
|
|
137
157
|
)
|
|
138
158
|
}
|
|
139
159
|
),
|
|
@@ -141,57 +161,58 @@ function te({
|
|
|
141
161
|
"div",
|
|
142
162
|
{
|
|
143
163
|
draggable: !0,
|
|
144
|
-
onDragStart: (
|
|
145
|
-
onDragOver: (
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
164
|
+
onDragStart: (c) => B(c, t, e.key),
|
|
165
|
+
onDragOver: (c) => {
|
|
166
|
+
if (y == null) return;
|
|
167
|
+
c.preventDefault(), c.dataTransfer.dropEffect = "move";
|
|
168
|
+
const F = c.currentTarget.getBoundingClientRect(), Q = c.clientY - F.top > F.height / 2 ? "after" : "before";
|
|
169
|
+
z !== t && A(t), m !== Q && C(Q);
|
|
150
170
|
},
|
|
151
|
-
onDrop: (
|
|
152
|
-
onDragEnd:
|
|
153
|
-
className:
|
|
171
|
+
onDrop: (c) => G(c, t),
|
|
172
|
+
onDragEnd: d,
|
|
173
|
+
className: l(
|
|
154
174
|
"group flex items-center py-2 px-1 gap-4",
|
|
155
175
|
"rounded-md box-border overflow-visible",
|
|
156
176
|
"transition-[background,transform] duration-150",
|
|
177
|
+
!o && "cursor-grab",
|
|
157
178
|
!o && !b && (r ? "hover:bg-neutral-300/60" : "hover:bg-slate-50"),
|
|
158
179
|
b && !o && (r ? "bg-neutral-300/60" : "bg-slate-50"),
|
|
159
180
|
o && (r ? "bg-neutral-300 opacity-100 scale-[0.99] cursor-grabbing" : "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing")
|
|
160
181
|
),
|
|
161
182
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ s(
|
|
163
184
|
"button",
|
|
164
185
|
{
|
|
165
186
|
type: "button",
|
|
166
|
-
className:
|
|
187
|
+
className: l(
|
|
167
188
|
"shrink-0",
|
|
168
189
|
r ? "text-neutral-100" : "text-slate-400",
|
|
169
190
|
"cursor-grab active:cursor-grabbing",
|
|
170
191
|
r ? "rounded-lg p-1 hover:bg-neutral-200" : "rounded-lg p-1 hover:bg-slate-100",
|
|
171
192
|
o && "cursor-grabbing"
|
|
172
193
|
),
|
|
173
|
-
"aria-label":
|
|
174
|
-
children: /* @__PURE__ */
|
|
194
|
+
"aria-label": f.drag,
|
|
195
|
+
children: /* @__PURE__ */ s(J, { weight: "Linear", size: 20 })
|
|
175
196
|
}
|
|
176
197
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
198
|
+
/* @__PURE__ */ s("div", { className: "shrink-0", children: /* @__PURE__ */ s(
|
|
199
|
+
V,
|
|
179
200
|
{
|
|
180
201
|
checked: a,
|
|
181
202
|
disabled: n,
|
|
182
|
-
onChange: () =>
|
|
183
|
-
variant:
|
|
203
|
+
onChange: () => H(e.key, n),
|
|
204
|
+
variant: E,
|
|
184
205
|
darkMode: r
|
|
185
206
|
}
|
|
186
207
|
) }),
|
|
187
208
|
/* @__PURE__ */ g("div", { className: "min-w-0 flex-1", children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
n && /* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ s("h4", { className: l("truncate text-base font-medium", r ? "text-neutral-50" : "text-slate-700"), title: e.title, children: e.title }),
|
|
210
|
+
n && /* @__PURE__ */ s("p", { className: l("mt-0.5 text-xs", r ? "text-neutral-100" : "text-slate-400"), children: f.minColumns(S) })
|
|
190
211
|
] })
|
|
191
212
|
]
|
|
192
213
|
}
|
|
193
214
|
),
|
|
194
|
-
t !== i.length - 1 && /* @__PURE__ */
|
|
215
|
+
t !== i.length - 1 && /* @__PURE__ */ s("div", { className: l("mx-2 h-px", r ? "bg-neutral-200" : "bg-slate-100") })
|
|
195
216
|
] }, e.key);
|
|
196
217
|
})
|
|
197
218
|
}
|
|
@@ -201,5 +222,5 @@ function te({
|
|
|
201
222
|
) : null;
|
|
202
223
|
}
|
|
203
224
|
export {
|
|
204
|
-
|
|
225
|
+
ae as default
|
|
205
226
|
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useRef as p, useCallback as I, useEffect as x, useMemo as O } from "react";
|
|
3
|
+
import { cn as l } from "../../lib/utils.js";
|
|
4
|
+
const j = {
|
|
5
|
+
top: "flex-col",
|
|
6
|
+
bottom: "flex-col-reverse",
|
|
7
|
+
left: "flex-row",
|
|
8
|
+
right: "flex-row-reverse"
|
|
9
|
+
}, _ = {
|
|
10
|
+
top: "flex-row",
|
|
11
|
+
bottom: "flex-row",
|
|
12
|
+
left: "flex-col",
|
|
13
|
+
right: "flex-col"
|
|
14
|
+
}, $ = {
|
|
15
|
+
top: "mt-4",
|
|
16
|
+
bottom: "mb-4",
|
|
17
|
+
left: "ml-4",
|
|
18
|
+
right: "mr-4"
|
|
19
|
+
};
|
|
20
|
+
function B({
|
|
21
|
+
tabs: t,
|
|
22
|
+
defaultTab: N,
|
|
23
|
+
position: c = "top",
|
|
24
|
+
darkMode: d = !1,
|
|
25
|
+
className: b,
|
|
26
|
+
tabListClassName: g,
|
|
27
|
+
contentClassName: S,
|
|
28
|
+
extra: w,
|
|
29
|
+
onChange: y
|
|
30
|
+
}) {
|
|
31
|
+
const [i, E] = v(N || t[0]?.id), [A, T] = v({}), a = p([]), h = p(null), s = I(() => {
|
|
32
|
+
requestAnimationFrame(() => {
|
|
33
|
+
requestAnimationFrame(() => {
|
|
34
|
+
const e = t.findIndex((R) => R?.id === i), n = a.current[e];
|
|
35
|
+
if (!n) return;
|
|
36
|
+
const { offsetLeft: f, offsetTop: m, offsetWidth: z, offsetHeight: L } = n;
|
|
37
|
+
T({
|
|
38
|
+
left: `${f}px`,
|
|
39
|
+
top: `${m}px`,
|
|
40
|
+
width: `${z}px`,
|
|
41
|
+
height: `${L}px`,
|
|
42
|
+
transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}, [i, t]);
|
|
47
|
+
x(() => (s(), window.addEventListener("resize", s), "fonts" in document && document.fonts.ready.then(s), () => window.removeEventListener("resize", s)), [c, s]), x(() => {
|
|
48
|
+
const e = h.current;
|
|
49
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
50
|
+
const n = new ResizeObserver(() => {
|
|
51
|
+
s();
|
|
52
|
+
});
|
|
53
|
+
return n.observe(e), a.current.forEach((f) => {
|
|
54
|
+
f && n.observe(f);
|
|
55
|
+
}), () => n.disconnect();
|
|
56
|
+
}, [t, s]), x(() => {
|
|
57
|
+
a.current = a.current.slice(0, t.length);
|
|
58
|
+
}, [t]);
|
|
59
|
+
const o = c === "left" || c === "right", C = O(
|
|
60
|
+
() => t.find((e) => e.id === i)?.content,
|
|
61
|
+
[i, t]
|
|
62
|
+
);
|
|
63
|
+
return /* @__PURE__ */ u("div", { className: l("flex w-full", j[c], b), children: [
|
|
64
|
+
/* @__PURE__ */ u(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: l(
|
|
68
|
+
"flex w-full gap-4",
|
|
69
|
+
o ? "flex-col items-start" : "flex-row flex-wrap items-center"
|
|
70
|
+
),
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ r("div", { className: l("flex-1", o ? "w-full" : "min-w-[520px]"), children: /* @__PURE__ */ u(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
ref: h,
|
|
76
|
+
className: l(
|
|
77
|
+
"relative flex rounded-xl p-1",
|
|
78
|
+
d ? "bg-neutral-300" : "bg-slate-100",
|
|
79
|
+
_[c],
|
|
80
|
+
!o && "w-full overflow-hidden",
|
|
81
|
+
o ? "min-w-48" : "",
|
|
82
|
+
g
|
|
83
|
+
),
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ r(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: l(
|
|
89
|
+
"absolute rounded-lg",
|
|
90
|
+
d ? "bg-black" : "bg-white",
|
|
91
|
+
o ? "w-full" : "h-full"
|
|
92
|
+
),
|
|
93
|
+
style: A
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
t?.map((e, n) => {
|
|
97
|
+
const f = i === e.id;
|
|
98
|
+
return /* @__PURE__ */ u(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
ref: (m) => {
|
|
102
|
+
a.current[n] = m;
|
|
103
|
+
},
|
|
104
|
+
onClick: () => {
|
|
105
|
+
e?.disabled || (E(e?.id), y?.(e?.id));
|
|
106
|
+
},
|
|
107
|
+
disabled: e?.disabled,
|
|
108
|
+
className: l(
|
|
109
|
+
"relative z-10 flex items-center justify-center px-3 py-2 text-base font-normal whitespace-nowrap transition-colors duration-300 hover:cursor-pointer",
|
|
110
|
+
d ? "text-white" : "text-black",
|
|
111
|
+
e?.disabled && (d ? "cursor-not-allowed text-neutral-100/50 opacity-60" : "cursor-not-allowed opacity-50"),
|
|
112
|
+
o ? "w-full justify-start" : "min-w-0 flex-1"
|
|
113
|
+
),
|
|
114
|
+
children: [
|
|
115
|
+
e?.icon && /* @__PURE__ */ r(
|
|
116
|
+
"span",
|
|
117
|
+
{
|
|
118
|
+
className: l(
|
|
119
|
+
"shrink-0 transition-transform duration-200",
|
|
120
|
+
f && "scale-110"
|
|
121
|
+
),
|
|
122
|
+
children: e?.icon
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ r("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label })
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
e?.id
|
|
129
|
+
);
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
) }),
|
|
134
|
+
w && /* @__PURE__ */ r("div", { className: l("ml-auto shrink-0", o ? "w-full" : "max-w-full"), children: /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center justify-end gap-2", children: w }) })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
C && /* @__PURE__ */ r(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
className: l(
|
|
142
|
+
"w-full flex-1 overflow-hidden",
|
|
143
|
+
$[c],
|
|
144
|
+
S
|
|
145
|
+
),
|
|
146
|
+
children: /* @__PURE__ */ r(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
className: "w-full animate-fade-in",
|
|
150
|
+
style: { animationDuration: "0.35s" },
|
|
151
|
+
children: t?.find((e) => e.id === i)?.content
|
|
152
|
+
},
|
|
153
|
+
i
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
] });
|
|
158
|
+
}
|
|
159
|
+
export {
|
|
160
|
+
B as default
|
|
161
|
+
};
|
|
@@ -1,149 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
top: "flex-col",
|
|
6
|
-
bottom: "flex-col-reverse",
|
|
7
|
-
left: "flex-row",
|
|
8
|
-
right: "flex-row-reverse"
|
|
9
|
-
}, O = {
|
|
10
|
-
top: "flex-row",
|
|
11
|
-
bottom: "flex-row",
|
|
12
|
-
left: "flex-col",
|
|
13
|
-
right: "flex-col"
|
|
14
|
-
}, j = {
|
|
15
|
-
top: "mt-4",
|
|
16
|
-
bottom: "mb-4",
|
|
17
|
-
left: "ml-4",
|
|
18
|
-
right: "mr-4"
|
|
19
|
-
};
|
|
20
|
-
function q({
|
|
21
|
-
tabs: l,
|
|
22
|
-
defaultTab: N,
|
|
23
|
-
position: c = "top",
|
|
24
|
-
darkMode: d = !1,
|
|
25
|
-
className: b,
|
|
26
|
-
tabListClassName: g,
|
|
27
|
-
contentClassName: S,
|
|
28
|
-
extra: w,
|
|
29
|
-
onChange: y
|
|
30
|
-
}) {
|
|
31
|
-
const [a, E] = v(N || l[0]?.id), [A, T] = v({}), f = p([]), h = p(null), n = R(() => {
|
|
32
|
-
requestAnimationFrame(() => {
|
|
33
|
-
requestAnimationFrame(() => {
|
|
34
|
-
const e = l.findIndex((L) => L?.id === a), r = f.current[e];
|
|
35
|
-
if (!r) return;
|
|
36
|
-
const { offsetLeft: o, offsetTop: m, offsetWidth: z, offsetHeight: C } = r;
|
|
37
|
-
T({
|
|
38
|
-
left: `${o}px`,
|
|
39
|
-
top: `${m}px`,
|
|
40
|
-
width: `${z}px`,
|
|
41
|
-
height: `${C}px`,
|
|
42
|
-
transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}, [a, l]);
|
|
47
|
-
x(() => (n(), window.addEventListener("resize", n), "fonts" in document && document.fonts.ready.then(n), () => window.removeEventListener("resize", n)), [c, n]), x(() => {
|
|
48
|
-
const e = h.current;
|
|
49
|
-
if (!e || typeof ResizeObserver > "u") return;
|
|
50
|
-
const r = new ResizeObserver(() => {
|
|
51
|
-
n();
|
|
52
|
-
});
|
|
53
|
-
return r.observe(e), f.current.forEach((o) => {
|
|
54
|
-
o && r.observe(o);
|
|
55
|
-
}), () => r.disconnect();
|
|
56
|
-
}, [l, n]), x(() => {
|
|
57
|
-
f.current = f.current.slice(0, l.length);
|
|
58
|
-
}, [l]);
|
|
59
|
-
const s = c === "left" || c === "right";
|
|
60
|
-
return /* @__PURE__ */ u("div", { className: t("flex w-full", I[c], b), children: [
|
|
61
|
-
/* @__PURE__ */ u(
|
|
62
|
-
"div",
|
|
63
|
-
{
|
|
64
|
-
className: t(
|
|
65
|
-
"flex w-full gap-4",
|
|
66
|
-
s ? "flex-col items-start" : "flex-row flex-wrap items-center"
|
|
67
|
-
),
|
|
68
|
-
children: [
|
|
69
|
-
/* @__PURE__ */ i(
|
|
70
|
-
"div",
|
|
71
|
-
{
|
|
72
|
-
className: t(
|
|
73
|
-
"flex-1",
|
|
74
|
-
s ? "w-full" : "min-w-[520px]"
|
|
75
|
-
),
|
|
76
|
-
children: /* @__PURE__ */ u(
|
|
77
|
-
"div",
|
|
78
|
-
{
|
|
79
|
-
ref: h,
|
|
80
|
-
className: t(
|
|
81
|
-
"relative flex rounded-xl p-1",
|
|
82
|
-
d ? "bg-neutral-300" : "bg-slate-100",
|
|
83
|
-
O[c],
|
|
84
|
-
!s && "w-full overflow-hidden",
|
|
85
|
-
s ? "min-w-48" : "",
|
|
86
|
-
g
|
|
87
|
-
),
|
|
88
|
-
children: [
|
|
89
|
-
/* @__PURE__ */ i(
|
|
90
|
-
"div",
|
|
91
|
-
{
|
|
92
|
-
className: t(
|
|
93
|
-
"absolute rounded-lg",
|
|
94
|
-
d ? "bg-black" : "bg-white",
|
|
95
|
-
s ? "w-full" : "h-full"
|
|
96
|
-
),
|
|
97
|
-
style: A
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
l?.map((e, r) => {
|
|
101
|
-
const o = a === e.id;
|
|
102
|
-
return /* @__PURE__ */ u(
|
|
103
|
-
"button",
|
|
104
|
-
{
|
|
105
|
-
ref: (m) => {
|
|
106
|
-
f.current[r] = m;
|
|
107
|
-
},
|
|
108
|
-
onClick: () => {
|
|
109
|
-
e?.disabled || (E(e?.id), y?.(e?.id));
|
|
110
|
-
},
|
|
111
|
-
disabled: e?.disabled,
|
|
112
|
-
className: t(
|
|
113
|
-
"relative z-10 flex items-center justify-center whitespace-nowrap px-3 py-2 text-base font-normal transition-colors duration-300 hover:cursor-pointer",
|
|
114
|
-
d ? "text-white" : "text-black",
|
|
115
|
-
e?.disabled && (d ? "cursor-not-allowed text-neutral-100/50 opacity-60" : "cursor-not-allowed opacity-50"),
|
|
116
|
-
s ? "w-full justify-start" : "flex-1 min-w-0"
|
|
117
|
-
),
|
|
118
|
-
children: [
|
|
119
|
-
e?.icon && /* @__PURE__ */ i("span", { className: t("shrink-0 transition-transform duration-200", o && "scale-110"), children: e?.icon }),
|
|
120
|
-
/* @__PURE__ */ i("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label })
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
e?.id
|
|
124
|
-
);
|
|
125
|
-
})
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
),
|
|
131
|
-
w && /* @__PURE__ */ i(
|
|
132
|
-
"div",
|
|
133
|
-
{
|
|
134
|
-
className: t(
|
|
135
|
-
"shrink-0 ml-auto",
|
|
136
|
-
s ? "w-full" : "max-w-full"
|
|
137
|
-
),
|
|
138
|
-
children: /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center justify-end gap-2", children: w })
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
/* @__PURE__ */ i("div", { className: t("w-full flex-1 overflow-hidden", j[c], S), children: /* @__PURE__ */ i("div", { className: "animate-fade-in w-full", style: { animationDuration: "0.35s" }, children: l?.find((e) => e.id === a)?.content }, a) })
|
|
145
|
-
] });
|
|
146
|
-
}
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import i from "./FilledTabs.js";
|
|
3
|
+
import a from "./OutlinedTabs.js";
|
|
4
|
+
const n = (t) => t.variant === "outlined" ? /* @__PURE__ */ r(a, { ...t }) : /* @__PURE__ */ r(i, { ...t });
|
|
147
5
|
export {
|
|
148
|
-
|
|
6
|
+
n as default
|
|
149
7
|
};
|