@mci-ui/mci-ui 0.0.94 → 0.0.96

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 (45) hide show
  1. package/dist/assets/png/empty.png.js +4 -0
  2. package/dist/index.css +1 -1
  3. package/dist/index.js +54 -50
  4. package/dist/shared/lib/uploadLanguage.js +6 -3
  5. package/dist/shared/ui/MciModal/MciModal.js +1 -1
  6. package/dist/shared/ui/mciAccordion/MciAccordion.js +4 -4
  7. package/dist/shared/ui/mciButton/MciButton.js +12 -10
  8. package/dist/shared/ui/mciCheck/MciCheck.js +3 -3
  9. package/dist/shared/ui/mciCollapse/MciCollapse.js +1 -1
  10. package/dist/shared/ui/mciDrawer/MciDrawer.js +1 -1
  11. package/dist/shared/ui/mciEmpty/MciEmpty.js +41 -0
  12. package/dist/shared/ui/mciInput/MciInput.js +32 -32
  13. package/dist/shared/ui/mciPagination/MciPagination.js +32 -32
  14. package/dist/shared/ui/mciPhone/MciPhone.js +23 -23
  15. package/dist/shared/ui/mciPicker/MciPicker.js +2 -2
  16. package/dist/shared/ui/mciTable/MciTable.js +317 -165
  17. package/dist/shared/ui/mciTable/MciTableClamp2.js +5 -5
  18. package/dist/shared/ui/mciTabs/FilledTabs.js +103 -90
  19. package/dist/shared/ui/mciTabs/OutlinedTabs.js +28 -24
  20. package/dist/shared/ui/mciTabs/TabCountBadge.js +19 -0
  21. package/dist/shared/ui/mciTag/MciTag.js +17 -17
  22. package/dist/shared/ui/mciTextarea/MciTextarea.js +5 -5
  23. package/dist/shared/ui/mciTimePicker/MciTimePicker.js +205 -194
  24. package/dist/shared/ui/mciUpload/MciUpload.js +102 -352
  25. package/dist/shared/ui/mciUpload/MciUploadButton.js +143 -0
  26. package/dist/shared/ui/mciUpload/MciUploadFileList.js +167 -0
  27. package/dist/shared/ui/mciUpload/mci-upload.theme.js +103 -0
  28. package/dist/shared/ui/mciUpload/mci-upload.utils.js +90 -41
  29. package/dist/shared/ui/mciUpload/useMciUpload.js +183 -0
  30. package/dist/types/index.d.ts +4 -0
  31. package/dist/types/shared/lib/uploadLanguage.d.ts +2 -0
  32. package/dist/types/shared/types/ui/empty.types.d.ts +11 -0
  33. package/dist/types/shared/types/ui/index.d.ts +2 -1
  34. package/dist/types/shared/types/ui/tabs.types.d.ts +2 -0
  35. package/dist/types/shared/types/ui/time-picker.types.d.ts +2 -0
  36. package/dist/types/shared/types/ui/upload.types.d.ts +25 -1
  37. package/dist/types/shared/ui/mciEmpty/MciEmpty.d.ts +2 -0
  38. package/dist/types/shared/ui/mciTabs/FilledTabs.d.ts +1 -1
  39. package/dist/types/shared/ui/mciTabs/TabCountBadge.d.ts +5 -0
  40. package/dist/types/shared/ui/mciUpload/MciUploadButton.d.ts +4 -0
  41. package/dist/types/shared/ui/mciUpload/MciUploadFileList.d.ts +18 -0
  42. package/dist/types/shared/ui/mciUpload/mci-upload.theme.d.ts +101 -0
  43. package/dist/types/shared/ui/mciUpload/mci-upload.utils.d.ts +7 -0
  44. package/dist/types/shared/ui/mciUpload/useMciUpload.d.ts +131 -0
  45. package/package.json +1 -1
