@caseparts-org/caseblocks 0.0.33 → 0.0.35
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.
- package/dist/assets/Cart.css +1 -1
- package/dist/assets/QuantityInput.css +1 -0
- package/dist/main-client.d.ts +1 -0
- package/dist/main-client.js +27 -25
- package/dist/main-server.d.ts +2 -0
- package/dist/main-server.js +20 -18
- package/dist/molecules/Cart/Cart.d.ts +2 -1
- package/dist/molecules/Cart/Cart.js +52 -36
- package/dist/molecules/Cart/Cart.stories.d.ts +2 -1
- package/dist/molecules/Cart/Cart.stories.js +33 -7
- package/dist/molecules/QuantityInput/QuantityInput.d.ts +11 -0
- package/dist/molecules/QuantityInput/QuantityInput.js +73 -0
- package/dist/molecules/QuantityInput/QuantityInput.stories.d.ts +35 -0
- package/dist/molecules/QuantityInput/QuantityInput.stories.js +75 -0
- package/dist/organisms/MainNav/MainNav.d.ts +2 -1
- package/dist/organisms/MainNav/MainNav.js +53 -51
- package/package.json +1 -1
package/dist/assets/Cart.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
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}
|
package/dist/main-client.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export { MainNav } from './organisms/MainNav/MainNav';
|
|
|
14
14
|
export type { MainCategory, MainNavProps, Category } from './organisms/MainNav/MainNav';
|
|
15
15
|
export { ChipSelector } from './organisms/ChipSelector/ChipSelector';
|
|
16
16
|
export type { ChipSelectorProps } from './organisms/ChipSelector/ChipSelector';
|
|
17
|
+
export type { ShoppingCart, CartItem } from './molecules/Cart/Cart';
|
package/dist/main-client.js
CHANGED
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { Button as
|
|
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
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Root as
|
|
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
|
|
10
|
-
import { Logo as
|
|
11
|
-
import { SearchBox as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
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
|
|
20
|
+
import { ChipSelector as D } from "./organisms/ChipSelector/ChipSelector.js";
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
N as Account,
|
|
23
|
+
Q as Avatar,
|
|
24
|
+
t as Button,
|
|
24
25
|
V as Chip,
|
|
25
|
-
|
|
26
|
+
D as ChipSelector,
|
|
26
27
|
m as Column,
|
|
27
28
|
p as Flex,
|
|
28
29
|
f as Grid,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
37
|
-
|
|
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
|
-
|
|
43
|
+
H as Tooltip
|
|
42
44
|
};
|
package/dist/main-server.d.ts
CHANGED
|
@@ -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';
|
package/dist/main-server.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { Button as t } from "./atoms/Button/Button.js";
|
|
2
|
-
import { Flex as
|
|
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
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Root as
|
|
7
|
-
import { Separator as
|
|
8
|
-
import { Text as
|
|
9
|
-
import { Input as
|
|
10
|
-
import { Logo as
|
|
11
|
-
import { SearchBox as
|
|
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
|
-
|
|
16
|
+
p as Flex,
|
|
16
17
|
f as Grid,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
3
|
-
import { Text as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Tooltip as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
14
|
-
cart:
|
|
15
|
-
onItemQtyChange:
|
|
16
|
-
onItemDelete:
|
|
17
|
-
onItemEdit:
|
|
18
|
-
onCheckout:
|
|
19
|
-
|
|
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
|
|
22
|
-
|
|
27
|
+
return i = i || { items: [] }, /* @__PURE__ */ t(
|
|
28
|
+
_,
|
|
23
29
|
{
|
|
24
|
-
trigger: /* @__PURE__ */ n("button", { className:
|
|
30
|
+
trigger: /* @__PURE__ */ n("button", { className: e.cart, ...d, children: [
|
|
25
31
|
/* @__PURE__ */ t(
|
|
26
|
-
|
|
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
|
-
|
|
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:
|
|
38
|
-
/* @__PURE__ */ t(
|
|
39
|
-
/* @__PURE__ */ t("div", { className:
|
|
40
|
-
(
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
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
|
-
] },
|
|
50
|
-
) }) : /* @__PURE__ */ t("div", { className:
|
|
51
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
73
|
+
T as ShoppingCart
|
|
58
74
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShoppingCart as e } from "./Cart.js";
|
|
2
|
-
const
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
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
|
|
5
|
-
import { Flex as
|
|
6
|
-
import { Grid as
|
|
7
|
-
import { Logo as
|
|
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
|
|
10
|
-
import { ShoppingCart as
|
|
11
|
-
import { Account as
|
|
12
|
-
import { CategoryNav as
|
|
13
|
-
import '../../assets/MainNav.css';const
|
|
14
|
-
topNav:
|
|
15
|
-
operations:
|
|
16
|
-
search:
|
|
17
|
-
siteLink:
|
|
18
|
-
accountArea:
|
|
19
|
-
category:
|
|
20
|
-
menuList:
|
|
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:
|
|
25
|
-
faqRoute:
|
|
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
|
-
|
|
31
|
+
cartSubtotal: A,
|
|
32
|
+
onLoginClick: v,
|
|
32
33
|
onSearch: h,
|
|
33
|
-
onItemQtyChange:
|
|
34
|
-
onItemDelete:
|
|
35
|
-
onItemEdit:
|
|
36
|
-
onCheckout:
|
|
37
|
-
...
|
|
34
|
+
onItemQtyChange: w,
|
|
35
|
+
onItemDelete: g,
|
|
36
|
+
onItemEdit: x,
|
|
37
|
+
onCheckout: L,
|
|
38
|
+
...C
|
|
38
39
|
}) {
|
|
39
|
-
return /* @__PURE__ */ e(
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
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(
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
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(
|
|
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:
|
|
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
|
-
|
|
63
|
+
F,
|
|
63
64
|
{
|
|
64
65
|
account: s,
|
|
65
66
|
accountRoute: _,
|
|
66
|
-
onLoginClick:
|
|
67
|
+
onLoginClick: v,
|
|
67
68
|
className: i.avatar
|
|
68
69
|
}
|
|
69
70
|
) }),
|
|
70
71
|
/* @__PURE__ */ e(
|
|
71
|
-
|
|
72
|
+
z,
|
|
72
73
|
{
|
|
73
74
|
cart: N,
|
|
74
|
-
onItemDelete:
|
|
75
|
-
onItemEdit:
|
|
76
|
-
onItemQtyChange:
|
|
77
|
-
onCheckout:
|
|
75
|
+
onItemDelete: g,
|
|
76
|
+
onItemEdit: x,
|
|
77
|
+
onItemQtyChange: w,
|
|
78
|
+
onCheckout: L,
|
|
79
|
+
subtotal: A
|
|
78
80
|
}
|
|
79
81
|
),
|
|
80
|
-
/* @__PURE__ */ e(
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
104
|
-
/* @__PURE__ */ e(
|
|
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:
|
|
110
|
-
...
|
|
111
|
+
children: t,
|
|
112
|
+
...o
|
|
111
113
|
}) {
|
|
112
|
-
return /* @__PURE__ */ e(p, { href: s, className: i.siteLink, ...
|
|
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
|
-
|
|
117
|
+
q as MainNav
|
|
116
118
|
};
|