@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.
Files changed (33) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared/ui/MciModal/MciModal.js +30 -28
  3. package/dist/shared/ui/mciAccordion/MciAccordion.js +97 -64
  4. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +45 -25
  5. package/dist/shared/ui/mciButton/MciButton.js +39 -31
  6. package/dist/shared/ui/mciCheck/MciCheck.js +86 -76
  7. package/dist/shared/ui/mciDrawer/MciDrawer.js +78 -54
  8. package/dist/shared/ui/mciInput/MciInput.js +39 -40
  9. package/dist/shared/ui/mciLoader/MciLoader.js +14 -14
  10. package/dist/shared/ui/mciPagination/MciPagination.js +28 -18
  11. package/dist/shared/ui/mciPicker/MciPicker.js +53 -53
  12. package/dist/shared/ui/mciSelect/MciSelect.js +42 -41
  13. package/dist/shared/ui/mciTable/MciTable.js +97 -90
  14. package/dist/shared/ui/mciTable/MciTableClamp2.js +4 -3
  15. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +100 -79
  16. package/dist/shared/ui/mciTabs/MciTabs.js +66 -55
  17. package/dist/shared/ui/mciToggle/MciToggle.js +51 -43
  18. package/dist/shared/ui/mciUpload/MciUpload.js +129 -107
  19. package/dist/types/shared/types/mci-table.types.d.ts +2 -0
  20. package/dist/types/shared/types/ui/accordion.types.d.ts +1 -0
  21. package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -1
  22. package/dist/types/shared/types/ui/button.types.d.ts +1 -1
  23. package/dist/types/shared/types/ui/check.types.d.ts +1 -1
  24. package/dist/types/shared/types/ui/drawer.types.d.ts +2 -0
  25. package/dist/types/shared/types/ui/loader.types.d.ts +1 -1
  26. package/dist/types/shared/types/ui/pagination.types.d.ts +1 -1
  27. package/dist/types/shared/types/ui/toggle.types.d.ts +1 -1
  28. package/dist/types/shared/types/ui/upload.types.d.ts +1 -1
  29. package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +5 -3
  30. package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
  31. package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
  32. package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
  33. package/package.json +1 -1
