@caseparts-org/caseblocks 0.0.293 → 0.0.294
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/Modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._overlay_1fxsx_1{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}._container_1fxsx_11{position:relative;display:flex;flex-direction:column;overflow:hidden;background-color:var(--surface-surface-primary);color:var(--text-text-primary);border-radius:var(--border-radius-lg);box-shadow:0 4px 6px #0000001a;width:min(var(--modal-width, 800px),92vw);max-height:80vh}@media (max-width:767px){._container_1fxsx_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._toolbar_1fxsx_31{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border-border-secondary-btn);padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default);gap:var(--spacing-spacing-2xs);z-index:1}@media (max-width:767px){._toolbar_1fxsx_31{padding:var(--spacing-spacing-2xs)}}._toolbarPlain_1fxsx_47{background-color:transparent;border-bottom:none}._headerGroup_1fxsx_52{display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs);flex:1 1 0}._headerLeft_1fxsx_60{justify-content:flex-start}._headerRight_1fxsx_64{justify-content:flex-end}._closeButton_1fxsx_68{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;border-radius:var(--radius-radius-md);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;transition:background-color .2s ease-in}._closeButton_1fxsx_68:hover{background-color:var(--color-neutrals-neutral-2)}._closeButtonTopRight_1fxsx_87{position:absolute;top:var(--spacing-spacing-2xs);right:var(--spacing-spacing-2xs);z-index:2;padding:var(--spacing-spacing-2xs)}._content_1fxsx_95{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_1fxsx_95{padding:var(--spacing-spacing-2xs)}}
|
|
@@ -24,6 +24,7 @@ export interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
24
24
|
}
|
|
25
25
|
export interface ModalCloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
26
26
|
size?: ModalHeaderSize;
|
|
27
|
+
position?: "top-right";
|
|
27
28
|
}
|
|
28
29
|
export type ModalContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
29
30
|
export declare const Modal: ModalCompound;
|
|
@@ -1,99 +1,109 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { r as
|
|
4
|
-
import { c as
|
|
2
|
+
import x from "react";
|
|
3
|
+
import { r as p } from "../../index-BkF-BQ3Q.js";
|
|
4
|
+
import { c as s } from "../../clsx-OuTLNxxd.js";
|
|
5
5
|
import { Text as g } from "../../atoms/Text/Text.js";
|
|
6
|
-
import { Icon as
|
|
7
|
-
import '../../assets/Modal.css';const
|
|
8
|
-
overlay:
|
|
9
|
-
container:
|
|
10
|
-
toolbar:
|
|
11
|
-
toolbarPlain:
|
|
12
|
-
headerGroup:
|
|
13
|
-
headerLeft:
|
|
14
|
-
headerRight:
|
|
15
|
-
closeButton:
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
import { Icon as b } from "../../atoms/Icon/Icon.js";
|
|
7
|
+
import '../../assets/Modal.css';const y = "_overlay_1fxsx_1", T = "_container_1fxsx_11", v = "_toolbar_1fxsx_31", B = "_toolbarPlain_1fxsx_47", R = "_headerGroup_1fxsx_52", z = "_headerLeft_1fxsx_60", M = "_headerRight_1fxsx_64", N = "_closeButton_1fxsx_68", w = "_closeButtonTopRight_1fxsx_87", P = "_content_1fxsx_95", e = {
|
|
8
|
+
overlay: y,
|
|
9
|
+
container: T,
|
|
10
|
+
toolbar: v,
|
|
11
|
+
toolbarPlain: B,
|
|
12
|
+
headerGroup: R,
|
|
13
|
+
headerLeft: z,
|
|
14
|
+
headerRight: M,
|
|
15
|
+
closeButton: N,
|
|
16
|
+
closeButtonTopRight: w,
|
|
17
|
+
content: P
|
|
18
|
+
}, C = {
|
|
18
19
|
sm: "sm",
|
|
19
20
|
md: "md",
|
|
20
21
|
lg: "lg"
|
|
21
|
-
},
|
|
22
|
+
}, D = {
|
|
22
23
|
sm: "xs",
|
|
23
24
|
md: "sm",
|
|
24
25
|
lg: "md"
|
|
25
|
-
},
|
|
26
|
-
isOpen:
|
|
27
|
-
onClose:
|
|
26
|
+
}, d = ({
|
|
27
|
+
isOpen: o,
|
|
28
|
+
onClose: r,
|
|
28
29
|
closeOnOverlayClick: t = !0,
|
|
29
|
-
width:
|
|
30
|
+
width: a,
|
|
30
31
|
className: l,
|
|
31
32
|
style: u,
|
|
32
|
-
children:
|
|
33
|
-
...
|
|
33
|
+
children: f,
|
|
34
|
+
...m
|
|
34
35
|
}) => {
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
const
|
|
38
|
-
t && (
|
|
36
|
+
const i = x.useRef(!1);
|
|
37
|
+
if (!o || typeof document > "u") return null;
|
|
38
|
+
const _ = (c) => {
|
|
39
|
+
t && (i.current = c.target === c.currentTarget);
|
|
39
40
|
}, h = (c) => {
|
|
40
41
|
if (!t) {
|
|
41
|
-
|
|
42
|
+
i.current = !1;
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
i.current && c.target === c.currentTarget && r(), i.current = !1;
|
|
45
46
|
};
|
|
46
|
-
return
|
|
47
|
+
return p.createPortal(
|
|
47
48
|
/* @__PURE__ */ n(
|
|
48
49
|
"div",
|
|
49
50
|
{
|
|
50
|
-
className:
|
|
51
|
-
onMouseDown:
|
|
51
|
+
className: s(e.overlay),
|
|
52
|
+
onMouseDown: _,
|
|
52
53
|
onMouseUp: h,
|
|
53
54
|
children: /* @__PURE__ */ n(
|
|
54
55
|
"div",
|
|
55
56
|
{
|
|
56
|
-
className:
|
|
57
|
+
className: s(e.container, l),
|
|
57
58
|
role: "dialog",
|
|
58
59
|
"aria-modal": "true",
|
|
59
|
-
style: { ...u, "--modal-width":
|
|
60
|
-
...
|
|
61
|
-
children:
|
|
60
|
+
style: { ...u, "--modal-width": a },
|
|
61
|
+
...m,
|
|
62
|
+
children: f
|
|
62
63
|
}
|
|
63
64
|
)
|
|
64
65
|
}
|
|
65
66
|
),
|
|
66
67
|
document.body
|
|
67
68
|
);
|
|
68
|
-
},
|
|
69
|
+
}, G = ({ variant: o = "standard", className: r, children: t, ...a }) => /* @__PURE__ */ n(
|
|
69
70
|
"div",
|
|
70
71
|
{
|
|
71
|
-
className:
|
|
72
|
-
...
|
|
72
|
+
className: s(e.toolbar, o === "plain" && e.toolbarPlain, r),
|
|
73
|
+
...a,
|
|
73
74
|
children: t
|
|
74
75
|
}
|
|
75
|
-
),
|
|
76
|
-
align:
|
|
77
|
-
size:
|
|
76
|
+
), L = ({
|
|
77
|
+
align: o = "left",
|
|
78
|
+
size: r = "md",
|
|
78
79
|
variant: t = "body",
|
|
79
|
-
className:
|
|
80
|
+
className: a,
|
|
80
81
|
children: l,
|
|
81
82
|
...u
|
|
82
83
|
}) => {
|
|
83
|
-
const
|
|
84
|
+
const f = typeof l == "string";
|
|
84
85
|
return /* @__PURE__ */ n(
|
|
85
86
|
"div",
|
|
86
87
|
{
|
|
87
|
-
className:
|
|
88
|
+
className: s(e.headerGroup, o === "left" ? e.headerLeft : e.headerRight, a),
|
|
88
89
|
...u,
|
|
89
|
-
children:
|
|
90
|
+
children: f ? /* @__PURE__ */ n(g, { as: "div", size: C[r], variant: t, weight: "semibold", children: l }) : l
|
|
90
91
|
}
|
|
91
92
|
);
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
}, S = ({ size: o = "md", position: r, className: t, ...a }) => /* @__PURE__ */ n(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
type: "button",
|
|
97
|
+
className: s(e.closeButton, r === "top-right" && e.closeButtonTopRight, t),
|
|
98
|
+
"aria-label": "Close",
|
|
99
|
+
...a,
|
|
100
|
+
children: /* @__PURE__ */ n(b, { iconKey: "fa-regular fa-xmark", size: D[o] })
|
|
101
|
+
}
|
|
102
|
+
), I = ({ className: o, children: r, ...t }) => /* @__PURE__ */ n("div", { className: s(e.content, o), ...t, children: r });
|
|
103
|
+
d.Toolbar = G;
|
|
104
|
+
d.Header = L;
|
|
105
|
+
d.CloseButton = S;
|
|
106
|
+
d.Content = I;
|
|
97
107
|
export {
|
|
98
|
-
|
|
108
|
+
d as Modal
|
|
99
109
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { useState as r } from "react";
|
|
3
3
|
import { Modal as n } from "./Modal.js";
|
|
4
4
|
import { Text as o } from "../../atoms/Text/Text.js";
|
|
5
|
-
import { Button as
|
|
5
|
+
import { Button as t } from "../../atoms/Button/Button.js";
|
|
6
6
|
const O = {
|
|
7
7
|
title: "Case Parts/Molecules/Modal",
|
|
8
8
|
component: n,
|
|
@@ -13,54 +13,86 @@ const O = {
|
|
|
13
13
|
},
|
|
14
14
|
args: { isOpen: !0, closeOnOverlayClick: !0 }
|
|
15
15
|
};
|
|
16
|
-
function
|
|
17
|
-
const [
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */ e(
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
16
|
+
function u() {
|
|
17
|
+
const [a, l] = r(!0);
|
|
18
|
+
return /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
|
|
19
|
+
/* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => l(!0), children: "Open Modal" }),
|
|
20
|
+
/* @__PURE__ */ i(n, { isOpen: a, onClose: () => l(!1), children: [
|
|
21
|
+
/* @__PURE__ */ i(n.Toolbar, { variant: "plain", children: [
|
|
22
22
|
/* @__PURE__ */ e(n.Header, { align: "left", size: "lg", variant: "display", children: "Plain Toolbar" }),
|
|
23
|
-
/* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { onClick: () =>
|
|
23
|
+
/* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { onClick: () => l(!1) }) })
|
|
24
24
|
] }),
|
|
25
25
|
/* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "md", children: "This modal uses a toolbar without a background or bottom border." }) })
|
|
26
26
|
] })
|
|
27
27
|
] });
|
|
28
28
|
}
|
|
29
29
|
const H = {
|
|
30
|
-
render: () => /* @__PURE__ */ e(
|
|
30
|
+
render: () => /* @__PURE__ */ e(u, {})
|
|
31
31
|
};
|
|
32
|
-
function
|
|
33
|
-
const [
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */ e(
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
32
|
+
function g() {
|
|
33
|
+
const [a, l] = r(!0);
|
|
34
|
+
return /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
|
|
35
|
+
/* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => l(!0), children: "Open Modal" }),
|
|
36
|
+
/* @__PURE__ */ i(n, { isOpen: a, onClose: () => l(!1), "aria-label": "Headerless modal", children: [
|
|
37
|
+
/* @__PURE__ */ e(n.CloseButton, { position: "top-right", onClick: () => l(!1) }),
|
|
38
|
+
/* @__PURE__ */ e(n.Content, { style: { padding: 0 }, children: /* @__PURE__ */ i(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
style: {
|
|
42
|
+
display: "grid",
|
|
43
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 300px), 1fr))"
|
|
44
|
+
},
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ i("section", { style: { padding: "3rem" }, children: [
|
|
47
|
+
/* @__PURE__ */ e(o, { as: "h2", size: "lg", weight: "semibold", children: "First section" }),
|
|
48
|
+
/* @__PURE__ */ e(o, { as: "p", size: "md", children: "Content can extend to the top of the modal without a toolbar." })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ i("section", { style: { padding: "3rem", background: "var(--surface-surface-secondary)" }, children: [
|
|
51
|
+
/* @__PURE__ */ e(o, { as: "h2", size: "lg", weight: "semibold", children: "Second section" }),
|
|
52
|
+
/* @__PURE__ */ e(o, { as: "p", size: "md", children: "The close button stays in the top-right corner while this content scrolls." }),
|
|
53
|
+
/* @__PURE__ */ e(o, { as: "p", size: "md", children: "Leave enough space around the button so it does not overlap your content." })
|
|
54
|
+
] })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
) })
|
|
58
|
+
] })
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
const k = {
|
|
62
|
+
render: () => /* @__PURE__ */ e(g, {})
|
|
63
|
+
};
|
|
64
|
+
function C() {
|
|
65
|
+
const [a, l] = r(!1), [h, s] = r(!1), [m, d] = r(!1), [p, c] = r(!1);
|
|
66
|
+
return /* @__PURE__ */ i("div", { style: { width: "200px", display: "grid", gap: 12 }, children: [
|
|
67
|
+
/* @__PURE__ */ e(t, { variant: "secondary", size: "sm", onClick: () => l(!0), children: "Small Header" }),
|
|
68
|
+
/* @__PURE__ */ i(n, { isOpen: a, onClose: () => l(!1), children: [
|
|
69
|
+
/* @__PURE__ */ i(n.Toolbar, { children: [
|
|
38
70
|
/* @__PURE__ */ e(n.Header, { align: "left", size: "sm", children: "Small Header" }),
|
|
39
|
-
/* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "sm", onClick: () =>
|
|
71
|
+
/* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "sm", onClick: () => l(!1) }) })
|
|
40
72
|
] }),
|
|
41
73
|
/* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "sm", children: "Small header modal content." }) })
|
|
42
74
|
] }),
|
|
43
|
-
/* @__PURE__ */ e(
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => s(!0), children: "Medium Header" }),
|
|
76
|
+
/* @__PURE__ */ i(n, { isOpen: h, onClose: () => s(!1), children: [
|
|
77
|
+
/* @__PURE__ */ i(n.Toolbar, { children: [
|
|
46
78
|
/* @__PURE__ */ e(n.Header, { align: "left", size: "md", children: "Medium Header" }),
|
|
47
79
|
/* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "md", onClick: () => s(!1) }) })
|
|
48
80
|
] }),
|
|
49
81
|
/* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "md", children: "Medium header modal content." }) })
|
|
50
82
|
] }),
|
|
51
|
-
/* @__PURE__ */ e(
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ e(t, { variant: "cta-primary", size: "lg", onClick: () => d(!0), children: "Large Header" }),
|
|
84
|
+
/* @__PURE__ */ i(n, { isOpen: m, onClose: () => d(!1), children: [
|
|
85
|
+
/* @__PURE__ */ i(n.Toolbar, { children: [
|
|
54
86
|
/* @__PURE__ */ e(n.Header, { align: "left", size: "lg", children: "Large Header" }),
|
|
55
87
|
/* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "md", onClick: () => d(!1) }) })
|
|
56
88
|
] }),
|
|
57
89
|
/* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "lg", children: "Large header modal content." }) })
|
|
58
90
|
] }),
|
|
59
|
-
/* @__PURE__ */ e(
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ e(t, { variant: "tertiary", size: "md", onClick: () => c(!0), children: "Custom Toolbar" }),
|
|
92
|
+
/* @__PURE__ */ i(n, { isOpen: p, onClose: () => c(!1), children: [
|
|
93
|
+
/* @__PURE__ */ i(n.Toolbar, { children: [
|
|
62
94
|
/* @__PURE__ */ e(n.Header, { align: "left", size: "md", variant: "display", children: "Custom Toolbar" }),
|
|
63
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ i(n.Header, { align: "right", children: [
|
|
64
96
|
/* @__PURE__ */ e("button", { onClick: () => alert("Sent!"), children: "Send Email" }),
|
|
65
97
|
/* @__PURE__ */ e(n.CloseButton, { size: "md", onClick: () => c(!1) })
|
|
66
98
|
] })
|
|
@@ -69,11 +101,12 @@ function u() {
|
|
|
69
101
|
] })
|
|
70
102
|
] });
|
|
71
103
|
}
|
|
72
|
-
const
|
|
73
|
-
render: () => /* @__PURE__ */ e(
|
|
104
|
+
const T = {
|
|
105
|
+
render: () => /* @__PURE__ */ e(C, {})
|
|
74
106
|
};
|
|
75
107
|
export {
|
|
108
|
+
k as Headerless,
|
|
76
109
|
H as PlainToolbar,
|
|
77
|
-
|
|
110
|
+
T as Sizes,
|
|
78
111
|
O as default
|
|
79
112
|
};
|