@@ -1,149 +1,162 @@
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 = {
1
+ import { jsxs as m, jsx as l } from "react/jsx-runtime";
2
+ import { useState as p, useRef as N, useCallback as O, useEffect as v, useMemo as j } from "react";
3
+ import { cn as n } from "../../lib/utils.js";
4
+ import _ from "./TabCountBadge.js";
5
+ const $ = {
5
6
  top: "flex-col",
6
7
  bottom: "flex-col-reverse",
7
8
  left: "flex-row",
8
9
  right: "flex-row-reverse"
9
- }, _ = {
10
+ }, k = {
10
11
  top: "flex-row",
11
12
  bottom: "flex-row",
12
13
  left: "flex-col",
13
14
  right: "flex-col"
14
- }, $ = {
15
+ }, F = {
15
16
  top: "mt-4",
16
17
  bottom: "mb-4",
17
18
  left: "ml-4",
18
19
  right: "mr-4"
19
20
  };
20
- function B({
21
+ function V({
21
22
  tabs: t,
22
- defaultTab: N,
23
+ defaultTab: g,
23
24
  position: c = "top",
24
25
  darkMode: d = !1,
25
26
  className: b,
26
- tabListClassName: g,
27
+ width: u,
28
+ tabListClassName: y,
27
29
  contentClassName: S,
28
30
  extra: w,
29
- onChange: y
31
+ onChange: E
30
32
  }) {
31
- const [i, E] = v(N || t[0]?.id), [A, T] = v({}), a = p([]), h = p(null), s = I(() => {
33
+ const [i, A] = p(g || t[0]?.id), [T, C] = p({}), a = N([]), h = N(null), s = O(() => {
32
34
  requestAnimationFrame(() => {
33
35
  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({
36
+ const e = t.findIndex((I) => I?.id === i), r = a.current[e];
37
+ if (!r) return;
38
+ const { offsetLeft: f, offsetTop: x, offsetWidth: L, offsetHeight: R } = r;
39
+ C({
38
40
  left: `${f}px`,
39
- top: `${m}px`,
40
- width: `${z}px`,
41
- height: `${L}px`,
41
+ top: `${x}px`,
42
+ width: `${L}px`,
43
+ height: `${R}px`,
42
44
  transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
43
45
  });
44
46
  });
45
47
  });
46
48
  }, [i, t]);
47
- x(() => (s(), window.addEventListener("resize", s), "fonts" in document && document.fonts.ready.then(s), () => window.removeEventListener("resize", s)), [c, s]), x(() => {
49
+ v(() => (s(), window.addEventListener("resize", s), "fonts" in document && document.fonts.ready.then(s), () => window.removeEventListener("resize", s)), [c, s]), v(() => {
48
50
  const e = h.current;
49
51
  if (!e || typeof ResizeObserver > "u") return;
50
- const n = new ResizeObserver(() => {
52
+ const r = new ResizeObserver(() => {
51
53
  s();
52
54
  });
53
- return n.observe(e), a.current.forEach((f) => {
54
- f && n.observe(f);
55
- }), () => n.disconnect();
56
- }, [t, s]), x(() => {
55
+ return r.observe(e), a.current.forEach((f) => {
56
+ f && r.observe(f);
57
+ }), () => r.disconnect();
58
+ }, [t, s]), v(() => {
57
59
  a.current = a.current.slice(0, t.length);
58
60
  }, [t]);
59
- const o = c === "left" || c === "right", C = O(
61
+ const o = c === "left" || c === "right", z = j(
60
62
  () => t.find((e) => e.id === i)?.content,
61
63
  [i, t]
62
64
  );
63
- return /* @__PURE__ */ u("div", { className: l("flex w-full", j[c], b), children: [
64
- /* @__PURE__ */ u(
65
+ return /* @__PURE__ */ m("div", { className: n("flex w-full", $[c], b), children: [
66
+ /* @__PURE__ */ m(
65
67
  "div",
66
68
  {
67
- className: l(
69
+ className: n(
68
70
  "flex w-full gap-4",
69
71
  o ? "flex-col items-start" : "flex-row flex-wrap items-center"
70
72
  ),
71
73
  children: [
72
- /* @__PURE__ */ r("div", { className: l("flex-1", o ? "w-full" : "min-w-[520px]"), children: /* @__PURE__ */ u(
74
+ /* @__PURE__ */ l(
73
75
  "div",
74
76
  {
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
77
+ className: n(
78
+ u ? "flex-none" : "flex-1",
79
+ o ? "w-full" : !u && "min-w-[520px]"
83
80
  ),
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"
81
+ style: u !== void 0 ? { width: u } : void 0,
82
+ children: /* @__PURE__ */ m(
83
+ "div",
84
+ {
85
+ ref: h,
86
+ className: n(
87
+ "relative flex rounded-xl p-1",
88
+ d ? "bg-neutral-300" : "bg-slate-100",
89
+ k[c],
90
+ !o && "w-full overflow-hidden",
91
+ o ? "min-w-48" : "",
92
+ y
93
+ ),
94
+ children: [
95
+ /* @__PURE__ */ l(
96
+ "div",
97
+ {
98
+ className: n(
99
+ "absolute rounded-lg",
100
+ d ? "bg-black" : "bg-white",
101
+ o ? "w-full" : "h-full"
102
+ ),
103
+ style: T
104
+ }
92
105
  ),
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"
106
+ t?.map((e, r) => {
107
+ const f = i === e.id;
108
+ return /* @__PURE__ */ m(
109
+ "button",
110
+ {
111
+ ref: (x) => {
112
+ a.current[r] = x;
113
+ },
114
+ onClick: () => {
115
+ e?.disabled || (A(e?.id), E?.(e?.id));
116
+ },
117
+ disabled: e?.disabled,
118
+ className: n(
119
+ "relative z-10 flex cursor-pointer items-center justify-center px-3 py-2 text-base font-normal whitespace-nowrap transition-colors duration-300",
120
+ d ? "text-white" : "text-black",
121
+ e?.disabled && (d ? "cursor-not-allowed text-neutral-100/50 opacity-60" : "cursor-not-allowed opacity-50"),
122
+ o ? "w-full justify-start" : "min-w-0 flex-1"
123
+ ),
124
+ children: [
125
+ e?.icon && /* @__PURE__ */ l(
126
+ "span",
127
+ {
128
+ className: n(
129
+ "shrink-0 transition-transform duration-200",
130
+ f && "scale-110"
131
+ ),
132
+ children: e?.icon
133
+ }
121
134
  ),
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
- ]
135
+ /* @__PURE__ */ l("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label }),
136
+ /* @__PURE__ */ l(_, { count: e?.count })
137
+ ]
138
+ },
139
+ e?.id
140
+ );
141
+ })
142
+ ]
143
+ }
144
+ )
132
145
  }
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 }) })
146
+ ),
147
+ w && /* @__PURE__ */ l("div", { className: n("ml-auto shrink-0", o ? "w-full" : "max-w-full"), children: /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center justify-end gap-2", children: w }) })
135
148
  ]
136
149
  }
137
150
  ),
138
- C && /* @__PURE__ */ r(
151
+ z && /* @__PURE__ */ l(
139
152
  "div",
140
153
  {
141
- className: l(
154
+ className: n(
142
155
  "w-full flex-1 overflow-hidden",
143
- $[c],
156
+ F[c],
144
157
  S
145
158
  ),
146
- children: /* @__PURE__ */ r(
159
+ children: /* @__PURE__ */ l(
147
160
  "div",
148
161
  {
149
162
  className: "w-full animate-fade-in",
@@ -157,5 +170,5 @@ function B({
157
170
  ] });
158
171
  }
159
172
  export {
160
- B as default
173
+ V as default
161
174
  };
@@ -1,50 +1,54 @@
1
- import { jsxs as x, jsx as a } from "react/jsx-runtime";
2
- import { useState as f, useRef as m, useEffect as S, useMemo as N } from "react";
1
+ import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
+ import { useState as f, useRef as m, useEffect as N, useMemo as S } from "react";
3
3
  import { cn as i } from "../../lib/utils.js";
4
- const j = ({
4
+ import A from "./TabCountBadge.js";
5
+ const _ = ({
5
6
  tabs: e,
6
7
  className: b,
7
8
  contentClassName: p,
8
9
  darkMode: l,
9
- defaultTab: w,
10
- onChange: T,
11
- tabClassName: v,
12
- tabListClassName: y,
10
+ defaultTab: T,
11
+ onChange: w,
12
+ tabClassName: B,
13
+ tabListClassName: v,
13
14
  color: r = "orange"
14
15
  }) => {
15
- const [n, B] = f(w || e[0]?.id), [c, C] = f({ left: 0, width: 0 }), d = m({}), g = m(null);
16
- S(() => {
17
- const t = d.current[n], o = g.current;
16
+ const [n, y] = f(T || e[0]?.id), [d, C] = f({ left: 0, width: 0 }), g = m({}), u = m(null);
17
+ N(() => {
18
+ const t = g.current[n], o = u.current;
18
19
  if (t && o) {
19
- const k = o.getBoundingClientRect().left, u = t.getBoundingClientRect();
20
+ const k = o.getBoundingClientRect().left, x = t.getBoundingClientRect();
20
21
  C({
21
- left: u.left - k,
22
- width: u.width
22
+ left: x.left - k,
23
+ width: x.width
23
24
  });
24
25
  }
25
26
  }, [n, e]);
26
27
  const R = (t) => {
27
- B(t), T?.(t);
28
- }, h = N(
28
+ y(t), w?.(t);
29
+ }, h = S(
29
30
  () => e.find((t) => t.id === n)?.content,
30
31
  [n, e]
31
32
  );
32
- return /* @__PURE__ */ x("div", { className: i("space-y-4", b), children: [
33
- /* @__PURE__ */ x("div", { ref: g, className: i("relative flex", y), children: [
34
- e.map((t) => /* @__PURE__ */ a(
33
+ return /* @__PURE__ */ c("div", { className: i("space-y-4", b), children: [
34
+ /* @__PURE__ */ c("div", { ref: u, className: i("relative flex", v), children: [
35
+ e.map((t) => /* @__PURE__ */ c(
35
36
  "button",
36
37
  {
37
38
  ref: (o) => {
38
- d.current[t.id] = o;
39
+ g.current[t.id] = o;
39
40
  },
40
41
  onClick: () => R(t.id),
41
42
  className: i(
42
- "cursor-pointer truncate border-b-2 px-3 py-2 text-sm font-medium transition-colors",
43
+ "flex cursor-pointer items-center truncate border-b-2 px-3 py-2 text-sm font-medium transition-colors",
43
44
  l ? "border-slate-200/20" : "border-slate-200",
44
45
  n === t.id ? l ? s[r].darkText : s[r].lightText : l ? "text-slate-200/70 hover:text-slate-100" : "hover:text-primary text-slate-400",
45
- v
46
+ B
46
47
  ),
47
- children: t.label
48
+ children: [
49
+ /* @__PURE__ */ a("span", { className: "truncate", children: t.label }),
50
+ /* @__PURE__ */ a(A, { count: t.count })
51
+ ]
48
52
  },
49
53
  t.id
50
54
  )),
@@ -55,7 +59,7 @@ const j = ({
55
59
  "pointer-events-none absolute bottom-0 h-0.5 transition-all duration-300 ease-in-out",
56
60
  l ? s[r].darkBg : s[r].lightBg
57
61
  ),
58
- style: { left: c.left, width: c.width }
62
+ style: { left: d.left, width: d.width }
59
63
  }
60
64
  )
61
65
  ] }),
@@ -82,5 +86,5 @@ const j = ({
82
86
  }
83
87
  };
84
88
  export {
85
- j as default
89
+ _ as default
86
90
  };
@@ -0,0 +1,19 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { cn as l } from "../../lib/utils.js";
3
+ function o({ count: t }) {
4
+ if (t == null) return null;
5
+ const e = String(t), n = e.length < 3;
6
+ return /* @__PURE__ */ r(
7
+ "span",
8
+ {
9
+ className: l(
10
+ "ml-2 flex h-4 shrink-0 items-center justify-center rounded-full bg-orange-600 text-[10px] font-medium whitespace-nowrap text-white tabular-nums",
11
+ n ? "w-4" : "min-w-4 px-1.5"
12
+ ),
13
+ children: e
14
+ }
15
+ );
16
+ }
17
+ export {
18
+ o as default
19
+ };
@@ -1,5 +1,5 @@
1
- import { jsxs as m, jsx as l } from "react/jsx-runtime";
2
- import { cn as s } from "../../lib/utils.js";
1
+ import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
+ import { cn as l } from "../../lib/utils.js";
3
3
  const d = {
4
4
  sm: "px-2 py-0.5",
5
5
  md: "px-2 py-1",
@@ -8,48 +8,48 @@ const d = {
8
8
  sm: "w-3 h-3",
9
9
  md: "w-3 h-3",
10
10
  lg: "w-3 h-3"
11
- }, b = {
11
+ }, i = {
12
12
  success: "bg-green-50 text-green-600",
13
13
  warning: "bg-yellow-50 text-yellow-600",
14
14
  error: "bg-red-50 text-red-600",
15
15
  gray: "bg-slate-200 text-slate-700",
16
16
  blue: "bg-blue-50 text-blue-600"
17
- }, p = {
17
+ }, o = {
18
18
  success: "bg-green-950 text-green-400",
19
19
  warning: "bg-yellow-900 text-yellow-400",
20
20
  error: "bg-red-950 text-red-400",
21
21
  gray: "bg-neutral-200 text-neutral-50",
22
22
  blue: "bg-blue-900 text-blue-400"
23
23
  };
24
- function i({
24
+ function f({
25
25
  children: g,
26
26
  variant: r = "success",
27
27
  size: t = "lg",
28
28
  darkMode: x = !1,
29
29
  icon: e,
30
30
  iconPosition: a = "left",
31
- rounded: u = !1,
32
- className: c
31
+ rounded: c = !1,
32
+ className: m
33
33
  }) {
34
- return /* @__PURE__ */ m(
34
+ return /* @__PURE__ */ u(
35
35
  "span",
36
36
  {
37
- className: s(
38
- "inline-flex animate-[fadeIn_0.3s_ease-out] items-center text-extra-small font-medium",
39
- u ? "rounded-full" : "rounded-lg",
37
+ className: l(
38
+ "inline-flex max-w-full animate-[fadeIn_0.3s_ease-out] items-center overflow-hidden whitespace-nowrap text-extra-small font-medium",
39
+ c ? "rounded-full" : "rounded-lg",
40
40
  d[t],
41
- x ? p[r] : b[r],
41
+ x ? o[r] : i[r],
42
42
  e && "gap-[2px]",
43
- c
43
+ m
44
44
  ),
45
45
  children: [
46
- e && a === "left" && /* @__PURE__ */ l("span", { className: `flex items-center ${s(n[t])}`, children: e }),
47
- /* @__PURE__ */ l("span", { children: g }),
48
- e && a === "right" && /* @__PURE__ */ l("span", { className: `flex items-center ${s(n[t])}`, children: e })
46
+ e && a === "left" && /* @__PURE__ */ s("span", { className: `flex shrink-0 items-center ${l(n[t])}`, children: e }),
47
+ /* @__PURE__ */ s("span", { className: "min-w-0 truncate", children: g }),
48
+ e && a === "right" && /* @__PURE__ */ s("span", { className: `flex shrink-0 items-center ${l(n[t])}`, children: e })
49
49
  ]
50
50
  }
51
51
  );
52
52
  }
53
53
  export {
54
- i as default
54
+ f as default
55
55
  };
@@ -13,8 +13,8 @@ const g = w(
13
13
  error: t,
14
14
  className: b,
15
15
  rows: c = 4,
16
- name: f,
17
- ...x
16
+ name: x,
17
+ ...f
18
18
  }, m) => {
19
19
  const h = _(() => e ? t ? "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))]" : t ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600", [e, t]);
20
20
  return /* @__PURE__ */ s("div", { className: r("relative w-full", b), children: [
@@ -34,16 +34,16 @@ const g = w(
34
34
  /* @__PURE__ */ a(
35
35
  "textarea",
36
36
  {
37
- ...x,
37
+ ...f,
38
38
  ref: m,
39
- name: f,
39
+ name: x,
40
40
  rows: c,
41
41
  value: d,
42
42
  onChange: (p) => n?.(p.target.value),
43
43
  disabled: i,
44
44
  placeholder: o,
45
45
  className: r(
46
- "w-full resize-none rounded-xl border text-base font-normal transition-all duration-300 ease-in-out outline-none",
46
+ "w-full resize-none rounded-xl border text-base font-normal transition-all duration-300 ease-in-out outline-none cursor-text",
47
47
  e ? "p-3 text-neutral-50 placeholder:text-neutral-100 focus:text-white 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 p-3 disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
48
48
  h
49
49
  )