@mci-ui/mci-ui 0.0.87 → 0.0.89
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 +30 -28
- package/dist/shared/ui/mciAccordion/MciAccordion.js +97 -64
- 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 -54
- 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 +53 -53
- package/dist/shared/ui/mciSelect/MciSelect.js +42 -41
- 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/MciTabs.js +66 -55
- package/dist/shared/ui/mciToggle/MciToggle.js +51 -43
- package/dist/shared/ui/mciUpload/MciUpload.js +129 -107
- package/dist/types/shared/types/mci-table.types.d.ts +2 -0
- package/dist/types/shared/types/ui/accordion.types.d.ts +1 -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 +2 -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/toggle.types.d.ts +1 -1
- package/dist/types/shared/types/ui/upload.types.d.ts +1 -1
- package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +5 -3
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,112 +1,123 @@
|
|
|
1
|
-
import { jsxs as u, jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useRef as p, useCallback as R, useEffect as x } from "react";
|
|
3
3
|
import { cn as t } from "../../lib/utils.js";
|
|
4
|
-
const
|
|
4
|
+
const I = {
|
|
5
5
|
top: "flex-col",
|
|
6
6
|
bottom: "flex-col-reverse",
|
|
7
7
|
left: "flex-row",
|
|
8
8
|
right: "flex-row-reverse"
|
|
9
|
-
},
|
|
9
|
+
}, O = {
|
|
10
10
|
top: "flex-row",
|
|
11
11
|
bottom: "flex-row",
|
|
12
12
|
left: "flex-col",
|
|
13
13
|
right: "flex-col"
|
|
14
|
-
},
|
|
14
|
+
}, j = {
|
|
15
15
|
top: "mt-4",
|
|
16
16
|
bottom: "mb-4",
|
|
17
17
|
left: "ml-4",
|
|
18
18
|
right: "mr-4"
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
tabs:
|
|
22
|
-
defaultTab:
|
|
23
|
-
position:
|
|
24
|
-
darkMode:
|
|
25
|
-
className:
|
|
26
|
-
tabListClassName:
|
|
27
|
-
contentClassName:
|
|
28
|
-
extra:
|
|
29
|
-
onChange:
|
|
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
30
|
}) {
|
|
31
|
-
const [
|
|
31
|
+
const [a, E] = v(N || l[0]?.id), [A, T] = v({}), f = p([]), h = p(null), n = R(() => {
|
|
32
32
|
requestAnimationFrame(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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({
|
|
37
38
|
left: `${o}px`,
|
|
38
39
|
top: `${m}px`,
|
|
39
|
-
width: `${
|
|
40
|
-
height: `${
|
|
40
|
+
width: `${z}px`,
|
|
41
|
+
height: `${C}px`,
|
|
41
42
|
transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
|
|
42
43
|
});
|
|
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();
|
|
44
52
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
|
|
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: [
|
|
51
61
|
/* @__PURE__ */ u(
|
|
52
62
|
"div",
|
|
53
63
|
{
|
|
54
64
|
className: t(
|
|
55
65
|
"flex w-full gap-4",
|
|
56
|
-
|
|
66
|
+
s ? "flex-col items-start" : "flex-row flex-wrap items-center"
|
|
57
67
|
),
|
|
58
68
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ i(
|
|
60
70
|
"div",
|
|
61
71
|
{
|
|
62
72
|
className: t(
|
|
63
73
|
"flex-1",
|
|
64
|
-
|
|
74
|
+
s ? "w-full" : "min-w-[520px]"
|
|
65
75
|
),
|
|
66
76
|
children: /* @__PURE__ */ u(
|
|
67
77
|
"div",
|
|
68
78
|
{
|
|
79
|
+
ref: h,
|
|
69
80
|
className: t(
|
|
70
81
|
"relative flex rounded-xl p-1",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
!
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
d ? "bg-neutral-300" : "bg-slate-100",
|
|
83
|
+
O[c],
|
|
84
|
+
!s && "w-full overflow-hidden",
|
|
85
|
+
s ? "min-w-48" : "",
|
|
86
|
+
g
|
|
76
87
|
),
|
|
77
88
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ i(
|
|
79
90
|
"div",
|
|
80
91
|
{
|
|
81
92
|
className: t(
|
|
82
93
|
"absolute rounded-lg",
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
d ? "bg-black" : "bg-white",
|
|
95
|
+
s ? "w-full" : "h-full"
|
|
85
96
|
),
|
|
86
|
-
style:
|
|
97
|
+
style: A
|
|
87
98
|
}
|
|
88
99
|
),
|
|
89
|
-
|
|
90
|
-
const o =
|
|
100
|
+
l?.map((e, r) => {
|
|
101
|
+
const o = a === e.id;
|
|
91
102
|
return /* @__PURE__ */ u(
|
|
92
103
|
"button",
|
|
93
104
|
{
|
|
94
105
|
ref: (m) => {
|
|
95
|
-
f.current[
|
|
106
|
+
f.current[r] = m;
|
|
96
107
|
},
|
|
97
108
|
onClick: () => {
|
|
98
|
-
e?.disabled || (
|
|
109
|
+
e?.disabled || (E(e?.id), y?.(e?.id));
|
|
99
110
|
},
|
|
100
111
|
disabled: e?.disabled,
|
|
101
112
|
className: t(
|
|
102
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",
|
|
103
|
-
|
|
104
|
-
e?.disabled && (
|
|
105
|
-
|
|
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"
|
|
106
117
|
),
|
|
107
118
|
children: [
|
|
108
|
-
e?.icon && /* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
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 })
|
|
110
121
|
]
|
|
111
122
|
},
|
|
112
123
|
e?.id
|
|
@@ -117,22 +128,22 @@ function k({
|
|
|
117
128
|
)
|
|
118
129
|
}
|
|
119
130
|
),
|
|
120
|
-
|
|
131
|
+
w && /* @__PURE__ */ i(
|
|
121
132
|
"div",
|
|
122
133
|
{
|
|
123
134
|
className: t(
|
|
124
135
|
"shrink-0 ml-auto",
|
|
125
|
-
|
|
136
|
+
s ? "w-full" : "max-w-full"
|
|
126
137
|
),
|
|
127
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center justify-end gap-2", children: w })
|
|
128
139
|
}
|
|
129
140
|
)
|
|
130
141
|
]
|
|
131
142
|
}
|
|
132
143
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
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) })
|
|
134
145
|
] });
|
|
135
146
|
}
|
|
136
147
|
export {
|
|
137
|
-
|
|
148
|
+
q as default
|
|
138
149
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsxs as u, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as r } from "../../lib/utils.js";
|
|
3
3
|
const b = {
|
|
4
4
|
blue: {
|
|
5
5
|
active: "bg-blue-600",
|
|
@@ -14,79 +14,87 @@ const b = {
|
|
|
14
14
|
focus: "focus:ring-2 focus:ring-yellow-200",
|
|
15
15
|
darkActive: "bg-yellow-500",
|
|
16
16
|
darkHover: "hover:bg-yellow-500"
|
|
17
|
+
},
|
|
18
|
+
orange: {
|
|
19
|
+
active: "bg-orange-600",
|
|
20
|
+
hover: "hover:bg-orange-600",
|
|
21
|
+
focus: "focus:ring-2 focus:ring-[rgba(227,98,12,0.25)]",
|
|
22
|
+
darkActive: "bg-orange-600",
|
|
23
|
+
darkHover: "hover:bg-orange-600"
|
|
17
24
|
}
|
|
18
25
|
};
|
|
19
26
|
function m({
|
|
20
|
-
checked:
|
|
21
|
-
onChange:
|
|
22
|
-
disabled:
|
|
23
|
-
variant:
|
|
24
|
-
darkMode:
|
|
25
|
-
label:
|
|
26
|
-
supportText:
|
|
27
|
-
className:
|
|
28
|
-
...
|
|
27
|
+
checked: o = !1,
|
|
28
|
+
onChange: c,
|
|
29
|
+
disabled: e = !1,
|
|
30
|
+
variant: n = "orange",
|
|
31
|
+
darkMode: t = !1,
|
|
32
|
+
label: s,
|
|
33
|
+
supportText: g,
|
|
34
|
+
className: i,
|
|
35
|
+
...v
|
|
29
36
|
}) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
return /* @__PURE__ */
|
|
37
|
+
const f = () => {
|
|
38
|
+
e || c?.(!o);
|
|
39
|
+
}, l = b[n];
|
|
40
|
+
return /* @__PURE__ */ u(
|
|
34
41
|
"div",
|
|
35
42
|
{
|
|
36
|
-
className:
|
|
43
|
+
className: r(
|
|
37
44
|
"flex items-start gap-3 select-none",
|
|
38
|
-
|
|
45
|
+
i
|
|
39
46
|
),
|
|
40
47
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ a(
|
|
42
49
|
"button",
|
|
43
50
|
{
|
|
44
|
-
...
|
|
51
|
+
...v,
|
|
45
52
|
type: "button",
|
|
46
|
-
disabled:
|
|
47
|
-
onClick:
|
|
48
|
-
className:
|
|
53
|
+
disabled: e,
|
|
54
|
+
onClick: f,
|
|
55
|
+
className: r(
|
|
49
56
|
"relative h-6 w-11 rounded-xl transition-all duration-300 outline-none",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
!
|
|
53
|
-
!
|
|
54
|
-
!
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
t &&
|
|
57
|
+
e ? "cursor-not-allowed" : "cursor-pointer",
|
|
58
|
+
o ? t ? l.darkActive : l.active : t ? "bg-neutral-200" : "bg-slate-200",
|
|
59
|
+
!e && o && (t ? l.darkHover : l.hover),
|
|
60
|
+
!e && !o && (t ? "hover:bg-neutral-100" : "hover:bg-slate-300"),
|
|
61
|
+
!e && l.focus,
|
|
62
|
+
t && !e && n === "blue" && "focus-visible:shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))]",
|
|
63
|
+
t && !e && n === "yellow" && "focus-visible:ring-2 focus-visible:ring-yellow-300/40",
|
|
64
|
+
t && !e && n === "orange" && "focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]",
|
|
65
|
+
e && (t ? "bg-neutral-200/60" : "bg-slate-100")
|
|
58
66
|
),
|
|
59
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ a(
|
|
60
68
|
"span",
|
|
61
69
|
{
|
|
62
|
-
className:
|
|
70
|
+
className: r(
|
|
63
71
|
"absolute top-1/2 left-0.5 h-5 w-5 -translate-y-1/2 rounded-full transition-all duration-300",
|
|
64
|
-
|
|
65
|
-
|
|
72
|
+
t ? "bg-black" : "bg-white",
|
|
73
|
+
o && "translate-x-5"
|
|
66
74
|
)
|
|
67
75
|
}
|
|
68
76
|
)
|
|
69
77
|
}
|
|
70
78
|
),
|
|
71
|
-
(
|
|
72
|
-
|
|
79
|
+
(s || g) && /* @__PURE__ */ u("div", { className: "flex flex-col leading-tight", children: [
|
|
80
|
+
s && /* @__PURE__ */ a(
|
|
73
81
|
"span",
|
|
74
82
|
{
|
|
75
|
-
className:
|
|
83
|
+
className: r(
|
|
76
84
|
"text-base font-medium",
|
|
77
|
-
|
|
85
|
+
t ? e ? "text-neutral-50/50" : "text-neutral-50" : e ? "text-slate-400" : "text-black"
|
|
78
86
|
),
|
|
79
|
-
children:
|
|
87
|
+
children: s
|
|
80
88
|
}
|
|
81
89
|
),
|
|
82
|
-
|
|
90
|
+
g && /* @__PURE__ */ a(
|
|
83
91
|
"span",
|
|
84
92
|
{
|
|
85
|
-
className:
|
|
93
|
+
className: r(
|
|
86
94
|
"text-sm font-normal",
|
|
87
|
-
|
|
95
|
+
t ? e ? "text-neutral-100/50" : "text-neutral-100" : e ? "text-slate-400" : "text-slate-500"
|
|
88
96
|
),
|
|
89
|
-
children:
|
|
97
|
+
children: g
|
|
90
98
|
}
|
|
91
99
|
)
|
|
92
100
|
] })
|