@mci-ui/mci-ui 0.0.83 → 0.0.85
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/assets/icons/check.svg.js +5 -0
- package/dist/assets/icons/close.svg.js +5 -0
- package/dist/assets/icons/loaderIcon.svg.js +5 -0
- package/dist/index.css +1 -1
- package/dist/index.js +53 -0
- package/dist/shared/lib/hooks/useTableColumnSettings.js +132 -0
- package/dist/shared/lib/locales.js +101 -0
- package/dist/shared/lib/uploadLanguage.js +80 -0
- package/dist/shared/lib/utils.js +20 -0
- package/dist/shared/ui/MciModal/MciModal.js +97 -0
- package/dist/shared/ui/mciAccordion/MciAccordion.js +74 -0
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +39 -0
- package/dist/shared/ui/mciButton/MciButton.js +63 -0
- package/dist/shared/ui/mciCheck/MciCheck.js +170 -0
- package/dist/shared/ui/mciCollapse/MciCollapse.js +60 -0
- package/dist/shared/ui/mciDrawer/MciDrawer.js +108 -0
- package/dist/shared/ui/mciIdentityInput/MciIdentityInput.js +30 -0
- package/dist/shared/ui/mciIdentityInput/mci-identity-input.utils.js +32 -0
- package/dist/shared/ui/mciInput/MciInput.js +225 -0
- package/dist/shared/ui/mciInput/mci-input.utils.js +49 -0
- package/dist/shared/ui/mciLoader/MciLoader.js +38 -0
- package/dist/shared/ui/mciPagination/MciPagination.js +135 -0
- package/dist/shared/ui/mciPagination/mci-pagination.utils.js +12 -0
- package/dist/shared/ui/mciPhone/MciPhone.js +83 -0
- package/dist/shared/ui/mciPhone/mci-phone.utils.js +47 -0
- package/dist/shared/ui/mciPicker/MciPicker.js +256 -0
- package/dist/shared/ui/mciPicker/mci-picker.utils.js +62 -0
- package/dist/shared/ui/mciSelect/MciSelect.js +226 -0
- package/dist/shared/ui/mciSelect/mci-select.utils.js +52 -0
- package/dist/shared/ui/mciSkeleton/MciSkeleton.js +29 -0
- package/dist/shared/ui/mciTable/MciTable.js +153 -0
- package/dist/shared/ui/mciTable/MciTableClamp2.js +7 -0
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +184 -0
- package/dist/shared/ui/mciTable/mci-table.utils.js +14 -0
- package/dist/shared/ui/mciTabs/MciTabs.js +131 -0
- package/dist/shared/ui/mciTag/MciTag.js +46 -0
- package/dist/shared/ui/mciTextarea/MciTextarea.js +56 -0
- package/dist/shared/ui/mciToast/MciToast.js +106 -0
- package/dist/shared/ui/mciToast/mci-toast.utils.js +47 -0
- package/dist/shared/ui/mciToggle/MciToggle.js +77 -0
- package/dist/shared/ui/mciTooltip/MciTooltip.js +52 -0
- package/dist/shared/ui/mciUpload/MciUpload.js +337 -0
- package/dist/shared/ui/mciUpload/mci-upload.utils.js +186 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/shared/types/ui/accordion.types.d.ts +7 -0
- package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +22 -0
- package/package.json +15 -12
- package/dist/index.es.js +0 -3319
- package/dist/index.umd.js +0 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import k from "../../../assets/icons/close.svg.js";
|
|
3
|
+
import { useRef as E, useEffect as b } from "react";
|
|
4
|
+
import { useEscapeKey as j, useClickOutside as w, cn as n } from "../../lib/utils.js";
|
|
5
|
+
function z({
|
|
6
|
+
show: t,
|
|
7
|
+
setShow: s,
|
|
8
|
+
title: i,
|
|
9
|
+
description: r,
|
|
10
|
+
Header: c,
|
|
11
|
+
Body: m,
|
|
12
|
+
footer: u,
|
|
13
|
+
handleClickOutside: a = !1,
|
|
14
|
+
showCloseIcon: p = !0,
|
|
15
|
+
showHeader: x = !0,
|
|
16
|
+
overlayClassName: v,
|
|
17
|
+
containerClassName: h,
|
|
18
|
+
bodyClassName: y,
|
|
19
|
+
footerClassName: N
|
|
20
|
+
}) {
|
|
21
|
+
const f = E(null), { handleEscape: o } = j(() => s(!1));
|
|
22
|
+
b(() => (t ? (document.addEventListener("keydown", o), document.body.style.overflow = "hidden") : document.body.style.overflow = "unset", () => document.removeEventListener("keydown", o)), [t, o]);
|
|
23
|
+
const { handleClick: l } = w(f, () => {
|
|
24
|
+
a && s(!1);
|
|
25
|
+
});
|
|
26
|
+
b(() => (t && a && document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l)), [t, l, a]);
|
|
27
|
+
const g = x && !!(c || i || r);
|
|
28
|
+
return /* @__PURE__ */ e(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: n(
|
|
32
|
+
"bg-black/40 fixed inset-0 z-50 flex justify-center transition-all duration-500 ease-in-out",
|
|
33
|
+
"items-end sm:items-center",
|
|
34
|
+
t ? "opacity-100" : "pointer-events-none opacity-0",
|
|
35
|
+
v
|
|
36
|
+
),
|
|
37
|
+
children: /* @__PURE__ */ d(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
ref: f,
|
|
41
|
+
className: n(
|
|
42
|
+
"relative bg-white w-full",
|
|
43
|
+
"sm:max-w-[720px]",
|
|
44
|
+
"rounded-t-2xl sm:rounded-2xl",
|
|
45
|
+
"transition-all duration-500 ease-out",
|
|
46
|
+
t ? "scale-100 opacity-100" : "scale-95 opacity-0",
|
|
47
|
+
h
|
|
48
|
+
),
|
|
49
|
+
children: [
|
|
50
|
+
g && /* @__PURE__ */ d("div", { className: "border-b border-slate-200 flex items-start justify-between p-4 sm:p-6 mb-4", children: [
|
|
51
|
+
c || /* @__PURE__ */ d("div", { className: "block", children: [
|
|
52
|
+
/* @__PURE__ */ e("h2", { className: "text-h3 font-semibold text-black", children: i }),
|
|
53
|
+
r && /* @__PURE__ */ e("p", { className: "text-base text-slate-base font-normal mt-2", children: r })
|
|
54
|
+
] }),
|
|
55
|
+
p && /* @__PURE__ */ e(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
onClick: () => s(!1),
|
|
59
|
+
className: "bg-slate-100 rounded-xl w-12 h-12 hover:cursor-pointer text-black transition flex items-center justify-center group",
|
|
60
|
+
"aria-label": "Close modal",
|
|
61
|
+
type: "button",
|
|
62
|
+
children: /* @__PURE__ */ e(k, { className: "h-6 w-6 transition-transform duration-300 group-hover:rotate-180" })
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] }),
|
|
66
|
+
m && /* @__PURE__ */ e(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: n(
|
|
70
|
+
"scrollbar-thin scrollbar-thumb-slate-200 overflow-y-auto",
|
|
71
|
+
"max-h-[70dvh] sm:max-h-96",
|
|
72
|
+
"px-4 sm:px-6 mb-2",
|
|
73
|
+
y
|
|
74
|
+
),
|
|
75
|
+
children: m
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
u && /* @__PURE__ */ e(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: n(
|
|
82
|
+
"flex items-center justify-end gap-3 border-t border-slate-200",
|
|
83
|
+
"p-4 sm:p-6",
|
|
84
|
+
N
|
|
85
|
+
),
|
|
86
|
+
children: u
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
z as default
|
|
97
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { AltArrowDown as h } from "@solar-icons/react";
|
|
3
|
+
import m, { useState as y, useRef as w, useId as x } from "react";
|
|
4
|
+
import { cn as n } from "../../lib/utils.js";
|
|
5
|
+
const A = (e) => e.type.displayName, f = (e, t, i) => m.Children.toArray(e).find(
|
|
6
|
+
(o) => m.isValidElement(o) && (A(o) === t || o.type === i)
|
|
7
|
+
) ?? null;
|
|
8
|
+
function d({
|
|
9
|
+
children: e,
|
|
10
|
+
className: t
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ r("div", { className: n("text-base font-medium text-black", t), children: e });
|
|
13
|
+
}
|
|
14
|
+
d.displayName = "AccordionTitle";
|
|
15
|
+
function c({
|
|
16
|
+
children: e,
|
|
17
|
+
className: t
|
|
18
|
+
}) {
|
|
19
|
+
return /* @__PURE__ */ r("div", { className: n("p-5 text-base", t), children: e });
|
|
20
|
+
}
|
|
21
|
+
c.displayName = "AccordionContent";
|
|
22
|
+
function u({ children: e, defaultValue: t = !1, icon: i, className: o }) {
|
|
23
|
+
const [a, p] = y(t), b = w(null), s = x(), N = () => p((g) => !g);
|
|
24
|
+
return /* @__PURE__ */ l("div", { className: n("overflow-hidden rounded-xl border border-slate-200", o), children: [
|
|
25
|
+
/* @__PURE__ */ l(
|
|
26
|
+
"button",
|
|
27
|
+
{
|
|
28
|
+
type: "button",
|
|
29
|
+
onClick: N,
|
|
30
|
+
"aria-expanded": a,
|
|
31
|
+
"aria-controls": s,
|
|
32
|
+
className: n(
|
|
33
|
+
"flex w-full items-center justify-between gap-2 p-5 transition-all duration-300 hover:cursor-pointer",
|
|
34
|
+
a ? "border-b border-slate-200" : "border-b border-transparent"
|
|
35
|
+
),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ l("div", { className: "flex w-full items-center gap-2", children: [
|
|
38
|
+
i && /* @__PURE__ */ r("span", { className: "shrink-0", children: i }),
|
|
39
|
+
f(e, "AccordionTitle", d)
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ r(
|
|
42
|
+
h,
|
|
43
|
+
{
|
|
44
|
+
weight: "Linear",
|
|
45
|
+
size: 20,
|
|
46
|
+
className: n(
|
|
47
|
+
"shrink-0 text-slate-400 transition-transform duration-300",
|
|
48
|
+
a && "rotate-180"
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ r(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
id: s,
|
|
59
|
+
role: "region",
|
|
60
|
+
"aria-labelledby": s,
|
|
61
|
+
className: n(
|
|
62
|
+
"grid transition-[grid-template-rows] duration-300 ease-out",
|
|
63
|
+
a ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
64
|
+
),
|
|
65
|
+
children: /* @__PURE__ */ r("div", { ref: b, className: "min-h-0 overflow-hidden", children: f(e, "AccordionContent", c) })
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
u.Title = d;
|
|
71
|
+
u.Content = c;
|
|
72
|
+
export {
|
|
73
|
+
u as default
|
|
74
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as l, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { AltArrowRight as h } from "@solar-icons/react";
|
|
3
|
+
import { cn as r } from "../../lib/utils.js";
|
|
4
|
+
function b({
|
|
5
|
+
items: a,
|
|
6
|
+
variant: o = "blue",
|
|
7
|
+
className: i
|
|
8
|
+
}) {
|
|
9
|
+
const n = o === "blue", m = n ? "hover:text-blue-600" : "hover:text-yellow-500", x = n ? "text-blue-600" : "text-yellow-500";
|
|
10
|
+
return /* @__PURE__ */ l("nav", { className: r("flex items-center", i), "aria-label": "Breadcrumb", children: a.map((e, s) => {
|
|
11
|
+
const c = s === a.length - 1;
|
|
12
|
+
return /* @__PURE__ */ t("div", { className: "flex items-center", children: [
|
|
13
|
+
c ? /* @__PURE__ */ t("span", { className: r("flex items-center gap-x-2 font-medium", x), children: [
|
|
14
|
+
e.icon,
|
|
15
|
+
/* @__PURE__ */ l("span", { children: e.label })
|
|
16
|
+
] }) : /* @__PURE__ */ t(
|
|
17
|
+
"a",
|
|
18
|
+
{
|
|
19
|
+
href: e.href ?? "#",
|
|
20
|
+
onClick: (f) => {
|
|
21
|
+
e.onClick && (f.preventDefault(), e.onClick());
|
|
22
|
+
},
|
|
23
|
+
className: r(
|
|
24
|
+
"flex items-center gap-x-2 transition-all text-sm font-normal text-slate-500",
|
|
25
|
+
m
|
|
26
|
+
),
|
|
27
|
+
children: [
|
|
28
|
+
e.icon,
|
|
29
|
+
/* @__PURE__ */ l("span", { children: e.label })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
!c && /* @__PURE__ */ l("span", { className: "mx-2 flex items-center", children: /* @__PURE__ */ l(h, { weight: "Linear", size: 20, className: "text-slate-500" }) })
|
|
34
|
+
] }, s);
|
|
35
|
+
}) });
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
b as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs as x, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { cn as y } from "../../lib/utils.js";
|
|
3
|
+
import { Star2 as m } from "@solar-icons/react";
|
|
4
|
+
const v = {
|
|
5
|
+
sm: "h-9 px-2 text-sm gap-1.5 rounded-lg leading-9 min-w-9",
|
|
6
|
+
md: "h-10 px-2 text-base gap-2 rounded-lg leading-10 min-w-10",
|
|
7
|
+
base: "h-12 px-4 text-base gap-2 rounded-xl leading-12 min-w-12"
|
|
8
|
+
}, p = {
|
|
9
|
+
blue: {
|
|
10
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800 focus:ring-2 focus:ring-[rgba(21,93,252,0.25)]",
|
|
11
|
+
secondary: "bg-blue-100 text-blue-600 hover:bg-blue-200 active:bg-blue-200 active:border active:border-blue-600 focus:ring-2 focus:ring-[rgba(21,93,252,0.25)]",
|
|
12
|
+
outline: "border border-blue-600 text-blue-600 hover:border-blue-700 hover:text-blue-700 active:border-blue-800 active:text-blue-800 focus:ring-2 focus:ring-blue-200"
|
|
13
|
+
},
|
|
14
|
+
yellow: {
|
|
15
|
+
primary: "bg-yellow-500 text-white hover:bg-yellow-600 active:bg-yellow-700 focus:ring-2 focus:ring-yellow-300",
|
|
16
|
+
secondary: "bg-yellow-50 text-yellow-500 hover:bg-yellow-100 active:bg-yellow-100 active:border active:border-yellow-500 focus:ring-2 focus:ring-yellow-200",
|
|
17
|
+
outline: "border border-yellow-500 text-yellow-500 hover:border-yellow-600 hover:text-yellow-600 active:border-yellow-700 active:text-yellow-700 focus:ring-2 focus:ring-yellow-200"
|
|
18
|
+
}
|
|
19
|
+
}, N = {
|
|
20
|
+
danger: "bg-red-600 text-white hover:bg-red-700 active:bg-red-800 focus:ring-2 focus:shadow-red",
|
|
21
|
+
tertiary: "bg-slate-100 text-black hover:bg-slate-200 active:bg-slate-300 focus:ring-2 focus:shadow-slate"
|
|
22
|
+
};
|
|
23
|
+
function _({
|
|
24
|
+
children: n,
|
|
25
|
+
text: b,
|
|
26
|
+
icon: t,
|
|
27
|
+
iconPosition: s = "left",
|
|
28
|
+
size: c = "base",
|
|
29
|
+
variant: e = "primary",
|
|
30
|
+
color: u = "yellow",
|
|
31
|
+
loading: r = !1,
|
|
32
|
+
disabled: g = !1,
|
|
33
|
+
onClick: d,
|
|
34
|
+
className: w,
|
|
35
|
+
type: f = "button"
|
|
36
|
+
}) {
|
|
37
|
+
const a = n ?? b, i = e === "primary" || e === "secondary" || e === "outline" ? p[u][e] : N[e], o = g || r, h = o ? e === "outline" ? "border-slate-200 bg-white text-slate-400 cursor-not-allowed hover:bg-transparent hover:border-slate-200 hover:text-slate-400 active:border-slate-200 active:text-slate-400 active:bg-transparent focus:bg-transparent focus:ring-0" : "bg-slate-200 text-slate-400 cursor-not-allowed hover:bg-slate-200 active:bg-slate-200 focus:ring-0" : "";
|
|
38
|
+
return /* @__PURE__ */ x(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: f,
|
|
42
|
+
onClick: d,
|
|
43
|
+
disabled: o,
|
|
44
|
+
className: y(
|
|
45
|
+
"inline-flex w-fit shrink-0 items-center justify-center whitespace-nowrap text-center font-medium transition-all duration-200 cursor-pointer",
|
|
46
|
+
v[c],
|
|
47
|
+
i,
|
|
48
|
+
!o && i,
|
|
49
|
+
h,
|
|
50
|
+
w
|
|
51
|
+
),
|
|
52
|
+
children: [
|
|
53
|
+
t && s === "left" && !r && /* @__PURE__ */ l("span", { className: "flex items-center", children: t }),
|
|
54
|
+
a && /* @__PURE__ */ l("span", { className: "whitespace-nowrap", children: a }),
|
|
55
|
+
t && s === "right" && !r && /* @__PURE__ */ l("span", { className: "flex items-center", children: t }),
|
|
56
|
+
r && /* @__PURE__ */ l(m, { weight: "Linear", size: 20, className: "animate-spin" })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
_ as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { jsxs as u, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { memo as j, useState as S, useMemo as b, useCallback as L } from "react";
|
|
3
|
+
import $ from "../../../assets/icons/check.svg.js";
|
|
4
|
+
import { cn as r } from "../../lib/utils.js";
|
|
5
|
+
const A = {
|
|
6
|
+
blue: {
|
|
7
|
+
border: "border-blue-600",
|
|
8
|
+
bg: "bg-blue-600",
|
|
9
|
+
hover: "hover:border-blue-600 hover:bg-blue-100",
|
|
10
|
+
focus: "focus:shadow-blue"
|
|
11
|
+
},
|
|
12
|
+
yellow: {
|
|
13
|
+
border: "border-yellow-500",
|
|
14
|
+
bg: "bg-yellow-500",
|
|
15
|
+
hover: "hover:border-yellow-500 hover:bg-yello-100",
|
|
16
|
+
focus: "focus:ring-2 focus:ring-yellow-300"
|
|
17
|
+
}
|
|
18
|
+
}, E = j(function({
|
|
19
|
+
type: x = "checkbox",
|
|
20
|
+
label: c,
|
|
21
|
+
supportText: l,
|
|
22
|
+
checked: i,
|
|
23
|
+
onChange: g,
|
|
24
|
+
error: n,
|
|
25
|
+
disabled: a = !1,
|
|
26
|
+
required: h = !1,
|
|
27
|
+
className: v,
|
|
28
|
+
variant: p = "yellow",
|
|
29
|
+
name: f,
|
|
30
|
+
value: k
|
|
31
|
+
}) {
|
|
32
|
+
const [y, w] = S(!1), s = x === "radio", e = b(
|
|
33
|
+
() => i ?? y,
|
|
34
|
+
[i, y]
|
|
35
|
+
), N = L(
|
|
36
|
+
(t) => {
|
|
37
|
+
a || (i === void 0 && w(t.target.checked), g?.(t));
|
|
38
|
+
},
|
|
39
|
+
[i, g, a]
|
|
40
|
+
), m = b(() => {
|
|
41
|
+
if (a) {
|
|
42
|
+
const d = "border-slate-200 bg-slate-100";
|
|
43
|
+
return s ? {
|
|
44
|
+
container: d,
|
|
45
|
+
dot: e ? "bg-slate-300" : "bg-transparent",
|
|
46
|
+
check: "text-slate-400"
|
|
47
|
+
} : {
|
|
48
|
+
container: d,
|
|
49
|
+
dot: "",
|
|
50
|
+
check: e ? "text-slate-400" : "text-transparent"
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const t = A[p];
|
|
54
|
+
if (s) {
|
|
55
|
+
const d = r(
|
|
56
|
+
"border transition-all duration-200",
|
|
57
|
+
e ? t.border : "border-slate-400",
|
|
58
|
+
!e && t.hover,
|
|
59
|
+
t.focus,
|
|
60
|
+
e && ""
|
|
61
|
+
), M = r(
|
|
62
|
+
"transition-all duration-200 rounded-full",
|
|
63
|
+
e ? t.bg : "bg-transparent"
|
|
64
|
+
);
|
|
65
|
+
return {
|
|
66
|
+
container: d,
|
|
67
|
+
dot: M,
|
|
68
|
+
check: ""
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
container: r(
|
|
73
|
+
"border transition-all duration-200",
|
|
74
|
+
e ? r(t.bg, t.border) : "border-slate-400",
|
|
75
|
+
!e && t.hover,
|
|
76
|
+
t.focus
|
|
77
|
+
),
|
|
78
|
+
dot: "",
|
|
79
|
+
check: e ? "text-white" : "text-transparent"
|
|
80
|
+
};
|
|
81
|
+
}, [s, e, a, p]), C = b(() => !c && !l ? null : /* @__PURE__ */ u("div", { className: "flex flex-col", children: [
|
|
82
|
+
c && /* @__PURE__ */ u(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
className: r(
|
|
86
|
+
"text-base font-medium text-slate-700",
|
|
87
|
+
n && "text-red-600",
|
|
88
|
+
a && "text-slate-400"
|
|
89
|
+
),
|
|
90
|
+
children: [
|
|
91
|
+
c,
|
|
92
|
+
h && /* @__PURE__ */ o("span", { className: "text-extra-small text-red-600 ml-1", children: "*" })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
l && /* @__PURE__ */ o(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: r(
|
|
100
|
+
"text-slate-500 text-base font-normal",
|
|
101
|
+
a && "text-slate-400"
|
|
102
|
+
),
|
|
103
|
+
children: l
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] }), [c, l, n, a, h]);
|
|
107
|
+
return /* @__PURE__ */ u("div", { className: r("flex items-start", v), children: [
|
|
108
|
+
/* @__PURE__ */ u(
|
|
109
|
+
"label",
|
|
110
|
+
{
|
|
111
|
+
className: r(
|
|
112
|
+
"flex items-start gap-2 select-none",
|
|
113
|
+
a ? "cursor-not-allowed" : "cursor-pointer"
|
|
114
|
+
),
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ o(
|
|
117
|
+
"input",
|
|
118
|
+
{
|
|
119
|
+
type: x,
|
|
120
|
+
checked: e,
|
|
121
|
+
onChange: N,
|
|
122
|
+
disabled: a,
|
|
123
|
+
required: h,
|
|
124
|
+
className: "sr-only",
|
|
125
|
+
"aria-invalid": !!n,
|
|
126
|
+
"aria-describedby": n ? `${f}-error` : void 0,
|
|
127
|
+
name: f,
|
|
128
|
+
value: k
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ o(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
className: r(
|
|
135
|
+
"relative flex items-center justify-center",
|
|
136
|
+
s ? "w-5 h-5 rounded-full" : "w-5 h-5 rounded",
|
|
137
|
+
m.container
|
|
138
|
+
),
|
|
139
|
+
children: s ? /* @__PURE__ */ o("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ o(
|
|
140
|
+
"span",
|
|
141
|
+
{
|
|
142
|
+
className: r(
|
|
143
|
+
"w-3 h-3 rounded-full transition-all duration-200",
|
|
144
|
+
m.dot,
|
|
145
|
+
e ? "opacity-100 scale-100" : "opacity-0 scale-50"
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
) }) : /* @__PURE__ */ o(
|
|
149
|
+
$,
|
|
150
|
+
{
|
|
151
|
+
className: r(
|
|
152
|
+
"w-4 h-4 stroke-[2.5px] transition-opacity duration-200",
|
|
153
|
+
m.check,
|
|
154
|
+
e ? "opacity-100" : "opacity-0"
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
C
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
n && /* @__PURE__ */ o("p", { id: `${f}-error`, className: "mt-1 text-extra-small text-red-600", children: n })
|
|
165
|
+
] });
|
|
166
|
+
});
|
|
167
|
+
E.displayName = "MciCheck";
|
|
168
|
+
export {
|
|
169
|
+
E as default
|
|
170
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { AltArrowDown as p } from "@solar-icons/react";
|
|
3
|
+
import { useState as i, useRef as b, useEffect as x } from "react";
|
|
4
|
+
import { cn as e } from "../../lib/utils.js";
|
|
5
|
+
function k({
|
|
6
|
+
title: a,
|
|
7
|
+
children: l,
|
|
8
|
+
defaultOpen: c = !1,
|
|
9
|
+
icon: o,
|
|
10
|
+
className: d,
|
|
11
|
+
contentClassName: f
|
|
12
|
+
}) {
|
|
13
|
+
const [t, m] = i(c), [u, h] = i(0), s = b(null);
|
|
14
|
+
return x(() => {
|
|
15
|
+
s.current && h(t ? s.current.scrollHeight : 0);
|
|
16
|
+
}, [t]), /* @__PURE__ */ n("div", { className: e("overflow-hidden rounded-xl border border-slate-200", d), children: [
|
|
17
|
+
/* @__PURE__ */ n(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
onClick: () => m(!t),
|
|
21
|
+
className: e(
|
|
22
|
+
"flex w-full items-center justify-between p-5 transition-all duration-300 hover:cursor-pointer",
|
|
23
|
+
t ? "border-b border-slate-200" : "border-b border-transparent"
|
|
24
|
+
),
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
27
|
+
o && /* @__PURE__ */ r("span", { className: "shrink-0", children: o }),
|
|
28
|
+
/* @__PURE__ */ r("div", { className: e("text-base font-medium text-black"), children: a })
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ r(
|
|
31
|
+
p,
|
|
32
|
+
{
|
|
33
|
+
weight: "Linear",
|
|
34
|
+
size: 20,
|
|
35
|
+
className: e(
|
|
36
|
+
"shrink-0 transition-transform duration-300 text-slate-400",
|
|
37
|
+
t && "rotate-180"
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ r(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: e(
|
|
48
|
+
"overflow-hidden transition-all duration-300 ease-out"
|
|
49
|
+
),
|
|
50
|
+
style: {
|
|
51
|
+
height: `${u}px`
|
|
52
|
+
},
|
|
53
|
+
children: /* @__PURE__ */ r("div", { ref: s, className: e("p-5", f), children: l })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
k as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsxs as n, Fragment as j, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f, useCallback as E, useEffect as h, useMemo as C } from "react";
|
|
3
|
+
import { cn as l } from "../../lib/utils.js";
|
|
4
|
+
import X from "../../../assets/icons/close.svg.js";
|
|
5
|
+
function A({
|
|
6
|
+
isOpen: e,
|
|
7
|
+
onClose: i,
|
|
8
|
+
position: o = "right",
|
|
9
|
+
children: p,
|
|
10
|
+
footer: m,
|
|
11
|
+
title: r,
|
|
12
|
+
description: a,
|
|
13
|
+
showCloseButton: c = !0,
|
|
14
|
+
drawerClassName: x,
|
|
15
|
+
contentClassName: v,
|
|
16
|
+
closeOnOverlayClick: y = !0,
|
|
17
|
+
closeOnEscape: z = !0,
|
|
18
|
+
width: s = 572
|
|
19
|
+
}) {
|
|
20
|
+
const d = f(null), u = f(null), b = E(() => i(), [i]);
|
|
21
|
+
h(() => {
|
|
22
|
+
e ? (u.current = document.activeElement, d.current?.focus()) : u.current?.focus();
|
|
23
|
+
}, [e]), h(() => (e && (document.body.style.overflow = "hidden"), () => {
|
|
24
|
+
document.body.style.overflow = "unset";
|
|
25
|
+
}), [e]);
|
|
26
|
+
const w = C(
|
|
27
|
+
() => ({
|
|
28
|
+
"--drawer-w": typeof s == "number" ? `${s}px` : s,
|
|
29
|
+
transform: e ? "translateX(0)" : o === "right" ? "translateX(calc(100% + 48px))" : "translateX(calc(-100% - 48px))"
|
|
30
|
+
}),
|
|
31
|
+
[e, s, o]
|
|
32
|
+
), g = !!(r || a || c), k = o === "right" ? "top-0 bottom-0 right-0 left-3 rounded-l-3xl rounded-r-none" : "top-0 bottom-0 left-0 right-3 rounded-r-3xl rounded-l-none", N = o === "right" ? "sm:top-6 sm:bottom-6 sm:right-6 sm:left-auto" : "sm:top-6 sm:bottom-6 sm:left-6 sm:right-auto";
|
|
33
|
+
return /* @__PURE__ */ n(j, { children: [
|
|
34
|
+
/* @__PURE__ */ t(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: l(
|
|
38
|
+
"fixed inset-0 z-50 bg-black/40 transition-opacity duration-300",
|
|
39
|
+
e ? "opacity-100 visible cursor-pointer" : "opacity-0 invisible pointer-events-none"
|
|
40
|
+
),
|
|
41
|
+
onClick: y ? b : void 0,
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ n(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
ref: d,
|
|
49
|
+
tabIndex: -1,
|
|
50
|
+
style: w,
|
|
51
|
+
className: l(
|
|
52
|
+
"fixed z-50 flex flex-col bg-white outline-none min-h-0",
|
|
53
|
+
"transition-[transform,opacity,visibility] duration-300 ease-in-out",
|
|
54
|
+
e ? "opacity-100 visible pointer-events-auto shadow-2xl" : "opacity-0 invisible pointer-events-none shadow-none",
|
|
55
|
+
k,
|
|
56
|
+
"h-[100dvh]",
|
|
57
|
+
"pb-[env(safe-area-inset-bottom)]",
|
|
58
|
+
N,
|
|
59
|
+
"sm:h-auto sm:rounded-2xl sm:pb-0",
|
|
60
|
+
"sm:w-[var(--drawer-w)]",
|
|
61
|
+
x
|
|
62
|
+
),
|
|
63
|
+
role: "dialog",
|
|
64
|
+
"aria-modal": "true",
|
|
65
|
+
"aria-hidden": !e,
|
|
66
|
+
"aria-labelledby": r ? "drawer-title" : void 0,
|
|
67
|
+
children: [
|
|
68
|
+
g && /* @__PURE__ */ n("div", { className: "flex items-start justify-between border-b border-slate-200 shrink-0 px-4 py-4 sm:p-6", children: [
|
|
69
|
+
(r || a) && /* @__PURE__ */ n("div", { className: "block pr-3", children: [
|
|
70
|
+
r && /* @__PURE__ */ t(
|
|
71
|
+
"h2",
|
|
72
|
+
{
|
|
73
|
+
id: "drawer-title",
|
|
74
|
+
className: "font-semibold text-black text-xl leading-tight sm:text-h3",
|
|
75
|
+
children: r
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
a && /* @__PURE__ */ t("p", { className: "text-sm sm:text-base text-slate-base font-normal mt-2", children: a })
|
|
79
|
+
] }),
|
|
80
|
+
c && /* @__PURE__ */ t(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: b,
|
|
85
|
+
className: "bg-slate-100 rounded-xl w-11 h-11 sm:w-12 sm:h-12 hover:cursor-pointer text-black transition flex items-center justify-center group active:scale-95",
|
|
86
|
+
children: /* @__PURE__ */ t(X, { className: "h-5 w-5 sm:h-6 sm:w-6 transition-transform duration-300 group-hover:rotate-180" })
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ t(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: l(
|
|
94
|
+
"flex-1 min-h-0 overflow-y-auto scrollbar-thin scrollbar-thumb-slate-200 px-4 py-4 sm:p-6",
|
|
95
|
+
v
|
|
96
|
+
),
|
|
97
|
+
children: p
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
m && /* @__PURE__ */ t("div", { className: "shrink-0 flex items-center justify-end border-t border-slate-200 px-4 py-4 sm:p-6 gap-3 [&>*]:w-fit [&>*]:shrink-0 [&>*]:whitespace-nowrap", children: m })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
A as default
|
|
108
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useState as g, useCallback as h } from "react";
|
|
3
|
+
import p from "../mciInput/MciInput.js";
|
|
4
|
+
import { formatIdentityValue as I, getIdentityPlaceholder as y, getIdentityMaxLength as V } from "./mci-identity-input.utils.js";
|
|
5
|
+
const x = m(
|
|
6
|
+
({ mode: t, onChange: o, value: e, ...a }, i) => {
|
|
7
|
+
const [r, c] = g(""), u = e !== void 0 ? e : r, d = h(
|
|
8
|
+
(n) => {
|
|
9
|
+
const f = n.target.value, l = I(t, f);
|
|
10
|
+
e === void 0 && c(l), n.target.value = l, o?.(l, n);
|
|
11
|
+
},
|
|
12
|
+
[t, o, e]
|
|
13
|
+
);
|
|
14
|
+
return /* @__PURE__ */ s(
|
|
15
|
+
p,
|
|
16
|
+
{
|
|
17
|
+
ref: i,
|
|
18
|
+
...a,
|
|
19
|
+
value: u,
|
|
20
|
+
onChange: d,
|
|
21
|
+
maxLength: V(t, a.maxLength),
|
|
22
|
+
placeholder: y(t, a.placeholder)
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
x.displayName = "MciIdentityInput";
|
|
28
|
+
export {
|
|
29
|
+
x as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function f(t) {
|
|
2
|
+
const r = t.replace(/\s/g, "").toUpperCase();
|
|
3
|
+
let e = "";
|
|
4
|
+
for (let i = 0; i < r.length; i += 1) {
|
|
5
|
+
const n = r[i];
|
|
6
|
+
if (e.length < 2 ? /[A-Z]/.test(n) && (e += n) : /[0-9]/.test(n) && (e += n), e.length >= 9) break;
|
|
7
|
+
}
|
|
8
|
+
return e.length > 2 ? `${e.slice(0, 2)} ${e.slice(2)}` : e;
|
|
9
|
+
}
|
|
10
|
+
function s(t) {
|
|
11
|
+
return t.replace(/\D/g, "").slice(0, 14);
|
|
12
|
+
}
|
|
13
|
+
function u(t) {
|
|
14
|
+
return t.toUpperCase().replace(/[^A-Z0-9\-\s]/g, "").replace(/\s+/g, " ").slice(0, 15);
|
|
15
|
+
}
|
|
16
|
+
function p(t, r) {
|
|
17
|
+
return t === "passport" ? f(r) : t === "pinfl" ? s(r) : u(r);
|
|
18
|
+
}
|
|
19
|
+
function a(t, r) {
|
|
20
|
+
return r || (t === "passport" ? "AA 1234567" : t === "pinfl" ? "12345678901234" : t === "metirka" ? "I-TN 1234567" : "");
|
|
21
|
+
}
|
|
22
|
+
function l(t, r) {
|
|
23
|
+
return r || (t === "passport" ? 10 : t === "pinfl" ? 14 : t === "metirka" ? 15 : 255);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
p as formatIdentityValue,
|
|
27
|
+
u as formatMetirka,
|
|
28
|
+
f as formatPassport,
|
|
29
|
+
s as formatPinfl,
|
|
30
|
+
l as getIdentityMaxLength,
|
|
31
|
+
a as getIdentityPlaceholder
|
|
32
|
+
};
|