@caseparts-org/caseblocks 0.0.171 → 0.0.172
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.
|
@@ -5,6 +5,7 @@ export interface CartPartProps extends Omit<React.LiHTMLAttributes<HTMLLIElement
|
|
|
5
5
|
imageAlt?: string;
|
|
6
6
|
title: React.ReactNode;
|
|
7
7
|
titleHref?: string;
|
|
8
|
+
onTitleNavigate?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
8
9
|
partNumber?: string | number;
|
|
9
10
|
custom?: boolean;
|
|
10
11
|
availabilityId?: string;
|
|
@@ -17,4 +18,4 @@ export interface CartPartProps extends Omit<React.LiHTMLAttributes<HTMLLIElement
|
|
|
17
18
|
onQuantityChange?: (_quantity: number) => void;
|
|
18
19
|
onRemove?: () => void;
|
|
19
20
|
}
|
|
20
|
-
export declare function CartPart({ imageUrl, imageAlt, title, titleHref, partNumber, custom, availabilityId, availability, contactHref, contactLinkBehavior, priceLabel, price, quantity, onQuantityChange, onRemove, className, ...otherProps }: CartPartProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function CartPart({ imageUrl, imageAlt, title, titleHref, onTitleNavigate, partNumber, custom, availabilityId, availability, contactHref, contactLinkBehavior, priceLabel, price, quantity, onQuantityChange, onRemove, className, ...otherProps }: CartPartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Link as
|
|
3
|
-
import { Text as
|
|
4
|
-
import { Image as
|
|
5
|
-
import { Availability as
|
|
6
|
-
import { Pricing as
|
|
7
|
-
import { QuantityInput as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { c as
|
|
10
|
-
import { s as
|
|
11
|
-
function
|
|
12
|
-
imageUrl:
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Link as K } from "../../atoms/Link/Link.js";
|
|
3
|
+
import { Text as c } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Image as N } from "../../atoms/Image/Image.js";
|
|
5
|
+
import { Availability as w } from "../Availability/Availability.js";
|
|
6
|
+
import { Pricing as S } from "../Pricing/Pricing.js";
|
|
7
|
+
import { QuantityInput as C } from "../QuantityInput/QuantityInput.js";
|
|
8
|
+
import { Icon as L } from "../../atoms/Icon/Icon.js";
|
|
9
|
+
import { c as j } from "../../clsx-OuTLNxxd.js";
|
|
10
|
+
import { s as i } from "../../Cart.module-DzPBP5QJ.js";
|
|
11
|
+
function F({
|
|
12
|
+
imageUrl: u,
|
|
13
13
|
imageAlt: p = "Product image",
|
|
14
14
|
title: m,
|
|
15
15
|
titleHref: s,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
onTitleNavigate: a,
|
|
17
|
+
partNumber: l,
|
|
18
|
+
custom: y,
|
|
19
|
+
availabilityId: I,
|
|
20
|
+
availability: o,
|
|
21
|
+
contactHref: b,
|
|
22
|
+
contactLinkBehavior: g = "new-tab",
|
|
23
|
+
priceLabel: x = "List Price",
|
|
24
|
+
price: n,
|
|
25
|
+
quantity: d,
|
|
26
|
+
onQuantityChange: f,
|
|
27
|
+
onRemove: h,
|
|
28
|
+
className: P,
|
|
29
|
+
...k
|
|
29
30
|
}) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
function z(e) {
|
|
32
|
+
e.defaultPrevented || e.button === 0 && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey || e.currentTarget.target && e.currentTarget.target !== "_self" || a == null || a(e));
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ t("li", { className: j(i.cartItem, P), ...k, children: [
|
|
35
|
+
/* @__PURE__ */ r(N, { height: 50, width: 50, src: u || "", alt: p, className: i.itemImage }),
|
|
36
|
+
/* @__PURE__ */ t("div", { children: [
|
|
37
|
+
/* @__PURE__ */ t("div", { className: i.topRow, children: [
|
|
38
|
+
/* @__PURE__ */ t("div", { className: i.itemInfo, children: [
|
|
39
|
+
/* @__PURE__ */ r(c, { size: "sm", weight: "semibold", children: s ? /* @__PURE__ */ r(K, { href: s, onClick: z, children: m }) : m }),
|
|
40
|
+
l != null && /* @__PURE__ */ t(c, { size: "sm", children: [
|
|
41
|
+
/* @__PURE__ */ r(c, { colorToken: "quaternary", size: "xs", children: y ? "Specs " : "Part # " }),
|
|
42
|
+
l
|
|
39
43
|
] })
|
|
40
44
|
] }),
|
|
41
|
-
|
|
45
|
+
h && /* @__PURE__ */ r("button", { onClick: h, className: i.removeItem, "aria-label": "Remove item", type: "button", children: /* @__PURE__ */ r(L, { iconKey: "fa-regular fa-trash", size: "sm" }) })
|
|
42
46
|
] }),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
47
|
+
/* @__PURE__ */ t("div", { className: i.itemManagement, children: [
|
|
48
|
+
/* @__PURE__ */ t("div", { className: i.purchaseInformation, children: [
|
|
49
|
+
/* @__PURE__ */ r("div", { className: i.availabilitySlot, children: o && /* @__PURE__ */ r(
|
|
50
|
+
w,
|
|
47
51
|
{
|
|
48
|
-
availId:
|
|
49
|
-
availDescription:
|
|
50
|
-
contactHref:
|
|
51
|
-
contactLinkBehavior:
|
|
52
|
+
availId: I || "",
|
|
53
|
+
availDescription: o,
|
|
54
|
+
contactHref: b || "",
|
|
55
|
+
contactLinkBehavior: g
|
|
52
56
|
}
|
|
53
57
|
) }),
|
|
54
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ r("div", { className: i.priceSlot, children: n && /* @__PURE__ */ r(S, { pricingLabel: x, price: n }) })
|
|
55
59
|
] }),
|
|
56
|
-
typeof
|
|
57
|
-
|
|
60
|
+
typeof d == "number" && f && /* @__PURE__ */ r("div", { className: i.quantitySlot, children: /* @__PURE__ */ r(
|
|
61
|
+
C,
|
|
58
62
|
{
|
|
59
|
-
quantity:
|
|
60
|
-
onQuantityChange:
|
|
63
|
+
quantity: d,
|
|
64
|
+
onQuantityChange: f,
|
|
61
65
|
size: "sm"
|
|
62
66
|
}
|
|
63
67
|
) })
|
|
@@ -66,5 +70,5 @@ function B({
|
|
|
66
70
|
] });
|
|
67
71
|
}
|
|
68
72
|
export {
|
|
69
|
-
|
|
73
|
+
F as CartPart
|
|
70
74
|
};
|
|
@@ -10,6 +10,7 @@ export interface CartSlideInPanelProps {
|
|
|
10
10
|
contactLinkBehavior?: ContactUsLinkBehavior;
|
|
11
11
|
onItemQtyChange: (_item: CartItem, _newQty: number) => void;
|
|
12
12
|
onItemDelete: (_item: CartItem) => void;
|
|
13
|
+
onItemNavigate?: (_item: CartItem) => void;
|
|
13
14
|
onCheckout: () => void;
|
|
14
15
|
}
|
|
15
|
-
export declare function CartSlideInPanel({ open, onClose, cart, subtotal, itemPriceLabel, contactHref, contactLinkBehavior, onItemQtyChange, onItemDelete, onCheckout }: CartSlideInPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function CartSlideInPanel({ open, onClose, cart, subtotal, itemPriceLabel, contactHref, contactLinkBehavior, onItemQtyChange, onItemDelete, onItemNavigate, onCheckout }: CartSlideInPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,74 +1,76 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { SlideInPanel as
|
|
1
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { SlideInPanel as g } from "../../atoms/SlideInPanel/SlideInPanel.js";
|
|
3
3
|
import { Text as l } from "../../atoms/Text/Text.js";
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { CartPart as
|
|
7
|
-
import { s as
|
|
8
|
-
function
|
|
4
|
+
import { Button as v } from "../../atoms/Button/Button.js";
|
|
5
|
+
import { Icon as C } from "../../atoms/Icon/Icon.js";
|
|
6
|
+
import { CartPart as x } from "./CartPart.js";
|
|
7
|
+
import { s as t } from "../../Cart.module-DzPBP5QJ.js";
|
|
8
|
+
function B({
|
|
9
9
|
open: o,
|
|
10
|
-
onClose:
|
|
11
|
-
cart:
|
|
10
|
+
onClose: s,
|
|
11
|
+
cart: r,
|
|
12
12
|
subtotal: n,
|
|
13
|
-
itemPriceLabel:
|
|
14
|
-
contactHref:
|
|
15
|
-
contactLinkBehavior:
|
|
16
|
-
onItemQtyChange:
|
|
17
|
-
onItemDelete:
|
|
18
|
-
|
|
13
|
+
itemPriceLabel: c,
|
|
14
|
+
contactHref: h,
|
|
15
|
+
contactLinkBehavior: p,
|
|
16
|
+
onItemQtyChange: u,
|
|
17
|
+
onItemDelete: y,
|
|
18
|
+
onItemNavigate: m,
|
|
19
|
+
onCheckout: b
|
|
19
20
|
}) {
|
|
20
|
-
var
|
|
21
|
-
return
|
|
22
|
-
|
|
21
|
+
var d;
|
|
22
|
+
return r = r || { items: [] }, /* @__PURE__ */ i(
|
|
23
|
+
g,
|
|
23
24
|
{
|
|
24
25
|
side: "right",
|
|
25
26
|
open: o,
|
|
26
|
-
onClose:
|
|
27
|
+
onClose: s,
|
|
27
28
|
ariaLabel: "Shopping Cart",
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
29
|
+
children: /* @__PURE__ */ a("div", { id: "cart-panel", className: t.cartContainer, children: [
|
|
30
|
+
/* @__PURE__ */ a("div", { className: t.headerWrapper, children: [
|
|
31
|
+
/* @__PURE__ */ a("div", { className: t.header, children: [
|
|
31
32
|
/* @__PURE__ */ i(l, { size: "2xl", children: "Cart" }),
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
(
|
|
33
|
+
/* @__PURE__ */ a(l, { size: "xs", colorToken: "quaternary", children: [
|
|
34
|
+
(d = r == null ? void 0 : r.items) == null ? void 0 : d.length,
|
|
34
35
|
" items in your cart"
|
|
35
36
|
] })
|
|
36
37
|
] }),
|
|
37
|
-
/* @__PURE__ */ i("button", { onClick:
|
|
38
|
+
/* @__PURE__ */ i("button", { onClick: s, children: /* @__PURE__ */ i(C, { iconKey: "fa-regular fa-xmark", size: "md" }) })
|
|
38
39
|
] }),
|
|
39
|
-
/* @__PURE__ */ i("div", { className:
|
|
40
|
-
|
|
40
|
+
/* @__PURE__ */ i("div", { className: t.cartItems, children: r.items.length > 0 ? /* @__PURE__ */ i("ul", { children: r.items.map((e) => /* @__PURE__ */ i(
|
|
41
|
+
x,
|
|
41
42
|
{
|
|
42
43
|
imageUrl: e.imageUrl,
|
|
43
44
|
imageAlt: `${e.itemId} product image`,
|
|
44
45
|
title: e.description,
|
|
45
46
|
titleHref: e.itemHref || `/part/${e.itemId}`,
|
|
47
|
+
onTitleNavigate: () => m == null ? void 0 : m(e),
|
|
46
48
|
partNumber: e.itemId,
|
|
47
49
|
custom: !!e.custom,
|
|
48
50
|
availabilityId: e.availabilityId,
|
|
49
51
|
availability: e.availability,
|
|
50
|
-
contactHref:
|
|
51
|
-
contactLinkBehavior:
|
|
52
|
+
contactHref: h,
|
|
53
|
+
contactLinkBehavior: p,
|
|
52
54
|
price: e.price,
|
|
53
|
-
priceLabel:
|
|
55
|
+
priceLabel: c || "List Price",
|
|
54
56
|
quantity: e.quantity,
|
|
55
|
-
onQuantityChange: (
|
|
56
|
-
onRemove: () =>
|
|
57
|
+
onQuantityChange: (f) => u(e, f),
|
|
58
|
+
onRemove: () => y(e)
|
|
57
59
|
},
|
|
58
60
|
e.id
|
|
59
|
-
)) }) : /* @__PURE__ */ i("div", { className:
|
|
60
|
-
n && /* @__PURE__ */
|
|
61
|
+
)) }) : /* @__PURE__ */ i("div", { className: t.noItems, children: /* @__PURE__ */ i(l, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
|
|
62
|
+
n && /* @__PURE__ */ a("div", { className: t.subtotal, children: [
|
|
61
63
|
/* @__PURE__ */ i(l, { size: "md", weight: "semibold", children: "Subtotal" }),
|
|
62
64
|
/* @__PURE__ */ i(l, { size: "md", weight: "semibold", children: n })
|
|
63
65
|
] }),
|
|
64
66
|
/* @__PURE__ */ i(
|
|
65
|
-
|
|
67
|
+
v,
|
|
66
68
|
{
|
|
67
|
-
disabled:
|
|
68
|
-
onClick:
|
|
69
|
+
disabled: r.items.length === 0,
|
|
70
|
+
onClick: b,
|
|
69
71
|
variant: "cta-primary",
|
|
70
72
|
size: "md",
|
|
71
|
-
className:
|
|
73
|
+
className: t.checkoutButton,
|
|
72
74
|
children: "Checkout"
|
|
73
75
|
}
|
|
74
76
|
)
|
|
@@ -77,5 +79,5 @@ function q({
|
|
|
77
79
|
);
|
|
78
80
|
}
|
|
79
81
|
export {
|
|
80
|
-
|
|
82
|
+
B as CartSlideInPanel
|
|
81
83
|
};
|