@caseparts-org/caseblocks 0.0.161 → 0.0.162

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.
@@ -1,12 +1,20 @@
1
1
  import { default as React } from 'react';
2
+ import { ContactUsLinkBehavior } from '../Availability/Availability';
2
3
  export interface CartPartProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title"> {
3
4
  imageUrl?: string;
4
5
  imageAlt?: string;
5
6
  title: React.ReactNode;
6
7
  titleHref?: string;
7
- subtitle?: React.ReactNode;
8
- topAction?: React.ReactNode;
9
- purchaseInfo?: React.ReactNode;
10
- actions?: React.ReactNode;
8
+ partNumber?: string | number;
9
+ custom?: boolean;
10
+ availabilityId?: string;
11
+ availability?: string;
12
+ contactHref?: string;
13
+ contactLinkBehavior?: ContactUsLinkBehavior;
14
+ priceLabel?: string;
15
+ price?: string;
16
+ quantity?: number;
17
+ onQuantityChange?: (_quantity: number) => void;
18
+ onRemove?: () => void;
11
19
  }
12
- export declare function CartPart({ imageUrl, imageAlt, title, titleHref, subtitle, topAction, purchaseInfo, actions, className, ...otherProps }: CartPartProps): import("react/jsx-runtime").JSX.Element;
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;
@@ -1,38 +1,70 @@
1
- import { jsxs as e, jsx as m } from "react/jsx-runtime";
2
- import { Link as p } from "../../atoms/Link/Link.js";
3
- import { Text as o } from "../../atoms/Text/Text.js";
4
- import { s as i } from "../../Cart.module-B-yc1ax6.js";
5
- import { Image as g } from "../../atoms/Image/Image.js";
6
- import { c as N } from "../../clsx-OuTLNxxd.js";
7
- function z({
8
- imageUrl: t,
9
- imageAlt: d = "Product image",
10
- title: r,
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { Link as N } from "../../atoms/Link/Link.js";
3
+ import { Text as m } from "../../atoms/Text/Text.js";
4
+ import { s as r } from "../../Cart.module-B-yc1ax6.js";
5
+ import { Image as z } from "../../atoms/Image/Image.js";
6
+ import { c as P } from "../../clsx-OuTLNxxd.js";
7
+ import { Availability as w } from "../Availability/Availability.js";
8
+ import { Pricing as y } from "../Pricing/Pricing.js";
9
+ import { QuantityInput as k } from "../QuantityInput/QuantityInput.js";
10
+ import { Icon as L } from "../../atoms/Icon/Icon.js";
11
+ function B({
12
+ imageUrl: f,
13
+ imageAlt: h = "Product image",
14
+ title: a,
11
15
  titleHref: s,
12
- subtitle: a,
13
- topAction: l,
14
- purchaseInfo: c,
15
- actions: n,
16
- className: h,
17
- ...f
16
+ partNumber: t,
17
+ custom: p,
18
+ availabilityId: u,
19
+ availability: o,
20
+ contactHref: I,
21
+ contactLinkBehavior: g = "new-tab",
22
+ priceLabel: v = "List Price",
23
+ price: c,
24
+ quantity: l,
25
+ onQuantityChange: n,
26
+ onRemove: d,
27
+ className: b,
28
+ ...x
18
29
  }) {
19
- return /* @__PURE__ */ e("li", { className: N(i.cartItem, h), ...f, children: [
20
- /* @__PURE__ */ m(g, { height: 50, width: 50, src: t || "", alt: d, className: i.itemImage }),
21
- /* @__PURE__ */ e("div", { children: [
22
- /* @__PURE__ */ e("div", { className: i.topRow, children: [
23
- /* @__PURE__ */ e("div", { className: i.itemInfo, children: [
24
- /* @__PURE__ */ m(o, { size: "sm", weight: "semibold", children: s ? /* @__PURE__ */ m(p, { href: s, children: r }) : r }),
25
- a && /* @__PURE__ */ m(o, { size: "sm", children: a })
30
+ return /* @__PURE__ */ i("li", { className: P(r.cartItem, b), ...x, children: [
31
+ /* @__PURE__ */ e(z, { height: 50, width: 50, src: f || "", alt: h, className: r.itemImage }),
32
+ /* @__PURE__ */ i("div", { children: [
33
+ /* @__PURE__ */ i("div", { className: r.topRow, children: [
34
+ /* @__PURE__ */ i("div", { className: r.itemInfo, children: [
35
+ /* @__PURE__ */ e(m, { size: "sm", weight: "semibold", children: s ? /* @__PURE__ */ e(N, { href: s, children: a }) : a }),
36
+ t != null && /* @__PURE__ */ i(m, { size: "sm", children: [
37
+ /* @__PURE__ */ e(m, { colorToken: "quaternary", size: "xs", children: p ? "Specs " : "Part # " }),
38
+ t
39
+ ] })
26
40
  ] }),
27
- l
41
+ d && /* @__PURE__ */ e("button", { onClick: d, className: r.removeItem, "aria-label": "Remove item", type: "button", children: /* @__PURE__ */ e(L, { iconKey: "fa-regular fa-trash", size: "sm" }) })
28
42
  ] }),
29
- /* @__PURE__ */ e("div", { className: i.itemManagement, children: [
30
- c && /* @__PURE__ */ m("div", { className: i.purchaseInformation, children: c }),
31
- n
43
+ /* @__PURE__ */ i("div", { className: r.itemManagement, children: [
44
+ /* @__PURE__ */ i("div", { className: r.purchaseInformation, children: [
45
+ o && /* @__PURE__ */ e(
46
+ w,
47
+ {
48
+ availId: u || "",
49
+ availDescription: o,
50
+ contactHref: I || "",
51
+ contactLinkBehavior: g
52
+ }
53
+ ),
54
+ c && /* @__PURE__ */ e(y, { pricingLabel: v, price: c })
55
+ ] }),
56
+ typeof l == "number" && n && /* @__PURE__ */ e(
57
+ k,
58
+ {
59
+ quantity: l,
60
+ onQuantityChange: n,
61
+ size: "sm"
62
+ }
63
+ )
32
64
  ] })
33
65
  ] })
34
66
  ] });
35
67
  }
36
68
  export {
37
- z as CartPart
69
+ B as CartPart
38
70
  };
@@ -12,7 +12,17 @@ declare const meta: {
12
12
  imageAlt: string;
13
13
  title: string;
14
14
  titleHref: string;
15
- subtitle: import("react/jsx-runtime").JSX.Element;
15
+ partNumber: string;
16
+ custom: false;
17
+ availabilityId: string;
18
+ availability: string;
19
+ contactHref: string;
20
+ contactLinkBehavior: "new-tab";
21
+ priceLabel: string;
22
+ price: string;
23
+ quantity: number;
24
+ onQuantityChange: () => void;
25
+ onRemove: () => void;
16
26
  };
17
27
  };
18
28
  export default meta;
@@ -1,14 +1,8 @@
1
- import { jsxs as e, jsx as t, Fragment as a } from "react/jsx-runtime";
2
- import { Text as n } from "../../atoms/Text/Text.js";
3
- import { Icon as s } from "../../atoms/Icon/Icon.js";
4
- import { Button as l } from "../../atoms/Button/Button.js";
5
- import { Availability as o } from "../Availability/Availability.js";
6
- import { Pricing as c } from "../Pricing/Pricing.js";
7
- import { QuantityInput as d } from "../QuantityInput/QuantityInput.js";
8
- import { CartPart as r } from "./CartPart.js";
9
- const v = {
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { CartPart as e } from "./CartPart.js";
3
+ const l = {
10
4
  title: "Case Parts/Molecules/CartPart",
11
- component: r,
5
+ component: e,
12
6
  parameters: {
13
7
  layout: "centered"
14
8
  },
@@ -18,63 +12,35 @@ const v = {
18
12
  imageAlt: "1094-01 product image",
19
13
  title: "Kason Door Closer - Flush",
20
14
  titleHref: "#",
21
- subtitle: /* @__PURE__ */ e(a, { children: [
22
- /* @__PURE__ */ t(n, { colorToken: "quaternary", size: "xs", children: "Part # " }),
23
- "1094-01"
24
- ] })
15
+ partNumber: "1094-01",
16
+ custom: !1,
17
+ availabilityId: "available",
18
+ availability: "In Stock",
19
+ contactHref: "#",
20
+ contactLinkBehavior: "new-tab",
21
+ priceLabel: "List Price",
22
+ price: "$99.99",
23
+ quantity: 1,
24
+ onQuantityChange: () => {
25
+ },
26
+ onRemove: () => {
27
+ }
25
28
  }
26
- }, I = {
27
- args: {
28
- purchaseInfo: /* @__PURE__ */ e(a, { children: [
29
- /* @__PURE__ */ t(
30
- o,
31
- {
32
- availId: "available",
33
- availDescription: "In Stock",
34
- contactHref: "#",
35
- contactLinkBehavior: "new-tab"
36
- }
37
- ),
38
- /* @__PURE__ */ t(c, { pricingLabel: "List Price", price: "$99.99" })
39
- ] }),
40
- actions: /* @__PURE__ */ t(
41
- d,
42
- {
43
- quantity: 1,
44
- onQuantityChange: () => {
45
- },
46
- size: "sm"
47
- }
48
- ),
49
- topAction: /* @__PURE__ */ t("button", { type: "button", "aria-label": "Remove item", style: { border: "none", background: "transparent", padding: 0 }, children: /* @__PURE__ */ t(s, { iconKey: "fa-regular fa-trash", size: "sm" }) })
50
- },
51
- render: (i) => /* @__PURE__ */ t("div", { style: { width: 360 }, children: /* @__PURE__ */ t("ul", { style: { margin: 0, padding: 0 }, children: /* @__PURE__ */ t(r, { ...i }) }) })
52
- }, k = {
29
+ }, o = {
30
+ render: (a) => /* @__PURE__ */ t("div", { style: { width: 360 }, children: /* @__PURE__ */ t("ul", { style: { margin: 0, padding: 0 }, children: /* @__PURE__ */ t(e, { ...a }) }) })
31
+ }, s = {
53
32
  args: {
54
33
  title: "Custom-Molded Snap-In Magnetic Gasket",
55
- subtitle: /* @__PURE__ */ e(a, { children: [
56
- /* @__PURE__ */ t(n, { colorToken: "quaternary", size: "xs", children: "Specs " }),
57
- 'MG064 36\\" x 79\\" 3-Sided Dart-to-Dart Gasket'
58
- ] }),
59
- purchaseInfo: /* @__PURE__ */ e(a, { children: [
60
- /* @__PURE__ */ t(
61
- o,
62
- {
63
- availId: "contact",
64
- availDescription: "Contact us for availability",
65
- contactHref: "#",
66
- contactLinkBehavior: "new-tab"
67
- }
68
- ),
69
- /* @__PURE__ */ t(c, { pricingLabel: "List Price", price: "$129.99" })
70
- ] }),
71
- actions: /* @__PURE__ */ t(l, { type: "button", variant: "secondary", size: "sm", children: "Remove" }),
72
- topAction: null
34
+ partNumber: 'MG064 36" x 79" 3-Sided Dart-to-Dart Gasket',
35
+ custom: !0,
36
+ availabilityId: "contact",
37
+ availability: "Contact us for availability",
38
+ price: "$129.99"
73
39
  },
74
- render: (i) => /* @__PURE__ */ t("div", { style: { width: 360 }, children: /* @__PURE__ */ t("ul", { style: { margin: 0, padding: 0 }, children: /* @__PURE__ */ t(r, { ...i }) }) })
40
+ render: (a) => /* @__PURE__ */ t("div", { style: { width: 360 }, children: /* @__PURE__ */ t("ul", { style: { margin: 0, padding: 0 }, children: /* @__PURE__ */ t(e, { ...a }) }) })
75
41
  };
76
42
  export {
77
- I as Basic,
78
- k as CustomSpecs,
79
- v as default
43
+ o as Basic,
44
+ s as CustomSpecs,
45
+ l as default
80
46
  };
@@ -1,91 +1,74 @@
1
- import { jsx as e, jsxs as a, Fragment as s } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as r } from "react/jsx-runtime";
2
2
  import { SlideInPanel as b } from "../../atoms/SlideInPanel/SlideInPanel.js";
3
- import { Text as n } from "../../atoms/Text/Text.js";
4
- import { Button as I } from "../../atoms/Button/Button.js";
5
- import { Pricing as z } from "../Pricing/Pricing.js";
6
- import { QuantityInput as k } from "../QuantityInput/QuantityInput.js";
7
- import { Availability as C } from "../Availability/Availability.js";
8
- import { Icon as c } from "../../atoms/Icon/Icon.js";
9
- import { CartPart as N } from "./CartPart.js";
10
- import { s as r } from "../../Cart.module-B-yc1ax6.js";
11
- function j({
12
- open: d,
13
- onClose: l,
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-B-yc1ax6.js";
8
+ function q({
9
+ open: o,
10
+ onClose: m,
14
11
  cart: t,
15
- subtotal: m,
16
- itemPriceLabel: h,
17
- contactHref: p,
18
- contactLinkBehavior: u,
19
- onItemQtyChange: f,
20
- onItemDelete: g,
12
+ subtotal: n,
13
+ itemPriceLabel: d,
14
+ contactHref: c,
15
+ contactLinkBehavior: h,
16
+ onItemQtyChange: p,
17
+ onItemDelete: u,
21
18
  onCheckout: y
22
19
  }) {
23
- var o;
24
- return t = t || { items: [] }, /* @__PURE__ */ e(
20
+ var s;
21
+ return t = t || { items: [] }, /* @__PURE__ */ i(
25
22
  b,
26
23
  {
27
24
  side: "right",
28
- open: d,
29
- onClose: l,
25
+ open: o,
26
+ onClose: m,
30
27
  ariaLabel: "Shopping Cart",
31
- children: /* @__PURE__ */ a("div", { id: "cart-panel", className: r.cartContainer, children: [
32
- /* @__PURE__ */ a("div", { className: r.headerWrapper, children: [
33
- /* @__PURE__ */ a("div", { className: r.header, children: [
34
- /* @__PURE__ */ e(n, { size: "2xl", children: "Cart" }),
35
- /* @__PURE__ */ a(n, { size: "xs", colorToken: "quaternary", children: [
36
- (o = t == null ? void 0 : t.items) == null ? void 0 : o.length,
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: [
31
+ /* @__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,
37
34
  " items in your cart"
38
35
  ] })
39
36
  ] }),
40
- /* @__PURE__ */ e("button", { onClick: l, children: /* @__PURE__ */ e(c, { iconKey: "fa-regular fa-xmark", size: "md" }) })
37
+ /* @__PURE__ */ i("button", { onClick: m, children: /* @__PURE__ */ i(v, { iconKey: "fa-regular fa-xmark", size: "md" }) })
41
38
  ] }),
42
- /* @__PURE__ */ e("div", { className: r.cartItems, children: t.items.length > 0 ? /* @__PURE__ */ e("ul", { children: t.items.map((i) => /* @__PURE__ */ e(
43
- N,
39
+ /* @__PURE__ */ i("div", { className: a.cartItems, children: t.items.length > 0 ? /* @__PURE__ */ i("ul", { children: t.items.map((e) => /* @__PURE__ */ i(
40
+ I,
44
41
  {
45
- imageUrl: i.imageUrl,
46
- imageAlt: `${i.itemId} product image`,
47
- title: i.description,
48
- titleHref: i.itemHref || `/part/${i.itemId}`,
49
- subtitle: /* @__PURE__ */ a(s, { children: [
50
- /* @__PURE__ */ e(n, { colorToken: "quaternary", size: "xs", children: i.custom ? "Specs " : "Part # " }),
51
- i.itemId
52
- ] }),
53
- topAction: /* @__PURE__ */ e("button", { onClick: () => g(i), className: r.removeItem, "aria-label": "Remove item", children: /* @__PURE__ */ e(c, { iconKey: "fa-regular fa-trash", size: "sm" }) }),
54
- purchaseInfo: /* @__PURE__ */ a(s, { children: [
55
- /* @__PURE__ */ e(
56
- C,
57
- {
58
- availId: i.availabilityId || "",
59
- availDescription: i.availability || "",
60
- contactHref: p || "",
61
- contactLinkBehavior: u || "new-tab"
62
- }
63
- ),
64
- /* @__PURE__ */ e(z, { pricingLabel: h || "List Price", price: i.price })
65
- ] }),
66
- actions: /* @__PURE__ */ e(
67
- k,
68
- {
69
- quantity: i.quantity,
70
- onQuantityChange: (v) => f(i, v),
71
- size: "sm"
72
- }
73
- )
42
+ imageUrl: e.imageUrl,
43
+ imageAlt: `${e.itemId} product image`,
44
+ title: e.description,
45
+ titleHref: e.itemHref || `/part/${e.itemId}`,
46
+ partNumber: e.itemId,
47
+ custom: !!e.custom,
48
+ availabilityId: e.availabilityId,
49
+ availability: e.availability,
50
+ contactHref: c,
51
+ contactLinkBehavior: h,
52
+ price: e.price,
53
+ priceLabel: d || "List Price",
54
+ quantity: e.quantity,
55
+ onQuantityChange: (g) => p(e, g),
56
+ onRemove: () => u(e)
74
57
  },
75
- i.id
76
- )) }) : /* @__PURE__ */ e("div", { className: r.noItems, children: /* @__PURE__ */ e(n, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
77
- m && /* @__PURE__ */ a("div", { className: r.subtotal, children: [
78
- /* @__PURE__ */ e(n, { size: "md", weight: "semibold", children: "Subtotal" }),
79
- /* @__PURE__ */ e(n, { size: "md", weight: "semibold", children: m })
58
+ 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(l, { size: "md", weight: "semibold", children: "Subtotal" }),
62
+ /* @__PURE__ */ i(l, { size: "md", weight: "semibold", children: n })
80
63
  ] }),
81
- /* @__PURE__ */ e(
82
- I,
64
+ /* @__PURE__ */ i(
65
+ f,
83
66
  {
84
67
  disabled: t.items.length === 0,
85
68
  onClick: y,
86
69
  variant: "cta-primary",
87
70
  size: "md",
88
- className: r.checkoutButton,
71
+ className: a.checkoutButton,
89
72
  children: "Checkout"
90
73
  }
91
74
  )
@@ -94,5 +77,5 @@ function j({
94
77
  );
95
78
  }
96
79
  export {
97
- j as CartSlideInPanel
80
+ q as CartSlideInPanel
98
81
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.161",
4
+ "version": "0.0.162",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",