@mci-ui/mci-ui 0.0.93 → 0.0.95

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 (43) 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/mciCollapse/MciCollapse.js +1 -1
  9. package/dist/shared/ui/mciDrawer/MciDrawer.js +1 -1
  10. package/dist/shared/ui/mciEmpty/MciEmpty.js +41 -0
  11. package/dist/shared/ui/mciInput/MciInput.js +32 -32
  12. package/dist/shared/ui/mciPagination/MciPagination.js +32 -32
  13. package/dist/shared/ui/mciPhone/MciPhone.js +23 -23
  14. package/dist/shared/ui/mciPicker/MciPicker.js +2 -2
  15. package/dist/shared/ui/mciTable/MciTable.js +317 -165
  16. package/dist/shared/ui/mciTable/MciTableClamp2.js +5 -5
  17. package/dist/shared/ui/mciTabs/FilledTabs.js +38 -36
  18. package/dist/shared/ui/mciTabs/OutlinedTabs.js +28 -24
  19. package/dist/shared/ui/mciTabs/TabCountBadge.js +19 -0
  20. package/dist/shared/ui/mciTag/MciTag.js +17 -17
  21. package/dist/shared/ui/mciTextarea/MciTextarea.js +5 -5
  22. package/dist/shared/ui/mciTimePicker/MciTimePicker.js +368 -217
  23. package/dist/shared/ui/mciUpload/MciUpload.js +102 -352
  24. package/dist/shared/ui/mciUpload/MciUploadButton.js +143 -0
  25. package/dist/shared/ui/mciUpload/MciUploadFileList.js +167 -0
  26. package/dist/shared/ui/mciUpload/mci-upload.theme.js +103 -0
  27. package/dist/shared/ui/mciUpload/mci-upload.utils.js +90 -41
  28. package/dist/shared/ui/mciUpload/useMciUpload.js +183 -0
  29. package/dist/types/index.d.ts +4 -0
  30. package/dist/types/shared/lib/uploadLanguage.d.ts +2 -0
  31. package/dist/types/shared/types/ui/empty.types.d.ts +11 -0
  32. package/dist/types/shared/types/ui/index.d.ts +2 -1
  33. package/dist/types/shared/types/ui/tabs.types.d.ts +1 -0
  34. package/dist/types/shared/types/ui/time-picker.types.d.ts +7 -1
  35. package/dist/types/shared/types/ui/upload.types.d.ts +25 -1
  36. package/dist/types/shared/ui/mciEmpty/MciEmpty.d.ts +2 -0
  37. package/dist/types/shared/ui/mciTabs/TabCountBadge.d.ts +5 -0
  38. package/dist/types/shared/ui/mciUpload/MciUploadButton.d.ts +4 -0
  39. package/dist/types/shared/ui/mciUpload/MciUploadFileList.d.ts +18 -0
  40. package/dist/types/shared/ui/mciUpload/mci-upload.theme.d.ts +101 -0
  41. package/dist/types/shared/ui/mciUpload/mci-upload.utils.d.ts +7 -0
  42. package/dist/types/shared/ui/mciUpload/useMciUpload.d.ts +131 -0
  43. package/package.json +1 -1
