@caseparts-org/caseblocks 0.0.116 → 0.0.118
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.
|
@@ -9,18 +9,18 @@ import '../../assets/Popover.css';const W = "_popover_vlr81_1", q = "_content_vl
|
|
|
9
9
|
function D(r) {
|
|
10
10
|
return r ? r.includes(" ") ? r : `${r} center` : "top center";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function T(r) {
|
|
13
13
|
const d = D(r).toLowerCase(), [s, c] = d.split(" ");
|
|
14
14
|
return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: c === "left" || c === "top" ? "start" : c === "right" || c === "bottom" ? "end" : "center" };
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function U(r, d, s, c, p = 8) {
|
|
17
17
|
const n = r.getBoundingClientRect(), l = d.getBoundingClientRect();
|
|
18
18
|
let a = 0, u = 0;
|
|
19
19
|
s === "top" ? a = n.top - l.height - p : s === "bottom" ? a = n.bottom + p : s === "left" ? u = n.left - l.width - p : s === "right" && (u = n.right + p), s === "top" || s === "bottom" ? c === "start" ? u = n.left : c === "end" ? u = n.right - l.width : u = n.left + n.width / 2 - l.width / 2 : c === "start" ? a = n.top : c === "end" ? a = n.bottom - l.height : a = n.top + n.height / 2 - l.height / 2;
|
|
20
20
|
const w = window.innerWidth, h = window.innerHeight;
|
|
21
21
|
return a = Math.max(4, Math.min(h - l.height - 4, a)), u = Math.max(4, Math.min(w - l.width - 4, u)), { top: a, left: u };
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const J = ({
|
|
24
24
|
trigger: r,
|
|
25
25
|
children: d,
|
|
26
26
|
position: s,
|
|
@@ -32,7 +32,7 @@ const K = ({
|
|
|
32
32
|
open: u,
|
|
33
33
|
onOpenChange: w
|
|
34
34
|
}) => {
|
|
35
|
-
const { side: h, align: y } =
|
|
35
|
+
const { side: h, align: y } = T(s), [M, S] = f.useState(!1), x = typeof u == "boolean", o = x ? u : M, [m, R] = f.useState(null), b = f.useRef(null), v = f.useRef(null), L = (t) => {
|
|
36
36
|
const e = typeof t == "function" ? t(o) : t;
|
|
37
37
|
x ? w == null || w(e) : S(e);
|
|
38
38
|
}, _ = () => {
|
|
@@ -59,7 +59,7 @@ const K = ({
|
|
|
59
59
|
const t = b.current, e = v.current;
|
|
60
60
|
if (!t || !e) return;
|
|
61
61
|
const i = () => {
|
|
62
|
-
R(
|
|
62
|
+
R(U(t, e, h, y, 8));
|
|
63
63
|
};
|
|
64
64
|
return i(), window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), () => {
|
|
65
65
|
window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0);
|
|
@@ -78,7 +78,7 @@ const K = ({
|
|
|
78
78
|
const e = (i) => {
|
|
79
79
|
const g = i.target;
|
|
80
80
|
if (!g) return;
|
|
81
|
-
g.closest('[data-popover-close="true"]') && E();
|
|
81
|
+
g.closest('[data-popover-close="true"]') && setTimeout(() => E(), 0);
|
|
82
82
|
};
|
|
83
83
|
return t.addEventListener("click", e), () => t.removeEventListener("click", e);
|
|
84
84
|
}, [o, a]), f.useEffect(() => {
|
|
@@ -122,5 +122,5 @@ const K = ({
|
|
|
122
122
|
] });
|
|
123
123
|
};
|
|
124
124
|
export {
|
|
125
|
-
|
|
125
|
+
J as Popover
|
|
126
126
|
};
|
|
@@ -6,7 +6,8 @@ export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
6
6
|
caption?: string;
|
|
7
7
|
onClose: () => void;
|
|
8
8
|
closeOnOverlayClick?: boolean;
|
|
9
|
+
contentWrapperClassName?: string;
|
|
9
10
|
headerSize?: ModalHeaderSize;
|
|
10
11
|
headerVariant?: ModalHeaderVariant;
|
|
11
12
|
}
|
|
12
|
-
export declare function Modal({ isOpen, caption, onClose, closeOnOverlayClick, headerSize, headerVariant, className, children, ...otherProps }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export declare function Modal({ isOpen, caption, onClose, closeOnOverlayClick, headerSize, headerVariant, className, contentWrapperClassName, children, ...otherProps }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,53 +1,54 @@
|
|
|
1
1
|
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
3
|
-
import { Text as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import '../../assets/Modal.css';const
|
|
6
|
-
overlay:
|
|
7
|
-
container:
|
|
8
|
-
header:
|
|
9
|
-
closeButton:
|
|
10
|
-
content:
|
|
11
|
-
headerPlain:
|
|
12
|
-
},
|
|
2
|
+
import { c as t } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { Text as p } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Icon as y } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import '../../assets/Modal.css';const g = "_overlay_1du2l_1", x = "_container_1du2l_11", N = "_header_1du2l_30", T = "_closeButton_1du2l_43", k = "_content_1du2l_56", z = "_headerPlain_1du2l_64", e = {
|
|
6
|
+
overlay: g,
|
|
7
|
+
container: x,
|
|
8
|
+
header: N,
|
|
9
|
+
closeButton: T,
|
|
10
|
+
content: k,
|
|
11
|
+
headerPlain: z
|
|
12
|
+
}, B = {
|
|
13
13
|
sm: "sm",
|
|
14
14
|
md: "md",
|
|
15
15
|
lg: "lg"
|
|
16
|
-
},
|
|
16
|
+
}, C = {
|
|
17
17
|
sm: "sm",
|
|
18
18
|
md: "md",
|
|
19
19
|
lg: "md"
|
|
20
20
|
};
|
|
21
|
-
function
|
|
21
|
+
function I({
|
|
22
22
|
isOpen: i,
|
|
23
23
|
caption: o,
|
|
24
24
|
onClose: l,
|
|
25
25
|
closeOnOverlayClick: d = !0,
|
|
26
|
-
headerSize:
|
|
26
|
+
headerSize: n = "md",
|
|
27
27
|
headerVariant: r = "default",
|
|
28
28
|
className: m,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
contentWrapperClassName: u,
|
|
30
|
+
children: _,
|
|
31
|
+
...h
|
|
31
32
|
}) {
|
|
32
33
|
if (!i) return null;
|
|
33
|
-
const
|
|
34
|
+
const f = (c) => {
|
|
34
35
|
d && c.target === c.currentTarget && l();
|
|
35
|
-
},
|
|
36
|
-
return /* @__PURE__ */ a("div", { className:
|
|
36
|
+
}, v = r === "default" && !!o;
|
|
37
|
+
return /* @__PURE__ */ a("div", { className: t(e.overlay), onClick: f, children: /* @__PURE__ */ s("div", { className: t(e.container, m), role: "dialog", "aria-modal": "true", ...h, children: [
|
|
37
38
|
/* @__PURE__ */ s(
|
|
38
39
|
"div",
|
|
39
40
|
{
|
|
40
|
-
className:
|
|
41
|
+
className: t(
|
|
41
42
|
e.header,
|
|
42
|
-
e[`header-${
|
|
43
|
+
e[`header-${n}`],
|
|
43
44
|
r === "plain" && e.headerPlain
|
|
44
45
|
),
|
|
45
46
|
children: [
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
v ? /* @__PURE__ */ a(
|
|
48
|
+
p,
|
|
48
49
|
{
|
|
49
50
|
as: "div",
|
|
50
|
-
size:
|
|
51
|
+
size: B[n],
|
|
51
52
|
variant: "display",
|
|
52
53
|
className: e.caption,
|
|
53
54
|
children: o
|
|
@@ -60,15 +61,15 @@ function j({
|
|
|
60
61
|
className: e.closeButton,
|
|
61
62
|
"aria-label": "Close",
|
|
62
63
|
onClick: l,
|
|
63
|
-
children: /* @__PURE__ */ a(
|
|
64
|
+
children: /* @__PURE__ */ a(y, { iconKey: "fa-regular fa-xmark", size: C[n] })
|
|
64
65
|
}
|
|
65
66
|
)
|
|
66
67
|
]
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
|
-
/* @__PURE__ */ a("div", { className: e.content, children:
|
|
70
|
+
/* @__PURE__ */ a("div", { className: t(e.content, u), children: _ })
|
|
70
71
|
] }) });
|
|
71
72
|
}
|
|
72
73
|
export {
|
|
73
|
-
|
|
74
|
+
I as Modal
|
|
74
75
|
};
|