@caseparts-org/caseblocks 0.0.91 → 0.0.92

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,15 +14,10 @@ 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;
20
+ onCheckout: () => void;
26
21
  }
27
22
  export interface ShoppingCartHandle {
28
23
  open: () => void;
@@ -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 C = {
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,75 @@ 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: i.onCheckout
58
65
  }
59
66
  )
60
67
  ] });
61
- }, C = {
68
+ }, g = {
62
69
  args: {
63
70
  cart: { items: [] },
64
71
  onCheckout: () => {
65
72
  alert("Checkout");
66
73
  },
67
- onItemDelete: () => {
68
- alert("Delete");
69
- },
70
- onItemQtyChange: () => {
71
- alert("Qty Change");
72
- },
73
74
  onCartClick: () => {
74
75
  }
75
- // required placeholder (overridden in render)
76
+ // placeholder
76
77
  },
77
- render: t
78
- }, k = {
78
+ render: r
79
+ }, S = {
79
80
  args: {
80
- cart: m,
81
+ cart: p,
81
82
  onCheckout: () => {
82
83
  alert("Checkout");
83
84
  },
84
- onItemDelete: () => {
85
- alert("Delete");
86
- },
87
- onItemQtyChange: () => {
88
- alert("Qty Change");
89
- },
90
- subtotal: "$748.98",
91
85
  onCartClick: () => {
92
86
  }
93
- // required
94
87
  },
95
- render: t
96
- }, g = {
88
+ render: r
89
+ }, h = {
97
90
  args: {
98
91
  cart: y,
99
92
  onCheckout: () => {
100
93
  alert("Checkout");
101
94
  },
102
- onItemDelete: () => {
103
- alert("Delete");
104
- },
105
- onItemQtyChange: () => {
106
- alert("Qty Change");
107
- },
108
- subtotal: "$748.98",
109
95
  onCartClick: () => {
110
96
  }
111
- // required
112
97
  },
113
- render: t
98
+ render: r
114
99
  };
115
100
  export {
116
- C as EmptyCart,
117
- k as LargeCart,
118
- g as SmallCart,
119
- u as default
101
+ g as EmptyCart,
102
+ S as LargeCart,
103
+ h as SmallCart,
104
+ C as default
120
105
  };
@@ -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,50 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import I from "react";
2
+ import j 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 D } 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 M, Column as z } from "../../atoms/Grid/Grid.js";
8
+ import { Logo as I } 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 U } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
11
+ import { ShoppingCart as F } from "../../molecules/Cart/Cart.js";
12
+ import { Account as S } from "../../molecules/Account/Account.js";
13
+ import { CategoryNav as B } from "../../molecules/CategoryNav/CategoryNav.js";
14
+ import { c as G } from "../../clsx-OuTLNxxd.js";
15
+ import '../../assets/MainNav.css';const H = "_main_1l043_1", K = "_column_1l043_8", P = "_topNav_1l043_13", Q = "_logo_1l043_21", T = "_operations_1l043_24", W = "_search_1l043_31", q = "_siteLink_1l043_34", E = "_accountArea_1l043_38", J = "_category_1l043_50", O = "_menuList_1l043_72", r = {
16
+ main: H,
17
+ column: K,
18
+ topNav: P,
19
+ logo: Q,
20
+ operations: T,
21
+ search: W,
22
+ siteLink: q,
23
+ accountArea: E,
24
+ category: J,
25
+ menuList: O
26
+ }, le = j.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
+ onCheckout: L,
40
+ open: C,
46
41
  // NEW: consume external panel control props from CartPropsBase
47
- onCartClick: j,
42
+ onCartClick: k,
48
43
  // 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: [