@@ -1,29 +1,30 @@
1
- import { jsxs as u, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as l } from "react/jsx-runtime";
2
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 = {
3
+ import { cn as n } from "../../lib/utils.js";
4
+ import j 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
+ }, $ = {
10
11
  top: "flex-row",
11
12
  bottom: "flex-row",
12
13
  left: "flex-col",
13
14
  right: "flex-col"
14
- }, $ = {
15
+ }, k = {
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 H({
21
22
  tabs: t,
22
23
  defaultTab: N,
23
24
  position: c = "top",
24
25
  darkMode: d = !1,
25
- className: b,
26
- tabListClassName: g,
26
+ className: g,
27
+ tabListClassName: b,
27
28
  contentClassName: S,
28
29
  extra: w,
29
30
  onChange: y
@@ -31,9 +32,9 @@ function B({
31
32
  const [i, E] = v(N || t[0]?.id), [A, T] = v({}), a = p([]), h = p(null), s = I(() => {
32
33
  requestAnimationFrame(() => {
33
34
  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;
35
+ const e = t.findIndex((R) => R?.id === i), r = a.current[e];
36
+ if (!r) return;
37
+ const { offsetLeft: f, offsetTop: m, offsetWidth: z, offsetHeight: L } = r;
37
38
  T({
38
39
  left: `${f}px`,
39
40
  top: `${m}px`,
@@ -47,12 +48,12 @@ function B({
47
48
  x(() => (s(), window.addEventListener("resize", s), "fonts" in document && document.fonts.ready.then(s), () => window.removeEventListener("resize", s)), [c, s]), x(() => {
48
49
  const e = h.current;
49
50
  if (!e || typeof ResizeObserver > "u") return;
50
- const n = new ResizeObserver(() => {
51
+ const r = new ResizeObserver(() => {
51
52
  s();
52
53
  });
53
- return n.observe(e), a.current.forEach((f) => {
54
- f && n.observe(f);
55
- }), () => n.disconnect();
54
+ return r.observe(e), a.current.forEach((f) => {
55
+ f && r.observe(f);
56
+ }), () => r.disconnect();
56
57
  }, [t, s]), x(() => {
57
58
  a.current = a.current.slice(0, t.length);
58
59
  }, [t]);
@@ -60,32 +61,32 @@ function B({
60
61
  () => t.find((e) => e.id === i)?.content,
61
62
  [i, t]
62
63
  );
63
- return /* @__PURE__ */ u("div", { className: l("flex w-full", j[c], b), children: [
64
+ return /* @__PURE__ */ u("div", { className: n("flex w-full", _[c], g), children: [
64
65
  /* @__PURE__ */ u(
65
66
  "div",
66
67
  {
67
- className: l(
68
+ className: n(
68
69
  "flex w-full gap-4",
69
70
  o ? "flex-col items-start" : "flex-row flex-wrap items-center"
70
71
  ),
71
72
  children: [
72
- /* @__PURE__ */ r("div", { className: l("flex-1", o ? "w-full" : "min-w-[520px]"), children: /* @__PURE__ */ u(
73
+ /* @__PURE__ */ l("div", { className: n("flex-1", o ? "w-full" : "min-w-[520px]"), children: /* @__PURE__ */ u(
73
74
  "div",
74
75
  {
75
76
  ref: h,
76
- className: l(
77
+ className: n(
77
78
  "relative flex rounded-xl p-1",
78
79
  d ? "bg-neutral-300" : "bg-slate-100",
79
- _[c],
80
+ $[c],
80
81
  !o && "w-full overflow-hidden",
81
82
  o ? "min-w-48" : "",
82
- g
83
+ b
83
84
  ),
84
85
  children: [
85
- /* @__PURE__ */ r(
86
+ /* @__PURE__ */ l(
86
87
  "div",
87
88
  {
88
- className: l(
89
+ className: n(
89
90
  "absolute rounded-lg",
90
91
  d ? "bg-black" : "bg-white",
91
92
  o ? "w-full" : "h-full"
@@ -93,36 +94,37 @@ function B({
93
94
  style: A
94
95
  }
95
96
  ),
96
- t?.map((e, n) => {
97
+ t?.map((e, r) => {
97
98
  const f = i === e.id;
98
99
  return /* @__PURE__ */ u(
99
100
  "button",
100
101
  {
101
102
  ref: (m) => {
102
- a.current[n] = m;
103
+ a.current[r] = m;
103
104
  },
104
105
  onClick: () => {
105
106
  e?.disabled || (E(e?.id), y?.(e?.id));
106
107
  },
107
108
  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",
109
+ className: n(
110
+ "relative z-10 flex cursor-pointer items-center justify-center px-3 py-2 text-base font-normal whitespace-nowrap transition-colors duration-300",
110
111
  d ? "text-white" : "text-black",
111
112
  e?.disabled && (d ? "cursor-not-allowed text-neutral-100/50 opacity-60" : "cursor-not-allowed opacity-50"),
112
113
  o ? "w-full justify-start" : "min-w-0 flex-1"
113
114
  ),
114
115
  children: [
115
- e?.icon && /* @__PURE__ */ r(
116
+ e?.icon && /* @__PURE__ */ l(
116
117
  "span",
117
118
  {
118
- className: l(
119
+ className: n(
119
120
  "shrink-0 transition-transform duration-200",
120
121
  f && "scale-110"
121
122
  ),
122
123
  children: e?.icon
123
124
  }
124
125
  ),
125
- /* @__PURE__ */ r("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label })
126
+ /* @__PURE__ */ l("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label }),
127
+ /* @__PURE__ */ l(j, { count: e?.count })
126
128
  ]
127
129
  },
128
130
  e?.id
@@ -131,19 +133,19 @@ function B({
131
133
  ]
132
134
  }
133
135
  ) }),
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 }) })
136
+ 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
137
  ]
136
138
  }
137
139
  ),
138
- C && /* @__PURE__ */ r(
140
+ C && /* @__PURE__ */ l(
139
141
  "div",
140
142
  {
141
- className: l(
143
+ className: n(
142
144
  "w-full flex-1 overflow-hidden",
143
- $[c],
145
+ k[c],
144
146
  S
145
147
  ),
146
- children: /* @__PURE__ */ r(
148
+ children: /* @__PURE__ */ l(
147
149
  "div",
148
150
  {
149
151
  className: "w-full animate-fade-in",
@@ -157,5 +159,5 @@ function B({
157
159
  ] });
158
160
  }
159
161
  export {
160
- B as default
162
+ H as default
161
163
  };
@@ -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
  )