@caseparts-org/caseblocks 0.0.91 → 0.0.93

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,120 +1,131 @@
1
- import { jsxs as H, Fragment as N, jsx as F } from "react/jsx-runtime";
2
- import * as r from "react";
3
- import { c as M } from "../../clsx-OuTLNxxd.js";
4
- import { r as O } from "../../index-B4KbmMH3.js";
5
- import '../../assets/Tooltip.css';const W = "_tooltip_17o7a_1", A = "_content_17o7a_11", S = {
6
- tooltip: W,
7
- content: A
1
+ import { jsxs as N, Fragment as O, jsx as M } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { c as S } from "../../clsx-OuTLNxxd.js";
4
+ import { r as W } from "../../index-B4KbmMH3.js";
5
+ import '../../assets/Tooltip.css';const A = "_tooltip_17o7a_1", D = "_content_17o7a_11", j = {
6
+ tooltip: A,
7
+ content: D
8
8
  };
9
- function D(l) {
9
+ function I(l) {
10
10
  return l ? l.includes(" ") ? l : `${l} center` : "top center";
11
11
  }
12
- function I(l) {
13
- const m = D(l).toLowerCase(), [i, t] = m.split(" ");
14
- return { side: ["top", "right", "bottom", "left"].includes(i) ? i : "top", align: t === "left" || t === "top" ? "start" : t === "right" || t === "bottom" ? "end" : "center" };
12
+ function $(l) {
13
+ const v = I(l).toLowerCase(), [s, t] = v.split(" ");
14
+ return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: t === "left" || t === "top" ? "start" : t === "right" || t === "bottom" ? "end" : "center" };
15
15
  }
16
- function $(l, m, i, t, a = 8) {
17
- const e = l.getBoundingClientRect(), u = m.getBoundingClientRect();
18
- let f = 0, s = 0;
19
- i === "top" ? f = e.top - u.height - a : i === "bottom" ? f = e.bottom + a : i === "left" ? s = e.left - u.width - a : i === "right" && (s = e.right + a), i === "top" || i === "bottom" ? t === "start" ? s = e.left : t === "end" ? s = e.right - u.width : s = e.left + e.width / 2 - u.width / 2 : t === "start" ? f = e.top : t === "end" ? f = e.bottom - u.height : f = e.top + e.height / 2 - u.height / 2;
20
- const h = window.innerWidth, w = window.innerHeight;
21
- return f = Math.max(4, Math.min(w - u.height - 4, f)), s = Math.max(4, Math.min(h - u.width - 4, s)), { top: f, left: s };
16
+ function q(l, v, s, t, d = 8) {
17
+ const n = l.getBoundingClientRect(), u = v.getBoundingClientRect();
18
+ let f = 0, c = 0;
19
+ s === "top" ? f = n.top - u.height - d : s === "bottom" ? f = n.bottom + d : s === "left" ? c = n.left - u.width - d : s === "right" && (c = n.right + d), s === "top" || s === "bottom" ? t === "start" ? c = n.left : t === "end" ? c = n.right - u.width : c = n.left + n.width / 2 - u.width / 2 : t === "start" ? f = n.top : t === "end" ? f = n.bottom - u.height : f = n.top + n.height / 2 - u.height / 2;
20
+ const E = window.innerWidth, R = window.innerHeight;
21
+ return f = Math.max(4, Math.min(R - u.height - 4, f)), c = Math.max(4, Math.min(E - u.width - 4, c)), { top: f, left: c };
22
22
  }
23
- const K = ({
23
+ const Q = ({
24
24
  tooltipClassName: l,
25
- contentClassName: m,
26
- children: i,
25
+ contentClassName: v,
26
+ children: s,
27
27
  trigger: t,
28
- position: a,
29
- disabled: e,
28
+ position: d,
29
+ disabled: n,
30
30
  openDelay: u = 150,
31
31
  closeDelay: f = 100,
32
- leaveGraceMs: s = 0
32
+ leaveGraceMs: c = 0
33
33
  }) => {
34
- const { side: h, align: w } = I(a), [c, E] = r.useState(!1), [d, g] = r.useState(null), _ = r.useRef(null), z = r.useRef(null), T = r.useRef(null), R = r.useRef(null), y = r.useRef(null), L = r.useRef(!1), p = (n) => {
35
- n.current && (window.clearTimeout(n.current), n.current = null);
36
- }, C = () => {
37
- p(T), p(R), p(y);
34
+ const { side: E, align: R } = $(d), [o, y] = i.useState(!1), [m, C] = i.useState(null), T = i.useRef(null), g = i.useRef(null), x = i.useRef(null), L = i.useRef(null), P = i.useRef(null), w = i.useRef(!1), a = (e) => {
35
+ e.current && (window.clearTimeout(e.current), e.current = null);
36
+ }, B = () => {
37
+ a(x), a(L), a(P);
38
38
  };
39
- r.useEffect(() => () => C(), []);
40
- const B = () => {
41
- e || c || (p(T), T.current = window.setTimeout(() => E(!0), u));
42
- }, x = () => {
43
- c && (p(R), R.current = window.setTimeout(() => {
44
- L.current || E(!1);
39
+ i.useEffect(() => () => B(), []);
40
+ const k = () => {
41
+ n || o || (a(x), x.current = window.setTimeout(() => y(!0), u));
42
+ }, _ = () => {
43
+ o && (a(L), L.current = window.setTimeout(() => {
44
+ w.current || y(!1);
45
45
  }, f));
46
- }, k = () => {
47
- if (c) {
48
- if (p(y), s <= 0) {
49
- x();
46
+ }, z = () => {
47
+ if (o) {
48
+ if (a(P), c <= 0) {
49
+ _();
50
50
  return;
51
51
  }
52
- y.current = window.setTimeout(() => {
53
- L.current || x();
54
- }, s);
52
+ P.current = window.setTimeout(() => {
53
+ w.current || _();
54
+ }, c);
55
55
  }
56
- }, P = (n, o) => (b) => {
57
- n == null || n(b), o == null || o(b);
58
- }, j = r.cloneElement(t, {
59
- ref: (n) => {
60
- const { ref: o } = t;
61
- typeof o == "function" ? o(n) : o && (o.current = n), _.current = n;
56
+ }, b = (e, r) => (h) => {
57
+ e == null || e(h), r == null || r(h);
58
+ }, H = i.cloneElement(t, {
59
+ ref: (e) => {
60
+ const { ref: r } = t;
61
+ typeof r == "function" ? r(e) : r && (r.current = e), T.current = e;
62
62
  },
63
- onPointerEnter: P(t.props.onPointerEnter, B),
64
- onPointerLeave: P(t.props.onPointerLeave, k),
65
- onFocus: P(t.props.onFocus, B),
66
- onBlur: P(t.props.onBlur, x),
67
- "aria-describedby": c ? "tooltip-popup" : void 0,
63
+ onPointerEnter: b(t.props.onPointerEnter, k),
64
+ onPointerLeave: b(t.props.onPointerLeave, z),
65
+ onFocus: b(t.props.onFocus, k),
66
+ onBlur: b(t.props.onBlur, _),
67
+ "aria-describedby": o ? "tooltip-popup" : void 0,
68
68
  style: { ...t.props.style || {}, outline: "none" }
69
69
  });
70
- return r.useEffect(() => {
71
- e && c && (C(), E(!1));
72
- }, [e]), r.useEffect(() => {
73
- if (!c) return;
74
- const n = (o) => {
75
- o.key === "Escape" && E(!1);
70
+ return i.useEffect(() => {
71
+ n && o && (B(), y(!1));
72
+ }, [n]), i.useEffect(() => {
73
+ if (!o) return;
74
+ const e = (r) => {
75
+ r.key === "Escape" && y(!1);
76
76
  };
77
- return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
78
- }, [c]), r.useLayoutEffect(() => {
79
- if (!c) {
80
- g(null);
77
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
78
+ }, [o]), i.useLayoutEffect(() => {
79
+ if (!o) {
80
+ C(null);
81
81
  return;
82
82
  }
83
- const n = _.current, o = z.current;
84
- if (!n || !o) return;
85
- const b = 8, v = () => {
86
- g($(n, o, h, w, b));
83
+ const e = T.current, r = g.current;
84
+ if (!e || !r) return;
85
+ const h = 8, p = () => {
86
+ C(q(e, r, E, R, h));
87
+ };
88
+ return p(), window.addEventListener("resize", p), window.addEventListener("scroll", p, !0), () => {
89
+ window.removeEventListener("resize", p), window.removeEventListener("scroll", p, !0);
87
90
  };
88
- return v(), window.addEventListener("resize", v), window.addEventListener("scroll", v, !0), () => {
89
- window.removeEventListener("resize", v), window.removeEventListener("scroll", v, !0);
91
+ }, [o, E, R, s]), i.useEffect(() => {
92
+ if (!o) return;
93
+ const e = (r) => {
94
+ const h = T.current, p = g.current;
95
+ if (!h || !p) return;
96
+ const F = r.target;
97
+ !h.contains(F) && !p.contains(F) && (w.current = !1, z());
90
98
  };
91
- }, [c, h, w, i]), /* @__PURE__ */ H(N, { children: [
92
- j,
93
- c && typeof document < "u" && O.createPortal(
94
- /* @__PURE__ */ F(
99
+ return document.addEventListener("pointermove", e), () => document.removeEventListener("pointermove", e);
100
+ }, [o]), i.useEffect(() => {
101
+ o || (w.current = !1);
102
+ }, [o]), /* @__PURE__ */ N(O, { children: [
103
+ H,
104
+ o && typeof document < "u" && W.createPortal(
105
+ /* @__PURE__ */ M(
95
106
  "div",
96
107
  {
97
108
  id: "tooltip-popup",
98
- ref: z,
109
+ ref: g,
99
110
  role: "tooltip",
100
- "aria-hidden": !c,
101
- "data-side": h,
102
- "data-align": w,
103
- className: M(S.tooltip, l),
111
+ "aria-hidden": !o,
112
+ "data-side": E,
113
+ "data-align": R,
114
+ className: S(j.tooltip, l),
104
115
  style: {
105
116
  position: "absolute",
106
- top: (d == null ? void 0 : d.top) ?? 0,
107
- left: (d == null ? void 0 : d.left) ?? 0,
108
- visibility: d ? "visible" : "hidden",
117
+ top: (m == null ? void 0 : m.top) ?? 0,
118
+ left: (m == null ? void 0 : m.left) ?? 0,
119
+ visibility: m ? "visible" : "hidden",
109
120
  zIndex: 10
110
121
  },
111
122
  onPointerEnter: () => {
112
- L.current = !0, p(R), p(y);
123
+ w.current = !0, a(L), a(P);
113
124
  },
114
125
  onPointerLeave: () => {
115
- L.current = !1, k();
126
+ w.current = !1, z();
116
127
  },
117
- children: /* @__PURE__ */ F("div", { className: M(S.content, m), children: i })
128
+ children: /* @__PURE__ */ M("div", { className: S(j.content, v), children: s })
118
129
  }
119
130
  ),
120
131
  document.body
@@ -122,5 +133,5 @@ const K = ({
122
133
  ] });
123
134
  };
124
135
  export {
125
- K as Tooltip
136
+ Q as Tooltip
126
137
  };
@@ -11,6 +11,8 @@ export type { ChipProps } from './molecules/Chip/Chip';
11
11
  export { ToggleView } from './molecules/ToggleView/ToggleView';
12
12
  export type { ToggleViewProps, ToggleOptionProps, ToggleOptionBaseProps, } from './molecules/ToggleView/ToggleView';
13
13
  export type { ShoppingCart, CartItem } from './molecules/Cart/Cart';
14
+ export { CartSlideInPanel } from './molecules/Cart/CartSlideInPanel';
15
+ export type { CartSlideInPanelProps } from './molecules/Cart/CartSlideInPanel';
14
16
  export type { StatefulButtonProps } from './molecules/StatefulButton/StatefulButton';
15
17
  export { StatefulButton } from './molecules/StatefulButton/StatefulButton';
16
18
  export type { AnimatedCheckMarkProps } from './molecules/StatefulButton/AnimatedCheckmark';
@@ -3,14 +3,14 @@ import { Flex as p } from "./atoms/Flex/Flex.js";
3
3
  import { Column as f, Grid as x } from "./atoms/Grid/Grid.js";
4
4
  import { Head as a } from "./atoms/Root/Head.js";
5
5
  import { Icon as l } from "./atoms/Icon/Icon.js";
6
- import { Root as c } from "./atoms/Root/Root.js";
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 A } from "./atoms/Input/Input.js";
10
- import { Link as I } from "./atoms/Link/Link.js";
9
+ import { Input as I } from "./atoms/Input/Input.js";
10
+ import { Link as B } from "./atoms/Link/Link.js";
11
11
  import { linkClassName as h } from "./atoms/Link/linkClassName.js";
12
- import { configureLink as T, routerOverride as s } from "./atoms/Link/configureLink.js";
13
- import { LinkButton as N } from "./atoms/LinkButton/LinkButton.js";
12
+ import { configureLink as P, routerOverride as T } from "./atoms/Link/configureLink.js";
13
+ import { LinkButton as F } from "./atoms/LinkButton/LinkButton.js";
14
14
  import { configureImage as y } from "./atoms/Image/configureImage.js";
15
15
  import { Logo as M } from "./molecules/Logo/Logo.js";
16
16
  import { SearchBox as w } from "./molecules/SearchBox/SearchBox.js";
@@ -27,52 +27,54 @@ import { Tooltip as oo } from "./atoms/Tooltip/Tooltip.js";
27
27
  import { Account as to } from "./molecules/Account/Account.js";
28
28
  import { Chip as po } from "./molecules/Chip/Chip.js";
29
29
  import { ToggleView as fo } from "./molecules/ToggleView/ToggleView.js";
30
- import { StatefulButton as no } from "./molecules/StatefulButton/StatefulButton.js";
31
- import { AnimatedCheckMark as io } from "./molecules/StatefulButton/AnimatedCheckmark.js";
32
- import { AddToCart as uo } from "./molecules/AddToCart/AddToCart.js";
33
- import { MainNav as Co } from "./organisms/MainNav/MainNav.js";
34
- import { ChipSelector as ko } from "./organisms/ChipSelector/ChipSelector.js";
35
- import { Product as Ao } from "./organisms/Product/Product.js";
36
- import { Carousel as Io } from "./organisms/Carousel/Carousel.js";
37
- import { Footer as ho } from "./organisms/Footer/Footer.js";
30
+ import { CartSlideInPanel as no } from "./molecules/Cart/CartSlideInPanel.js";
31
+ import { StatefulButton as io } from "./molecules/StatefulButton/StatefulButton.js";
32
+ import { AnimatedCheckMark as uo } from "./molecules/StatefulButton/AnimatedCheckmark.js";
33
+ import { AddToCart as Co } from "./molecules/AddToCart/AddToCart.js";
34
+ import { MainNav as ko } from "./organisms/MainNav/MainNav.js";
35
+ import { ChipSelector as Io } from "./organisms/ChipSelector/ChipSelector.js";
36
+ import { Product as Bo } from "./organisms/Product/Product.js";
37
+ import { Carousel as ho } from "./organisms/Carousel/Carousel.js";
38
+ import { Footer as Po } from "./organisms/Footer/Footer.js";
38
39
  export {
39
40
  to as Account,
40
- uo as AddToCart,
41
- io as AnimatedCheckMark,
41
+ Co as AddToCart,
42
+ uo as AnimatedCheckMark,
42
43
  V as Availability,
43
44
  q as Avatar,
44
45
  E as BannerCard,
45
46
  t as Button,
46
47
  K as CardLink,
47
- Io as Carousel,
48
+ ho as Carousel,
49
+ no as CartSlideInPanel,
48
50
  po as Chip,
49
- ko as ChipSelector,
51
+ Io as ChipSelector,
50
52
  f as Column,
51
53
  p as Flex,
52
- ho as Footer,
54
+ Po as Footer,
53
55
  x as Grid,
54
56
  a as Head,
55
57
  Y as HorizontalScroll,
56
58
  l as Icon,
57
- A as Input,
58
- I as Link,
59
- N as LinkButton,
59
+ I as Input,
60
+ B as Link,
61
+ F as LinkButton,
60
62
  M as Logo,
61
- Co as MainNav,
63
+ ko as MainNav,
62
64
  W as NotFound,
63
65
  Q as Pricing,
64
- Ao as Product,
66
+ Bo as Product,
65
67
  G as QuantityInput,
66
- c as Root,
68
+ d as Root,
67
69
  w as SearchBox,
68
70
  C as Separator,
69
71
  _ as SlideInPanel,
70
- no as StatefulButton,
72
+ io as StatefulButton,
71
73
  k as Text,
72
74
  fo as ToggleView,
73
75
  oo as Tooltip,
74
76
  y as configureImage,
75
- T as configureLink,
77
+ P as configureLink,
76
78
  h as linkClassName,
77
- s as routerOverride
79
+ T as routerOverride
78
80
  };
@@ -14,13 +14,7 @@ export interface ShoppingCart {
14
14
  items: CartItem[];
15
15
  }
16
16
  export interface CartPropsBase {
17
- onItemQtyChange: (_item: CartItem, _newQuantity: number) => void;
18
- onItemDelete: (_item: CartItem) => void;
19
- onCheckout: () => void;
20
17
  cart: ShoppingCart;
21
- subtotal?: string;
22
- itemPriceLabel?: string;
23
- contactHref?: string;
24
18
  open?: boolean;
25
19
  onCartClick: () => void;
26
20
  }
@@ -1,15 +1,15 @@
1
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
- import { useState as d } from "react";
3
- import { ShoppingCart as r } from "./Cart.js";
4
- import { CartSlideInPanel as s } from "./CartSlideInPanel.js";
5
- const u = {
1
+ import { jsxs as c, Fragment as d, jsx as o } from "react/jsx-runtime";
2
+ import { useState as s } from "react";
3
+ import { ShoppingCart as n } from "./Cart.js";
4
+ import { CartSlideInPanel as m } from "./CartSlideInPanel.js";
5
+ const g = {
6
6
  title: "Case Parts/Molecules/Cart",
7
- component: r,
7
+ component: n,
8
8
  parameters: {
9
9
  layout: "centered"
10
10
  },
11
11
  tags: ["autodocs"]
12
- }, a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", m = {
12
+ }, a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", p = {
13
13
  items: [
14
14
  { id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
15
15
  { id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
@@ -31,90 +31,66 @@ const u = {
31
31
  { id: 3, itemId: "MG064", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
32
32
  { id: 4, itemId: "MG064-B", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" }
33
33
  ]
34
- }, t = (i) => {
35
- const [e, l] = d(!1);
36
- return /* @__PURE__ */ c("div", { style: { width: "100%", display: "flex", justifyContent: "center" }, children: [
34
+ };
35
+ function b(i) {
36
+ return `$${i.items.reduce(
37
+ (t, e) => t + (parseFloat(e.price.replace(/[^0-9.]/g, "")) || 0) * e.quantity,
38
+ 0
39
+ ).toFixed(2)}`;
40
+ }
41
+ const r = (i) => {
42
+ const [l, t] = s(!1);
43
+ return /* @__PURE__ */ c(d, { children: [
37
44
  /* @__PURE__ */ o(
38
- r,
45
+ n,
39
46
  {
40
47
  ...i,
41
- open: e,
42
- onCartClick: () => l((n) => !n)
48
+ open: l,
49
+ onCartClick: () => t((e) => !e)
43
50
  }
44
51
  ),
45
52
  /* @__PURE__ */ o(
46
- s,
53
+ m,
47
54
  {
48
- open: e,
49
- onClose: () => l(!1),
55
+ open: l,
56
+ onClose: () => t(!1),
50
57
  cart: i.cart,
51
- subtotal: i.subtotal,
52
- itemPriceLabel: i.itemPriceLabel,
53
- contactHref: i.contactHref,
54
- onItemQtyChange: i.onItemQtyChange,
55
- onItemDelete: i.onItemDelete,
56
- onCheckout: i.onCheckout,
57
- contactLinkBehavior: "new-tab"
58
+ subtotal: b(i.cart),
59
+ itemPriceLabel: "List Price",
60
+ contactHref: "#",
61
+ contactLinkBehavior: "new-tab",
62
+ onItemDelete: () => alert("Delete"),
63
+ onItemQtyChange: () => alert("Qty Change"),
64
+ onCheckout: () => alert("checkout")
58
65
  }
59
66
  )
60
67
  ] });
61
68
  }, C = {
62
69
  args: {
63
70
  cart: { items: [] },
64
- onCheckout: () => {
65
- alert("Checkout");
66
- },
67
- onItemDelete: () => {
68
- alert("Delete");
69
- },
70
- onItemQtyChange: () => {
71
- alert("Qty Change");
72
- },
73
71
  onCartClick: () => {
74
72
  }
75
- // required placeholder (overridden in render)
73
+ // placeholder
76
74
  },
77
- render: t
78
- }, k = {
75
+ render: r
76
+ }, S = {
79
77
  args: {
80
- cart: m,
81
- onCheckout: () => {
82
- alert("Checkout");
83
- },
84
- onItemDelete: () => {
85
- alert("Delete");
86
- },
87
- onItemQtyChange: () => {
88
- alert("Qty Change");
89
- },
90
- subtotal: "$748.98",
78
+ cart: p,
91
79
  onCartClick: () => {
92
80
  }
93
- // required
94
81
  },
95
- render: t
96
- }, g = {
82
+ render: r
83
+ }, D = {
97
84
  args: {
98
85
  cart: y,
99
- onCheckout: () => {
100
- alert("Checkout");
101
- },
102
- onItemDelete: () => {
103
- alert("Delete");
104
- },
105
- onItemQtyChange: () => {
106
- alert("Qty Change");
107
- },
108
- subtotal: "$748.98",
109
86
  onCartClick: () => {
110
87
  }
111
- // required
112
88
  },
113
- render: t
89
+ render: r
114
90
  };
115
91
  export {
116
92
  C as EmptyCart,
117
- k as LargeCart,
118
- g as SmallCart,
119
- u as default
93
+ S as LargeCart,
94
+ D as SmallCart,
95
+ g as default
120
96
  };
@@ -1,7 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { CartPropsBase, ShoppingCart, ShoppingCartHandle } from '../../molecules/Cart/Cart';
3
3
  import { AccountProps } from '../../molecules/Account/Account';
4
- import { ContactUsLinkBehavior } from 'lib/main-client';
5
4
  export interface Category {
6
5
  id: string | number;
7
6
  label: string;
@@ -21,9 +20,6 @@ export interface MainNavProps extends CartPropsBase, React.HTMLAttributes<HTMLDi
21
20
  accountRoute: string;
22
21
  contactRoute: string;
23
22
  cart: ShoppingCart;
24
- cartSubtotal?: string;
25
- cartItemPriceLabel?: string;
26
- cartContactLinkBehavior?: ContactUsLinkBehavior;
27
23
  onLoginClick: () => void;
28
24
  onSearch: (_input: string) => void;
29
25
  }
@@ -1,55 +1,49 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import I from "react";
2
+ import b from "react";
3
3
  import { Text as _ } from "../../atoms/Text/Text.js";
4
- import { Link as s } from "../../atoms/Link/Link.js";
5
- import { Icon as U } from "../../atoms/Icon/Icon.js";
4
+ import { Link as l } from "../../atoms/Link/Link.js";
5
+ import { Icon as j } from "../../atoms/Icon/Icon.js";
6
6
  import { Flex as t } from "../../atoms/Flex/Flex.js";
7
- import { Grid as B, Column as F } from "../../atoms/Grid/Grid.js";
8
- import { Logo as H } from "../../molecules/Logo/Logo.js";
7
+ import { Grid as D, Column as M } from "../../atoms/Grid/Grid.js";
8
+ import { Logo as z } from "../../molecules/Logo/Logo.js";
9
9
  import { SearchBox as p } from "../../molecules/SearchBox/SearchBox.js";
10
- import { HamburgerMenu as P } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
11
- import { ShoppingCart as S } from "../../molecules/Cart/Cart.js";
12
- import { Account as G } from "../../molecules/Account/Account.js";
13
- import { CategoryNav as K } from "../../molecules/CategoryNav/CategoryNav.js";
14
- import { c as Q } from "../../clsx-OuTLNxxd.js";
15
- import '../../assets/MainNav.css';const T = "_main_1l043_1", W = "_column_1l043_8", q = "_topNav_1l043_13", E = "_logo_1l043_21", J = "_operations_1l043_24", O = "_search_1l043_31", V = "_siteLink_1l043_34", X = "_accountArea_1l043_38", Y = "_category_1l043_50", Z = "_menuList_1l043_72", r = {
16
- main: T,
17
- column: W,
18
- topNav: q,
19
- logo: E,
20
- operations: J,
21
- search: O,
22
- siteLink: V,
23
- accountArea: X,
24
- category: Y,
25
- menuList: Z
26
- }, fe = I.forwardRef(function({
10
+ import { HamburgerMenu as I } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
11
+ import { ShoppingCart as U } from "../../molecules/Cart/Cart.js";
12
+ import { Account as F } from "../../molecules/Account/Account.js";
13
+ import { CategoryNav as S } from "../../molecules/CategoryNav/CategoryNav.js";
14
+ import { c as B } from "../../clsx-OuTLNxxd.js";
15
+ import '../../assets/MainNav.css';const G = "_main_1l043_1", H = "_column_1l043_8", K = "_topNav_1l043_13", P = "_logo_1l043_21", Q = "_operations_1l043_24", T = "_search_1l043_31", W = "_siteLink_1l043_34", q = "_accountArea_1l043_38", E = "_category_1l043_50", J = "_menuList_1l043_72", r = {
16
+ main: G,
17
+ column: H,
18
+ topNav: K,
19
+ logo: P,
20
+ operations: Q,
21
+ search: T,
22
+ siteLink: W,
23
+ accountArea: q,
24
+ category: E,
25
+ menuList: J
26
+ }, ae = b.forwardRef(function({
27
27
  account: c,
28
28
  categories: n,
29
- byModelSerialRoute: h,
29
+ byModelSerialRoute: m,
30
30
  homeRoute: u,
31
31
  faqRoute: N,
32
- customPartsRoute: d,
32
+ customPartsRoute: h,
33
33
  aboutUsRoute: g,
34
34
  accountRoute: v,
35
- contactRoute: a,
35
+ contactRoute: d,
36
36
  cart: A,
37
- cartSubtotal: L,
38
- cartItemPriceLabel: x,
39
- cartContactLinkBehavior: $,
40
- onLoginClick: C,
37
+ onLoginClick: x,
41
38
  onSearch: f,
42
- onItemQtyChange: k,
43
- onItemDelete: w,
44
- onCheckout: y,
45
- open: b,
39
+ open: L,
46
40
  // NEW: consume external panel control props from CartPropsBase
47
- onCartClick: j,
41
+ onCartClick: C,
48
42
  // NEW: callback from consumer
49
- className: D,
50
- ...M
51
- }, z) {
52
- return /* @__PURE__ */ e(B, { ...M, gridWrapperClassName: Q(r.main, D), children: /* @__PURE__ */ o(F, { span: 12, className: r.column, children: [
43
+ className: k,
44
+ ...w
45
+ }, y) {
46
+ return /* @__PURE__ */ e(D, { ...w, gridWrapperClassName: B(r.main, k), children: /* @__PURE__ */ o(M, { span: 12, className: r.column, children: [
53
47
  /* @__PURE__ */ o(
54
48
  t,
55
49
  {
@@ -58,7 +52,7 @@ import '../../assets/MainNav.css';const T = "_main_1l043_1", W = "_column_1l043_
58
52
  justifyContent: "space-between",
59
53
  className: r.topNav,
60
54
  children: [
61
- /* @__PURE__ */ e("div", { className: r.logo, children: /* @__PURE__ */ e(s, { href: u, children: /* @__PURE__ */ e(H, {}) }) }),
55
+ /* @__PURE__ */ e("div", { className: r.logo, children: /* @__PURE__ */ e(l, { href: u, children: /* @__PURE__ */ e(z, {}) }) }),
62
56
  /* @__PURE__ */ o(
63
57
  t,
64
58
  {
@@ -68,50 +62,44 @@ import '../../assets/MainNav.css';const T = "_main_1l043_1", W = "_column_1l043_
68
62
  className: r.operations,
69
63
  children: [
70
64
  /* @__PURE__ */ e(t, { flexDirection: "row", hideAt: ["sm"], className: r.search, children: /* @__PURE__ */ e(p, { onSearch: f, inputName: "cpc-search" }) }),
71
- /* @__PURE__ */ e(i, { href: h, hideAt: ["sm", "md"], children: "Model/Serial" }),
72
- /* @__PURE__ */ e(i, { href: d, hideAt: ["sm", "md"], children: "Custom Parts" }),
73
- /* @__PURE__ */ e(i, { href: a, hideAt: ["sm", "md"], children: "Contact Us" }),
65
+ /* @__PURE__ */ e(i, { href: m, hideAt: ["sm", "md"], children: "Model/Serial" }),
66
+ /* @__PURE__ */ e(i, { href: h, hideAt: ["sm", "md"], children: "Custom Parts" }),
67
+ /* @__PURE__ */ e(i, { href: d, hideAt: ["sm", "md"], children: "Contact Us" }),
74
68
  /* @__PURE__ */ e("div", { className: r.accountArea, children: /* @__PURE__ */ e(
75
- G,
69
+ F,
76
70
  {
77
71
  account: c,
78
72
  accountRoute: v,
79
- onLoginClick: C,
73
+ onLoginClick: x,
80
74
  className: r.avatar
81
75
  }
82
76
  ) }),
83
77
  /* @__PURE__ */ e(
84
- S,
78
+ U,
85
79
  {
86
- ref: z,
80
+ ref: y,
87
81
  cart: A,
88
- open: b,
89
- onCartClick: j,
90
- onItemDelete: w,
91
- onItemQtyChange: k,
92
- onCheckout: y,
93
- subtotal: L,
94
- contactHref: a,
95
- itemPriceLabel: x
82
+ open: L,
83
+ onCartClick: C
96
84
  }
97
85
  ),
98
- /* @__PURE__ */ e(P, { hideAt: ["lg"], children: /* @__PURE__ */ o("ul", { className: r.menuList, children: [
99
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: h, children: "Make/Serial" }) }),
100
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: d, children: "Custom Parts" }) }),
101
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: a, children: "Contact Us" }) }),
86
+ /* @__PURE__ */ e(I, { hideAt: ["lg"], children: /* @__PURE__ */ o("ul", { className: r.menuList, children: [
87
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: m, children: "Make/Serial" }) }),
88
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: h, children: "Custom Parts" }) }),
89
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: d, children: "Contact Us" }) }),
102
90
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: N, children: "FAQ" }) }),
103
91
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: g, children: "About Us" }) }),
104
- n && n.map((l) => /* @__PURE__ */ e("li", { className: r.category, children: /* @__PURE__ */ o(s, { href: l.route, children: [
105
- /* @__PURE__ */ e(_, { size: "sm", weight: "semibold", children: l.label }),
92
+ n && n.map((a) => /* @__PURE__ */ e("li", { className: r.category, children: /* @__PURE__ */ o(l, { href: a.route, children: [
93
+ /* @__PURE__ */ e(_, { size: "sm", weight: "semibold", children: a.label }),
106
94
  /* @__PURE__ */ e(
107
- U,
95
+ j,
108
96
  {
109
97
  iconKey: "fa-solid fa-chevron-right",
110
98
  title: "Navigate",
111
99
  size: "sm"
112
100
  }
113
101
  )
114
- ] }) }, l.id))
102
+ ] }) }, a.id))
115
103
  ] }) })
116
104
  ]
117
105
  }
@@ -120,16 +108,16 @@ import '../../assets/MainNav.css';const T = "_main_1l043_1", W = "_column_1l043_
120
108
  }
121
109
  ),
122
110
  /* @__PURE__ */ e(t, { flexDirection: "row", hideAt: ["md", "lg"], children: /* @__PURE__ */ e(p, { onSearch: f, inputName: "cpc-search", className: r.search }) }),
123
- /* @__PURE__ */ e(K, { categories: n })
111
+ /* @__PURE__ */ e(S, { categories: n })
124
112
  ] }) });
125
113
  });
126
114
  function i({
127
- href: m,
115
+ href: s,
128
116
  children: c,
129
117
  ...n
130
118
  }) {
131
- return /* @__PURE__ */ e(s, { href: m, className: r.siteLink, ...n, children: /* @__PURE__ */ e(_, { size: "md", variant: "display", children: c }) });
119
+ return /* @__PURE__ */ e(l, { href: s, className: r.siteLink, ...n, children: /* @__PURE__ */ e(_, { size: "md", variant: "display", children: c }) });
132
120
  }
133
121
  export {
134
- fe as MainNav
122
+ ae as MainNav
135
123
  };
@@ -1,16 +1,16 @@
1
- import { jsxs as u, Fragment as s, jsx as r } from "react/jsx-runtime";
2
- import { useState as m } from "react";
3
- import { MainNav as c } from "./MainNav.js";
4
- import { CartSlideInPanel as b } from "../../molecules/Cart/CartSlideInPanel.js";
5
- const C = {
1
+ import { jsxs as s, Fragment as u, jsx as c } from "react/jsx-runtime";
2
+ import { useState as b } from "react";
3
+ import { MainNav as d } from "./MainNav.js";
4
+ import { CartSlideInPanel as m } from "../../molecules/Cart/CartSlideInPanel.js";
5
+ const g = {
6
6
  title: "Case Parts/Organisms/MainNav",
7
- component: c,
7
+ component: d,
8
8
  parameters: {
9
9
  // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
10
10
  layout: "fullscreen"
11
11
  }
12
12
  // tags: ["autodocs"],
13
- }, a = [
13
+ }, l = [
14
14
  {
15
15
  id: 0,
16
16
  label: "Shop by Brands",
@@ -27,7 +27,12 @@ const C = {
27
27
  id: 1,
28
28
  label: "Gaskets",
29
29
  route: "#",
30
- children: []
30
+ children: [
31
+ { id: 25, label: "Sponge", route: "/anthony" },
32
+ { id: 26, label: "Magnetic", route: "/beverage" },
33
+ { id: 27, label: "Compression", route: "/continental" },
34
+ { id: 28, label: "Door Sweep", route: "/delfield" }
35
+ ]
31
36
  },
32
37
  {
33
38
  id: 2,
@@ -83,52 +88,59 @@ const C = {
83
88
  route: "#",
84
89
  children: []
85
90
  }
86
- ], t = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", i = {
91
+ ], a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", r = {
87
92
  items: [
88
- { id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
89
- { id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
90
- { id: 3, itemId: "MG064", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
91
- { id: 4, itemId: "MG064-B", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
92
- { id: 5, itemId: "Warmer Wire", description: '228" 7.0 OHMS 115V', price: "$99.99", quantity: 1, imageUrl: t, availability: "", availabilityId: "available" },
93
- { id: 6, itemId: "810803", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
94
- { id: 7, itemId: "ABG-12114-PF", description: "Adhesive Sponge Gasket 1/4", price: "$99.99", quantity: 10, imageUrl: t, availability: "In Stock", availabilityId: "available" },
95
- { id: 8, itemId: "ABG-12138-PF", description: "Adhesive Sponge Gasket 3/8", price: "$99.99", quantity: 10, imageUrl: t, availability: "In Stock", availabilityId: "available" },
96
- { id: 9, itemId: "1094-C1", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
97
- { id: 10, itemId: "1094-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
98
- { id: 11, itemId: "1092-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
99
- { id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" }
93
+ { id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
94
+ { id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
95
+ { id: 3, itemId: "MG064", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
96
+ { id: 4, itemId: "MG064-B", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
97
+ { id: 5, itemId: "Warmer Wire", description: '228" 7.0 OHMS 115V', price: "$99.99", quantity: 1, imageUrl: a, availability: "", availabilityId: "available" },
98
+ { id: 6, itemId: "810803", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
99
+ { id: 7, itemId: "ABG-12114-PF", description: "Adhesive Sponge Gasket 1/4", price: "$99.99", quantity: 10, imageUrl: a, availability: "In Stock", availabilityId: "available" },
100
+ { id: 8, itemId: "ABG-12138-PF", description: "Adhesive Sponge Gasket 3/8", price: "$99.99", quantity: 10, imageUrl: a, availability: "In Stock", availabilityId: "available" },
101
+ { id: 9, itemId: "1094-C1", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
102
+ { id: 10, itemId: "1094-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
103
+ { id: 11, itemId: "1092-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
104
+ { id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" }
100
105
  ]
101
- }, o = (e) => {
102
- const [l, n] = m(!1);
103
- return /* @__PURE__ */ u(s, { children: [
104
- /* @__PURE__ */ r(
105
- c,
106
+ };
107
+ function y(e) {
108
+ return `$${e.items.reduce(
109
+ (t, i) => t + (parseFloat(i.price.replace(/[^0-9.]/g, "")) || 0) * i.quantity,
110
+ 0
111
+ ).toFixed(2)}`;
112
+ }
113
+ const n = (e) => {
114
+ const [o, t] = b(!1);
115
+ return /* @__PURE__ */ s(u, { children: [
116
+ /* @__PURE__ */ c(
117
+ d,
106
118
  {
107
119
  ...e,
108
- open: l,
109
- onCartClick: () => n((d) => !d)
120
+ open: o,
121
+ onCartClick: () => t((i) => !i)
110
122
  }
111
123
  ),
112
- /* @__PURE__ */ r(
113
- b,
124
+ /* @__PURE__ */ c(
125
+ m,
114
126
  {
115
- open: l,
116
- onClose: () => n(!1),
127
+ open: o,
128
+ onClose: () => t(!1),
117
129
  cart: e.cart,
118
- subtotal: e.cartSubtotal,
119
- itemPriceLabel: e.cartItemPriceLabel,
130
+ subtotal: y(e.cart),
131
+ itemPriceLabel: "List Price",
120
132
  contactHref: e.contactRoute,
121
- contactLinkBehavior: e.cartContactLinkBehavior,
122
- onItemQtyChange: e.onItemQtyChange,
123
- onItemDelete: e.onItemDelete,
124
- onCheckout: e.onCheckout
133
+ contactLinkBehavior: "new-tab",
134
+ onItemQtyChange: () => alert("Qty Change"),
135
+ onItemDelete: () => alert("Delete"),
136
+ onCheckout: () => alert("checkout")
125
137
  }
126
138
  )
127
139
  ] });
128
- }, p = {
140
+ }, S = {
129
141
  args: {
130
142
  account: { name: "Ringo", initials: "RS", number: "123456789012" },
131
- cart: i,
143
+ cart: r,
132
144
  homeRoute: "/",
133
145
  customPartsRoute: "/custom",
134
146
  accountRoute: "/account",
@@ -136,32 +148,22 @@ const C = {
136
148
  faqRoute: "/faq",
137
149
  aboutUsRoute: "/about",
138
150
  contactRoute: "/contact",
139
- cartSubtotal: "$1200.34",
140
151
  onLoginClick: () => {
141
- alert("Login ");
142
- },
143
- onCheckout: () => {
144
- alert("Checkout");
145
- },
146
- onItemDelete: () => {
147
- alert("Delete");
148
- },
149
- onItemQtyChange: () => {
150
- alert("Qty Change");
152
+ alert("Login");
151
153
  },
152
154
  onSearch: (e) => {
153
155
  alert(`Search ${e}`);
154
156
  },
155
157
  onCartClick: () => {
156
158
  },
157
- // required prop placeholder (overridden in render)
158
- categories: a
159
+ // placeholder required by component
160
+ categories: l
159
161
  },
160
- render: o
162
+ render: n
161
163
  }, k = {
162
164
  args: {
163
165
  account: { name: "Ringo", initials: "RS", number: "123456789012" },
164
- cart: i,
166
+ cart: r,
165
167
  homeRoute: "/",
166
168
  customPartsRoute: "/custom",
167
169
  accountRoute: "/account",
@@ -169,31 +171,20 @@ const C = {
169
171
  faqRoute: "/faq",
170
172
  aboutUsRoute: "/about",
171
173
  contactRoute: "/contact",
172
- cartSubtotal: "$1200.34",
173
174
  onLoginClick: () => {
174
- alert("Login ");
175
- },
176
- onCheckout: () => {
177
- alert("Checkout");
178
- },
179
- onItemDelete: () => {
180
- alert("Delete");
181
- },
182
- onItemQtyChange: () => {
183
- alert("Qty Change");
175
+ alert("Login");
184
176
  },
185
177
  onSearch: (e) => {
186
178
  alert(`Search ${e}`);
187
179
  },
188
180
  onCartClick: () => {
189
181
  },
190
- // required
191
- categories: a
182
+ categories: l
192
183
  },
193
- render: o
194
- }, g = {
184
+ render: n
185
+ }, C = {
195
186
  args: {
196
- cart: i,
187
+ cart: r,
197
188
  homeRoute: "/",
198
189
  customPartsRoute: "/custom",
199
190
  accountRoute: "/account",
@@ -202,30 +193,20 @@ const C = {
202
193
  aboutUsRoute: "/about",
203
194
  contactRoute: "/contact",
204
195
  onLoginClick: () => {
205
- alert("Login ");
206
- },
207
- onCheckout: () => {
208
- alert("Checkout");
209
- },
210
- onItemDelete: () => {
211
- alert("Delete");
212
- },
213
- onItemQtyChange: () => {
214
- alert("Qty Change");
196
+ alert("Login");
215
197
  },
216
198
  onSearch: (e) => {
217
199
  alert(`Search ${e}`);
218
200
  },
219
201
  onCartClick: () => {
220
202
  },
221
- // required
222
- categories: a
203
+ categories: l
223
204
  },
224
- render: o
205
+ render: n
225
206
  };
226
207
  export {
227
- p as Authenticated,
228
- g as Unauthenticated,
208
+ S as Authenticated,
209
+ C as Unauthenticated,
229
210
  k as WithCartItems,
230
- C as default
211
+ g as default
231
212
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.91",
4
+ "version": "0.0.93",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",