44
+ className: w,
45
+ ...y
46
+ }, b) {
47
+ return /* @__PURE__ */ e(M, { ...y, gridWrapperClassName: G(r.main, w), children: /* @__PURE__ */ o(z, { span: 12, className: r.column, children: [
53
48
  /* @__PURE__ */ o(
54
49
  t,
55
50
  {
@@ -58,7 +53,7 @@ import '../../assets/MainNav.css';const T = "_main_1l043_1", W = "_column_1l043_
58
53
  justifyContent: "space-between",
59
54
  className: r.topNav,
60
55
  children: [
61
- /* @__PURE__ */ e("div", { className: r.logo, children: /* @__PURE__ */ e(s, { href: u, children: /* @__PURE__ */ e(H, {}) }) }),
56
+ /* @__PURE__ */ e("div", { className: r.logo, children: /* @__PURE__ */ e(l, { href: u, children: /* @__PURE__ */ e(I, {}) }) }),
62
57
  /* @__PURE__ */ o(
63
58
  t,
64
59
  {
@@ -68,50 +63,45 @@ import '../../assets/MainNav.css';const T = "_main_1l043_1", W = "_column_1l043_
68
63
  className: r.operations,
69
64
  children: [
70
65
  /* @__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" }),
66
+ /* @__PURE__ */ e(i, { href: m, hideAt: ["sm", "md"], children: "Model/Serial" }),
67
+ /* @__PURE__ */ e(i, { href: h, hideAt: ["sm", "md"], children: "Custom Parts" }),
68
+ /* @__PURE__ */ e(i, { href: d, hideAt: ["sm", "md"], children: "Contact Us" }),
74
69
  /* @__PURE__ */ e("div", { className: r.accountArea, children: /* @__PURE__ */ e(
75
- G,
70
+ S,
76
71
  {
77
72
  account: c,
78
73
  accountRoute: v,
79
- onLoginClick: C,
74
+ onLoginClick: x,
80
75
  className: r.avatar
81
76
  }
82
77
  ) }),
83
78
  /* @__PURE__ */ e(
84
- S,
79
+ F,
85
80
  {
86
- ref: z,
81
+ ref: b,
87
82
  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
83
+ open: C,
84
+ onCartClick: k,
85
+ onCheckout: L
96
86
  }
97
87
  ),
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" }) }),
88
+ /* @__PURE__ */ e(U, { hideAt: ["lg"], children: /* @__PURE__ */ o("ul", { className: r.menuList, children: [
89
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: m, children: "Make/Serial" }) }),
90
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: h, children: "Custom Parts" }) }),
91
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: d, children: "Contact Us" }) }),
102
92
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { href: N, children: "FAQ" }) }),
103
93
  /* @__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 }),
94
+ n && n.map((a) => /* @__PURE__ */ e("li", { className: r.category, children: /* @__PURE__ */ o(l, { href: a.route, children: [
95
+ /* @__PURE__ */ e(_, { size: "sm", weight: "semibold", children: a.label }),
106
96
  /* @__PURE__ */ e(
107
- U,
97
+ D,
108
98
  {
109
99
  iconKey: "fa-solid fa-chevron-right",
110
100
  title: "Navigate",
111
101
  size: "sm"
112
102
  }
113
103
  )
114
- ] }) }, l.id))
104
+ ] }) }, a.id))
115
105
  ] }) })
116
106
  ]
117
107
  }
@@ -120,16 +110,16 @@ import '../../assets/MainNav.css';const T = "_main_1l043_1", W = "_column_1l043_
120
110
  }
121
111
  ),
122
112
  /* @__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 })
113
+ /* @__PURE__ */ e(B, { categories: n })
124
114
  ] }) });
125
115
  });
126
116
  function i({
127
- href: m,
117
+ href: s,
128
118
  children: c,
129
119
  ...n
130
120
  }) {
131
- return /* @__PURE__ */ e(s, { href: m, className: r.siteLink, ...n, children: /* @__PURE__ */ e(_, { size: "md", variant: "display", children: c }) });
121
+ return /* @__PURE__ */ e(l, { href: s, className: r.siteLink, ...n, children: /* @__PURE__ */ e(_, { size: "md", variant: "display", children: c }) });
132
122
  }
133
123
  export {
134
- fe as MainNav
124
+ le as MainNav
135
125
  };