@@ -1,112 +1,123 @@
1
- import { jsxs as u, jsx as l } from "react/jsx-runtime";
2
- import { useState as w, useRef as C, useCallback as I, useEffect as h } from "react";
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 L = {
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
- }, j = {
9
+ }, O = {
10
10
  top: "flex-row",
11
11
  bottom: "flex-row",
12
12
  left: "flex-col",
13
13
  right: "flex-col"
14
- }, z = {
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 k({
21
- tabs: i,
22
- defaultTab: p,
23
- position: r = "top",
24
- darkMode: a = !1,
25
- className: v,
26
- tabListClassName: N,
27
- contentClassName: g,
28
- extra: x,
29
- onChange: S
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 [s, b] = w(p || i[0]?.id), [y, E] = w({}), f = C([]), c = I(() => {
31
+ const [a, E] = v(N || l[0]?.id), [A, T] = v({}), f = p([]), h = p(null), n = R(() => {
32
32
  requestAnimationFrame(() => {
33
- const e = i.findIndex((o) => o?.id === s), d = f.current[e];
34
- if (d) {
35
- const { offsetLeft: o, offsetTop: m, offsetWidth: T, offsetHeight: A } = d;
36
- E({
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: `${T}px`,
40
- height: `${A}px`,
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
- }, [s, i]);
46
- h(() => (c(), window.addEventListener("resize", c), "fonts" in document && document.fonts.ready.then(c), () => window.removeEventListener("resize", c)), [r, c]), h(() => {
47
- f.current = f.current.slice(0, i.length);
48
- }, [i]);
49
- const n = r === "left" || r === "right";
50
- return /* @__PURE__ */ u("div", { className: t("flex w-full", L[r], v), children: [
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
- n ? "flex-col items-start" : "flex-row flex-wrap items-center"
66
+ s ? "flex-col items-start" : "flex-row flex-wrap items-center"
57
67
  ),
58
68
  children: [
59
- /* @__PURE__ */ l(
69
+ /* @__PURE__ */ i(
60
70
  "div",
61
71
  {
62
72
  className: t(
63
73
  "flex-1",
64
- n ? "w-full" : "min-w-[520px]"
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
- a ? "bg-neutral-300" : "bg-slate-100",
72
- j[r],
73
- !n && "w-full overflow-hidden",
74
- n ? "min-w-48" : "",
75
- N
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__ */ l(
89
+ /* @__PURE__ */ i(
79
90
  "div",
80
91
  {
81
92
  className: t(
82
93
  "absolute rounded-lg",
83
- a ? "bg-black" : "bg-white",
84
- n ? "w-full" : "h-full"
94
+ d ? "bg-black" : "bg-white",
95
+ s ? "w-full" : "h-full"
85
96
  ),
86
- style: y
97
+ style: A
87
98
  }
88
99
  ),
89
- i?.map((e, d) => {
90
- const o = s === e.id;
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[d] = m;
106
+ f.current[r] = m;
96
107
  },
97
108
  onClick: () => {
98
- e?.disabled || (b(e?.id), S?.(e?.id));
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
- a ? "text-white" : "text-black",
104
- e?.disabled && (a ? "cursor-not-allowed text-neutral-100/50 opacity-60" : "cursor-not-allowed opacity-50"),
105
- n ? "w-full justify-start" : "flex-1 min-w-0"
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__ */ l("span", { className: t("shrink-0 transition-transform duration-200", o && "scale-110"), children: e?.icon }),
109
- /* @__PURE__ */ l("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label })
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
- x && /* @__PURE__ */ l(
131
+ w && /* @__PURE__ */ i(
121
132
  "div",
122
133
  {
123
134
  className: t(
124
135
  "shrink-0 ml-auto",
125
- n ? "w-full" : "max-w-full"
136
+ s ? "w-full" : "max-w-full"
126
137
  ),
127
- children: /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center justify-end gap-2", children: x })
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__ */ l("div", { className: t("w-full flex-1 overflow-hidden", z[r], g), children: /* @__PURE__ */ l("div", { className: "animate-fade-in w-full", style: { animationDuration: "0.35s" }, children: i?.find((e) => e.id === s)?.content }, s) })
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
- k as default
148
+ q as default
138
149
  };
@@ -1,5 +1,5 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
- import { cn as n } from "../../lib/utils.js";
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: l = !1,
21
- onChange: i,
22
- disabled: t = !1,
23
- variant: s = "yellow",
24
- darkMode: e = !1,
25
- label: a,
26
- supportText: u,
27
- className: g,
28
- ...f
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 v = () => {
31
- t || i?.(!l);
32
- }, o = b[s];
33
- return /* @__PURE__ */ c(
37
+ const f = () => {
38
+ e || c?.(!o);
39
+ }, l = b[n];
40
+ return /* @__PURE__ */ u(
34
41
  "div",
35
42
  {
36
- className: n(
43
+ className: r(
37
44
  "flex items-start gap-3 select-none",
38
- g
45
+ i
39
46
  ),
40
47
  children: [
41
- /* @__PURE__ */ r(
48
+ /* @__PURE__ */ a(
42
49
  "button",
43
50
  {
44
- ...f,
51
+ ...v,
45
52
  type: "button",
46
- disabled: t,
47
- onClick: v,
48
- className: n(
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
- t ? "cursor-not-allowed" : "cursor-pointer",
51
- l ? e ? o.darkActive : o.active : e ? "bg-neutral-200" : "bg-slate-200",
52
- !t && l && (e ? o.darkHover : o.hover),
53
- !t && !l && (e ? "hover:bg-neutral-100" : "hover:bg-slate-300"),
54
- !t && o.focus,
55
- e && !t && s === "blue" && "focus-visible:shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))]",
56
- e && !t && s === "yellow" && "focus-visible:ring-2 focus-visible:ring-yellow-300/40",
57
- t && (e ? "bg-neutral-200/60" : "bg-slate-100")
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__ */ r(
67
+ children: /* @__PURE__ */ a(
60
68
  "span",
61
69
  {
62
- className: n(
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
- e ? "bg-black" : "bg-white",
65
- l && "translate-x-5"
72
+ t ? "bg-black" : "bg-white",
73
+ o && "translate-x-5"
66
74
  )
67
75
  }
68
76
  )
69
77
  }
70
78
  ),
71
- (a || u) && /* @__PURE__ */ c("div", { className: "flex flex-col leading-tight", children: [
72
- a && /* @__PURE__ */ r(
79
+ (s || g) && /* @__PURE__ */ u("div", { className: "flex flex-col leading-tight", children: [
80
+ s && /* @__PURE__ */ a(
73
81
  "span",
74
82
  {
75
- className: n(
83
+ className: r(
76
84
  "text-base font-medium",
77
- e ? t ? "text-neutral-50/50" : "text-neutral-50" : t ? "text-slate-400" : "text-black"
85
+ t ? e ? "text-neutral-50/50" : "text-neutral-50" : e ? "text-slate-400" : "text-black"
78
86
  ),
79
- children: a
87
+ children: s
80
88
  }
81
89
  ),
82
- u && /* @__PURE__ */ r(
90
+ g && /* @__PURE__ */ a(
83
91
  "span",
84
92
  {
85
- className: n(
93
+ className: r(
86
94
  "text-sm font-normal",
87
- e ? t ? "text-neutral-100/50" : "text-neutral-100" : t ? "text-slate-400" : "text-slate-500"
95
+ t ? e ? "text-neutral-100/50" : "text-neutral-100" : e ? "text-slate-400" : "text-slate-500"
88
96
  ),
89
- children: u
97
+ children: g
90
98
  }
91
99
  )
92
100
  ] })