mcr-design-systems 1.0.45 → 1.0.46
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.
|
@@ -74,4 +74,4 @@ export interface CardProps extends React.HTMLAttributes<HTMLDivElement>, Variant
|
|
|
74
74
|
* </Card>
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
export default function Card({ variant, title, titleIcon, actionButton, actionIcon, children, className, showHeader, headerGap, contentPadding, contentGap, width,
|
|
77
|
+
export default function Card({ variant, title, titleIcon, actionButton, actionIcon, children, className, showHeader, headerGap, contentPadding, contentGap, width, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,44 +1,42 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { cardHeaderTitleVariants as
|
|
3
|
+
import { cardHeaderTitleVariants as v, cardHeaderActionVariants as u, cardHeaderVariants as N, cardContentVariants as y, cardVariants as V } from "./helper/variants.js";
|
|
4
4
|
import { cn as n } from "../../shared/utils/cn.js";
|
|
5
|
-
import { dataTestId as
|
|
6
|
-
import { Typography as
|
|
7
|
-
function
|
|
8
|
-
variant:
|
|
5
|
+
import { dataTestId as k } from "../../shared/utils/dataTestId.js";
|
|
6
|
+
import { Typography as b } from "../Typography/index.js";
|
|
7
|
+
function z({
|
|
8
|
+
variant: f = "default",
|
|
9
9
|
title: a,
|
|
10
10
|
titleIcon: e,
|
|
11
|
-
actionButton:
|
|
11
|
+
actionButton: m,
|
|
12
12
|
actionIcon: s,
|
|
13
|
-
children:
|
|
14
|
-
className:
|
|
15
|
-
showHeader:
|
|
16
|
-
headerGap:
|
|
17
|
-
contentPadding:
|
|
18
|
-
contentGap:
|
|
13
|
+
children: l,
|
|
14
|
+
className: t,
|
|
15
|
+
showHeader: p = !0,
|
|
16
|
+
headerGap: c = "xs",
|
|
17
|
+
contentPadding: x = "md",
|
|
18
|
+
contentGap: o = "md",
|
|
19
19
|
width: d,
|
|
20
|
-
|
|
21
|
-
...v
|
|
20
|
+
...g
|
|
22
21
|
}) {
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */
|
|
22
|
+
const h = d ? { width: typeof d == "number" ? `${d}px` : d } : {};
|
|
23
|
+
return /* @__PURE__ */ i(
|
|
25
24
|
"div",
|
|
26
25
|
{
|
|
27
|
-
className: n(
|
|
28
|
-
style:
|
|
29
|
-
...
|
|
30
|
-
...
|
|
26
|
+
className: n(V({ variant: f }), t),
|
|
27
|
+
style: h,
|
|
28
|
+
...k("Card"),
|
|
29
|
+
...g,
|
|
31
30
|
children: [
|
|
32
|
-
|
|
31
|
+
p && (a || e || m || s) && /* @__PURE__ */ i(
|
|
33
32
|
"div",
|
|
34
33
|
{
|
|
35
|
-
className: n(
|
|
36
|
-
style: h,
|
|
34
|
+
className: n(N({ gap: c }), t),
|
|
37
35
|
children: [
|
|
38
|
-
(a || e) && /* @__PURE__ */ r("div", { className:
|
|
36
|
+
(a || e) && /* @__PURE__ */ r("div", { className: v(), children: /* @__PURE__ */ i("div", { className: "flex items-center gap-xs", children: [
|
|
39
37
|
e && /* @__PURE__ */ r("div", { className: "flex-shrink-0 text-fg-neutral-main", children: e }),
|
|
40
38
|
a && /* @__PURE__ */ r(
|
|
41
|
-
|
|
39
|
+
b,
|
|
42
40
|
{
|
|
43
41
|
variants: "heading-xs",
|
|
44
42
|
size: "xs",
|
|
@@ -47,22 +45,22 @@ function A({
|
|
|
47
45
|
}
|
|
48
46
|
)
|
|
49
47
|
] }) }),
|
|
50
|
-
(
|
|
51
|
-
|
|
48
|
+
(m || s) && /* @__PURE__ */ i("div", { className: u({ gap: "xs" }), children: [
|
|
49
|
+
m,
|
|
52
50
|
s && /* @__PURE__ */ r("div", { className: "flex-shrink-0 text-fg-neutral-main", children: s })
|
|
53
51
|
] })
|
|
54
52
|
]
|
|
55
53
|
}
|
|
56
54
|
),
|
|
57
|
-
|
|
55
|
+
l && /* @__PURE__ */ r(
|
|
58
56
|
"div",
|
|
59
57
|
{
|
|
60
|
-
className:
|
|
61
|
-
padding:
|
|
62
|
-
gap:
|
|
58
|
+
className: y({
|
|
59
|
+
padding: x,
|
|
60
|
+
gap: o
|
|
63
61
|
}),
|
|
64
62
|
style: { wordWrap: "break-word", overflowWrap: "break-word" },
|
|
65
|
-
children:
|
|
63
|
+
children: l
|
|
66
64
|
}
|
|
67
65
|
)
|
|
68
66
|
]
|
|
@@ -70,5 +68,5 @@ function A({
|
|
|
70
68
|
);
|
|
71
69
|
}
|
|
72
70
|
export {
|
|
73
|
-
|
|
71
|
+
z as default
|
|
74
72
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as s, useEffect as m } from "react";
|
|
3
3
|
import { modal as F } from "./helper/variants.js";
|
|
4
4
|
import { cn as n } from "../../shared/utils/cn.js";
|
|
@@ -26,40 +26,40 @@ function _({
|
|
|
26
26
|
footer: v,
|
|
27
27
|
...R
|
|
28
28
|
}) {
|
|
29
|
-
const
|
|
29
|
+
const p = s(null), j = s(null), c = s(null), {
|
|
30
30
|
overlay: L,
|
|
31
|
-
content:
|
|
32
|
-
header:
|
|
33
|
-
titleContainer:
|
|
34
|
-
title:
|
|
31
|
+
content: P,
|
|
32
|
+
header: T,
|
|
33
|
+
titleContainer: z,
|
|
34
|
+
title: D,
|
|
35
35
|
closeButton: S,
|
|
36
36
|
body: I,
|
|
37
|
-
footer:
|
|
37
|
+
footer: y,
|
|
38
38
|
actionsContainer: M,
|
|
39
39
|
loadingContainer: V
|
|
40
40
|
} = F();
|
|
41
41
|
m(() => {
|
|
42
42
|
if (!i || !u) return;
|
|
43
|
-
const
|
|
43
|
+
const e = (A) => {
|
|
44
44
|
A.key === "Escape" && o();
|
|
45
45
|
};
|
|
46
|
-
return document.addEventListener("keydown",
|
|
46
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
47
47
|
}, [i, u, o]), m(() => {
|
|
48
48
|
if (!i) return;
|
|
49
|
-
const
|
|
49
|
+
const e = window.getComputedStyle(document.body).overflow;
|
|
50
50
|
return document.body.style.overflow = "hidden", () => {
|
|
51
|
-
document.body.style.overflow =
|
|
51
|
+
document.body.style.overflow = e;
|
|
52
52
|
};
|
|
53
53
|
}, [i]), m(() => {
|
|
54
54
|
t && i && c.current?.scrollTo({ top: 0, behavior: "instant" });
|
|
55
55
|
}, [t, i, c]);
|
|
56
|
-
const q = (
|
|
57
|
-
w &&
|
|
56
|
+
const q = (e) => {
|
|
57
|
+
w && e.target === p.current && !a && o();
|
|
58
58
|
};
|
|
59
|
-
return i ? /* @__PURE__ */
|
|
59
|
+
return i ? /* @__PURE__ */ r(
|
|
60
60
|
"div",
|
|
61
61
|
{
|
|
62
|
-
ref:
|
|
62
|
+
ref: p,
|
|
63
63
|
className: n(L(), B),
|
|
64
64
|
onClick: q,
|
|
65
65
|
...G("modal"),
|
|
@@ -68,24 +68,24 @@ function _({
|
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
70
70
|
ref: j,
|
|
71
|
-
className: n(
|
|
71
|
+
className: n(P({ size: x }), g),
|
|
72
72
|
role: "dialog",
|
|
73
73
|
"aria-modal": "true",
|
|
74
74
|
"aria-labelledby": "modal-title",
|
|
75
75
|
"aria-describedby": k ? "modal-subtitle" : void 0,
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */ d("div", { className:
|
|
78
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ d("div", { className: T(), children: [
|
|
78
|
+
/* @__PURE__ */ r("div", { className: z(), children: /* @__PURE__ */ r(
|
|
79
79
|
J,
|
|
80
80
|
{
|
|
81
81
|
id: "modal-title",
|
|
82
82
|
variants: "heading-xs",
|
|
83
83
|
size: "xs",
|
|
84
|
-
className:
|
|
84
|
+
className: D(),
|
|
85
85
|
children: b
|
|
86
86
|
}
|
|
87
87
|
) }),
|
|
88
|
-
N && /* @__PURE__ */
|
|
88
|
+
N && /* @__PURE__ */ r(
|
|
89
89
|
f,
|
|
90
90
|
{
|
|
91
91
|
variant: "outline",
|
|
@@ -93,7 +93,9 @@ function _({
|
|
|
93
93
|
iconOnly: !0,
|
|
94
94
|
icon: "x-close",
|
|
95
95
|
type: "button",
|
|
96
|
-
onClick:
|
|
96
|
+
onClick: (e) => {
|
|
97
|
+
e.stopPropagation(), o();
|
|
98
|
+
},
|
|
97
99
|
disabled: a,
|
|
98
100
|
className: S(),
|
|
99
101
|
"aria-label": "Close modal"
|
|
@@ -108,37 +110,37 @@ function _({
|
|
|
108
110
|
"overflow-hidden": t
|
|
109
111
|
}),
|
|
110
112
|
children: [
|
|
111
|
-
t && /* @__PURE__ */
|
|
113
|
+
t && /* @__PURE__ */ r("div", { className: V(), children: /* @__PURE__ */ r("div", { className: "w-[44px] h-[44px] p-sm-2 bg-neutral-700 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ r(H, { width: 20, thickness: 3 }) }) }),
|
|
112
114
|
C
|
|
113
115
|
]
|
|
114
116
|
}
|
|
115
117
|
),
|
|
116
|
-
l && /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
+
l && /* @__PURE__ */ r("div", { className: n(y(), h), children: /* @__PURE__ */ r("div", { className: M(), children: /* @__PURE__ */ d("div", { className: "flex gap-3", children: [
|
|
119
|
+
/* @__PURE__ */ r(
|
|
118
120
|
f,
|
|
119
121
|
{
|
|
120
122
|
disabled: l.cancelBtn?.isDisabled || a,
|
|
121
123
|
variant: "outline",
|
|
122
|
-
onClick: (
|
|
123
|
-
|
|
124
|
+
onClick: (e) => {
|
|
125
|
+
e.stopPropagation(), l.cancelBtn?.onClick?.();
|
|
124
126
|
},
|
|
125
127
|
children: l.cancelBtn?.label || "Cancel"
|
|
126
128
|
}
|
|
127
129
|
),
|
|
128
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ r(
|
|
129
131
|
f,
|
|
130
132
|
{
|
|
131
133
|
loading: a,
|
|
132
134
|
disabled: l.confirmBtn?.isDisabled || t || a,
|
|
133
135
|
variant: l?.confirmBtn?.isConfirm ? "danger" : "primary",
|
|
134
|
-
onClick: (
|
|
135
|
-
|
|
136
|
+
onClick: (e) => {
|
|
137
|
+
e.stopPropagation(), l.confirmBtn?.onClick?.();
|
|
136
138
|
},
|
|
137
139
|
children: l.confirmBtn?.label || "Confirm"
|
|
138
140
|
}
|
|
139
141
|
)
|
|
140
142
|
] }) }) }),
|
|
141
|
-
v && /* @__PURE__ */
|
|
143
|
+
v && /* @__PURE__ */ r("div", { className: n(y(), h), children: v })
|
|
142
144
|
]
|
|
143
145
|
}
|
|
144
146
|
)
|
|
@@ -47,7 +47,7 @@ const t = e({
|
|
|
47
47
|
true: [
|
|
48
48
|
"bg-bg-selected-rest text-fg-selected-rest",
|
|
49
49
|
"before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2",
|
|
50
|
-
"before:w-[2px] before:h-[16px] before:bg-fg-
|
|
50
|
+
"before:w-[2px] before:h-[16px] before:bg-fg-brand-rest",
|
|
51
51
|
"before:rounded-tr-xs before:rounded-br-xs"
|
|
52
52
|
],
|
|
53
53
|
false: "text-fg-neutral-subtle hover:bg-bg-neutral-subtle"
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Typography as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
text:
|
|
3
|
+
import { Typography as n } from "../Typography/index.js";
|
|
4
|
+
import f from "../Icon/Icon.js";
|
|
5
|
+
import g from "clsx";
|
|
6
|
+
const T = ({
|
|
7
|
+
text: m,
|
|
8
8
|
error: l = !1,
|
|
9
|
-
haveIcon:
|
|
10
|
-
iconsCustom:
|
|
9
|
+
haveIcon: h = !0,
|
|
10
|
+
iconsCustom: o,
|
|
11
11
|
className: r,
|
|
12
12
|
iconsSize: t = 16,
|
|
13
|
-
customContent:
|
|
13
|
+
customContent: d,
|
|
14
14
|
requirementsList: a
|
|
15
15
|
}) => {
|
|
16
|
-
if (
|
|
16
|
+
if (d)
|
|
17
17
|
return /* @__PURE__ */ e(
|
|
18
18
|
"div",
|
|
19
19
|
{
|
|
20
20
|
className: `self-stretch inline-flex flex-col justify-start items-start ${r || ""}`,
|
|
21
|
-
children:
|
|
21
|
+
children: d
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
24
|
if (a) {
|
|
25
|
-
const { items: x } = a,
|
|
25
|
+
const { items: x } = a, u = a.showTitle !== !1, p = a.title || "Requirements:", c = x.every((s) => s.isValid);
|
|
26
26
|
return /* @__PURE__ */ i("div", { className: `mt-1 space-y-1 ${r || ""}`, children: [
|
|
27
|
-
|
|
27
|
+
u && /* @__PURE__ */ i("div", { className: "self-stretch inline-flex justify-start items-start gap-1", children: [
|
|
28
28
|
/* @__PURE__ */ e(
|
|
29
|
-
|
|
29
|
+
f,
|
|
30
30
|
{
|
|
31
|
-
name: "alert-octagon",
|
|
32
|
-
className: "text-fg-accent-error",
|
|
31
|
+
name: c ? "check-circle" : "alert-octagon",
|
|
32
|
+
className: c ? "text-fg-accent-success" : "text-fg-accent-error",
|
|
33
33
|
variant: "solid",
|
|
34
34
|
size: typeof t == "number" ? t : 16
|
|
35
35
|
}
|
|
36
36
|
),
|
|
37
37
|
/* @__PURE__ */ e(
|
|
38
|
-
|
|
38
|
+
n,
|
|
39
39
|
{
|
|
40
40
|
variants: "body",
|
|
41
41
|
size: "sm",
|
|
42
|
-
color: "fg-accent-error",
|
|
42
|
+
color: c ? "fg-accent-success" : "fg-accent-error",
|
|
43
43
|
className: "font-medium",
|
|
44
44
|
children: p
|
|
45
45
|
}
|
|
@@ -48,23 +48,23 @@ const j = ({
|
|
|
48
48
|
/* @__PURE__ */ e("ul", { className: "list-disc ml-9", children: x.map((s) => /* @__PURE__ */ e(
|
|
49
49
|
"li",
|
|
50
50
|
{
|
|
51
|
-
className:
|
|
51
|
+
className: g("", {
|
|
52
52
|
"marker:text-fg-accent-success text-fg-accent-success": s.isValid,
|
|
53
53
|
"marker:text-fg-accent-error text-fg-accent-error": !s.isValid
|
|
54
54
|
}),
|
|
55
|
-
children: /* @__PURE__ */ e(
|
|
55
|
+
children: /* @__PURE__ */ e(n, { variants: "body", size: "sm", className: "text-inherit", children: s.text })
|
|
56
56
|
},
|
|
57
57
|
s.id
|
|
58
58
|
)) })
|
|
59
59
|
] });
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return m ? /* @__PURE__ */ e(
|
|
62
62
|
"div",
|
|
63
63
|
{
|
|
64
64
|
className: `self-stretch inline-flex flex-col justify-start items-start ${r || ""}`,
|
|
65
65
|
children: /* @__PURE__ */ i("div", { className: "self-stretch inline-flex justify-start items-start gap-1", children: [
|
|
66
|
-
l && (
|
|
67
|
-
|
|
66
|
+
l && (o || /* @__PURE__ */ e(
|
|
67
|
+
f,
|
|
68
68
|
{
|
|
69
69
|
name: "alert-octagon",
|
|
70
70
|
className: "text-fg-accent-error",
|
|
@@ -72,8 +72,8 @@ const j = ({
|
|
|
72
72
|
size: typeof t == "number" ? t : 16
|
|
73
73
|
}
|
|
74
74
|
)),
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
h && !l && /* @__PURE__ */ e(
|
|
76
|
+
f,
|
|
77
77
|
{
|
|
78
78
|
name: "help-circle",
|
|
79
79
|
variant: "line",
|
|
@@ -82,13 +82,13 @@ const j = ({
|
|
|
82
82
|
}
|
|
83
83
|
),
|
|
84
84
|
/* @__PURE__ */ e("div", { className: "flex-1 justify-start text-left flex flex-wrap items-center gap-0", children: /* @__PURE__ */ e(
|
|
85
|
-
|
|
85
|
+
n,
|
|
86
86
|
{
|
|
87
87
|
variants: "body",
|
|
88
88
|
size: "sm",
|
|
89
89
|
color: l ? "fg-accent-error" : "fg-neutral-subtle",
|
|
90
90
|
className: "inline",
|
|
91
|
-
children:
|
|
91
|
+
children: m
|
|
92
92
|
}
|
|
93
93
|
) })
|
|
94
94
|
] })
|
|
@@ -96,5 +96,5 @@ const j = ({
|
|
|
96
96
|
) : null;
|
|
97
97
|
};
|
|
98
98
|
export {
|
|
99
|
-
|
|
99
|
+
T as default
|
|
100
100
|
};
|