@caseparts-org/caseblocks 0.0.298 → 0.0.300
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/Cart.module-Cnsy6nxN.js +40 -0
- package/dist/assets/AddToCartPart.css +1 -1
- package/dist/assets/Cart.css +1 -1
- package/dist/assets/MainNav.css +1 -1
- package/dist/atoms/Popover/Popover.js +56 -55
- package/dist/molecules/AddToCartPart/AddToCartPart.d.ts +5 -2
- package/dist/molecules/AddToCartPart/AddToCartPart.js +90 -86
- package/dist/molecules/AddToCartPart/AddToCartPart.stories.d.ts +2 -2
- package/dist/molecules/AddToCartPart/AddToCartPart.stories.js +5 -2
- package/dist/molecules/Cart/Cart.d.ts +1 -0
- package/dist/molecules/Cart/Cart.js +35 -29
- package/dist/molecules/Cart/CartPart.js +1 -1
- package/dist/molecules/Cart/CartSlideInPanel.js +1 -1
- package/dist/organisms/MainNav/MainNav.d.ts +4 -0
- package/dist/organisms/MainNav/MainNav.js +223 -200
- package/dist/organisms/MainNav/MainNav.stories.js +137 -84
- package/package.json +1 -1
- package/dist/Cart.module-CG06lLyg.js +0 -38
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import './assets/Cart.css';const t = "_cartIconButton_1xng9_2", n = "_splash_1xng9_15", o = "_splashRay_1xng9_24", e = "_count_1xng9_53", a = "_cartContainer_1xng9_71", i = "_headerWrapper_1xng9_83", _ = "_header_1xng9_83", c = "_cartItems_1xng9_101", r = "_cartItem_1xng9_101", s = "_cartItemContent_1xng9_120", m = "_carItemSeparator_1xng9_132", g = "_itemContainer_1xng9_136", d = "_topRow_1xng9_140", I = "_itemInfo_1xng9_147", l = "_unitDetails_1xng9_153", x = "_editUnit_1xng9_157", p = "_purchaseInformation_1xng9_173", u = "_availabilitySlot_1xng9_179", h = "_priceSlot_1xng9_186", A = "_itemManagement_1xng9_188", C = "_itemImage_1xng9_201", v = "_removeItem_1xng9_204", R = "_cartItemAdmonitionsPanel_1xng9_213", S = "_admonitionsPanelCollapsed_1xng9_218", T = "_cartItemAdmonitionsTrigger_1xng9_223", y = "_cartItemAdmonitionHeader_1xng9_235", b = "_admonitionsReveal_1xng9_243", f = "_admonitionsRevealExpanded_1xng9_248", B = "_cartItemAdmonitions_1xng9_213", E = "_admonitionTriggerIconExpanded_1xng9_254", P = "_admonitionTriggerIcon_1xng9_254", k = "_cartItemAdmonitionContent_1xng9_267", w = "_noItems_1xng9_277", D = "_subtotal_1xng9_284", H = "_checkoutButton_1xng9_291", M = {
|
|
2
|
+
cartIconButton: t,
|
|
3
|
+
splash: n,
|
|
4
|
+
splashRay: o,
|
|
5
|
+
count: e,
|
|
6
|
+
cartContainer: a,
|
|
7
|
+
headerWrapper: i,
|
|
8
|
+
header: _,
|
|
9
|
+
cartItems: c,
|
|
10
|
+
cartItem: r,
|
|
11
|
+
cartItemContent: s,
|
|
12
|
+
carItemSeparator: m,
|
|
13
|
+
itemContainer: g,
|
|
14
|
+
topRow: d,
|
|
15
|
+
itemInfo: I,
|
|
16
|
+
unitDetails: l,
|
|
17
|
+
editUnit: x,
|
|
18
|
+
purchaseInformation: p,
|
|
19
|
+
availabilitySlot: u,
|
|
20
|
+
priceSlot: h,
|
|
21
|
+
itemManagement: A,
|
|
22
|
+
itemImage: C,
|
|
23
|
+
removeItem: v,
|
|
24
|
+
cartItemAdmonitionsPanel: R,
|
|
25
|
+
admonitionsPanelCollapsed: S,
|
|
26
|
+
cartItemAdmonitionsTrigger: T,
|
|
27
|
+
cartItemAdmonitionHeader: y,
|
|
28
|
+
admonitionsReveal: b,
|
|
29
|
+
admonitionsRevealExpanded: f,
|
|
30
|
+
cartItemAdmonitions: B,
|
|
31
|
+
admonitionTriggerIconExpanded: E,
|
|
32
|
+
admonitionTriggerIcon: P,
|
|
33
|
+
cartItemAdmonitionContent: k,
|
|
34
|
+
noItems: w,
|
|
35
|
+
subtotal: D,
|
|
36
|
+
checkoutButton: H
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
M as s
|
|
40
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_37qcs_1{width:100%;display:flex;flex-direction:column;gap:var(--spacing-spacing-2xs);padding:var(--spacing-spacing-2xs);background:var(--surface-surface-primary);border:1px solid var(--border-border-primary);border-radius:var(--border-radius-md);box-shadow:2px 4px 12px #00000026;box-sizing:border-box}._header_37qcs_14,._confirmation_37qcs_14,._totals_37qcs_14{display:flex;align-items:center;gap:var(--spacing-spacing-3xs)}._totals_37qcs_14{border-bottom:1px solid var(--border-border-primary);padding:var(--spacing-spacing-2xs) 0 var(--spacing-spacing-default)}._header_37qcs_14,._totals_37qcs_14{justify-content:space-between}._dismissButton_37qcs_29{border:0;padding:0;background:transparent;color:var(--text-text-quaternary);cursor:pointer}._item_37qcs_37{display:flex;align-items:center;gap:var(--spacing-spacing-2xs);padding:var(--spacing-spacing-2xs);background:var(--color-brand-secondary-lt-teal-blue);border-radius:var(--border-radius-sm)}._mediaSlot_37qcs_46{width:56px;height:56px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--surface-surface-primary);border-radius:var(--border-radius-sm);overflow:hidden}._image_37qcs_58{object-fit:contain}._summary_37qcs_60{display:flex;flex-direction:column;flex:1;min-width:0;overflow-wrap:anywhere}._price_37qcs_68{display:flex;flex-direction:column;align-items:flex-end}._actions_37qcs_74{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--spacing-spacing-3xs);padding:var(--spacing-spacing-2xs) 0}
|
package/dist/assets/Cart.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._cartIconButton_1xng9_2{position:relative;border:none;padding:0;margin:0;background-color:transparent;cursor:pointer;color:#000;transition:color .3s ease,transform .3s ease}._cartIconButton_1xng9_2:hover{color:var(--color-brand-primary-primary-teal-blue)}._splash_1xng9_15{position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(2.5px);pointer-events:none}@media (prefers-reduced-motion: reduce){._splash_1xng9_15{display:none}}._splashRay_1xng9_24{position:absolute;width:20%;height:2px;border-radius:999px;background-color:var(--color-brand-primary-primary-teal-blue);transform-origin:left center;animation:_cartSplash_1xng9_1 .6s ease-out forwards}._splashRay_1xng9_24:nth-child(1){left:50%;top:0;transform:rotate(-90deg)}._splashRay_1xng9_24:nth-child(2){left:23%;top:10%;transform:rotate(-145deg)}._splashRay_1xng9_24:nth-child(3){left:77%;top:10%;transform:rotate(-35deg)}@keyframes _cartSplash_1xng9_1{0%{clip-path:inset(0 100% 0 0)}40%{clip-path:inset(0 0 0 0)}to{clip-path:inset(0 0 0 100%)}}._count_1xng9_53{position:absolute;top:0;left:14px;border-radius:1rem;min-width:18px;height:18px;box-sizing:border-box;padding-inline:2px;display:flex;flex-direction:row;align-items:center;justify-content:center;white-space:nowrap;background-color:var(--color-brand-primary-primary-tangerine);color:var(--color-neutrals-neutral-1);font-weight:var(--font-weight-semibold)}._cartContainer_1xng9_71{background-color:#f9f9f9;height:100vh;width:100%;min-width:320px;max-width:375px;box-sizing:border-box;display:grid;grid-template-rows:auto auto 1fr auto auto;gap:var(--spacing-1);padding:var(--spacing-1)}._headerWrapper_1xng9_83{display:flex;flex-direction:row;align-items:flex-start;gap:var(--spacing-spacing-2xs)}._headerWrapper_1xng9_83>button{padding:0;margin:0;background-color:transparent;border:none}._header_1xng9_83{display:flex;flex-direction:column;align-items:flex-start;width:100%}._cartItems_1xng9_101{height:100%;overflow-y:auto;overflow-x:hidden}._cartItems_1xng9_101 ul{margin:0;padding:0;display:flex;flex-direction:column;gap:var(--spacing-spacing-1xs)}._cartItem_1xng9_101{background-color:#fff;border:1px solid var(--color-neutrals-neutral-2);border-radius:var(--border-radius-sm);box-shadow:0 2px 4px #00000014}._cartItemContent_1xng9_120{display:grid;grid-template-columns:auto minmax(0,1fr);gap:var(--spacing-spacing-2xs);align-items:start;box-sizing:border-box;position:relative;list-style:none;margin:0;padding:var(--spacing-spacing-2xs);width:100%}._carItemSeparator_1xng9_132{width:100%;border-bottom:1px solid var(--border-border-primary)}._itemContainer_1xng9_136{display:grid;gap:var(--spacing-spacing-3xs)}._topRow_1xng9_140{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;gap:var(--spacing-spacing-4xs)}._itemInfo_1xng9_147{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-spacing-4xs)}._unitDetails_1xng9_153{min-width:0;width:100%}._editUnit_1xng9_157{display:flex;align-items:center;text-align:start;gap:var(--spacing-spacing-3xs);border:none;background-color:transparent;padding:0;margin:0;cursor:pointer;color:var(--text-text-links);word-wrap:break-word;font-size:var(--font-size-xs);font-weight:var(--font-weight-semibold)}._purchaseInformation_1xng9_173{display:flex;flex-direction:column;align-items:flex-end;gap:var(--spacing-spacing-3xs)}._availabilitySlot_1xng9_179{min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-spacing-3xs)}._itemManagement_1xng9_188{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between}._cartItem_1xng9_101 p{margin:0;padding:0;word-wrap:break-word;white-space:normal;overflow-wrap:break-word}._itemImage_1xng9_201{object-fit:contain}._removeItem_1xng9_204{border:none;background-color:transparent;padding:0;margin:0;cursor:pointer;width:min-content;height:min-content}._cartItemAdmonitionsPanel_1xng9_213{padding:var(--spacing-spacing-2xs);display:grid;gap:var(--spacing-spacing-2xs)}._admonitionsPanelCollapsed_1xng9_218{padding-block:var(--spacing-spacing-3xs);gap:0}._cartItemAdmonitionsTrigger_1xng9_223{border:none;background-color:transparent;outline:none;margin:0;padding:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:space-between}._cartItemAdmonitionHeader_1xng9_235{display:inline-flex;align-items:center;gap:var(--spacing-spacing-4xs)}._cartItemAdmonitionHeader_1xng9_235>span{text-align:start}._admonitionsReveal_1xng9_243{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-in}._admonitionsRevealExpanded_1xng9_248{grid-template-rows:1fr}._admonitionsReveal_1xng9_243>._cartItemAdmonitions_1xng9_213{overflow:hidden}._admonitionTriggerIconExpanded_1xng9_254{transform:rotate(180deg)}._admonitionTriggerIcon_1xng9_254{transition:transform .2s ease-in}._cartItemAdmonitions_1xng9_213{list-style:none;margin:0;padding:0}._cartItemAdmonitionContent_1xng9_267{font-size:var(--font-size-xs)}._noItems_1xng9_277{display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%}._subtotal_1xng9_284{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--spacing-0-5)}._checkoutButton_1xng9_291{width:100%;height:fit-content;display:inline-flex;gap:var(--spacing-spacing-2xs)}
|
package/dist/assets/MainNav.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._main_r1xgh_1{box-shadow:#bbb3 0 8px 24px;padding:var(--spacing-0-5) 0;z-index:1;position:relative}._column_r1xgh_8{box-sizing:border-box;padding:0 var(--spacing-1)}._topNav_r1xgh_13{padding-bottom:var(--spacing-0-5);gap:var(--spacing-1-5)}@media (max-width: 1281px){._topNav_r1xgh_13{gap:var(--spacing-1);padding-bottom:0}}._logo_r1xgh_21{cursor:pointer}._operations_r1xgh_24{gap:var(--spacing-1-5);width:100%}@media (max-width: 1281px){._operations_r1xgh_24{gap:var(--spacing-1)}}._search_r1xgh_31{flex:1;min-width:0;position:relative;container-type:inline-size}._mobileSearch_r1xgh_37{width:100%}._typeAheadPortal_r1xgh_40{position:fixed;z-index:900;container-type:inline-size;overflow-x:hidden;overflow-y:auto}._siteLink_r1xgh_47{color:var(--color-brand-primary-primary-black);cursor:default;border:none;background-color:transparent;padding:0;margin:0;font-family:var(--font-family-display);font-size:var(--font-size-md);cursor:pointer;display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-4xs)}._siteLink_r1xgh_47:hover{text-decoration:underline;color:var(--text-text-links)}@media (max-width:1280px){._siteLink_r1xgh_47{font-family:var(--font-family-body);font-size:var(--font-size-sm)}}._siteLink_r1xgh_47 path{fill:var(--color-brand-primary-primary-teal-blue)}._accountArea_r1xgh_74{width:145px;min-width:max-content}@media (max-width: 1280px){._accountArea_r1xgh_74{width:min-content;min-width:0}}._cart_r1xgh_82{border:none;padding:0;margin:0;background-color:transparent}._cartArea_r1xgh_88{position:relative}@media (max-width: 767px){._cartArea_r1xgh_88{position:static}}._cartPopover_r1xgh_94{position:fixed!important;width:min(350px,calc(100vw - 32px));max-height:calc(100dvh - 8rem);overflow-y:auto}@media (max-width: 767px){._cartPopover_r1xgh_94{--popover-offset: 40px;left:0!important;width:100%}}._cartPopoverHidden_r1xgh_106{visibility:hidden!important;pointer-events:none}._cartPopoverContent_r1xgh_110{padding:0;border:0;box-shadow:none}._category_r1xgh_115{list-style:none;min-height:42px;display:flex;flex-direction:row;align-items:stretch;padding:0}._categoryLink_r1xgh_123{color:var(--text-text-primary);text-decoration:none;display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%}._categoryLink_r1xgh_123:hover{color:var(--color-brand-primary-primary-teal-blue);text-decoration:none}._categoryLink_r1xgh_123 path{fill:var(--color-brand-primary-primary-teal-blue)}._menuList_r1xgh_139{list-style:none;padding:0;margin:0;height:min-content;display:flex;flex-direction:column;gap:var(--spacing-spacing-3xs)}._menuList_r1xgh_139>li{width:100%;min-height:42px;padding:var(--spacing-spacing-2xs);border:1px solid var(--border-border-primary, #dfdfdf);box-sizing:border-box;display:flex;flex-direction:row;align-items:center;border-radius:var(--border-radius-md);color:var(--text-text-links)}._menuItemAction_r1xgh_162{width:100%;display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-4xs);color:var(--color-brand-primary-primary-black)}._shortcutIcon_r1xgh_171{color:var(--text-text-links)}
|
|
@@ -1,121 +1,122 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as B, Fragment as H, jsx as _ } from "react/jsx-runtime";
|
|
2
2
|
import * as f from "react";
|
|
3
3
|
import { r as W } from "../../index-BkF-BQ3Q.js";
|
|
4
|
-
import { c as
|
|
5
|
-
import '../../assets/Popover.css';const q = "_popover_vlr81_1",
|
|
4
|
+
import { c as k } from "../../clsx-OuTLNxxd.js";
|
|
5
|
+
import '../../assets/Popover.css';const q = "_popover_vlr81_1", C = "_content_vlr81_7", z = {
|
|
6
6
|
popover: q,
|
|
7
|
-
content:
|
|
7
|
+
content: C
|
|
8
8
|
};
|
|
9
|
-
function
|
|
9
|
+
function D(r) {
|
|
10
10
|
return r ? r.includes(" ") ? r : `${r} center` : "top center";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
12
|
+
function T(r) {
|
|
13
|
+
const p = D(r).toLowerCase(), [s, c] = p.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
|
|
17
|
-
const
|
|
16
|
+
function U(r, p, s, c, m = 8) {
|
|
17
|
+
const o = r.getBoundingClientRect(), u = p.getBoundingClientRect();
|
|
18
18
|
let l = 0, a = 0;
|
|
19
|
-
s === "top" ? l =
|
|
20
|
-
const g = window.innerWidth,
|
|
21
|
-
return l = Math.max(4, Math.min(
|
|
19
|
+
s === "top" ? l = o.top - u.height - m : s === "bottom" ? l = o.bottom + m : s === "left" ? a = o.left - u.width - m : s === "right" && (a = o.right + m), s === "top" || s === "bottom" ? c === "start" ? a = o.left : c === "end" ? a = o.right - u.width : a = o.left + o.width / 2 - u.width / 2 : c === "start" ? l = o.top : c === "end" ? l = o.bottom - u.height : l = o.top + o.height / 2 - u.height / 2;
|
|
20
|
+
const g = window.innerWidth, h = window.innerHeight;
|
|
21
|
+
return l = Math.max(4, Math.min(h - u.height - 4, l)), a = Math.max(4, Math.min(g - u.width - 4, a)), { top: l, left: a };
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const J = ({
|
|
24
24
|
trigger: r,
|
|
25
|
-
children:
|
|
25
|
+
children: p,
|
|
26
26
|
position: s,
|
|
27
27
|
popoverClassName: c,
|
|
28
|
-
contentClassName:
|
|
29
|
-
contentStyle:
|
|
28
|
+
contentClassName: m,
|
|
29
|
+
contentStyle: o,
|
|
30
30
|
disabled: u,
|
|
31
31
|
closeOnOutsideClick: l = !0,
|
|
32
32
|
closeOnInsideClickAttr: a = !0,
|
|
33
33
|
open: g,
|
|
34
|
-
onOpenChange:
|
|
34
|
+
onOpenChange: h
|
|
35
35
|
}) => {
|
|
36
|
-
const { side: y, align: b } =
|
|
37
|
-
const e = typeof t == "function" ? t(
|
|
38
|
-
R ?
|
|
39
|
-
},
|
|
36
|
+
const { side: y, align: b } = T(s), [S, M] = f.useState(!1), R = typeof g == "boolean", n = R ? g : S, [v, N] = f.useState(null), L = f.useRef(null), w = f.useRef(null), x = (t) => {
|
|
37
|
+
const e = typeof t == "function" ? t(n) : t;
|
|
38
|
+
R ? h == null || h(e) : M(e);
|
|
39
|
+
}, P = () => {
|
|
40
40
|
u || x((t) => !t);
|
|
41
|
-
}, E = () => x(!1),
|
|
41
|
+
}, E = () => x(!1), F = () => x(!0), j = f.cloneElement(r, {
|
|
42
42
|
ref: (t) => {
|
|
43
43
|
const { ref: e } = r;
|
|
44
44
|
typeof e == "function" ? e(t) : e && (e.current = t), L.current = t;
|
|
45
45
|
},
|
|
46
46
|
onClick: (t) => {
|
|
47
47
|
var e, i;
|
|
48
|
-
(i = (e = r.props).onClick) == null || i.call(e, t),
|
|
48
|
+
(i = (e = r.props).onClick) == null || i.call(e, t), P();
|
|
49
49
|
},
|
|
50
50
|
"aria-haspopup": "dialog",
|
|
51
|
-
"aria-expanded":
|
|
52
|
-
"aria-controls":
|
|
51
|
+
"aria-expanded": n || void 0,
|
|
52
|
+
"aria-controls": n ? "popover-panel" : void 0,
|
|
53
53
|
style: { ...r.props.style || {}, outline: "none" }
|
|
54
54
|
});
|
|
55
55
|
return f.useLayoutEffect(() => {
|
|
56
|
-
if (!
|
|
57
|
-
|
|
56
|
+
if (!n) {
|
|
57
|
+
N(null);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
const t = L.current, e =
|
|
60
|
+
const t = L.current, e = w.current;
|
|
61
61
|
if (!t || !e) return;
|
|
62
62
|
const i = () => {
|
|
63
|
-
|
|
63
|
+
const d = Number.parseFloat(getComputedStyle(e).getPropertyValue("--popover-offset"));
|
|
64
|
+
N(U(t, e, y, b, Number.isNaN(d) ? 8 : d));
|
|
64
65
|
};
|
|
65
66
|
return i(), window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), () => {
|
|
66
67
|
window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0);
|
|
67
68
|
};
|
|
68
|
-
}, [
|
|
69
|
-
if (!
|
|
69
|
+
}, [n, y, b, p]), f.useEffect(() => {
|
|
70
|
+
if (!n || !l) return;
|
|
70
71
|
const t = (e) => {
|
|
71
|
-
const i =
|
|
72
|
-
!i || !
|
|
72
|
+
const i = w.current, d = L.current;
|
|
73
|
+
!i || !d || i.contains(e.target) || d.contains(e.target) || E();
|
|
73
74
|
};
|
|
74
75
|
return window.addEventListener("mousedown", t), () => window.removeEventListener("mousedown", t);
|
|
75
|
-
}, [
|
|
76
|
-
if (!
|
|
77
|
-
const t =
|
|
76
|
+
}, [n, l]), f.useEffect(() => {
|
|
77
|
+
if (!n || !a) return;
|
|
78
|
+
const t = w.current;
|
|
78
79
|
if (!t) return;
|
|
79
80
|
const e = (i) => {
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
82
|
-
|
|
81
|
+
const d = i.target;
|
|
82
|
+
if (!d) return;
|
|
83
|
+
d.closest('[data-popover-close="true"]') && setTimeout(() => E(), 0);
|
|
83
84
|
};
|
|
84
85
|
return t.addEventListener("click", e), () => t.removeEventListener("click", e);
|
|
85
|
-
}, [
|
|
86
|
-
if (!
|
|
86
|
+
}, [n, a]), f.useEffect(() => {
|
|
87
|
+
if (!n) return;
|
|
87
88
|
const t = (e) => {
|
|
88
89
|
e.key === "Escape" && E();
|
|
89
90
|
};
|
|
90
91
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
91
|
-
}, [
|
|
92
|
-
if (
|
|
93
|
-
const t =
|
|
92
|
+
}, [n]), f.useEffect(() => {
|
|
93
|
+
if (n && w.current) {
|
|
94
|
+
const t = w.current.querySelector(
|
|
94
95
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
95
96
|
);
|
|
96
97
|
t == null || t.focus();
|
|
97
98
|
}
|
|
98
|
-
}, [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/* @__PURE__ */
|
|
99
|
+
}, [n]), /* @__PURE__ */ B(H, { children: [
|
|
100
|
+
j,
|
|
101
|
+
n && typeof document < "u" && W.createPortal(
|
|
102
|
+
/* @__PURE__ */ _(
|
|
102
103
|
"div",
|
|
103
104
|
{
|
|
104
105
|
id: "popover-panel",
|
|
105
|
-
ref:
|
|
106
|
+
ref: w,
|
|
106
107
|
role: "dialog",
|
|
107
108
|
"aria-modal": "false",
|
|
108
|
-
className:
|
|
109
|
+
className: k(z.popover, c),
|
|
109
110
|
"data-side": y,
|
|
110
111
|
"data-align": b,
|
|
111
112
|
style: {
|
|
112
113
|
position: "absolute",
|
|
113
|
-
top: (
|
|
114
|
-
left: (
|
|
115
|
-
visibility:
|
|
114
|
+
top: (v == null ? void 0 : v.top) ?? 0,
|
|
115
|
+
left: (v == null ? void 0 : v.left) ?? 0,
|
|
116
|
+
visibility: v ? "visible" : "hidden",
|
|
116
117
|
zIndex: 20
|
|
117
118
|
},
|
|
118
|
-
children: /* @__PURE__ */
|
|
119
|
+
children: /* @__PURE__ */ _("div", { className: k(z.content, m), style: o, children: typeof p == "function" ? p({ close: E, open: F, toggle: P }) : p })
|
|
119
120
|
}
|
|
120
121
|
),
|
|
121
122
|
document.body
|
|
@@ -123,5 +124,5 @@ const K = ({
|
|
|
123
124
|
] });
|
|
124
125
|
};
|
|
125
126
|
export {
|
|
126
|
-
|
|
127
|
+
J as Popover
|
|
127
128
|
};
|
|
@@ -12,7 +12,10 @@ export interface AddToCartPartProps extends Omit<React.HTMLAttributes<HTMLDivEle
|
|
|
12
12
|
price?: string;
|
|
13
13
|
confirmationText?: React.ReactNode;
|
|
14
14
|
checkoutLabel?: React.ReactNode;
|
|
15
|
-
|
|
15
|
+
cartCount?: number;
|
|
16
|
+
subtotal?: string;
|
|
17
|
+
checkoutHref: string;
|
|
16
18
|
onDismiss?: () => void;
|
|
19
|
+
onItemNavigate?: () => void;
|
|
17
20
|
}
|
|
18
|
-
export declare function AddToCartPart({ imageUrl, imageAlt, title, titleHref, partNumber, partNumberLabel, quantity, quantityLabel, priceLabel, price, confirmationText, checkoutLabel,
|
|
21
|
+
export declare function AddToCartPart({ imageUrl, imageAlt, title, titleHref, partNumber, partNumberLabel, quantity, quantityLabel, priceLabel, price, confirmationText, checkoutLabel, cartCount, subtotal, checkoutHref, onDismiss, onItemNavigate, className, ...otherProps }: AddToCartPartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,114 +1,118 @@
|
|
|
1
|
-
import { jsxs as e, jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Image as
|
|
6
|
-
import { Link as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import '../../assets/AddToCartPart.css';const
|
|
10
|
-
container:
|
|
11
|
-
header:
|
|
12
|
-
confirmation:
|
|
13
|
-
|
|
14
|
-
dismissButton:
|
|
15
|
-
|
|
16
|
-
mediaSlot:
|
|
17
|
-
image:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
purchaseRow: j,
|
|
22
|
-
quantityBlock: A,
|
|
23
|
-
pricing: Q,
|
|
24
|
-
checkoutButton: D
|
|
1
|
+
import { jsxs as e, jsx as i, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { c as b } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { Button as B } from "../../atoms/Button/Button.js";
|
|
4
|
+
import { Icon as r } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import { Image as S } from "../../atoms/Image/Image.js";
|
|
6
|
+
import { Link as T } from "../../atoms/Link/Link.js";
|
|
7
|
+
import { LinkButton as w } from "../../atoms/LinkButton/LinkButton.js";
|
|
8
|
+
import { Text as c } from "../../atoms/Text/Text.js";
|
|
9
|
+
import '../../assets/AddToCartPart.css';const C = "_container_37qcs_1", K = "_header_37qcs_14", P = "_confirmation_37qcs_14", j = "_totals_37qcs_14", A = "_dismissButton_37qcs_29", L = "_item_37qcs_37", F = "_mediaSlot_37qcs_46", I = "_image_37qcs_58", Q = "_summary_37qcs_60", E = "_price_37qcs_68", G = "_actions_37qcs_74", s = {
|
|
10
|
+
container: C,
|
|
11
|
+
header: K,
|
|
12
|
+
confirmation: P,
|
|
13
|
+
totals: j,
|
|
14
|
+
dismissButton: A,
|
|
15
|
+
item: L,
|
|
16
|
+
mediaSlot: F,
|
|
17
|
+
image: I,
|
|
18
|
+
summary: Q,
|
|
19
|
+
price: E,
|
|
20
|
+
actions: G
|
|
25
21
|
};
|
|
26
|
-
function
|
|
27
|
-
imageUrl:
|
|
28
|
-
imageAlt:
|
|
29
|
-
title:
|
|
30
|
-
titleHref:
|
|
31
|
-
partNumber:
|
|
32
|
-
partNumberLabel:
|
|
33
|
-
quantity:
|
|
34
|
-
quantityLabel:
|
|
35
|
-
priceLabel:
|
|
36
|
-
price:
|
|
37
|
-
confirmationText:
|
|
38
|
-
checkoutLabel:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
function Z({
|
|
23
|
+
imageUrl: a,
|
|
24
|
+
imageAlt: f = "Product image",
|
|
25
|
+
title: n,
|
|
26
|
+
titleHref: m,
|
|
27
|
+
partNumber: d,
|
|
28
|
+
partNumberLabel: p = "Part #",
|
|
29
|
+
quantity: y,
|
|
30
|
+
quantityLabel: g = "Qty",
|
|
31
|
+
priceLabel: l = "List Price",
|
|
32
|
+
price: h,
|
|
33
|
+
confirmationText: k = "Added to cart",
|
|
34
|
+
checkoutLabel: q = "Checkout",
|
|
35
|
+
cartCount: t,
|
|
36
|
+
subtotal: _,
|
|
37
|
+
checkoutHref: z,
|
|
38
|
+
onDismiss: o,
|
|
39
|
+
onItemNavigate: u,
|
|
40
|
+
className: v,
|
|
41
|
+
...x
|
|
43
42
|
}) {
|
|
44
|
-
return /* @__PURE__ */ e("div", { className:
|
|
45
|
-
/* @__PURE__ */ e("div", { className:
|
|
46
|
-
/* @__PURE__ */ e("div", { className:
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
43
|
+
return /* @__PURE__ */ e("div", { className: b(s.container, v), ...x, children: [
|
|
44
|
+
/* @__PURE__ */ e("div", { className: s.header, children: [
|
|
45
|
+
/* @__PURE__ */ e("div", { className: s.confirmation, children: [
|
|
46
|
+
/* @__PURE__ */ i(
|
|
47
|
+
r,
|
|
49
48
|
{
|
|
50
|
-
iconKey: "fa-
|
|
49
|
+
iconKey: "fa-solid fa-circle-check",
|
|
51
50
|
size: "md",
|
|
52
|
-
|
|
51
|
+
colorToken: "success",
|
|
53
52
|
"aria-hidden": "true"
|
|
54
53
|
}
|
|
55
54
|
),
|
|
56
|
-
/* @__PURE__ */ c
|
|
55
|
+
/* @__PURE__ */ i(c, { size: "sm", weight: "semibold", colorToken: "success", children: k })
|
|
57
56
|
] }),
|
|
58
|
-
|
|
57
|
+
o && /* @__PURE__ */ i(
|
|
59
58
|
"button",
|
|
60
59
|
{
|
|
61
60
|
type: "button",
|
|
62
|
-
onClick:
|
|
63
|
-
className:
|
|
61
|
+
onClick: o,
|
|
62
|
+
className: s.dismissButton,
|
|
64
63
|
"aria-label": "Dismiss add to cart message",
|
|
65
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ i(r, { iconKey: "fa-regular fa-xmark", size: "sm" })
|
|
66
65
|
}
|
|
67
66
|
)
|
|
68
67
|
] }),
|
|
69
|
-
/* @__PURE__ */ e("div", { className:
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
68
|
+
/* @__PURE__ */ e("div", { className: s.item, children: [
|
|
69
|
+
/* @__PURE__ */ i("div", { className: s.mediaSlot, children: a ? /* @__PURE__ */ i(
|
|
70
|
+
S,
|
|
72
71
|
{
|
|
73
72
|
height: 56,
|
|
74
73
|
width: 56,
|
|
75
|
-
src:
|
|
76
|
-
alt:
|
|
77
|
-
className:
|
|
74
|
+
src: a,
|
|
75
|
+
alt: f,
|
|
76
|
+
className: s.image
|
|
78
77
|
}
|
|
79
|
-
) : /* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */ e("div", { className:
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
) : /* @__PURE__ */ i(r, { iconKey: "fa-regular fa-box-open", size: "md", "aria-hidden": "true" }) }),
|
|
79
|
+
/* @__PURE__ */ e("div", { className: s.summary, children: [
|
|
80
|
+
/* @__PURE__ */ i(c, { size: "sm", weight: "semibold", children: m ? /* @__PURE__ */ i(T, { href: m, onClick: u, children: n }) : n }),
|
|
81
|
+
/* @__PURE__ */ e(c, { size: "xs", colorToken: "quaternary", children: [
|
|
82
|
+
d != null && /* @__PURE__ */ e(N, { children: [
|
|
83
|
+
p,
|
|
85
84
|
" ",
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
] }),
|
|
89
|
-
/* @__PURE__ */ e("div", { className: i.purchaseRow, children: [
|
|
90
|
-
/* @__PURE__ */ e("div", { className: i.quantityBlock, children: [
|
|
91
|
-
/* @__PURE__ */ c(t, { size: "xxs", colorToken: "quaternary", children: p }),
|
|
92
|
-
/* @__PURE__ */ c(t, { size: "sm", weight: "semibold", children: u })
|
|
85
|
+
d,
|
|
86
|
+
" · "
|
|
93
87
|
] }),
|
|
94
|
-
|
|
88
|
+
g,
|
|
89
|
+
" ",
|
|
90
|
+
y
|
|
95
91
|
] })
|
|
92
|
+
] }),
|
|
93
|
+
h && /* @__PURE__ */ e("div", { className: s.price, children: [
|
|
94
|
+
l && /* @__PURE__ */ i(c, { size: "xxs", colorToken: "quaternary", children: l }),
|
|
95
|
+
/* @__PURE__ */ i(c, { size: "sm", weight: "semibold", children: h })
|
|
96
|
+
] })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ e("div", { className: s.totals, children: [
|
|
99
|
+
t !== void 0 && /* @__PURE__ */ e(c, { size: "xs", children: [
|
|
100
|
+
"Cart: ",
|
|
101
|
+
t,
|
|
102
|
+
" ",
|
|
103
|
+
t === 1 ? "item" : "items"
|
|
104
|
+
] }),
|
|
105
|
+
_ !== void 0 && /* @__PURE__ */ e(c, { size: "xs", children: [
|
|
106
|
+
"Subtotal ",
|
|
107
|
+
/* @__PURE__ */ i(c, { size: "sm", weight: "semibold", children: _ })
|
|
96
108
|
] })
|
|
97
109
|
] }),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
onClick: l,
|
|
103
|
-
disabled: !l,
|
|
104
|
-
variant: "cta-primary",
|
|
105
|
-
size: "md",
|
|
106
|
-
className: i.checkoutButton,
|
|
107
|
-
children: k
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
+
/* @__PURE__ */ e("div", { className: s.actions, children: [
|
|
111
|
+
/* @__PURE__ */ i(w, { href: z, onClick: u, variant: "cta-primary", size: "md", children: q }),
|
|
112
|
+
o && /* @__PURE__ */ i(B, { type: "button", onClick: o, variant: "secondary", size: "md", children: "Keep Shopping" })
|
|
113
|
+
] })
|
|
110
114
|
] });
|
|
111
115
|
}
|
|
112
116
|
export {
|
|
113
|
-
|
|
117
|
+
Z as AddToCartPart
|
|
114
118
|
};
|
|
@@ -16,7 +16,7 @@ const o = {
|
|
|
16
16
|
imageAlt: { control: "text" },
|
|
17
17
|
confirmationText: { control: "text" },
|
|
18
18
|
checkoutLabel: { control: "text" },
|
|
19
|
-
|
|
19
|
+
checkoutHref: { control: "text" },
|
|
20
20
|
onDismiss: { action: "dismissClicked" }
|
|
21
21
|
},
|
|
22
22
|
args: {
|
|
@@ -28,9 +28,12 @@ const o = {
|
|
|
28
28
|
quantityLabel: "Qty",
|
|
29
29
|
priceLabel: "List Price",
|
|
30
30
|
price: "$129.99",
|
|
31
|
+
cartCount: 2,
|
|
32
|
+
subtotal: "$259.98",
|
|
31
33
|
imageUrl: "https://dev.caseparts.com/graphics/photos/R-23_IMG_2009.png",
|
|
32
34
|
confirmationText: "Added to cart",
|
|
33
|
-
checkoutLabel: "Checkout"
|
|
35
|
+
checkoutLabel: "Checkout",
|
|
36
|
+
checkoutHref: "/checkout"
|
|
34
37
|
},
|
|
35
38
|
tags: ["autodocs"]
|
|
36
39
|
}, r = {}, a = {
|
|
@@ -35,5 +35,6 @@ export interface ShoppingCartHandle {
|
|
|
35
35
|
toggle: () => void;
|
|
36
36
|
}
|
|
37
37
|
export interface CartProps extends CartPropsBase, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
38
|
+
splashKey?: number;
|
|
38
39
|
}
|
|
39
40
|
export declare const ShoppingCart: React.ForwardRefExoticComponent<CartProps & React.RefAttributes<ShoppingCartHandle>>;
|
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
1
|
+
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import o from "react";
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { Text as
|
|
5
|
-
import { s
|
|
6
|
-
const
|
|
7
|
-
cart:
|
|
8
|
-
open:
|
|
9
|
-
onCartClick:
|
|
10
|
-
className:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
import { Icon as g } from "../../atoms/Icon/Icon.js";
|
|
4
|
+
import { Text as h } from "../../atoms/Text/Text.js";
|
|
5
|
+
import { s } from "../../Cart.module-Cnsy6nxN.js";
|
|
6
|
+
const S = o.forwardRef(function({
|
|
7
|
+
cart: l,
|
|
8
|
+
open: i = !1,
|
|
9
|
+
onCartClick: e,
|
|
10
|
+
className: p,
|
|
11
|
+
splashKey: m,
|
|
12
|
+
...n
|
|
13
|
+
}, f) {
|
|
14
|
+
l = l || { items: [] };
|
|
15
|
+
const r = l.items.reduce((c, t) => c + t.quantity, 0);
|
|
16
|
+
o.useImperativeHandle(f, () => ({
|
|
16
17
|
open: () => {
|
|
17
|
-
|
|
18
|
+
i || e();
|
|
18
19
|
},
|
|
19
20
|
close: () => {
|
|
20
|
-
|
|
21
|
+
i && e();
|
|
21
22
|
},
|
|
22
23
|
toggle: () => {
|
|
23
|
-
|
|
24
|
+
e();
|
|
24
25
|
}
|
|
25
|
-
}), [
|
|
26
|
-
const
|
|
27
|
-
var
|
|
28
|
-
(
|
|
26
|
+
}), [i, e]);
|
|
27
|
+
const u = (c) => {
|
|
28
|
+
var t;
|
|
29
|
+
(t = n.onClick) == null || t.call(n, c), e();
|
|
29
30
|
};
|
|
30
|
-
return /* @__PURE__ */ a("div", { className:
|
|
31
|
+
return /* @__PURE__ */ a("div", { className: p, children: /* @__PURE__ */ d(
|
|
31
32
|
"button",
|
|
32
33
|
{
|
|
33
|
-
className:
|
|
34
|
+
className: s.cartIconButton,
|
|
34
35
|
tabIndex: 0,
|
|
35
|
-
"aria-expanded":
|
|
36
|
+
"aria-expanded": i,
|
|
36
37
|
"aria-controls": "cart-panel",
|
|
37
|
-
onClick:
|
|
38
|
-
...
|
|
38
|
+
onClick: u,
|
|
39
|
+
...n,
|
|
39
40
|
children: [
|
|
40
|
-
/* @__PURE__ */ a(
|
|
41
|
-
m
|
|
41
|
+
/* @__PURE__ */ a(g, { iconKey: "fa-kit fa-shoppingcart-empty", title: "Shopping Cart", size: "lg" }),
|
|
42
|
+
m !== void 0 && /* @__PURE__ */ d("span", { className: s.splash, "aria-hidden": "true", children: [
|
|
43
|
+
/* @__PURE__ */ a("span", { className: s.splashRay }),
|
|
44
|
+
/* @__PURE__ */ a("span", { className: s.splashRay }),
|
|
45
|
+
/* @__PURE__ */ a("span", { className: s.splashRay })
|
|
46
|
+
] }, m),
|
|
47
|
+
r > 0 && /* @__PURE__ */ a("div", { className: s.count, children: /* @__PURE__ */ a(h, { size: "xxs", children: r }) })
|
|
42
48
|
]
|
|
43
49
|
}
|
|
44
50
|
) });
|
|
45
51
|
});
|
|
46
52
|
export {
|
|
47
|
-
|
|
53
|
+
S as ShoppingCart
|
|
48
54
|
};
|