@caseparts-org/caseblocks 0.0.115 → 0.0.116
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/atoms/Popover/Popover.d.ts +5 -1
- package/dist/atoms/Popover/Popover.js +35 -36
- package/dist/main-client.d.ts +0 -2
- package/dist/main-client.js +33 -35
- package/dist/molecules/Modal/Modal.js +26 -27
- package/package.json +1 -1
- package/dist/atoms/Popover/usePopover.d.ts +0 -8
- package/dist/atoms/Popover/usePopover.js +0 -12
package/dist/assets/Modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._overlay_1du2l_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_1du2l_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_1du2l_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._header_1du2l_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);z-index:1}._closeButton_1du2l_43{-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_1du2l_56{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_1du2l_56{padding:var(--spacing-spacing-2xs)}}._headerPlain_1du2l_64{background-color:transparent;border-bottom:none}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { PopoverAPI } from './usePopover';
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
export type PopoverAPI = {
|
|
3
|
+
close: () => void;
|
|
4
|
+
open: () => void;
|
|
5
|
+
toggle: () => void;
|
|
6
|
+
};
|
|
3
7
|
type PositionKeyword = "top" | "right" | "bottom" | "left";
|
|
4
8
|
type Position = "top left" | "top center" | "top right" | "right top" | "right center" | "right bottom" | "bottom left" | "bottom center" | "bottom right" | "left top" | "left center" | "left bottom" | PositionKeyword;
|
|
5
9
|
export type PopoverProps = {
|
|
@@ -1,79 +1,78 @@
|
|
|
1
|
-
import { jsxs as H, jsx as k } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as F, Fragment as H, jsx as k } from "react/jsx-runtime";
|
|
2
2
|
import * as f from "react";
|
|
3
3
|
import { r as N } from "../../index-B4KbmMH3.js";
|
|
4
4
|
import { c as z } from "../../clsx-OuTLNxxd.js";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
content: C
|
|
5
|
+
import '../../assets/Popover.css';const W = "_popover_vlr81_1", q = "_content_vlr81_7", P = {
|
|
6
|
+
popover: W,
|
|
7
|
+
content: q
|
|
9
8
|
};
|
|
10
9
|
function D(r) {
|
|
11
10
|
return r ? r.includes(" ") ? r : `${r} center` : "top center";
|
|
12
11
|
}
|
|
13
|
-
function
|
|
12
|
+
function U(r) {
|
|
14
13
|
const d = D(r).toLowerCase(), [s, c] = d.split(" ");
|
|
15
14
|
return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: c === "left" || c === "top" ? "start" : c === "right" || c === "bottom" ? "end" : "center" };
|
|
16
15
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
16
|
+
function $(r, d, s, c, p = 8) {
|
|
17
|
+
const n = r.getBoundingClientRect(), l = d.getBoundingClientRect();
|
|
19
18
|
let a = 0, u = 0;
|
|
20
|
-
s === "top" ? a =
|
|
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;
|
|
21
20
|
const w = window.innerWidth, h = window.innerHeight;
|
|
22
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 };
|
|
23
22
|
}
|
|
24
|
-
const
|
|
23
|
+
const K = ({
|
|
25
24
|
trigger: r,
|
|
26
25
|
children: d,
|
|
27
26
|
position: s,
|
|
28
27
|
popoverClassName: c,
|
|
29
28
|
contentClassName: p,
|
|
30
|
-
disabled:
|
|
29
|
+
disabled: n,
|
|
31
30
|
closeOnOutsideClick: l = !0,
|
|
32
31
|
closeOnInsideClickAttr: a = !0,
|
|
33
32
|
open: u,
|
|
34
33
|
onOpenChange: w
|
|
35
34
|
}) => {
|
|
36
|
-
const { side: h, align: y } =
|
|
37
|
-
const e = typeof t == "function" ? t(
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
}, E = () => L(!1),
|
|
35
|
+
const { side: h, align: y } = U(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
|
+
const e = typeof t == "function" ? t(o) : t;
|
|
37
|
+
x ? w == null || w(e) : S(e);
|
|
38
|
+
}, _ = () => {
|
|
39
|
+
n || L((t) => !t);
|
|
40
|
+
}, E = () => L(!1), j = () => L(!0), B = f.cloneElement(r, {
|
|
42
41
|
ref: (t) => {
|
|
43
42
|
const { ref: e } = r;
|
|
44
43
|
typeof e == "function" ? e(t) : e && (e.current = t), b.current = t;
|
|
45
44
|
},
|
|
46
45
|
onClick: (t) => {
|
|
47
46
|
var e, i;
|
|
48
|
-
(i = (e = r.props).onClick) == null || i.call(e, t),
|
|
47
|
+
(i = (e = r.props).onClick) == null || i.call(e, t), _();
|
|
49
48
|
},
|
|
50
49
|
"aria-haspopup": "dialog",
|
|
51
|
-
"aria-expanded":
|
|
52
|
-
"aria-controls":
|
|
50
|
+
"aria-expanded": o || void 0,
|
|
51
|
+
"aria-controls": o ? "popover-panel" : void 0,
|
|
53
52
|
style: { ...r.props.style || {}, outline: "none" }
|
|
54
53
|
});
|
|
55
54
|
return f.useLayoutEffect(() => {
|
|
56
|
-
if (!
|
|
57
|
-
|
|
55
|
+
if (!o) {
|
|
56
|
+
R(null);
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
const t = b.current, e = v.current;
|
|
61
60
|
if (!t || !e) return;
|
|
62
61
|
const i = () => {
|
|
63
|
-
|
|
62
|
+
R($(t, e, h, y, 8));
|
|
64
63
|
};
|
|
65
64
|
return i(), window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), () => {
|
|
66
65
|
window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0);
|
|
67
66
|
};
|
|
68
|
-
}, [
|
|
69
|
-
if (!
|
|
67
|
+
}, [o, h, y, d]), f.useEffect(() => {
|
|
68
|
+
if (!o || !l) return;
|
|
70
69
|
const t = (e) => {
|
|
71
70
|
const i = v.current, g = b.current;
|
|
72
71
|
!i || !g || i.contains(e.target) || g.contains(e.target) || E();
|
|
73
72
|
};
|
|
74
73
|
return window.addEventListener("mousedown", t), () => window.removeEventListener("mousedown", t);
|
|
75
|
-
}, [
|
|
76
|
-
if (!
|
|
74
|
+
}, [o, l]), f.useEffect(() => {
|
|
75
|
+
if (!o || !a) return;
|
|
77
76
|
const t = v.current;
|
|
78
77
|
if (!t) return;
|
|
79
78
|
const e = (i) => {
|
|
@@ -82,22 +81,22 @@ const Q = ({
|
|
|
82
81
|
g.closest('[data-popover-close="true"]') && E();
|
|
83
82
|
};
|
|
84
83
|
return t.addEventListener("click", e), () => t.removeEventListener("click", e);
|
|
85
|
-
}, [
|
|
86
|
-
if (!
|
|
84
|
+
}, [o, a]), f.useEffect(() => {
|
|
85
|
+
if (!o) return;
|
|
87
86
|
const t = (e) => {
|
|
88
87
|
e.key === "Escape" && E();
|
|
89
88
|
};
|
|
90
89
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
91
|
-
}, [
|
|
92
|
-
if (
|
|
90
|
+
}, [o]), f.useEffect(() => {
|
|
91
|
+
if (o && v.current) {
|
|
93
92
|
const t = v.current.querySelector(
|
|
94
93
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
95
94
|
);
|
|
96
95
|
t == null || t.focus();
|
|
97
96
|
}
|
|
98
|
-
}, [
|
|
97
|
+
}, [o]), /* @__PURE__ */ F(H, { children: [
|
|
99
98
|
B,
|
|
100
|
-
|
|
99
|
+
o && typeof document < "u" && N.createPortal(
|
|
101
100
|
/* @__PURE__ */ k(
|
|
102
101
|
"div",
|
|
103
102
|
{
|
|
@@ -105,7 +104,7 @@ const Q = ({
|
|
|
105
104
|
ref: v,
|
|
106
105
|
role: "dialog",
|
|
107
106
|
"aria-modal": "false",
|
|
108
|
-
className: z(
|
|
107
|
+
className: z(P.popover, c),
|
|
109
108
|
"data-side": h,
|
|
110
109
|
"data-align": y,
|
|
111
110
|
style: {
|
|
@@ -115,7 +114,7 @@ const Q = ({
|
|
|
115
114
|
visibility: m ? "visible" : "hidden",
|
|
116
115
|
zIndex: 20
|
|
117
116
|
},
|
|
118
|
-
children: /* @__PURE__ */ k("div", { className: z(
|
|
117
|
+
children: /* @__PURE__ */ k("div", { className: z(P.content, p), children: typeof d == "function" ? d({ close: E, open: j, toggle: _ }) : d })
|
|
119
118
|
}
|
|
120
119
|
),
|
|
121
120
|
document.body
|
|
@@ -123,5 +122,5 @@ const Q = ({
|
|
|
123
122
|
] });
|
|
124
123
|
};
|
|
125
124
|
export {
|
|
126
|
-
|
|
125
|
+
K as Popover
|
|
127
126
|
};
|
package/dist/main-client.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ export type { SlideInPanelProps } from './atoms/SlideInPanel/SlideInPanel';
|
|
|
6
6
|
export { Tooltip } from './atoms/Tooltip/Tooltip';
|
|
7
7
|
export { Popover } from './atoms/Popover/Popover';
|
|
8
8
|
export type { PopoverProps } from './atoms/Popover/Popover';
|
|
9
|
-
export { usePopover } from './atoms/Popover/usePopover';
|
|
10
|
-
export type { PopoverAPI } from './atoms/Popover/usePopover';
|
|
11
9
|
export { Account } from './molecules/Account/Account';
|
|
12
10
|
export type { AccountProps } from './molecules/Account/Account';
|
|
13
11
|
export { Chip } from './molecules/Chip/Chip';
|
package/dist/main-client.js
CHANGED
|
@@ -6,10 +6,10 @@ 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
|
|
10
|
-
import { Link as
|
|
11
|
-
import { linkClassName as
|
|
12
|
-
import { configureLink as
|
|
9
|
+
import { Input as B } from "./atoms/Input/Input.js";
|
|
10
|
+
import { Link as v } from "./atoms/Link/Link.js";
|
|
11
|
+
import { linkClassName as L } from "./atoms/Link/linkClassName.js";
|
|
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
15
|
import { Logo as y } from "./molecules/Logo/Logo.js";
|
|
@@ -26,63 +26,61 @@ import { HorizontalScroll as _ } from "./atoms/HorizontalScroll/HorizontalScroll
|
|
|
26
26
|
import { SlideInPanel as oo } from "./atoms/SlideInPanel/SlideInPanel.js";
|
|
27
27
|
import { Tooltip as eo } from "./atoms/Tooltip/Tooltip.js";
|
|
28
28
|
import { Popover as po } from "./atoms/Popover/Popover.js";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import { Modal as so } from "./molecules/Modal/Modal.js";
|
|
29
|
+
import { Account as fo } from "./molecules/Account/Account.js";
|
|
30
|
+
import { Chip as ao } from "./molecules/Chip/Chip.js";
|
|
31
|
+
import { ToggleView as io } from "./molecules/ToggleView/ToggleView.js";
|
|
32
|
+
import { CartSlideInPanel as uo } from "./molecules/Cart/CartSlideInPanel.js";
|
|
33
|
+
import { StatefulButton as Co } from "./molecules/StatefulButton/StatefulButton.js";
|
|
34
|
+
import { AnimatedCheckMark as ko } from "./molecules/StatefulButton/AnimatedCheckmark.js";
|
|
35
|
+
import { AddToCart as Bo } from "./molecules/AddToCart/AddToCart.js";
|
|
36
|
+
import { Modal as vo } from "./molecules/Modal/Modal.js";
|
|
38
37
|
import { MainNav as Lo } from "./organisms/MainNav/MainNav.js";
|
|
39
|
-
import { ChipSelector as
|
|
40
|
-
import { Product as
|
|
41
|
-
import { Carousel as
|
|
42
|
-
import { Footer as
|
|
38
|
+
import { ChipSelector as ho } from "./organisms/ChipSelector/ChipSelector.js";
|
|
39
|
+
import { Product as To } from "./organisms/Product/Product.js";
|
|
40
|
+
import { Carousel as Mo } from "./organisms/Carousel/Carousel.js";
|
|
41
|
+
import { Footer as bo } from "./organisms/Footer/Footer.js";
|
|
43
42
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
fo as Account,
|
|
44
|
+
Bo as AddToCart,
|
|
45
|
+
ko as AnimatedCheckMark,
|
|
47
46
|
V as Availability,
|
|
48
47
|
q as Avatar,
|
|
49
48
|
E as BannerCard,
|
|
50
49
|
W as Breadcrumbs,
|
|
51
50
|
e as Button,
|
|
52
51
|
K as CardLink,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
Mo as Carousel,
|
|
53
|
+
uo as CartSlideInPanel,
|
|
54
|
+
ao as Chip,
|
|
55
|
+
ho as ChipSelector,
|
|
57
56
|
f as Column,
|
|
58
57
|
p as Flex,
|
|
59
|
-
|
|
58
|
+
bo as Footer,
|
|
60
59
|
x as Grid,
|
|
61
60
|
n as Head,
|
|
62
61
|
_ as HorizontalScroll,
|
|
63
62
|
l as Icon,
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
B as Input,
|
|
64
|
+
v as Link,
|
|
66
65
|
F as LinkButton,
|
|
67
66
|
y as Logo,
|
|
68
67
|
Lo as MainNav,
|
|
69
|
-
|
|
68
|
+
vo as Modal,
|
|
70
69
|
Y as NotFound,
|
|
71
70
|
po as Popover,
|
|
72
71
|
Q as Pricing,
|
|
73
|
-
|
|
72
|
+
To as Product,
|
|
74
73
|
G as QuantityInput,
|
|
75
74
|
d as Root,
|
|
76
75
|
w as SearchBox,
|
|
77
76
|
C as Separator,
|
|
78
77
|
oo as SlideInPanel,
|
|
79
|
-
|
|
78
|
+
Co as StatefulButton,
|
|
80
79
|
k as Text,
|
|
81
|
-
|
|
80
|
+
io as ToggleView,
|
|
82
81
|
eo as Tooltip,
|
|
83
82
|
N as configureImage,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
fo as usePopover
|
|
83
|
+
h as configureLink,
|
|
84
|
+
L as linkClassName,
|
|
85
|
+
s as routerOverride
|
|
88
86
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { Text as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import '../../assets/Modal.css';const y = "
|
|
1
|
+
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { c as n } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { Text as v } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Icon as p } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import '../../assets/Modal.css';const y = "_overlay_1du2l_1", g = "_container_1du2l_11", x = "_header_1du2l_30", N = "_closeButton_1du2l_43", T = "_content_1du2l_56", k = "_headerPlain_1du2l_64", e = {
|
|
6
6
|
overlay: y,
|
|
7
7
|
container: g,
|
|
8
8
|
header: x,
|
|
9
9
|
closeButton: N,
|
|
10
|
-
captionSpacer: S,
|
|
11
10
|
content: T,
|
|
12
11
|
headerPlain: k
|
|
13
12
|
}, z = {
|
|
@@ -19,57 +18,57 @@ import '../../assets/Modal.css';const y = "_overlay_vmpn5_1", g = "_container_vm
|
|
|
19
18
|
md: "md",
|
|
20
19
|
lg: "md"
|
|
21
20
|
};
|
|
22
|
-
function
|
|
21
|
+
function j({
|
|
23
22
|
isOpen: i,
|
|
24
23
|
caption: o,
|
|
25
|
-
onClose:
|
|
26
|
-
closeOnOverlayClick:
|
|
27
|
-
headerSize:
|
|
24
|
+
onClose: l,
|
|
25
|
+
closeOnOverlayClick: d = !0,
|
|
26
|
+
headerSize: t = "md",
|
|
28
27
|
headerVariant: r = "default",
|
|
29
|
-
className:
|
|
30
|
-
children:
|
|
28
|
+
className: m,
|
|
29
|
+
children: u,
|
|
31
30
|
..._
|
|
32
31
|
}) {
|
|
33
32
|
if (!i) return null;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
return /* @__PURE__ */
|
|
33
|
+
const h = (c) => {
|
|
34
|
+
d && c.target === c.currentTarget && l();
|
|
35
|
+
}, f = r === "default" && !!o;
|
|
36
|
+
return /* @__PURE__ */ a("div", { className: n(e.overlay), onClick: h, children: /* @__PURE__ */ s("div", { className: n(e.container, m), role: "dialog", "aria-modal": "true", ..._, children: [
|
|
38
37
|
/* @__PURE__ */ s(
|
|
39
38
|
"div",
|
|
40
39
|
{
|
|
41
|
-
className:
|
|
40
|
+
className: n(
|
|
42
41
|
e.header,
|
|
43
|
-
e[`header-${
|
|
42
|
+
e[`header-${t}`],
|
|
44
43
|
r === "plain" && e.headerPlain
|
|
45
44
|
),
|
|
46
45
|
children: [
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
f ? /* @__PURE__ */ a(
|
|
47
|
+
v,
|
|
49
48
|
{
|
|
50
49
|
as: "div",
|
|
51
|
-
size: z[
|
|
50
|
+
size: z[t],
|
|
52
51
|
variant: "display",
|
|
53
52
|
className: e.caption,
|
|
54
53
|
children: o
|
|
55
54
|
}
|
|
56
|
-
) : /* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
55
|
+
) : /* @__PURE__ */ a("div", { className: e.captionSpacer }),
|
|
56
|
+
/* @__PURE__ */ a(
|
|
58
57
|
"button",
|
|
59
58
|
{
|
|
60
59
|
type: "button",
|
|
61
60
|
className: e.closeButton,
|
|
62
61
|
"aria-label": "Close",
|
|
63
|
-
onClick:
|
|
64
|
-
children: /* @__PURE__ */
|
|
62
|
+
onClick: l,
|
|
63
|
+
children: /* @__PURE__ */ a(p, { iconKey: "fa-regular fa-xmark", size: B[t] })
|
|
65
64
|
}
|
|
66
65
|
)
|
|
67
66
|
]
|
|
68
67
|
}
|
|
69
68
|
),
|
|
70
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ a("div", { className: e.content, children: u })
|
|
71
70
|
] }) });
|
|
72
71
|
}
|
|
73
72
|
export {
|
|
74
|
-
|
|
73
|
+
j as Modal
|
|
75
74
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as e from "react";
|
|
2
|
-
const t = e.createContext(null);
|
|
3
|
-
function r() {
|
|
4
|
-
const o = e.useContext(t);
|
|
5
|
-
if (!o)
|
|
6
|
-
throw new Error("usePopover must be used within a Popover");
|
|
7
|
-
return o;
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
t as PopoverContext,
|
|
11
|
-
r as usePopover
|
|
12
|
-
};
|