@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 r, jsx as i } from "react/jsx-runtime";
2
- import { Link as x } from "../../atoms/Link/Link.js";
3
- import { Text as a } from "../../atoms/Text/Text.js";
4
- import { Image as y } from "../../atoms/Image/Image.js";
5
- import { Availability as z } from "../Availability/Availability.js";
6
- import { Pricing as P } from "../Pricing/Pricing.js";
7
- import { QuantityInput as w } from "../QuantityInput/QuantityInput.js";
8
- import { Icon as S } from "../../atoms/Icon/Icon.js";
9
- import { c as k } from "../../clsx-OuTLNxxd.js";
10
- import { s as e } from "../../Cart.module-DzPBP5QJ.js";
11
- function B({
12
- imageUrl: h,
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
- partNumber: t,
17
- custom: f,
18
- availabilityId: v,
19
- availability: c,
20
- contactHref: u,
21
- contactLinkBehavior: I = "new-tab",
22
- priceLabel: N = "List Price",
23
- price: l,
24
- quantity: o,
25
- onQuantityChange: n,
26
- onRemove: d,
27
- className: g,
28
- ...b
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
- return /* @__PURE__ */ r("li", { className: k(e.cartItem, g), ...b, children: [
31
- /* @__PURE__ */ i(y, { height: 50, width: 50, src: h || "", alt: p, className: e.itemImage }),
32
- /* @__PURE__ */ r("div", { children: [
33
- /* @__PURE__ */ r("div", { className: e.topRow, children: [
34
- /* @__PURE__ */ r("div", { className: e.itemInfo, children: [
35
- /* @__PURE__ */ i(a, { size: "sm", weight: "semibold", children: s ? /* @__PURE__ */ i(x, { href: s, children: m }) : m }),
36
- t != null && /* @__PURE__ */ r(a, { size: "sm", children: [
37
- /* @__PURE__ */ i(a, { colorToken: "quaternary", size: "xs", children: f ? "Specs " : "Part # " }),
38
- t
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
- d && /* @__PURE__ */ i("button", { onClick: d, className: e.removeItem, "aria-label": "Remove item", type: "button", children: /* @__PURE__ */ i(S, { iconKey: "fa-regular fa-trash", size: "sm" }) })
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__ */ r("div", { className: e.itemManagement, children: [
44
- /* @__PURE__ */ r("div", { className: e.purchaseInformation, children: [
45
- /* @__PURE__ */ i("div", { className: e.availabilitySlot, children: c && /* @__PURE__ */ i(
46
- z,
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: v || "",
49
- availDescription: c,
50
- contactHref: u || "",
51
- contactLinkBehavior: I
52
+ availId: I || "",
53
+ availDescription: o,
54
+ contactHref: b || "",
55
+ contactLinkBehavior: g
52
56
  }
53
57
  ) }),
54
- /* @__PURE__ */ i("div", { className: e.priceSlot, children: l && /* @__PURE__ */ i(P, { pricingLabel: N, price: l }) })
58
+ /* @__PURE__ */ r("div", { className: i.priceSlot, children: n && /* @__PURE__ */ r(S, { pricingLabel: x, price: n }) })
55
59
  ] }),
56
- typeof o == "number" && n && /* @__PURE__ */ i("div", { className: e.quantitySlot, children: /* @__PURE__ */ i(
57
- w,
60
+ typeof d == "number" && f && /* @__PURE__ */ r("div", { className: i.quantitySlot, children: /* @__PURE__ */ r(
61
+ C,
58
62
  {
59
- quantity: o,
60
- onQuantityChange: n,
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
- B as CartPart
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 r } from "react/jsx-runtime";
2
- import { SlideInPanel as b } from "../../atoms/SlideInPanel/SlideInPanel.js";
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 f } from "../../atoms/Button/Button.js";
5
- import { Icon as v } from "../../atoms/Icon/Icon.js";
6
- import { CartPart as I } from "./CartPart.js";
7
- import { s as a } from "../../Cart.module-DzPBP5QJ.js";
8
- function q({
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: m,
11
- cart: t,
10
+ onClose: s,
11
+ cart: r,
12
12
  subtotal: n,
13
- itemPriceLabel: d,
14
- contactHref: c,
15
- contactLinkBehavior: h,
16
- onItemQtyChange: p,
17
- onItemDelete: u,
18
- onCheckout: y
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 s;
21
- return t = t || { items: [] }, /* @__PURE__ */ i(
22
- b,
21
+ var d;
22
+ return r = r || { items: [] }, /* @__PURE__ */ i(
23
+ g,
23
24
  {
24
25
  side: "right",
25
26
  open: o,
26
- onClose: m,
27
+ onClose: s,
27
28
  ariaLabel: "Shopping Cart",
28
- children: /* @__PURE__ */ r("div", { id: "cart-panel", className: a.cartContainer, children: [
29
- /* @__PURE__ */ r("div", { className: a.headerWrapper, children: [
30
- /* @__PURE__ */ r("div", { className: a.header, children: [
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__ */ r(l, { size: "xs", colorToken: "quaternary", children: [
33
- (s = t == null ? void 0 : t.items) == null ? void 0 : s.length,
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: m, children: /* @__PURE__ */ i(v, { iconKey: "fa-regular fa-xmark", size: "md" }) })
38
+ /* @__PURE__ */ i("button", { onClick: s, children: /* @__PURE__ */ i(C, { iconKey: "fa-regular fa-xmark", size: "md" }) })
38
39
  ] }),
39
- /* @__PURE__ */ i("div", { className: a.cartItems, children: t.items.length > 0 ? /* @__PURE__ */ i("ul", { children: t.items.map((e) => /* @__PURE__ */ i(
40
- I,
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: c,
51
- contactLinkBehavior: h,
52
+ contactHref: h,
53
+ contactLinkBehavior: p,
52
54
  price: e.price,
53
- priceLabel: d || "List Price",
55
+ priceLabel: c || "List Price",
54
56
  quantity: e.quantity,
55
- onQuantityChange: (g) => p(e, g),
56
- onRemove: () => u(e)
57
+ onQuantityChange: (f) => u(e, f),
58
+ onRemove: () => y(e)
57
59
  },
58
60
  e.id
59
- )) }) : /* @__PURE__ */ i("div", { className: a.noItems, children: /* @__PURE__ */ i(l, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
60
- n && /* @__PURE__ */ r("div", { className: a.subtotal, children: [
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
- f,
67
+ v,
66
68
  {
67
- disabled: t.items.length === 0,
68
- onClick: y,
69
+ disabled: r.items.length === 0,
70
+ onClick: b,
69
71
  variant: "cta-primary",
70
72
  size: "md",
71
- className: a.checkoutButton,
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
- q as CartSlideInPanel
82
+ B as CartSlideInPanel
81
83
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.171",
4
+ "version": "0.0.172",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",