@@ -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 u, Fragment as s, 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,7 +88,7 @@ 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
+ ], t = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", r = {
87
92
  items: [
88
93
  { id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
89
94
  { id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
@@ -98,37 +103,44 @@ const C = {
98
103
  { id: 11, itemId: "1092-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
99
104
  { id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" }
100
105
  ]
101
- }, o = (e) => {
102
- const [l, n] = m(!1);
106
+ };
107
+ function h(e) {
108
+ return `$${e.items.reduce(
109
+ (a, i) => a + (parseFloat(i.price.replace(/[^0-9.]/g, "")) || 0) * i.quantity,
110
+ 0
111
+ ).toFixed(2)}`;
112
+ }
113
+ const n = (e) => {
114
+ const [o, a] = b(!1);
103
115
  return /* @__PURE__ */ u(s, { children: [
104
- /* @__PURE__ */ r(
105
- c,
116
+ /* @__PURE__ */ c(
117
+ d,
106
118
  {
107
119
  ...e,
108
- open: l,
109
- onCartClick: () => n((d) => !d)
120
+ open: o,
121
+ onCartClick: () => a((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: () => a(!1),
117
129
  cart: e.cart,
118
- subtotal: e.cartSubtotal,
119
- itemPriceLabel: e.cartItemPriceLabel,
130
+ subtotal: h(e.cart),
131
+ itemPriceLabel: "List Price",
120
132
  contactHref: e.contactRoute,
121
- contactLinkBehavior: e.cartContactLinkBehavior,
122
- onItemQtyChange: e.onItemQtyChange,
123
- onItemDelete: e.onItemDelete,
133
+ contactLinkBehavior: "new-tab",
134
+ onItemQtyChange: () => alert("Qty Change"),
135
+ onItemDelete: () => alert("Delete"),
124
136
  onCheckout: e.onCheckout
125
137
  }
126
138
  )
127
139
  ] });
128
- }, p = {
140
+ }, C = {
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,25 @@ const C = {
136
148
  faqRoute: "/faq",
137
149
  aboutUsRoute: "/about",
138
150
  contactRoute: "/contact",
139
- cartSubtotal: "$1200.34",
140
151
  onLoginClick: () => {
141
- alert("Login ");
152
+ alert("Login");
142
153
  },
143
154
  onCheckout: () => {
144
155
  alert("Checkout");
145
156
  },
146
- onItemDelete: () => {
147
- alert("Delete");
148
- },
149
- onItemQtyChange: () => {
150
- alert("Qty Change");
151
- },
152
157
  onSearch: (e) => {
153
158
  alert(`Search ${e}`);
154
159
  },
155
160
  onCartClick: () => {
156
161
  },
157
- // required prop placeholder (overridden in render)
158
- categories: a
162
+ // placeholder required by component
163
+ categories: l
159
164
  },
160
- render: o
165
+ render: n
161
166
  }, k = {
162
167
  args: {
163
168
  account: { name: "Ringo", initials: "RS", number: "123456789012" },
164
- cart: i,
169
+ cart: r,
165
170
  homeRoute: "/",
166
171
  customPartsRoute: "/custom",
167
172
  accountRoute: "/account",
@@ -169,31 +174,23 @@ const C = {
169
174
  faqRoute: "/faq",
170
175
  aboutUsRoute: "/about",
171
176
  contactRoute: "/contact",
172
- cartSubtotal: "$1200.34",
173
177
  onLoginClick: () => {
174
- alert("Login ");
178
+ alert("Login");
175
179
  },
176
180
  onCheckout: () => {
177
181
  alert("Checkout");
178
182
  },
179
- onItemDelete: () => {
180
- alert("Delete");
181
- },
182
- onItemQtyChange: () => {
183
- alert("Qty Change");
184
- },
185
183
  onSearch: (e) => {
186
184
  alert(`Search ${e}`);
187
185
  },
188
186
  onCartClick: () => {
189
187
  },
190
- // required
191
- categories: a
188
+ categories: l
192
189
  },
193
- render: o
194
- }, g = {
190
+ render: n
191
+ }, S = {
195
192
  args: {
196
- cart: i,
193
+ cart: r,
197
194
  homeRoute: "/",
198
195
  customPartsRoute: "/custom",
199
196
  accountRoute: "/account",
@@ -202,30 +199,23 @@ const C = {
202
199
  aboutUsRoute: "/about",
203
200
  contactRoute: "/contact",
204
201
  onLoginClick: () => {
205
- alert("Login ");
202
+ alert("Login");
206
203
  },
207
204
  onCheckout: () => {
208
205
  alert("Checkout");
209
206
  },
210
- onItemDelete: () => {
211
- alert("Delete");
212
- },
213
- onItemQtyChange: () => {
214
- alert("Qty Change");
215
- },
216
207
  onSearch: (e) => {
217
208
  alert(`Search ${e}`);
218
209
  },
219
210
  onCartClick: () => {
220
211
  },
221
- // required
222
- categories: a
212
+ categories: l
223
213
  },
224
- render: o
214
+ render: n
225
215
  };
226
216
  export {
227
- p as Authenticated,
228
- g as Unauthenticated,
217
+ C as Authenticated,
218
+ S as Unauthenticated,
229
219
  k as WithCartItems,
230
- C as default
220
+ g as default
231
221
  };
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.92",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",