@caseparts-org/caseblocks 0.0.33 → 0.0.34

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 +1 @@
1
- ._cart_h4033_1{position:relative;border:none;padding:0;margin:0;background-color:transparent}._count_h4033_8{position:absolute;top:4px;left:17px;border-radius:50%;width:18px;height:18px;display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:var(--color-brand-primary-primary-tangerine);color:var(--color-neutrals-neutral-1);font-weight:var(--font-weight-semibold)}._cartContainer_h4033_23{height:calc(100vh - 120px);width:375px;box-sizing:border-box;display:grid;grid-template-rows:auto 1fr auto;gap:var(--spacing-1)}._cartItems_h4033_32{height:100%;overflow-y:auto;overflow-x:hidden}._cartItems_h4033_32 ul{margin:0;padding:0}._cartItems_h4033_32 li{list-style:none;margin:0;padding:var(--spacing-0-25);width:100%;display:flex;flex-direction:row;align-items:center;gap:var(--spacing-0-5)}._cartItems_h4033_32 li p{margin:0;padding:0}._cartItems_h4033_32 img{height:40px;width:40px;object-fit:contain}._noItems_h4033_60{display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%}
1
+ ._cart_tgc5k_1{position:relative;border:none;padding:0;margin:0;background-color:transparent}._count_tgc5k_8{position:absolute;top:4px;left:17px;border-radius:50%;width:18px;height:18px;display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:var(--color-brand-primary-primary-tangerine);color:var(--color-neutrals-neutral-1);font-weight:var(--font-weight-semibold)}._cartContainer_tgc5k_23{height:calc(100vh - 120px);width:375px;box-sizing:border-box;display:grid;grid-template-rows:auto 1fr auto auto;gap:var(--spacing-1)}._cartItems_tgc5k_32{height:100%;overflow-y:auto;overflow-x:hidden}._cartItems_tgc5k_32 ul{margin:0;padding:0}._cartItems_tgc5k_32 li{display:grid;grid-template-columns:1fr auto;gap:var(--spacing-0-5);align-items:center;box-sizing:border-box;position:relative;list-style:none;margin:0;padding:var(--spacing-0-5);width:100%;border-bottom:1px solid var(--color-neutrals-neutral-2)}._itemInfo_tgc5k_54{display:flex;flex-direction:row;align-items:center}._cartItems_tgc5k_32 li p{margin:0;padding:0;word-wrap:break-word;white-space:normal;overflow-wrap:break-word}._cartItems_tgc5k_32 img{height:40px;width:40px;object-fit:contain}._removeItem_tgc5k_71{border:none;background-color:transparent;padding:0;margin:0;cursor:pointer}._itemManagement_tgc5k_78{display:flex;flex-direction:column;align-items:flex-end}._noItems_tgc5k_83{display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%}._subtotal_tgc5k_90{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--spacing-0-5)}
@@ -0,0 +1 @@
1
+ ._qty-container_19ir9_1{display:flex;flex-direction:row;align-items:center}._qty-container_19ir9_1>button{font-size:1.25rem;border:1px solid var(--color-neutrals-neutral-3);background-color:#fff;box-sizing:border-box}._qty-container_19ir9_1>input{text-align:center;font-size:18px;border:1px solid var(--color-neutrals-neutral-3);box-sizing:border-box}._qty-container_19ir9_1>input::-webkit-outer-spin-button,._qty-container_19ir9_1>input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._qty-container_19ir9_1>input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}._decrease-btn_19ir9_34{position:relative;left:2px;z-index:0;display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:pointer}._increase-btn_19ir9_45{position:relative;left:-2px;z-index:0;display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:pointer}._decrease-btn_19ir9_34:disabled,._increase-btn_19ir9_45:disabled{pointer-events:none}._decrease-btn_19ir9_34:disabled svg,._increase-btn_19ir9_45:disabled svg{fill:var(--color-neutrals-neutral-4)}._button-sm_19ir9_66{width:1.5rem;height:1.5rem}._button-md_19ir9_70{width:2rem;height:2rem}._qty-input-sm_19ir9_74{width:2.5rem;height:1.5rem}._qty-input-md_19ir9_78{width:3rem;height:2rem}
@@ -1,42 +1,44 @@
1
- import { Button as e } from "./atoms/Button/Button.js";
1
+ import { Button as t } from "./atoms/Button/Button.js";
2
2
  import { Flex as p } from "./atoms/Flex/Flex.js";
3
3
  import { Column as m, Grid as f } from "./atoms/Grid/Grid.js";
4
- import { Head as a } from "./atoms/Root/Head.js";
5
- import { Icon as c } from "./atoms/Icon/Icon.js";
6
- import { Root as u } from "./atoms/Root/Root.js";
4
+ import { Head as n } from "./atoms/Root/Head.js";
5
+ import { Icon as u } from "./atoms/Icon/Icon.js";
6
+ import { Root as l } from "./atoms/Root/Root.js";
7
7
  import { Separator as g } from "./atoms/Separator/Separator.js";
8
8
  import { Text as v } from "./atoms/Text/Text.js";
9
- import { Input as L } from "./atoms/Input/Input.js";
10
- import { Logo as T } from "./molecules/Logo/Logo.js";
11
- import { SearchBox as A } from "./molecules/SearchBox/SearchBox.js";
12
- import { Link as I, LinkProvider as w } from "./atoms/Link/Link.js";
13
- import { Tooltip as G } from "./molecules/Tooltip/Tooltip.js";
14
- import { Account as M } from "./molecules/Account/Account.js";
15
- import { Avatar as P } from "./molecules/Avatar/Avatar.js";
9
+ import { Input as I } from "./atoms/Input/Input.js";
10
+ import { Logo as S } from "./molecules/Logo/Logo.js";
11
+ import { SearchBox as k } from "./molecules/SearchBox/SearchBox.js";
12
+ import { QuantityInput as B } from "./molecules/QuantityInput/QuantityInput.js";
13
+ import { Link as y, LinkProvider as F } from "./atoms/Link/Link.js";
14
+ import { Tooltip as H } from "./molecules/Tooltip/Tooltip.js";
15
+ import { Account as N } from "./molecules/Account/Account.js";
16
+ import { Avatar as Q } from "./molecules/Avatar/Avatar.js";
16
17
  import { Chip as V } from "./molecules/Chip/Chip.js";
17
18
  import { ToggleView as j } from "./molecules/ToggleView/ToggleView.js";
18
19
  import { MainNav as s } from "./organisms/MainNav/MainNav.js";
19
- import { ChipSelector as z } from "./organisms/ChipSelector/ChipSelector.js";
20
+ import { ChipSelector as D } from "./organisms/ChipSelector/ChipSelector.js";
20
21
  export {
21
- M as Account,
22
- P as Avatar,
23
- e as Button,
22
+ N as Account,
23
+ Q as Avatar,
24
+ t as Button,
24
25
  V as Chip,
25
- z as ChipSelector,
26
+ D as ChipSelector,
26
27
  m as Column,
27
28
  p as Flex,
28
29
  f as Grid,
29
- a as Head,
30
- c as Icon,
31
- L as Input,
32
- I as Link,
33
- w as LinkProvider,
34
- T as Logo,
30
+ n as Head,
31
+ u as Icon,
32
+ I as Input,
33
+ y as Link,
34
+ F as LinkProvider,
35
+ S as Logo,
35
36
  s as MainNav,
36
- u as Root,
37
- A as SearchBox,
37
+ B as QuantityInput,
38
+ l as Root,
39
+ k as SearchBox,
38
40
  g as Separator,
39
41
  v as Text,
40
42
  j as ToggleView,
41
- G as Tooltip
43
+ H as Tooltip
42
44
  };
@@ -16,3 +16,5 @@ export type { InputProps } from './atoms/Input/Input';
16
16
  export { Logo } from './molecules/Logo/Logo';
17
17
  export { SearchBox } from './molecules/SearchBox/SearchBox';
18
18
  export type { SearchBoxProps } from './molecules/SearchBox/SearchBox';
19
+ export type { QuantityInputProps } from './molecules/QuantityInput/QuantityInput';
20
+ export { QuantityInput } from './molecules/QuantityInput/QuantityInput';
@@ -1,25 +1,27 @@
1
1
  import { Button as t } from "./atoms/Button/Button.js";
2
- import { Flex as x } from "./atoms/Flex/Flex.js";
2
+ import { Flex as p } from "./atoms/Flex/Flex.js";
3
3
  import { Column as m, Grid as f } from "./atoms/Grid/Grid.js";
4
- import { Head as n } from "./atoms/Root/Head.js";
5
- import { Icon as c } from "./atoms/Icon/Icon.js";
6
- import { Root as l } from "./atoms/Root/Root.js";
7
- import { Separator as I } from "./atoms/Separator/Separator.js";
8
- import { Text as g } from "./atoms/Text/Text.js";
9
- import { Input as i } from "./atoms/Input/Input.js";
10
- import { Logo as F } from "./molecules/Logo/Logo.js";
11
- import { SearchBox as H } from "./molecules/SearchBox/SearchBox.js";
4
+ import { Head as a } from "./atoms/Root/Head.js";
5
+ import { Icon as I } from "./atoms/Icon/Icon.js";
6
+ import { Root as d } from "./atoms/Root/Root.js";
7
+ import { Separator as l } from "./atoms/Separator/Separator.js";
8
+ import { Text as S } from "./atoms/Text/Text.js";
9
+ import { Input as h } from "./atoms/Input/Input.js";
10
+ import { Logo as C } from "./molecules/Logo/Logo.js";
11
+ import { SearchBox as G } from "./molecules/SearchBox/SearchBox.js";
12
+ import { QuantityInput as L } from "./molecules/QuantityInput/QuantityInput.js";
12
13
  export {
13
14
  t as Button,
14
15
  m as Column,
15
- x as Flex,
16
+ p as Flex,
16
17
  f as Grid,
17
- n as Head,
18
- c as Icon,
19
- i as Input,
20
- F as Logo,
21
- l as Root,
22
- H as SearchBox,
23
- I as Separator,
24
- g as Text
18
+ a as Head,
19
+ I as Icon,
20
+ h as Input,
21
+ C as Logo,
22
+ L as QuantityInput,
23
+ d as Root,
24
+ G as SearchBox,
25
+ l as Separator,
26
+ S as Text
25
27
  };
@@ -16,9 +16,10 @@ export interface CartPropsBase {
16
16
  onItemDelete: (_item: CartItem) => void;
17
17
  onItemEdit: (_item: CartItem) => void;
18
18
  onCheckout: () => void;
19
+ subtotal?: number;
19
20
  cart: ShoppingCart;
20
21
  }
21
22
  interface CartProps extends CartPropsBase, React.HtmlHTMLAttributes<HTMLButtonElement> {
22
23
  }
23
- export declare function ShoppingCart({ cart, onItemQtyChange, onItemDelete, onItemEdit, onCheckout, ...otherProps }: CartProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function ShoppingCart({ cart, onItemQtyChange, onItemDelete, onItemEdit, onCheckout, subtotal, ...otherProps }: CartProps): import("react/jsx-runtime").JSX.Element;
24
25
  export {};
@@ -1,58 +1,74 @@
1
1
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
- import { Icon as m } from "../../atoms/Icon/Icon.js";
3
- import { Text as s } from "../../atoms/Text/Text.js";
4
- import { Button as a } from "../../atoms/Button/Button.js";
5
- import { Tooltip as l } from "../Tooltip/Tooltip.js";
6
- import '../../assets/Cart.css';const h = "_cart_h4033_1", d = "_count_h4033_8", p = "_cartContainer_h4033_23", _ = "_cartItems_h4033_32", g = "_noItems_h4033_60", o = {
7
- cart: h,
8
- count: d,
9
- cartContainer: p,
10
- cartItems: _,
11
- noItems: g
2
+ import { Icon as o } from "../../atoms/Icon/Icon.js";
3
+ import { Text as m } from "../../atoms/Text/Text.js";
4
+ import { Button as g } from "../../atoms/Button/Button.js";
5
+ import { Tooltip as _ } from "../Tooltip/Tooltip.js";
6
+ import { QuantityInput as p } from "../QuantityInput/QuantityInput.js";
7
+ import '../../assets/Cart.css';const I = "_cart_tgc5k_1", u = "_count_tgc5k_8", f = "_cartContainer_tgc5k_23", k = "_cartItems_tgc5k_32", v = "_itemInfo_tgc5k_54", z = "_removeItem_tgc5k_71", C = "_itemManagement_tgc5k_78", N = "_noItems_tgc5k_83", y = "_subtotal_tgc5k_90", e = {
8
+ cart: I,
9
+ count: u,
10
+ cartContainer: f,
11
+ cartItems: k,
12
+ itemInfo: v,
13
+ removeItem: z,
14
+ itemManagement: C,
15
+ noItems: N,
16
+ subtotal: y
12
17
  };
13
- function N({
14
- cart: e,
15
- onItemQtyChange: I,
16
- onItemDelete: u,
17
- onItemEdit: C,
18
- onCheckout: r,
19
- ...c
18
+ function T({
19
+ cart: i,
20
+ onItemQtyChange: a,
21
+ onItemDelete: r,
22
+ onItemEdit: b,
23
+ onCheckout: l,
24
+ subtotal: c,
25
+ ...d
20
26
  }) {
21
- return e = e || { items: [] }, /* @__PURE__ */ t(
22
- l,
27
+ return i = i || { items: [] }, /* @__PURE__ */ t(
28
+ _,
23
29
  {
24
- trigger: /* @__PURE__ */ n("button", { className: o.cart, ...c, children: [
30
+ trigger: /* @__PURE__ */ n("button", { className: e.cart, ...d, children: [
25
31
  /* @__PURE__ */ t(
26
- m,
32
+ o,
27
33
  {
28
34
  iconKey: "fa-kit fa-shoppingcart-empty",
29
35
  title: "Shopping Cart",
30
36
  size: "lg"
31
37
  }
32
38
  ),
33
- e.items.length > 0 && /* @__PURE__ */ t("div", { className: o.count, children: /* @__PURE__ */ t(s, { size: "xxs", children: e.items.length }) })
39
+ i.items.length > 0 && /* @__PURE__ */ t("div", { className: e.count, children: /* @__PURE__ */ t(m, { size: "xxs", children: i.items.length }) })
34
40
  ] }),
35
41
  position: "bottom",
36
42
  on: "click",
37
- children: /* @__PURE__ */ n("div", { className: o.cartContainer, children: [
38
- /* @__PURE__ */ t(s, { as: "h1", size: "2xl", children: "Cart" }),
39
- /* @__PURE__ */ t("div", { className: o.cartItems, children: e.items.length > 0 ? /* @__PURE__ */ t("ul", { children: e.items.map(
40
- (i) => /* @__PURE__ */ n("li", { children: [
41
- /* @__PURE__ */ t("img", { src: i.imageUrl, alt: `${i.itemId} product image` }),
42
- /* @__PURE__ */ n("div", { children: [
43
- /* @__PURE__ */ t(s, { as: "p", size: "sm", children: i.description }),
44
- /* @__PURE__ */ n(s, { as: "p", size: "sm", children: [
45
- "Part # ",
46
- i.itemId
43
+ children: /* @__PURE__ */ n("div", { className: e.cartContainer, children: [
44
+ /* @__PURE__ */ t(m, { as: "h1", size: "2xl", children: "Cart" }),
45
+ /* @__PURE__ */ t("div", { className: e.cartItems, children: i.items.length > 0 ? /* @__PURE__ */ t("ul", { children: i.items.map(
46
+ (s) => /* @__PURE__ */ n("li", { className: e.cartItem, children: [
47
+ /* @__PURE__ */ n("div", { className: e.itemInfo, children: [
48
+ /* @__PURE__ */ t("img", { src: s.imageUrl, alt: `${s.itemId} product image` }),
49
+ /* @__PURE__ */ n("div", { children: [
50
+ /* @__PURE__ */ t(m, { as: "p", size: "sm", children: s.description }),
51
+ /* @__PURE__ */ n(m, { as: "p", size: "sm", children: [
52
+ "Part # ",
53
+ s.itemId
54
+ ] })
47
55
  ] })
56
+ ] }),
57
+ /* @__PURE__ */ n("div", { className: e.itemManagement, children: [
58
+ /* @__PURE__ */ t("button", { onClick: () => r(s), className: e.removeItem, children: /* @__PURE__ */ t(o, { iconKey: "fa-regular fa-trash", size: "sm" }) }),
59
+ /* @__PURE__ */ t(p, { onQuantityChange: (h) => a(s, h), size: "sm" })
48
60
  ] })
49
- ] }, i.id)
50
- ) }) : /* @__PURE__ */ t("div", { className: o.noItems, children: /* @__PURE__ */ t(s, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
51
- /* @__PURE__ */ t(a, { disabled: e.items.length === 0, onClick: r, variant: "cta-primary", size: "md", children: "Checkout" })
61
+ ] }, s.id)
62
+ ) }) : /* @__PURE__ */ t("div", { className: e.noItems, children: /* @__PURE__ */ t(m, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
63
+ c && /* @__PURE__ */ n("div", { className: e.subtotal, children: [
64
+ /* @__PURE__ */ t(m, { size: "md", children: "Subtotal" }),
65
+ /* @__PURE__ */ t(m, { size: "md", children: c })
66
+ ] }),
67
+ /* @__PURE__ */ t(g, { disabled: i.items.length === 0, onClick: l, variant: "cta-primary", size: "md", children: "Checkout" })
52
68
  ] })
53
69
  }
54
70
  );
55
71
  }
56
72
  export {
57
- N as ShoppingCart
73
+ T as ShoppingCart
58
74
  };
@@ -11,4 +11,5 @@ declare const meta: {
11
11
  export default meta;
12
12
  type Story = StoryObj<typeof meta>;
13
13
  export declare const EmptyCart: Story;
14
- export declare const CartWithItems: Story;
14
+ export declare const LargeCart: Story;
15
+ export declare const SmallCart: Story;
@@ -1,5 +1,5 @@
1
1
  import { ShoppingCart as e } from "./Cart.js";
2
- const r = {
2
+ const o = {
3
3
  title: "Case Parts/Molecules/Cart",
4
4
  component: e,
5
5
  parameters: {
@@ -21,7 +21,14 @@ const r = {
21
21
  { id: 11, itemId: "1092-01", description: "Kason Door Closer - Flush", price: 40.1, quantity: 1, imageUrl: t, availability: "In Stock" },
22
22
  { id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: 50.15, quantity: 1, imageUrl: t, availability: "In Stock" }
23
23
  ]
24
- }, o = {
24
+ }, a = {
25
+ items: [
26
+ { id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: 99.99, quantity: 1, imageUrl: t, availability: "In Stock" },
27
+ { id: 2, itemId: "810810", description: "True Door Gasket", price: 9.99, quantity: 1, imageUrl: t, availability: "In Stock" },
28
+ { id: 3, itemId: "MG064", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: 9.99, quantity: 1, imageUrl: t, availability: "" },
29
+ { id: 4, itemId: "MG064-B", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: 9.99, quantity: 1, imageUrl: t, availability: "" }
30
+ ]
31
+ }, l = {
25
32
  args: {
26
33
  cart: { items: [] },
27
34
  onCheckout: () => {
@@ -37,7 +44,7 @@ const r = {
37
44
  alert("Delete");
38
45
  }
39
46
  }
40
- }, l = {
47
+ }, n = {
41
48
  args: {
42
49
  cart: i,
43
50
  onCheckout: () => {
@@ -51,11 +58,30 @@ const r = {
51
58
  },
52
59
  onItemQtyChange: () => {
53
60
  alert("Delete");
54
- }
61
+ },
62
+ subtotal: 748.98
63
+ }
64
+ }, s = {
65
+ args: {
66
+ cart: a,
67
+ onCheckout: () => {
68
+ alert("Checkout");
69
+ },
70
+ onItemDelete: () => {
71
+ alert("Delete");
72
+ },
73
+ onItemEdit: () => {
74
+ alert("Delete");
75
+ },
76
+ onItemQtyChange: () => {
77
+ alert("Delete");
78
+ },
79
+ subtotal: 748.98
55
80
  }
56
81
  };
57
82
  export {
58
- l as CartWithItems,
59
- o as EmptyCart,
60
- r as default
83
+ l as EmptyCart,
84
+ n as LargeCart,
85
+ s as SmallCart,
86
+ o as default
61
87
  };
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { HideAtProps } from '../../atoms/HideAt';
3
+ export interface QuantityInputProps extends React.HTMLAttributes<HTMLInputElement>, HideAtProps {
4
+ quantity?: number;
5
+ onQuantityChange: (_quantity: number) => void;
6
+ min?: number;
7
+ max?: number;
8
+ size?: "sm" | "md";
9
+ wrapperClassName?: string;
10
+ }
11
+ export declare function QuantityInput({ quantity, onQuantityChange, min, max, className, wrapperClassName, hideAt, size, ...otherProps }: QuantityInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { jsxs as v, jsx as r } from "react/jsx-runtime";
2
+ import { c } from "../../clsx-OuTLNxxd.js";
3
+ import { Icon as l } from "../../atoms/Icon/Icon.js";
4
+ import { getHideAtStyles as g } from "../../atoms/HideAt.js";
5
+ import '../../assets/QuantityInput.css';const s = {
6
+ "qty-container": "_qty-container_19ir9_1",
7
+ "decrease-btn": "_decrease-btn_19ir9_34",
8
+ "increase-btn": "_increase-btn_19ir9_45",
9
+ "button-sm": "_button-sm_19ir9_66",
10
+ "button-md": "_button-md_19ir9_70",
11
+ "qty-input-sm": "_qty-input-sm_19ir9_74",
12
+ "qty-input-md": "_qty-input-md_19ir9_78"
13
+ };
14
+ function j({
15
+ quantity: i = 1,
16
+ onQuantityChange: b,
17
+ min: e = 1,
18
+ max: n = 9999,
19
+ className: d,
20
+ wrapperClassName: _,
21
+ hideAt: p,
22
+ size: a = "md",
23
+ ...m
24
+ }) {
25
+ const y = (t) => (e !== void 0 && t < e && (t = e), n !== void 0 && n !== void 0 && t > n && (t = n), t), u = (t) => {
26
+ const o = y(Number.isNaN(t) ? e ?? 1 : t);
27
+ b(o);
28
+ }, f = () => u(i - 1), N = () => u(i + 1);
29
+ return /* @__PURE__ */ v("div", { className: c(s["qty-container"], g(p), _), children: [
30
+ /* @__PURE__ */ r(
31
+ "button",
32
+ {
33
+ type: "button",
34
+ className: c(s["decrease-btn"], s[`button-${a}`]),
35
+ onClick: f,
36
+ disabled: i <= (e ?? 1),
37
+ "aria-label": "Decrease quantity",
38
+ children: /* @__PURE__ */ r(l, { iconKey: "fa-solid fa-minus", size: "sm" })
39
+ }
40
+ ),
41
+ /* @__PURE__ */ r(
42
+ "input",
43
+ {
44
+ className: c(s["qty-input"], s[`qty-input-${a}`], d),
45
+ type: "number",
46
+ min: e,
47
+ max: n,
48
+ value: i,
49
+ onFocus: (t) => t.currentTarget.select(),
50
+ onChange: (t) => {
51
+ const o = parseInt(t.target.value, 10);
52
+ u(Number.isNaN(o) ? e ?? 1 : o);
53
+ },
54
+ "aria-label": "Quantity",
55
+ ...m
56
+ }
57
+ ),
58
+ /* @__PURE__ */ r(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ className: c(s["increase-btn"], s[`button-${a}`]),
63
+ onClick: N,
64
+ disabled: n !== void 0 && i >= n,
65
+ "aria-label": "Increase quantity",
66
+ children: /* @__PURE__ */ r(l, { iconKey: "fa-solid fa-plus", size: "sm" })
67
+ }
68
+ )
69
+ ] });
70
+ }
71
+ export {
72
+ j as QuantityInput
73
+ };
@@ -0,0 +1,35 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ import { QuantityInput } from './QuantityInput';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof QuantityInput;
6
+ tags: string[];
7
+ args: {
8
+ quantity: number;
9
+ min: number;
10
+ size: "md";
11
+ };
12
+ argTypes: {
13
+ onQuantityChange: {
14
+ action: string;
15
+ };
16
+ size: {
17
+ control: {
18
+ type: "inline-radio";
19
+ };
20
+ options: string[];
21
+ };
22
+ };
23
+ parameters: {
24
+ layout: string;
25
+ };
26
+ };
27
+ export default meta;
28
+ type Story = StoryObj<typeof meta>;
29
+ export declare const Default: Story;
30
+ export declare const Small: Story;
31
+ export declare const Medium: Story;
32
+ export declare const WithMinMax: Story;
33
+ export declare const AllSizes: Story;
34
+ export declare const MaxReached: Story;
35
+ export declare const EventHandler: Story;
@@ -0,0 +1,75 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { QuantityInput as u } from "./QuantityInput.js";
3
+ import { useState as s, useEffect as m } from "react";
4
+ const c = {
5
+ title: "Case Parts/Molecules/QuantityInput",
6
+ component: u,
7
+ tags: ["autodocs"],
8
+ args: {
9
+ quantity: 2,
10
+ min: 1,
11
+ size: "md"
12
+ },
13
+ argTypes: {
14
+ onQuantityChange: { action: "quantity changed" },
15
+ size: {
16
+ control: { type: "inline-radio" },
17
+ options: ["sm", "md"]
18
+ }
19
+ },
20
+ parameters: {
21
+ layout: "centered"
22
+ }
23
+ }, e = (t) => {
24
+ const [a, i] = s(t.quantity ?? 1);
25
+ return m(() => {
26
+ i(t.quantity ?? 1);
27
+ }, [t.quantity]), /* @__PURE__ */ n(
28
+ u,
29
+ {
30
+ ...t,
31
+ quantity: a,
32
+ onQuantityChange: (o) => {
33
+ var r;
34
+ i(o), (r = t.onQuantityChange) == null || r.call(t, o);
35
+ }
36
+ }
37
+ );
38
+ }, g = {
39
+ args: { onQuantityChange: () => {
40
+ } },
41
+ render: (t) => /* @__PURE__ */ n(e, { ...t })
42
+ }, h = {
43
+ args: { size: "sm", quantity: 3, onQuantityChange: () => {
44
+ } },
45
+ render: (t) => /* @__PURE__ */ n(e, { ...t })
46
+ }, p = {
47
+ args: { size: "md", quantity: 3, onQuantityChange: () => {
48
+ } },
49
+ render: (t) => /* @__PURE__ */ n(e, { ...t })
50
+ }, q = {
51
+ args: { min: 2, max: 5, quantity: 2, onQuantityChange: () => {
52
+ } },
53
+ render: (t) => /* @__PURE__ */ n(e, { ...t })
54
+ }, Q = {
55
+ args: { onQuantityChange: (t) => alert(t) },
56
+ render: (t) => /* @__PURE__ */ n("div", { style: { display: "flex", gap: "1rem", alignItems: "center" }, children: ["sm", "md"].map((a) => /* @__PURE__ */ n(e, { ...t, size: a, quantity: a === "sm" ? 1 : 2 }, a)) })
57
+ }, C = {
58
+ args: { min: 1, max: 3, quantity: 3, onQuantityChange: (t) => alert(t) },
59
+ render: (t) => /* @__PURE__ */ n(e, { ...t })
60
+ }, f = {
61
+ args: { min: 2, max: 5, quantity: 2, onQuantityChange: (t) => {
62
+ alert(t);
63
+ } },
64
+ render: (t) => /* @__PURE__ */ n(e, { ...t })
65
+ };
66
+ export {
67
+ Q as AllSizes,
68
+ g as Default,
69
+ f as EventHandler,
70
+ C as MaxReached,
71
+ p as Medium,
72
+ h as Small,
73
+ q as WithMinMax,
74
+ c as default
75
+ };
@@ -8,6 +8,7 @@ export interface MainNavProps extends CartPropsBase, React.HTMLAttributes<HTMLDi
8
8
  accountRoute: string;
9
9
  contactRoute: string;
10
10
  cart: ShoppingCart;
11
+ cartSubtotal?: number;
11
12
  onLoginClick: () => void;
12
13
  onSearch: (_input: string) => void;
13
14
  }
@@ -20,4 +21,4 @@ export interface MainCategory extends Category {
20
21
  children: Category[];
21
22
  showChevron?: boolean;
22
23
  }
23
- export declare function MainNav({ account, categories, faqRoute, customPartsRoute, aboutUsRoute, accountRoute, contactRoute, cart, onLoginClick, onSearch, onItemQtyChange, onItemDelete, onItemEdit, onCheckout, ...otherProps }: MainNavProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function MainNav({ account, categories, faqRoute, customPartsRoute, aboutUsRoute, accountRoute, contactRoute, cart, cartSubtotal, onLoginClick, onSearch, onItemQtyChange, onItemDelete, onItemEdit, onCheckout, ...otherProps }: MainNavProps): import("react/jsx-runtime").JSX.Element;
@@ -1,91 +1,93 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
2
  import { Text as f } from "../../atoms/Text/Text.js";
3
3
  import { Link as p } from "../../atoms/Link/Link.js";
4
- import { Icon as C } from "../../atoms/Icon/Icon.js";
5
- import { Flex as o } from "../../atoms/Flex/Flex.js";
6
- import { Grid as y, Column as k } from "../../atoms/Grid/Grid.js";
7
- import { Logo as b } from "../../molecules/Logo/Logo.js";
4
+ import { Icon as y } from "../../atoms/Icon/Icon.js";
5
+ import { Flex as c } from "../../atoms/Flex/Flex.js";
6
+ import { Grid as b, Column as k } from "../../atoms/Grid/Grid.js";
7
+ import { Logo as j } from "../../molecules/Logo/Logo.js";
8
8
  import { SearchBox as d } from "../../molecules/SearchBox/SearchBox.js";
9
- import { HamburgerMenu as j } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
10
- import { ShoppingCart as D } from "../../molecules/Cart/Cart.js";
11
- import { Account as z } from "../../molecules/Account/Account.js";
12
- import { CategoryNav as F } from "../../molecules/CategoryNav/CategoryNav.js";
13
- import '../../assets/MainNav.css';const I = "_topNav_1uhwf_1", U = "_operations_1uhwf_9", M = "_search_1uhwf_16", Q = "_siteLink_1uhwf_19", B = "_accountArea_1uhwf_23", G = "_category_1uhwf_35", H = "_menuList_1uhwf_57", i = {
14
- topNav: I,
15
- operations: U,
16
- search: M,
17
- siteLink: Q,
18
- accountArea: B,
19
- category: G,
20
- menuList: H
9
+ import { HamburgerMenu as D } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
10
+ import { ShoppingCart as z } from "../../molecules/Cart/Cart.js";
11
+ import { Account as F } from "../../molecules/Account/Account.js";
12
+ import { CategoryNav as I } from "../../molecules/CategoryNav/CategoryNav.js";
13
+ import '../../assets/MainNav.css';const U = "_topNav_1uhwf_1", M = "_operations_1uhwf_9", Q = "_search_1uhwf_16", B = "_siteLink_1uhwf_19", G = "_accountArea_1uhwf_23", H = "_category_1uhwf_35", K = "_menuList_1uhwf_57", i = {
14
+ topNav: U,
15
+ operations: M,
16
+ search: Q,
17
+ siteLink: B,
18
+ accountArea: G,
19
+ category: H,
20
+ menuList: K
21
21
  };
22
- function $({
22
+ function q({
23
23
  account: s,
24
- categories: n,
25
- faqRoute: c,
24
+ categories: t,
25
+ faqRoute: o,
26
26
  customPartsRoute: l,
27
27
  aboutUsRoute: u,
28
28
  accountRoute: _,
29
29
  contactRoute: m,
30
30
  cart: N,
31
- onLoginClick: A,
31
+ cartSubtotal: A,
32
+ onLoginClick: v,
32
33
  onSearch: h,
33
- onItemQtyChange: v,
34
- onItemDelete: w,
35
- onItemEdit: g,
36
- onCheckout: x,
37
- ...L
34
+ onItemQtyChange: w,
35
+ onItemDelete: g,
36
+ onItemEdit: x,
37
+ onCheckout: L,
38
+ ...C
38
39
  }) {
39
- return /* @__PURE__ */ e(y, { ...L, children: /* @__PURE__ */ t(k, { span: 12, children: [
40
- /* @__PURE__ */ t(
41
- o,
40
+ return /* @__PURE__ */ e(b, { ...C, children: /* @__PURE__ */ n(k, { span: 12, children: [
41
+ /* @__PURE__ */ n(
42
+ c,
42
43
  {
43
44
  flexDirection: "row",
44
45
  alignItems: "center",
45
46
  justifyContent: "space-between",
46
47
  className: i.topNav,
47
48
  children: [
48
- /* @__PURE__ */ e("div", { className: i.logo, children: /* @__PURE__ */ e(b, {}) }),
49
- /* @__PURE__ */ t(
50
- o,
49
+ /* @__PURE__ */ e("div", { className: i.logo, children: /* @__PURE__ */ e(j, {}) }),
50
+ /* @__PURE__ */ n(
51
+ c,
51
52
  {
52
53
  flexDirection: "row",
53
54
  alignItems: "center",
54
55
  justifyContent: "flex-end",
55
56
  className: i.operations,
56
57
  children: [
57
- /* @__PURE__ */ e(o, { flexDirection: "row", hideAt: ["sm"], className: i.search, children: /* @__PURE__ */ e(d, { onSearch: h, inputName: "cpc-search" }) }),
58
+ /* @__PURE__ */ e(c, { flexDirection: "row", hideAt: ["sm"], className: i.search, children: /* @__PURE__ */ e(d, { onSearch: h, inputName: "cpc-search" }) }),
58
59
  /* @__PURE__ */ e(r, { href: l, hideAt: ["sm", "md"], children: "Custom Parts" }),
59
- /* @__PURE__ */ e(r, { href: c, hideAt: ["sm", "md"], children: "FAQ" }),
60
+ /* @__PURE__ */ e(r, { href: o, hideAt: ["sm", "md"], children: "FAQ" }),
60
61
  /* @__PURE__ */ e(r, { href: m, hideAt: ["sm", "md"], children: "Contact Us" }),
61
62
  /* @__PURE__ */ e("div", { className: i.accountArea, children: /* @__PURE__ */ e(
62
- z,
63
+ F,
63
64
  {
64
65
  account: s,
65
66
  accountRoute: _,
66
- onLoginClick: A,
67
+ onLoginClick: v,
67
68
  className: i.avatar
68
69
  }
69
70
  ) }),
70
71
  /* @__PURE__ */ e(
71
- D,
72
+ z,
72
73
  {
73
74
  cart: N,
74
- onItemDelete: w,
75
- onItemEdit: g,
76
- onItemQtyChange: v,
77
- onCheckout: x
75
+ onItemDelete: g,
76
+ onItemEdit: x,
77
+ onItemQtyChange: w,
78
+ onCheckout: L,
79
+ subtotal: A
78
80
  }
79
81
  ),
80
- /* @__PURE__ */ e(j, { hideAt: ["lg"], children: /* @__PURE__ */ t("ul", { className: i.menuList, children: [
82
+ /* @__PURE__ */ e(D, { hideAt: ["lg"], children: /* @__PURE__ */ n("ul", { className: i.menuList, children: [
81
83
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(r, { href: l, children: "Custom Parts" }) }),
82
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(r, { href: c, children: "FAQ" }) }),
84
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(r, { href: o, children: "FAQ" }) }),
83
85
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(r, { href: m, children: "Contact Us" }) }),
84
86
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(r, { href: u, children: "About Us" }) }),
85
- n && n.map((a) => /* @__PURE__ */ e("li", { className: i.category, children: /* @__PURE__ */ t(p, { href: a.route, children: [
87
+ t && t.map((a) => /* @__PURE__ */ e("li", { className: i.category, children: /* @__PURE__ */ n(p, { href: a.route, children: [
86
88
  /* @__PURE__ */ e(f, { size: "sm", weight: "semibold", children: a.label }),
87
89
  /* @__PURE__ */ e(
88
- C,
90
+ y,
89
91
  {
90
92
  iconKey: "fa-solid fa-chevron-right",
91
93
  title: "Navigate",
@@ -100,17 +102,17 @@ function $({
100
102
  ]
101
103
  }
102
104
  ),
103
- /* @__PURE__ */ e(o, { flexDirection: "row", hideAt: ["md", "lg"], children: /* @__PURE__ */ e(d, { onSearch: h, inputName: "cpc-search", className: i.search }) }),
104
- /* @__PURE__ */ e(F, { categories: n })
105
+ /* @__PURE__ */ e(c, { flexDirection: "row", hideAt: ["md", "lg"], children: /* @__PURE__ */ e(d, { onSearch: h, inputName: "cpc-search", className: i.search }) }),
106
+ /* @__PURE__ */ e(I, { categories: t })
105
107
  ] }) });
106
108
  }
107
109
  function r({
108
110
  href: s,
109
- children: n,
110
- ...c
111
+ children: t,
112
+ ...o
111
113
  }) {
112
- return /* @__PURE__ */ e(p, { href: s, className: i.siteLink, ...c, children: /* @__PURE__ */ e(f, { size: "md", variant: "display", children: n }) });
114
+ return /* @__PURE__ */ e(p, { href: s, className: i.siteLink, ...o, children: /* @__PURE__ */ e(f, { size: "md", variant: "display", children: t }) });
113
115
  }
114
116
  export {
115
- $ as MainNav
117
+ q as MainNav
116
118
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.33",
4
+ "version": "0.0.34",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",