@caseparts-org/caseblocks 0.0.118 → 0.0.119
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_1mnoo_1{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}._container_1mnoo_11{background-color:var(--surface-surface-primary);color:var(--text-text-primary);border-radius:var(--border-radius-sm);box-shadow:0 4px 6px #0000001a;width:min(800px,92vw);max-height:80vh;display:flex;flex-direction:column;overflow:hidden}@media (max-width:767px){._container_1mnoo_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._toolbar_1mnoo_30{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;background-color:var(--surface-surface-secondary);border-bottom:1px solid var(--border-border-secondary-btn);padding:var(--spacing-spacing-2xs);gap:var(--spacing-spacing-2xs);z-index:1}._toolbarPlain_1mnoo_44{background-color:transparent;border-bottom:none}._headerGroup_1mnoo_49{display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs);flex:1 1 0}._headerLeft_1mnoo_57{justify-content:flex-start}._headerRight_1mnoo_61{justify-content:flex-end}._closeButton_1mnoo_65{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;padding:var(--spacing-spacing-4xs);cursor:pointer;display:flex;align-items:center;justify-content:center;color:inherit;padding:0}._content_1mnoo_78{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_1mnoo_78{padding:var(--spacing-spacing-2xs)}}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export type ModalHeaderSize = "sm" | "md" | "lg";
|
|
3
|
-
export type
|
|
3
|
+
export type ModalTextVariant = "display" | "body";
|
|
4
|
+
export type ModalToolbarVariant = "standard" | "plain";
|
|
4
5
|
export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
6
|
isOpen: boolean;
|
|
6
|
-
caption?: string;
|
|
7
7
|
onClose: () => void;
|
|
8
8
|
closeOnOverlayClick?: boolean;
|
|
9
|
-
contentWrapperClassName?: string;
|
|
10
|
-
headerSize?: ModalHeaderSize;
|
|
11
|
-
headerVariant?: ModalHeaderVariant;
|
|
12
9
|
}
|
|
13
|
-
|
|
10
|
+
type ModalCompound = React.FC<ModalProps> & {
|
|
11
|
+
Toolbar: React.FC<ModalToolbarProps>;
|
|
12
|
+
Header: React.FC<ModalHeaderProps>;
|
|
13
|
+
CloseButton: React.FC<ModalCloseButtonProps>;
|
|
14
|
+
Content: React.FC<ModalContentProps>;
|
|
15
|
+
};
|
|
16
|
+
export interface ModalToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
variant?: ModalToolbarVariant;
|
|
18
|
+
}
|
|
19
|
+
export interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
align?: "left" | "right";
|
|
21
|
+
size?: ModalHeaderSize;
|
|
22
|
+
variant?: ModalTextVariant;
|
|
23
|
+
}
|
|
24
|
+
export interface ModalCloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
25
|
+
size?: ModalHeaderSize;
|
|
26
|
+
}
|
|
27
|
+
export type ModalContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
export declare const Modal: ModalCompound;
|
|
29
|
+
export {};
|
|
@@ -1,75 +1,67 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { Text as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import '../../assets/Modal.css';const
|
|
6
|
-
overlay:
|
|
7
|
-
container:
|
|
8
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { c as a } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { Text as _ } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Icon as u } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import '../../assets/Modal.css';const h = "_overlay_1mnoo_1", f = "_container_1mnoo_11", p = "_toolbar_1mnoo_30", b = "_toolbarPlain_1mnoo_44", g = "_headerGroup_1mnoo_49", v = "_headerLeft_1mnoo_57", y = "_headerRight_1mnoo_61", T = "_closeButton_1mnoo_65", x = "_content_1mnoo_78", n = {
|
|
6
|
+
overlay: h,
|
|
7
|
+
container: f,
|
|
8
|
+
toolbar: p,
|
|
9
|
+
toolbarPlain: b,
|
|
10
|
+
headerGroup: g,
|
|
11
|
+
headerLeft: v,
|
|
12
|
+
headerRight: y,
|
|
9
13
|
closeButton: T,
|
|
10
|
-
content:
|
|
11
|
-
|
|
12
|
-
}, B = {
|
|
14
|
+
content: x
|
|
15
|
+
}, C = {
|
|
13
16
|
sm: "sm",
|
|
14
17
|
md: "md",
|
|
15
18
|
lg: "lg"
|
|
16
|
-
},
|
|
19
|
+
}, z = {
|
|
17
20
|
sm: "sm",
|
|
18
21
|
md: "md",
|
|
19
22
|
lg: "md"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"aria-label": "Close",
|
|
63
|
-
onClick: l,
|
|
64
|
-
children: /* @__PURE__ */ a(y, { iconKey: "fa-regular fa-xmark", size: C[n] })
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
),
|
|
70
|
-
/* @__PURE__ */ a("div", { className: t(e.content, u), children: _ })
|
|
71
|
-
] }) });
|
|
72
|
-
}
|
|
23
|
+
}, c = ({
|
|
24
|
+
isOpen: o,
|
|
25
|
+
onClose: e,
|
|
26
|
+
closeOnOverlayClick: t = !0,
|
|
27
|
+
className: l,
|
|
28
|
+
children: s,
|
|
29
|
+
...i
|
|
30
|
+
}) => {
|
|
31
|
+
if (!o) return null;
|
|
32
|
+
const d = (m) => {
|
|
33
|
+
t && m.target === m.currentTarget && e();
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ r("div", { className: a(n.overlay), onClick: d, children: /* @__PURE__ */ r("div", { className: a(n.container, l), role: "dialog", "aria-modal": "true", ...i, children: s }) });
|
|
36
|
+
}, B = ({ variant: o = "standard", className: e, children: t, ...l }) => /* @__PURE__ */ r(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: a(n.toolbar, o === "plain" && n.toolbarPlain, e),
|
|
40
|
+
...l,
|
|
41
|
+
children: t
|
|
42
|
+
}
|
|
43
|
+
), N = ({
|
|
44
|
+
align: o = "left",
|
|
45
|
+
size: e = "md",
|
|
46
|
+
variant: t = "display",
|
|
47
|
+
className: l,
|
|
48
|
+
children: s,
|
|
49
|
+
...i
|
|
50
|
+
}) => {
|
|
51
|
+
const d = typeof s == "string";
|
|
52
|
+
return /* @__PURE__ */ r(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: a(n.headerGroup, o === "left" ? n.headerLeft : n.headerRight, l),
|
|
56
|
+
...i,
|
|
57
|
+
children: d ? /* @__PURE__ */ r(_, { as: "div", size: C[e], variant: t, children: s }) : s
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}, G = ({ size: o = "md", className: e, ...t }) => /* @__PURE__ */ r("button", { type: "button", className: a(n.closeButton, e), "aria-label": "Close", ...t, children: /* @__PURE__ */ r(u, { iconKey: "fa-regular fa-xmark", size: z[o] }) }), L = ({ className: o, children: e, ...t }) => /* @__PURE__ */ r("div", { className: a(n.content, o), ...t, children: e });
|
|
61
|
+
c.Toolbar = B;
|
|
62
|
+
c.Header = N;
|
|
63
|
+
c.CloseButton = G;
|
|
64
|
+
c.Content = L;
|
|
73
65
|
export {
|
|
74
|
-
|
|
66
|
+
c as Modal
|
|
75
67
|
};
|
|
@@ -1,110 +1,81 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Modal as
|
|
4
|
-
import { Text as
|
|
5
|
-
import { Button as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { Modal as l } from "./Modal.js";
|
|
4
|
+
import { Text as r } from "../../atoms/Text/Text.js";
|
|
5
|
+
import { Button as s } from "../../atoms/Button/Button.js";
|
|
6
|
+
const v = {
|
|
7
7
|
title: "Case Parts/Molecules/Modal",
|
|
8
|
-
component:
|
|
8
|
+
component: l,
|
|
9
9
|
argTypes: {
|
|
10
|
-
isOpen: {
|
|
11
|
-
|
|
12
|
-
description: "Controls visibility of the modal"
|
|
13
|
-
},
|
|
14
|
-
caption: {
|
|
15
|
-
control: { type: "text" },
|
|
16
|
-
description: "Caption text displayed in the header"
|
|
17
|
-
},
|
|
18
|
-
closeOnOverlayClick: {
|
|
19
|
-
control: { type: "boolean" },
|
|
20
|
-
description: "Close when clicking on overlay"
|
|
21
|
-
},
|
|
22
|
-
headerSize: {
|
|
23
|
-
control: { type: "radio" },
|
|
24
|
-
options: ["sm", "md", "lg"],
|
|
25
|
-
description: "Header size controlling caption and X icon"
|
|
26
|
-
},
|
|
27
|
-
headerVariant: {
|
|
28
|
-
control: { type: "radio" },
|
|
29
|
-
options: ["default", "plain"],
|
|
30
|
-
description: "Header variant: styled (default) or plain"
|
|
31
|
-
}
|
|
10
|
+
isOpen: { control: { type: "boolean" }, description: "Controls visibility of the modal" },
|
|
11
|
+
closeOnOverlayClick: { control: { type: "boolean" }, description: "Close when clicking on overlay" }
|
|
32
12
|
},
|
|
33
|
-
args: {
|
|
34
|
-
isOpen: !0,
|
|
35
|
-
caption: "Sample Modal",
|
|
36
|
-
closeOnOverlayClick: !0,
|
|
37
|
-
headerSize: "md",
|
|
38
|
-
headerVariant: "default"
|
|
39
|
-
}
|
|
13
|
+
args: { isOpen: !0, closeOnOverlayClick: !0 }
|
|
40
14
|
};
|
|
41
|
-
function
|
|
42
|
-
const [
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */ e(
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/* @__PURE__ */ e(n, { as: "p", size: "md", children: "This is a reusable modal with a non-scrollable header. Click the overlay or the X to close." }),
|
|
56
|
-
/* @__PURE__ */ e("div", { style: { height: 600 }, children: /* @__PURE__ */ e(n, { as: "p", size: "sm", children: "Scrollable content spacer..." }) })
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
)
|
|
15
|
+
function C(i) {
|
|
16
|
+
const [a, o] = t(!!i.isOpen);
|
|
17
|
+
return /* @__PURE__ */ n("div", { style: { padding: 24 }, children: [
|
|
18
|
+
/* @__PURE__ */ e(s, { variant: "primary", size: "md", onClick: () => o(!0), children: "Open Modal" }),
|
|
19
|
+
/* @__PURE__ */ n(l, { isOpen: a, onClose: () => o(!1), closeOnOverlayClick: i.closeOnOverlayClick ?? !0, children: [
|
|
20
|
+
/* @__PURE__ */ n(l.Toolbar, { children: [
|
|
21
|
+
/* @__PURE__ */ e(l.Header, { align: "left", size: "lg", variant: "display", children: "Sample Modal" }),
|
|
22
|
+
/* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { onClick: () => o(!1) }) })
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ n(l.Content, { children: [
|
|
25
|
+
/* @__PURE__ */ e(r, { as: "p", size: "md", children: "This is a reusable modal with a non-scrollable toolbar. Click the overlay or the X to close." }),
|
|
26
|
+
/* @__PURE__ */ e("div", { style: { height: 600 }, children: /* @__PURE__ */ e(r, { as: "p", size: "sm", children: "Scrollable content spacer..." }) })
|
|
27
|
+
] })
|
|
28
|
+
] })
|
|
60
29
|
] });
|
|
61
30
|
}
|
|
62
|
-
const
|
|
63
|
-
render: (i) => /* @__PURE__ */ e(
|
|
31
|
+
const k = {
|
|
32
|
+
render: (i) => /* @__PURE__ */ e(C, { ...i })
|
|
64
33
|
};
|
|
65
|
-
function
|
|
66
|
-
const [i, o] =
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */ e(
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
34
|
+
function g() {
|
|
35
|
+
const [i, a] = t(!1), [o, d] = t(!1), [m, c] = t(!1), [p, h] = t(!1);
|
|
36
|
+
return /* @__PURE__ */ n("div", { style: { width: "200px", display: "grid", gap: 12 }, children: [
|
|
37
|
+
/* @__PURE__ */ e(s, { variant: "secondary", size: "sm", onClick: () => a(!0), children: "Small Header" }),
|
|
38
|
+
/* @__PURE__ */ n(l, { isOpen: i, onClose: () => a(!1), children: [
|
|
39
|
+
/* @__PURE__ */ n(l.Toolbar, { children: [
|
|
40
|
+
/* @__PURE__ */ e(l.Header, { align: "left", size: "sm", variant: "display", children: "Small Header" }),
|
|
41
|
+
/* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { size: "sm", onClick: () => a(!1) }) })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "sm", children: "Small header modal content." }) })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ e(s, { variant: "primary", size: "md", onClick: () => d(!0), children: "Medium Header" }),
|
|
46
|
+
/* @__PURE__ */ n(l, { isOpen: o, onClose: () => d(!1), children: [
|
|
47
|
+
/* @__PURE__ */ n(l.Toolbar, { children: [
|
|
48
|
+
/* @__PURE__ */ e(l.Header, { align: "left", size: "md", variant: "display", children: "Medium Header" }),
|
|
49
|
+
/* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { size: "md", onClick: () => d(!1) }) })
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "md", children: "Medium header modal content." }) })
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ e(s, { variant: "cta-primary", size: "lg", onClick: () => c(!0), children: "Large Header" }),
|
|
54
|
+
/* @__PURE__ */ n(l, { isOpen: m, onClose: () => c(!1), children: [
|
|
55
|
+
/* @__PURE__ */ n(l.Toolbar, { children: [
|
|
56
|
+
/* @__PURE__ */ e(l.Header, { align: "left", size: "lg", variant: "display", children: "Large Header" }),
|
|
57
|
+
/* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { size: "md", onClick: () => c(!1) }) })
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "lg", children: "Large header modal content." }) })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ e(s, { variant: "tertiary", size: "md", onClick: () => h(!0), children: "Custom Toolbar" }),
|
|
62
|
+
/* @__PURE__ */ n(l, { isOpen: p, onClose: () => h(!1), children: [
|
|
63
|
+
/* @__PURE__ */ n(l.Toolbar, { children: [
|
|
64
|
+
/* @__PURE__ */ e(l.Header, { align: "left", size: "md", variant: "display", children: "Custom Toolbar" }),
|
|
65
|
+
/* @__PURE__ */ n(l.Header, { align: "right", children: [
|
|
66
|
+
/* @__PURE__ */ e("button", { onClick: () => alert("Sent!"), children: "Send Email" }),
|
|
67
|
+
/* @__PURE__ */ e(l.CloseButton, { size: "md", onClick: () => h(!1) })
|
|
68
|
+
] })
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "md", children: "Modal with custom toolbar functions." }) })
|
|
71
|
+
] })
|
|
101
72
|
] });
|
|
102
73
|
}
|
|
103
|
-
const
|
|
104
|
-
render: () => /* @__PURE__ */ e(
|
|
74
|
+
const b = {
|
|
75
|
+
render: () => /* @__PURE__ */ e(g, {})
|
|
105
76
|
};
|
|
106
77
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
78
|
+
k as Basic,
|
|
79
|
+
b as Sizes,
|
|
80
|
+
v as default
|
|
110
81
|
};
|