@caseparts-org/caseblocks 0.0.118 → 0.0.120
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 +1 -1
- package/dist/main-client.d.ts +2 -0
- package/dist/main-client.js +26 -24
- package/dist/molecules/Account/Account.js +16 -19
- package/dist/molecules/ImageViewer/ImageViewer.d.ts +8 -0
- package/dist/molecules/ImageViewer/ImageViewer.js +123 -0
- package/dist/molecules/ImageViewer/ImageViewer.stories.d.ts +6 -0
- package/dist/molecules/ImageViewer/ImageViewer.stories.js +30 -0
- package/dist/molecules/Modal/Modal.d.ts +22 -6
- package/dist/molecules/Modal/Modal.js +58 -66
- package/dist/molecules/Modal/Modal.stories.js +69 -98
- package/package.json +1 -1
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)}}
|
package/dist/main-client.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export { AddToCart } from './molecules/AddToCart/AddToCart';
|
|
|
24
24
|
export type { CategoryWithChildren as MainCategory, Category } from './molecules/CategoryNav/CategoryNav';
|
|
25
25
|
export { Modal } from './molecules/Modal/Modal';
|
|
26
26
|
export type { ModalProps } from './molecules/Modal/Modal';
|
|
27
|
+
export { ImageViewer } from './molecules/ImageViewer/ImageViewer';
|
|
28
|
+
export type { ImageViewerProps } from './molecules/ImageViewer/ImageViewer';
|
|
27
29
|
export { MainNav } from './organisms/MainNav/MainNav';
|
|
28
30
|
export type { MainNavProps } from './organisms/MainNav/MainNav';
|
|
29
31
|
export { ChipSelector } from './organisms/ChipSelector/ChipSelector';
|
package/dist/main-client.js
CHANGED
|
@@ -6,17 +6,17 @@ import { Icon as l } from "./atoms/Icon/Icon.js";
|
|
|
6
6
|
import { Root as d } from "./atoms/Root/Root.js";
|
|
7
7
|
import { Separator as C } from "./atoms/Separator/Separator.js";
|
|
8
8
|
import { Text as k } from "./atoms/Text/Text.js";
|
|
9
|
-
import { Input as
|
|
9
|
+
import { Input as S } from "./atoms/Input/Input.js";
|
|
10
10
|
import { Link as v } from "./atoms/Link/Link.js";
|
|
11
11
|
import { linkClassName as L } from "./atoms/Link/linkClassName.js";
|
|
12
12
|
import { configureLink as h, routerOverride as s } from "./atoms/Link/configureLink.js";
|
|
13
13
|
import { LinkButton as F } from "./atoms/LinkButton/LinkButton.js";
|
|
14
14
|
import { configureImage as N } from "./atoms/Image/configureImage.js";
|
|
15
|
-
import { Logo as
|
|
16
|
-
import { SearchBox as
|
|
17
|
-
import { QuantityInput as
|
|
18
|
-
import { Pricing as
|
|
19
|
-
import { Availability as
|
|
15
|
+
import { Logo as w } from "./molecules/Logo/Logo.js";
|
|
16
|
+
import { SearchBox as H } from "./molecules/SearchBox/SearchBox.js";
|
|
17
|
+
import { QuantityInput as z } from "./molecules/QuantityInput/QuantityInput.js";
|
|
18
|
+
import { Pricing as O } from "./molecules/Pricing/Pricing.js";
|
|
19
|
+
import { Availability as R } from "./molecules/Availability/Availability.js";
|
|
20
20
|
import { Avatar as q } from "./molecules/Avatar/Avatar.js";
|
|
21
21
|
import { BannerCard as E } from "./molecules/BannerCard/BannerCard.js";
|
|
22
22
|
import { CardLink as K } from "./molecules/CardLink/CardLink.js";
|
|
@@ -32,47 +32,49 @@ import { ToggleView as io } from "./molecules/ToggleView/ToggleView.js";
|
|
|
32
32
|
import { CartSlideInPanel as uo } from "./molecules/Cart/CartSlideInPanel.js";
|
|
33
33
|
import { StatefulButton as Co } from "./molecules/StatefulButton/StatefulButton.js";
|
|
34
34
|
import { AnimatedCheckMark as ko } from "./molecules/StatefulButton/AnimatedCheckmark.js";
|
|
35
|
-
import { AddToCart as
|
|
35
|
+
import { AddToCart as So } from "./molecules/AddToCart/AddToCart.js";
|
|
36
36
|
import { Modal as vo } from "./molecules/Modal/Modal.js";
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
37
|
+
import { ImageViewer as Lo } from "./molecules/ImageViewer/ImageViewer.js";
|
|
38
|
+
import { MainNav as ho } from "./organisms/MainNav/MainNav.js";
|
|
39
|
+
import { ChipSelector as To } from "./organisms/ChipSelector/ChipSelector.js";
|
|
40
|
+
import { Product as Mo } from "./organisms/Product/Product.js";
|
|
41
|
+
import { Carousel as bo } from "./organisms/Carousel/Carousel.js";
|
|
42
|
+
import { Footer as yo } from "./organisms/Footer/Footer.js";
|
|
42
43
|
export {
|
|
43
44
|
fo as Account,
|
|
44
|
-
|
|
45
|
+
So as AddToCart,
|
|
45
46
|
ko as AnimatedCheckMark,
|
|
46
|
-
|
|
47
|
+
R as Availability,
|
|
47
48
|
q as Avatar,
|
|
48
49
|
E as BannerCard,
|
|
49
50
|
W as Breadcrumbs,
|
|
50
51
|
e as Button,
|
|
51
52
|
K as CardLink,
|
|
52
|
-
|
|
53
|
+
bo as Carousel,
|
|
53
54
|
uo as CartSlideInPanel,
|
|
54
55
|
ao as Chip,
|
|
55
|
-
|
|
56
|
+
To as ChipSelector,
|
|
56
57
|
f as Column,
|
|
57
58
|
p as Flex,
|
|
58
|
-
|
|
59
|
+
yo as Footer,
|
|
59
60
|
x as Grid,
|
|
60
61
|
n as Head,
|
|
61
62
|
_ as HorizontalScroll,
|
|
62
63
|
l as Icon,
|
|
63
|
-
|
|
64
|
+
Lo as ImageViewer,
|
|
65
|
+
S as Input,
|
|
64
66
|
v as Link,
|
|
65
67
|
F as LinkButton,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
w as Logo,
|
|
69
|
+
ho as MainNav,
|
|
68
70
|
vo as Modal,
|
|
69
71
|
Y as NotFound,
|
|
70
72
|
po as Popover,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
O as Pricing,
|
|
74
|
+
Mo as Product,
|
|
75
|
+
z as QuantityInput,
|
|
74
76
|
d as Root,
|
|
75
|
-
|
|
77
|
+
H as SearchBox,
|
|
76
78
|
C as Separator,
|
|
77
79
|
oo as SlideInPanel,
|
|
78
80
|
Co as StatefulButton,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { getHideAtStyles as m } from "../../atoms/HideAt.js";
|
|
3
3
|
import { Icon as f } from "../../atoms/Icon/Icon.js";
|
|
4
4
|
import { Text as c } from "../../atoms/Text/Text.js";
|
|
@@ -16,7 +16,7 @@ function y(i) {
|
|
|
16
16
|
return i.account !== void 0;
|
|
17
17
|
}
|
|
18
18
|
function j(i) {
|
|
19
|
-
return i.isAccountLoading ? /* @__PURE__ */
|
|
19
|
+
return i.isAccountLoading ? /* @__PURE__ */ n("div", { className: o.placeholder }) : y(i) ? /* @__PURE__ */ n(_, { ...i }) : /* @__PURE__ */ n(N, { ...i });
|
|
20
20
|
}
|
|
21
21
|
function _(i) {
|
|
22
22
|
const {
|
|
@@ -27,17 +27,17 @@ function _(i) {
|
|
|
27
27
|
isAccountLoading: h,
|
|
28
28
|
...l
|
|
29
29
|
} = i;
|
|
30
|
-
return a ? /* @__PURE__ */
|
|
30
|
+
return a ? /* @__PURE__ */ n(
|
|
31
31
|
A,
|
|
32
32
|
{
|
|
33
33
|
position: "bottom right",
|
|
34
|
-
trigger: /* @__PURE__ */
|
|
34
|
+
trigger: /* @__PURE__ */ t(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: g(o.loggedIn, m(s), r),
|
|
38
38
|
...l,
|
|
39
39
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ t(
|
|
41
41
|
d,
|
|
42
42
|
{
|
|
43
43
|
flexDirection: "column",
|
|
@@ -45,30 +45,30 @@ function _(i) {
|
|
|
45
45
|
hideAt: ["sm", "md"],
|
|
46
46
|
className: o.customer,
|
|
47
47
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ t(c, { size: "xxs", children: [
|
|
49
49
|
"Acct: ",
|
|
50
50
|
e == null ? void 0 : e.number
|
|
51
51
|
] }),
|
|
52
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ t(c, { size: "sm", variant: "display", colorToken: "links", children: [
|
|
53
53
|
"Hello ",
|
|
54
54
|
e == null ? void 0 : e.name
|
|
55
55
|
] })
|
|
56
56
|
]
|
|
57
57
|
}
|
|
58
58
|
),
|
|
59
|
-
e.avatar ?? (e.initials ? /* @__PURE__ */
|
|
59
|
+
e.avatar ?? (e.initials ? /* @__PURE__ */ n(u, { initials: e.initials }) : null)
|
|
60
60
|
]
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
63
|
children: a
|
|
64
64
|
}
|
|
65
|
-
) : /* @__PURE__ */
|
|
65
|
+
) : /* @__PURE__ */ t(
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
68
68
|
className: g(o.loggedIn, m(s), r),
|
|
69
69
|
...l,
|
|
70
70
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ t(
|
|
72
72
|
d,
|
|
73
73
|
{
|
|
74
74
|
flexDirection: "column",
|
|
@@ -76,18 +76,15 @@ function _(i) {
|
|
|
76
76
|
hideAt: ["sm", "md"],
|
|
77
77
|
className: o.customer,
|
|
78
78
|
children: [
|
|
79
|
-
/* @__PURE__ */ n(c, { size: "xxs", children:
|
|
80
|
-
|
|
81
|
-
e == null ? void 0 : e.number
|
|
82
|
-
] }),
|
|
83
|
-
/* @__PURE__ */ n(c, { size: "sm", variant: "display", colorToken: "links", children: [
|
|
79
|
+
/* @__PURE__ */ n(c, { size: "xxs", children: e == null ? void 0 : e.number }),
|
|
80
|
+
/* @__PURE__ */ t(c, { size: "sm", variant: "display", colorToken: "links", children: [
|
|
84
81
|
"Hello ",
|
|
85
82
|
e == null ? void 0 : e.name
|
|
86
83
|
] })
|
|
87
84
|
]
|
|
88
85
|
}
|
|
89
86
|
),
|
|
90
|
-
e.avatar ?? (e.initials ? /* @__PURE__ */
|
|
87
|
+
e.avatar ?? (e.initials ? /* @__PURE__ */ n(u, { initials: e.initials }) : null)
|
|
91
88
|
]
|
|
92
89
|
}
|
|
93
90
|
);
|
|
@@ -101,7 +98,7 @@ function N(i) {
|
|
|
101
98
|
isAccountLoading: h,
|
|
102
99
|
...l
|
|
103
100
|
} = i;
|
|
104
|
-
return /* @__PURE__ */
|
|
101
|
+
return /* @__PURE__ */ t(
|
|
105
102
|
d,
|
|
106
103
|
{
|
|
107
104
|
flexDirection: "row",
|
|
@@ -113,7 +110,7 @@ function N(i) {
|
|
|
113
110
|
r
|
|
114
111
|
),
|
|
115
112
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ n(
|
|
117
114
|
p,
|
|
118
115
|
{
|
|
119
116
|
onClick: e,
|
|
@@ -123,7 +120,7 @@ function N(i) {
|
|
|
123
120
|
children: "Sign In / Register"
|
|
124
121
|
}
|
|
125
122
|
),
|
|
126
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ n(f, { iconKey: "fa-kit fa-user-anon", size: "lg", hideAt: "lg" })
|
|
127
124
|
]
|
|
128
125
|
}
|
|
129
126
|
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ImageViewerProps {
|
|
2
|
+
imgSrc: string;
|
|
3
|
+
zoomFactor?: number;
|
|
4
|
+
minZoomScale?: number;
|
|
5
|
+
maxZoomScale?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function ImageViewer({ imgSrc, zoomFactor, // Default 10% per wheel notch
|
|
8
|
+
minZoomScale, maxZoomScale, }: ImageViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as U } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as o, useEffect as Q } from "react";
|
|
3
|
+
function Z({
|
|
4
|
+
imgSrc: j,
|
|
5
|
+
zoomFactor: O = 1.1,
|
|
6
|
+
// Default 10% per wheel notch
|
|
7
|
+
minZoomScale: x = 1,
|
|
8
|
+
maxZoomScale: z = 5
|
|
9
|
+
// 500%
|
|
10
|
+
}) {
|
|
11
|
+
const D = o(null), a = o(null), d = o(null), h = o(1), g = o(0), p = o(0), P = o(null), y = o(!1), A = o(0), b = o(0), W = o(0), B = o(0), R = o(!1), u = o(/* @__PURE__ */ new Map()), T = o(0), q = o(1), L = o({ x: 0, y: 0 });
|
|
12
|
+
Q(() => {
|
|
13
|
+
const t = a.current, n = D.current;
|
|
14
|
+
if (!t || !n) return;
|
|
15
|
+
const s = () => {
|
|
16
|
+
const e = n.getBoundingClientRect();
|
|
17
|
+
t.height = e.height, t.width = e.width;
|
|
18
|
+
const c = t.getContext("2d");
|
|
19
|
+
c && (c.setTransform(1, 0, 0, 1, 0, 0), d.current = c, k());
|
|
20
|
+
};
|
|
21
|
+
s();
|
|
22
|
+
const r = new ResizeObserver(s);
|
|
23
|
+
return r.observe(n), s(), () => r.disconnect();
|
|
24
|
+
}, []);
|
|
25
|
+
const k = () => {
|
|
26
|
+
const t = a.current;
|
|
27
|
+
if (!d.current || !t) return;
|
|
28
|
+
d.current.clearRect(0, 0, t.width, t.height);
|
|
29
|
+
const n = new Image();
|
|
30
|
+
n.crossOrigin = "anonymous", n.src = j, n.onload = () => {
|
|
31
|
+
P.current = n, Y();
|
|
32
|
+
};
|
|
33
|
+
}, Y = () => {
|
|
34
|
+
const t = a.current, n = P.current;
|
|
35
|
+
if (!d.current || !t || !n) return;
|
|
36
|
+
const s = n.width / 2, r = n.height / 2, e = t.width / 2, c = t.height / 2, i = e - s, f = c - r;
|
|
37
|
+
h.current = 1, g.current = i, p.current = f, v();
|
|
38
|
+
}, E = (t) => {
|
|
39
|
+
const n = a.current;
|
|
40
|
+
if (!d.current || !n) return;
|
|
41
|
+
const s = t.deltaY < 0 ? O : 1 / O, r = h.current;
|
|
42
|
+
let e = r * s;
|
|
43
|
+
if (e = Math.max(x, Math.min(z, e)), h.current = e, e === x) {
|
|
44
|
+
Y();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const { x: c, y: i } = X(t, n), f = (c - g.current) / r, w = (i - p.current) / r, m = c - f * e, l = i - w * e;
|
|
48
|
+
g.current = m, p.current = l, v();
|
|
49
|
+
}, H = (t) => {
|
|
50
|
+
var r;
|
|
51
|
+
const n = a.current;
|
|
52
|
+
if (!d.current || !n) return;
|
|
53
|
+
(r = a.current) == null || r.setPointerCapture(t.pointerId);
|
|
54
|
+
const s = X(t, n);
|
|
55
|
+
if (u.current.set(t.pointerId, s), u.current.size === 2) {
|
|
56
|
+
R.current = !0, y.current = !1;
|
|
57
|
+
const [e, c] = Array.from(u.current.values()), i = e.x - c.x, f = e.y - c.y, w = Math.sqrt(i * i + f * f);
|
|
58
|
+
T.current = w, q.current = h.current;
|
|
59
|
+
const m = (e.x + c.x) / 2, l = (e.y + c.y) / 2, M = (m - g.current) / h.current, C = (l - p.current) / h.current;
|
|
60
|
+
L.current = { x: M, y: C }, R.current = !0;
|
|
61
|
+
} else if (u.current.size === 1) {
|
|
62
|
+
const [e] = Array.from(u.current.values());
|
|
63
|
+
A.current = e.x, b.current = e.y, W.current = g.current, B.current = p.current, y.current = !0;
|
|
64
|
+
}
|
|
65
|
+
}, S = (t) => {
|
|
66
|
+
const n = a.current;
|
|
67
|
+
if (!d.current || !n) return;
|
|
68
|
+
const s = X(t, n);
|
|
69
|
+
if (u.current.has(t.pointerId)) {
|
|
70
|
+
if (u.current.set(t.pointerId, s), R.current && u.current.size === 2) {
|
|
71
|
+
const [r, e] = Array.from(u.current.values()), c = r.x - e.x, i = r.y - e.y, f = Math.sqrt(c * c + i * i), w = T.current;
|
|
72
|
+
if (w === 0) return;
|
|
73
|
+
const m = f / w;
|
|
74
|
+
let l = q.current * m;
|
|
75
|
+
if (l = Math.max(x, Math.min(z, l)), l === x) {
|
|
76
|
+
Y();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const M = (r.x + e.x) / 2, C = (r.y + e.y) / 2, { x: G, y: J } = L.current, K = M - G * l, N = C - J * l;
|
|
80
|
+
h.current = l, g.current = K, p.current = N, v();
|
|
81
|
+
} else if (y.current && u.current.size === 1) {
|
|
82
|
+
const r = n.getBoundingClientRect(), e = t.clientX - r.left, c = t.clientY - r.top, i = e - A.current, f = c - b.current;
|
|
83
|
+
g.current = W.current + i, p.current = B.current + f, v();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, I = (t) => {
|
|
87
|
+
u.current.delete(t.pointerId), u.current.size < 2 && (R.current = !1), u.current.size === 0 && (y.current = !1);
|
|
88
|
+
const n = a.current;
|
|
89
|
+
!d.current || !n || n.releasePointerCapture(t.pointerId);
|
|
90
|
+
}, V = I, F = I, X = (t, n) => {
|
|
91
|
+
const s = n.getBoundingClientRect();
|
|
92
|
+
return {
|
|
93
|
+
x: t.clientX - s.left,
|
|
94
|
+
y: t.clientY - s.top
|
|
95
|
+
};
|
|
96
|
+
}, v = () => {
|
|
97
|
+
const t = a.current, n = d.current, s = P.current;
|
|
98
|
+
!t || !n || !s || (n.setTransform(1, 0, 0, 1, 0, 0), n.clearRect(0, 0, t.width, t.height), n.setTransform(
|
|
99
|
+
h.current,
|
|
100
|
+
0,
|
|
101
|
+
0,
|
|
102
|
+
h.current,
|
|
103
|
+
g.current,
|
|
104
|
+
p.current
|
|
105
|
+
), n.drawImage(s, 0, 0));
|
|
106
|
+
};
|
|
107
|
+
return /* @__PURE__ */ U("div", { ref: D, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ U(
|
|
108
|
+
"canvas",
|
|
109
|
+
{
|
|
110
|
+
ref: a,
|
|
111
|
+
style: { width: "100%", height: "100%", display: "block", touchAction: "none" },
|
|
112
|
+
onWheel: E,
|
|
113
|
+
onPointerDown: H,
|
|
114
|
+
onPointerMove: S,
|
|
115
|
+
onPointerUp: I,
|
|
116
|
+
onPointerLeave: V,
|
|
117
|
+
onPointerCancel: F
|
|
118
|
+
}
|
|
119
|
+
) });
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
Z as ImageViewer
|
|
123
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { ImageViewer as o } from "./ImageViewer.js";
|
|
3
|
+
const r = {
|
|
4
|
+
title: "Case Parts/Molecules/ImageViewer",
|
|
5
|
+
component: o,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "fullscreen"
|
|
8
|
+
},
|
|
9
|
+
argTypes: {
|
|
10
|
+
imgSrc: { control: "text" },
|
|
11
|
+
zoomFactor: { control: { type: "number", min: 1, max: 2, step: 0.01 } },
|
|
12
|
+
minZoomScale: { control: { type: "number", min: 0.1, max: 2, step: 0.1 } },
|
|
13
|
+
maxZoomScale: { control: { type: "number", min: 2, max: 10, step: 0.5 } }
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(t) => /* @__PURE__ */ e("div", { style: { height: "90dvh", width: "100%" }, children: /* @__PURE__ */ e(t, {}) })
|
|
17
|
+
]
|
|
18
|
+
}, c = {
|
|
19
|
+
name: "Default",
|
|
20
|
+
args: {
|
|
21
|
+
imgSrc: "https://cdnimg.webstaurantstore.com/images/products/large/573147/2989461.jpg",
|
|
22
|
+
zoomFactor: 1.1,
|
|
23
|
+
minZoomScale: 1,
|
|
24
|
+
maxZoomScale: 5
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
c as Default,
|
|
29
|
+
r as default
|
|
30
|
+
};
|
|
@@ -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
|
};
|