@caseparts-org/caseblocks 0.0.89 → 0.0.91
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/Cart.module-9txlotpz.js +18 -0
- package/dist/assets/Cart.css +1 -1
- package/dist/assets/Icon.css +1 -1
- package/dist/assets/Popover.css +1 -0
- package/dist/assets/SlideInPanel.css +1 -0
- package/dist/assets/Tooltip.css +1 -1
- package/dist/assets/buttonClassName.css +1 -1
- package/dist/atoms/Button/buttonClassName.js +25 -25
- package/dist/atoms/Icon/Icon.d.ts +3 -1
- package/dist/atoms/Icon/Icon.js +48 -32
- package/dist/atoms/Input/Input.js +4 -4
- package/dist/atoms/Popover/Popover.d.ts +14 -0
- package/dist/atoms/Popover/Popover.js +110 -0
- package/dist/atoms/Popover/Popover.stories.d.ts +66 -0
- package/dist/atoms/Popover/Popover.stories.js +207 -0
- package/dist/atoms/SlideInPanel/SlideInPanel.d.ts +18 -0
- package/dist/atoms/SlideInPanel/SlideInPanel.js +99 -0
- package/dist/atoms/SlideInPanel/SlideInPanel.stories.d.ts +10 -0
- package/dist/atoms/SlideInPanel/SlideInPanel.stories.js +117 -0
- package/dist/atoms/Tooltip/Tooltip.d.ts +16 -0
- package/dist/atoms/Tooltip/Tooltip.js +126 -0
- package/dist/{molecules → atoms}/Tooltip/Tooltip.stories.d.ts +8 -26
- package/dist/atoms/Tooltip/Tooltip.stories.js +209 -0
- package/dist/index-B4KbmMH3.js +383 -0
- package/dist/main-client.d.ts +3 -1
- package/dist/main-client.js +40 -38
- package/dist/molecules/AddToCart/AddToCart.js +18 -18
- package/dist/molecules/CardLink/CardLink.js +5 -5
- package/dist/molecules/Cart/Cart.d.ts +10 -6
- package/dist/molecules/Cart/Cart.js +42 -93
- package/dist/molecules/Cart/Cart.stories.js +61 -28
- package/dist/molecules/Cart/CartSlideInPanel.d.ts +15 -0
- package/dist/molecules/Cart/CartSlideInPanel.js +97 -0
- package/dist/molecules/CategoryNav/CategoryNav.js +2 -2
- package/dist/molecules/StatefulButton/StatefulButton.stories.js +4 -4
- package/dist/molecules/ToggleView/ToggleView.js +6 -6
- package/dist/organisms/Carousel/Carousel.js +44 -44
- package/dist/organisms/Footer/Footer.js +1 -1
- package/dist/organisms/MainNav/MainNav.d.ts +13 -11
- package/dist/organisms/MainNav/MainNav.js +86 -82
- package/dist/organisms/MainNav/MainNav.stories.d.ts +1 -2
- package/dist/organisms/MainNav/MainNav.stories.js +85 -58
- package/package.json +28 -7
- package/dist/molecules/Cart/Cart.stories.d.ts +0 -15
- package/dist/molecules/Tooltip/Tooltip.d.ts +0 -12
- package/dist/molecules/Tooltip/Tooltip.js +0 -2321
- package/dist/molecules/Tooltip/Tooltip.stories.js +0 -202
package/dist/main-client.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
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 f, Grid as x } from "./atoms/Grid/Grid.js";
|
|
4
|
-
import { Head as
|
|
5
|
-
import { Icon as
|
|
4
|
+
import { Head as a } from "./atoms/Root/Head.js";
|
|
5
|
+
import { Icon as l } from "./atoms/Icon/Icon.js";
|
|
6
6
|
import { Root as c } 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
|
|
10
|
-
import { Link as
|
|
11
|
-
import { linkClassName as
|
|
9
|
+
import { Input as A } from "./atoms/Input/Input.js";
|
|
10
|
+
import { Link as I } from "./atoms/Link/Link.js";
|
|
11
|
+
import { linkClassName as h } from "./atoms/Link/linkClassName.js";
|
|
12
12
|
import { configureLink as T, routerOverride as s } from "./atoms/Link/configureLink.js";
|
|
13
13
|
import { LinkButton as N } from "./atoms/LinkButton/LinkButton.js";
|
|
14
|
-
import { configureImage as
|
|
15
|
-
import { Logo as
|
|
14
|
+
import { configureImage as y } from "./atoms/Image/configureImage.js";
|
|
15
|
+
import { Logo as M } from "./molecules/Logo/Logo.js";
|
|
16
16
|
import { SearchBox as w } from "./molecules/SearchBox/SearchBox.js";
|
|
17
17
|
import { QuantityInput as G } from "./molecules/QuantityInput/QuantityInput.js";
|
|
18
18
|
import { Pricing as Q } from "./molecules/Pricing/Pricing.js";
|
|
@@ -22,55 +22,57 @@ import { BannerCard as E } from "./molecules/BannerCard/BannerCard.js";
|
|
|
22
22
|
import { CardLink as K } from "./molecules/CardLink/CardLink.js";
|
|
23
23
|
import { NotFound as W } from "./organisms/NotFound/NotFound.js";
|
|
24
24
|
import { HorizontalScroll as Y } from "./atoms/HorizontalScroll/HorizontalScroll.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
25
|
+
import { SlideInPanel as _ } from "./atoms/SlideInPanel/SlideInPanel.js";
|
|
26
|
+
import { Tooltip as oo } from "./atoms/Tooltip/Tooltip.js";
|
|
27
|
+
import { Account as to } from "./molecules/Account/Account.js";
|
|
28
|
+
import { Chip as po } from "./molecules/Chip/Chip.js";
|
|
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";
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
to as Account,
|
|
40
|
+
uo as AddToCart,
|
|
41
|
+
io as AnimatedCheckMark,
|
|
41
42
|
V as Availability,
|
|
42
43
|
q as Avatar,
|
|
43
44
|
E as BannerCard,
|
|
44
45
|
t as Button,
|
|
45
46
|
K as CardLink,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
Io as Carousel,
|
|
48
|
+
po as Chip,
|
|
49
|
+
ko as ChipSelector,
|
|
49
50
|
f as Column,
|
|
50
51
|
p as Flex,
|
|
51
|
-
|
|
52
|
+
ho as Footer,
|
|
52
53
|
x as Grid,
|
|
53
|
-
|
|
54
|
+
a as Head,
|
|
54
55
|
Y as HorizontalScroll,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
l as Icon,
|
|
57
|
+
A as Input,
|
|
58
|
+
I as Link,
|
|
58
59
|
N as LinkButton,
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
M as Logo,
|
|
61
|
+
Co as MainNav,
|
|
61
62
|
W as NotFound,
|
|
62
63
|
Q as Pricing,
|
|
63
|
-
|
|
64
|
+
Ao as Product,
|
|
64
65
|
G as QuantityInput,
|
|
65
66
|
c as Root,
|
|
66
67
|
w as SearchBox,
|
|
67
68
|
C as Separator,
|
|
68
|
-
|
|
69
|
+
_ as SlideInPanel,
|
|
70
|
+
no as StatefulButton,
|
|
69
71
|
k as Text,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
fo as ToggleView,
|
|
73
|
+
oo as Tooltip,
|
|
74
|
+
y as configureImage,
|
|
73
75
|
T as configureLink,
|
|
74
|
-
|
|
76
|
+
h as linkClassName,
|
|
75
77
|
s as routerOverride
|
|
76
78
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as S, jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import r from "react";
|
|
3
3
|
import { c as j } from "../../clsx-OuTLNxxd.js";
|
|
4
4
|
import { StatefulButton as v } from "../StatefulButton/StatefulButton.js";
|
|
@@ -8,7 +8,7 @@ import '../../assets/AddToCart.css';const w = "_container_1xk40_1", y = {
|
|
|
8
8
|
};
|
|
9
9
|
function F({
|
|
10
10
|
itemKey: s,
|
|
11
|
-
initialQuantity:
|
|
11
|
+
initialQuantity: i = 1,
|
|
12
12
|
min: o = 1,
|
|
13
13
|
max: l,
|
|
14
14
|
onQuantityChange: c,
|
|
@@ -17,42 +17,42 @@ function F({
|
|
|
17
17
|
showQuantity: p = !0,
|
|
18
18
|
className: x,
|
|
19
19
|
addButtonClassName: T,
|
|
20
|
-
buttonText:
|
|
21
|
-
buttonDoneText:
|
|
20
|
+
buttonText: _,
|
|
21
|
+
buttonDoneText: b,
|
|
22
22
|
size: a
|
|
23
23
|
}) {
|
|
24
|
-
const [u,
|
|
25
|
-
const e = Number(
|
|
24
|
+
const [u, k] = r.useState(() => {
|
|
25
|
+
const e = Number(i) || 1;
|
|
26
26
|
return e < o ? o : e;
|
|
27
|
-
}), [
|
|
27
|
+
}), [A, n] = r.useState(!1), t = r.useRef(null);
|
|
28
28
|
r.useEffect(() => () => {
|
|
29
29
|
t.current && clearTimeout(t.current);
|
|
30
30
|
}, []);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
}, [c]),
|
|
31
|
+
const N = r.useCallback((e) => {
|
|
32
|
+
k(e), c == null || c(e);
|
|
33
|
+
}, [c]), R = async () => {
|
|
34
34
|
s && (await m(s, u), n(!0), t.current && clearTimeout(t.current), t.current = setTimeout(() => n(!1), f));
|
|
35
35
|
};
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
p && /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ S("div", { className: j(y.container, x), children: [
|
|
37
|
+
p && /* @__PURE__ */ d(
|
|
38
38
|
q,
|
|
39
39
|
{
|
|
40
40
|
quantity: u,
|
|
41
|
-
onQuantityChange:
|
|
41
|
+
onQuantityChange: N,
|
|
42
42
|
min: o,
|
|
43
43
|
max: l,
|
|
44
44
|
size: a || "md"
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ d(
|
|
48
48
|
v,
|
|
49
49
|
{
|
|
50
50
|
size: a || "md",
|
|
51
51
|
variant: "cta-primary",
|
|
52
|
-
completed:
|
|
53
|
-
onClick:
|
|
54
|
-
text:
|
|
55
|
-
completedText:
|
|
52
|
+
completed: A,
|
|
53
|
+
onClick: R,
|
|
54
|
+
text: _,
|
|
55
|
+
completedText: b,
|
|
56
56
|
disabled: !s,
|
|
57
57
|
className: T
|
|
58
58
|
}
|
|
@@ -2,19 +2,19 @@ import { jsx as a, jsxs as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { Text as r } from "../../atoms/Text/Text.js";
|
|
3
3
|
import { Link as n } from "../../atoms/Link/Link.js";
|
|
4
4
|
import { Image as m } from "../../atoms/Image/Image.js";
|
|
5
|
-
import '../../assets/CardLink.css';const _ = "_card_1yols_1", u = "_cardLink_1yols_24", y = "_callout_1yols_29",
|
|
5
|
+
import '../../assets/CardLink.css';const _ = "_card_1yols_1", u = "_cardLink_1yols_24", y = "_callout_1yols_29", h = "_calloutText_1yols_51", g = "_cardImage_1yols_57", T = "_cardBody_1yols_66", p = "_cardTitle_1yols_75", x = "_cardDescription_1yols_83", c = {
|
|
6
6
|
card: _,
|
|
7
7
|
cardLink: u,
|
|
8
8
|
callout: y,
|
|
9
|
-
calloutText:
|
|
9
|
+
calloutText: h,
|
|
10
10
|
cardImage: g,
|
|
11
|
-
cardBody:
|
|
12
|
-
cardTitle:
|
|
11
|
+
cardBody: T,
|
|
12
|
+
cardTitle: p,
|
|
13
13
|
cardDescription: x
|
|
14
14
|
};
|
|
15
15
|
function z({ href: l = "#", src: o, alt: s = "", callout: t = "Customize", title: i = "Title", description: d = "Customizable part description." }) {
|
|
16
16
|
return /* @__PURE__ */ a(n, { href: l, unstyled: !0, className: c.cardLink, children: /* @__PURE__ */ e("div", { className: c.card, children: [
|
|
17
|
-
/* @__PURE__ */ a(m, { src: o, alt: s, className: c.cardImage }),
|
|
17
|
+
/* @__PURE__ */ a(m, { src: o, alt: s, width: 208, height: 104, className: c.cardImage }),
|
|
18
18
|
/* @__PURE__ */ a("div", { className: c.callout, children: /* @__PURE__ */ a(r, { size: "xs", weight: "regular", colorToken: "default-inverted", className: c.calloutText, children: t }) }),
|
|
19
19
|
/* @__PURE__ */ e("div", { className: c.cardBody, children: [
|
|
20
20
|
/* @__PURE__ */ a(r, { size: "sm", weight: "regular", colorToken: "secondary", className: c.cardTitle, children: i }),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { ContactUsLinkBehavior } from '../Availability/Availability';
|
|
3
2
|
export interface CartItem {
|
|
4
3
|
id: string | number;
|
|
5
4
|
itemId: string | undefined;
|
|
@@ -17,15 +16,20 @@ export interface ShoppingCart {
|
|
|
17
16
|
export interface CartPropsBase {
|
|
18
17
|
onItemQtyChange: (_item: CartItem, _newQuantity: number) => void;
|
|
19
18
|
onItemDelete: (_item: CartItem) => void;
|
|
20
|
-
onItemEdit: (_item: CartItem) => void;
|
|
21
19
|
onCheckout: () => void;
|
|
20
|
+
cart: ShoppingCart;
|
|
22
21
|
subtotal?: string;
|
|
23
22
|
itemPriceLabel?: string;
|
|
24
|
-
cart: ShoppingCart;
|
|
25
23
|
contactHref?: string;
|
|
26
|
-
|
|
24
|
+
open?: boolean;
|
|
25
|
+
onCartClick: () => void;
|
|
26
|
+
}
|
|
27
|
+
export interface ShoppingCartHandle {
|
|
28
|
+
open: () => void;
|
|
29
|
+
close: () => void;
|
|
30
|
+
toggle: () => void;
|
|
27
31
|
}
|
|
28
|
-
interface CartProps extends CartPropsBase, React.
|
|
32
|
+
interface CartProps extends CartPropsBase, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
29
33
|
}
|
|
30
|
-
export declare
|
|
34
|
+
export declare const ShoppingCart: React.ForwardRefExoticComponent<CartProps & React.RefAttributes<ShoppingCartHandle>>;
|
|
31
35
|
export {};
|
|
@@ -1,97 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
contactHref: d,
|
|
31
|
-
contactLinkBehavior: h,
|
|
32
|
-
itemPriceLabel: p,
|
|
33
|
-
..._
|
|
34
|
-
}) {
|
|
35
|
-
return o = o || { items: [] }, /* @__PURE__ */ t(
|
|
36
|
-
g,
|
|
1
|
+
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import l from "react";
|
|
3
|
+
import { Icon as g } from "../../atoms/Icon/Icon.js";
|
|
4
|
+
import { Text as p } from "../../atoms/Text/Text.js";
|
|
5
|
+
import { s as m } from "../../Cart.module-9txlotpz.js";
|
|
6
|
+
const S = l.forwardRef(function({
|
|
7
|
+
cart: i,
|
|
8
|
+
open: t = !1,
|
|
9
|
+
onCartClick: e,
|
|
10
|
+
className: c,
|
|
11
|
+
...n
|
|
12
|
+
}, o) {
|
|
13
|
+
i = i || { items: [] }, l.useImperativeHandle(o, () => ({
|
|
14
|
+
open: () => {
|
|
15
|
+
t || e();
|
|
16
|
+
},
|
|
17
|
+
close: () => {
|
|
18
|
+
t && e();
|
|
19
|
+
},
|
|
20
|
+
toggle: () => {
|
|
21
|
+
e();
|
|
22
|
+
}
|
|
23
|
+
}), [t, e]);
|
|
24
|
+
const f = (r) => {
|
|
25
|
+
var s;
|
|
26
|
+
(s = n.onClick) == null || s.call(n, r), e();
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ a("div", { className: c, children: /* @__PURE__ */ d(
|
|
29
|
+
"button",
|
|
37
30
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
o.items.length > 0 && /* @__PURE__ */ t("div", { className: i.count, children: /* @__PURE__ */ t(a, { size: "xxs", children: o.items.length }) })
|
|
49
|
-
] }),
|
|
50
|
-
placement: "bottom",
|
|
51
|
-
on: "click",
|
|
52
|
-
children: /* @__PURE__ */ n("div", { className: i.cartContainer, children: [
|
|
53
|
-
/* @__PURE__ */ t(a, { size: "2xl", children: "Cart" }),
|
|
54
|
-
/* @__PURE__ */ t("div", { className: i.cartItems, children: o.items.length > 0 ? /* @__PURE__ */ t("ul", { children: o.items.map(
|
|
55
|
-
(e) => /* @__PURE__ */ n("li", { className: i.cartItem, children: [
|
|
56
|
-
/* @__PURE__ */ t("img", { src: e.imageUrl, alt: `${e.itemId} product image` }),
|
|
57
|
-
/* @__PURE__ */ n("div", { children: [
|
|
58
|
-
/* @__PURE__ */ n("div", { className: i.topRow, children: [
|
|
59
|
-
/* @__PURE__ */ n("div", { className: i.itemInfo, children: [
|
|
60
|
-
/* @__PURE__ */ t(a, { size: "sm", weight: "semibold", children: /* @__PURE__ */ t(u, { href: e.itemHref || `/part/${e.itemId}`, children: e.description }) }),
|
|
61
|
-
/* @__PURE__ */ n(a, { size: "sm", children: [
|
|
62
|
-
"Part # ",
|
|
63
|
-
e.itemId
|
|
64
|
-
] })
|
|
65
|
-
] }),
|
|
66
|
-
/* @__PURE__ */ t("button", { onClick: () => c(e), className: i.removeItem, children: /* @__PURE__ */ t(m, { iconKey: "fa-regular fa-trash", size: "sm" }) })
|
|
67
|
-
] }),
|
|
68
|
-
/* @__PURE__ */ n("div", { className: i.itemManagement, children: [
|
|
69
|
-
/* @__PURE__ */ n("div", { className: i.purchaseInformation, children: [
|
|
70
|
-
/* @__PURE__ */ t(
|
|
71
|
-
x,
|
|
72
|
-
{
|
|
73
|
-
availId: e.availabilityId || "",
|
|
74
|
-
availDescription: e.availability || "",
|
|
75
|
-
contactHref: d || "",
|
|
76
|
-
contactLinkBehavior: h || "new-tab"
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
/* @__PURE__ */ t(v, { pricingLabel: p || "List Price", price: e.price })
|
|
80
|
-
] }),
|
|
81
|
-
/* @__PURE__ */ t(w, { quantity: e.quantity, onQuantityChange: (I) => s(e, I), size: "sm" })
|
|
82
|
-
] })
|
|
83
|
-
] })
|
|
84
|
-
] }, e.id)
|
|
85
|
-
) }) : /* @__PURE__ */ t("div", { className: i.noItems, children: /* @__PURE__ */ t(a, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
|
|
86
|
-
r && /* @__PURE__ */ n("div", { className: i.subtotal, children: [
|
|
87
|
-
/* @__PURE__ */ t(a, { size: "md", weight: "semibold", children: "Subtotal" }),
|
|
88
|
-
/* @__PURE__ */ t(a, { size: "md", weight: "semibold", children: r })
|
|
89
|
-
] }),
|
|
90
|
-
/* @__PURE__ */ t(f, { disabled: o.items.length === 0, onClick: l, variant: "cta-primary", size: "md", children: "Checkout" })
|
|
91
|
-
] })
|
|
31
|
+
className: m.cartIconButton,
|
|
32
|
+
tabIndex: 0,
|
|
33
|
+
"aria-expanded": t,
|
|
34
|
+
"aria-controls": "cart-panel",
|
|
35
|
+
onClick: f,
|
|
36
|
+
...n,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ a(g, { iconKey: "fa-kit fa-shoppingcart-empty", title: "Shopping Cart", size: "lg" }),
|
|
39
|
+
i.items.length > 0 && /* @__PURE__ */ a("div", { className: m.count, children: /* @__PURE__ */ a(p, { size: "xxs", children: i.items.length }) })
|
|
40
|
+
]
|
|
92
41
|
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
42
|
+
) });
|
|
43
|
+
});
|
|
95
44
|
export {
|
|
96
|
-
|
|
45
|
+
S as ShoppingCart
|
|
97
46
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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 = {
|
|
3
6
|
title: "Case Parts/Molecules/Cart",
|
|
4
|
-
component:
|
|
7
|
+
component: r,
|
|
5
8
|
parameters: {
|
|
6
9
|
layout: "centered"
|
|
7
10
|
},
|
|
8
11
|
tags: ["autodocs"]
|
|
9
|
-
}, a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg",
|
|
12
|
+
}, a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", m = {
|
|
10
13
|
items: [
|
|
11
14
|
{ id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
|
|
12
15
|
{ id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
|
|
@@ -21,14 +24,41 @@ const r = {
|
|
|
21
24
|
{ id: 11, itemId: "1092-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
|
|
22
25
|
{ id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" }
|
|
23
26
|
]
|
|
24
|
-
},
|
|
27
|
+
}, y = {
|
|
25
28
|
items: [
|
|
26
29
|
{ id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
|
|
27
30
|
{ id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
|
|
28
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" },
|
|
29
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" }
|
|
30
33
|
]
|
|
31
|
-
},
|
|
34
|
+
}, t = (i) => {
|
|
35
|
+
const [e, l] = d(!1);
|
|
36
|
+
return /* @__PURE__ */ c("div", { style: { width: "100%", display: "flex", justifyContent: "center" }, children: [
|
|
37
|
+
/* @__PURE__ */ o(
|
|
38
|
+
r,
|
|
39
|
+
{
|
|
40
|
+
...i,
|
|
41
|
+
open: e,
|
|
42
|
+
onCartClick: () => l((n) => !n)
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ o(
|
|
46
|
+
s,
|
|
47
|
+
{
|
|
48
|
+
open: e,
|
|
49
|
+
onClose: () => l(!1),
|
|
50
|
+
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
|
+
}
|
|
59
|
+
)
|
|
60
|
+
] });
|
|
61
|
+
}, C = {
|
|
32
62
|
args: {
|
|
33
63
|
cart: { items: [] },
|
|
34
64
|
onCheckout: () => {
|
|
@@ -37,51 +67,54 @@ const r = {
|
|
|
37
67
|
onItemDelete: () => {
|
|
38
68
|
alert("Delete");
|
|
39
69
|
},
|
|
40
|
-
onItemEdit: () => {
|
|
41
|
-
alert("Edit");
|
|
42
|
-
},
|
|
43
70
|
onItemQtyChange: () => {
|
|
44
71
|
alert("Qty Change");
|
|
72
|
+
},
|
|
73
|
+
onCartClick: () => {
|
|
45
74
|
}
|
|
46
|
-
|
|
47
|
-
},
|
|
75
|
+
// required placeholder (overridden in render)
|
|
76
|
+
},
|
|
77
|
+
render: t
|
|
78
|
+
}, k = {
|
|
48
79
|
args: {
|
|
49
|
-
cart:
|
|
80
|
+
cart: m,
|
|
50
81
|
onCheckout: () => {
|
|
51
82
|
alert("Checkout");
|
|
52
83
|
},
|
|
53
84
|
onItemDelete: () => {
|
|
54
85
|
alert("Delete");
|
|
55
86
|
},
|
|
56
|
-
onItemEdit: () => {
|
|
57
|
-
alert("Edit");
|
|
58
|
-
},
|
|
59
87
|
onItemQtyChange: () => {
|
|
60
88
|
alert("Qty Change");
|
|
61
89
|
},
|
|
62
|
-
subtotal: "$748.98"
|
|
63
|
-
|
|
64
|
-
}
|
|
90
|
+
subtotal: "$748.98",
|
|
91
|
+
onCartClick: () => {
|
|
92
|
+
}
|
|
93
|
+
// required
|
|
94
|
+
},
|
|
95
|
+
render: t
|
|
96
|
+
}, g = {
|
|
65
97
|
args: {
|
|
66
|
-
cart:
|
|
98
|
+
cart: y,
|
|
67
99
|
onCheckout: () => {
|
|
68
100
|
alert("Checkout");
|
|
69
101
|
},
|
|
70
102
|
onItemDelete: () => {
|
|
71
103
|
alert("Delete");
|
|
72
104
|
},
|
|
73
|
-
onItemEdit: () => {
|
|
74
|
-
alert("Edit");
|
|
75
|
-
},
|
|
76
105
|
onItemQtyChange: () => {
|
|
77
106
|
alert("Qty Change");
|
|
78
107
|
},
|
|
79
|
-
subtotal: "$748.98"
|
|
80
|
-
|
|
108
|
+
subtotal: "$748.98",
|
|
109
|
+
onCartClick: () => {
|
|
110
|
+
}
|
|
111
|
+
// required
|
|
112
|
+
},
|
|
113
|
+
render: t
|
|
81
114
|
};
|
|
82
115
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
116
|
+
C as EmptyCart,
|
|
117
|
+
k as LargeCart,
|
|
118
|
+
g as SmallCart,
|
|
119
|
+
u as default
|
|
87
120
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ContactUsLinkBehavior } from '../Availability/Availability';
|
|
2
|
+
import { CartItem, ShoppingCart } from './Cart';
|
|
3
|
+
export interface CartSlideInPanelProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
cart: ShoppingCart;
|
|
7
|
+
subtotal?: string;
|
|
8
|
+
itemPriceLabel?: string;
|
|
9
|
+
contactHref?: string;
|
|
10
|
+
contactLinkBehavior?: ContactUsLinkBehavior;
|
|
11
|
+
onItemQtyChange: (_item: CartItem, _newQty: number) => void;
|
|
12
|
+
onItemDelete: (_item: CartItem) => void;
|
|
13
|
+
onCheckout: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function CartSlideInPanel({ open, onClose, cart, subtotal, itemPriceLabel, contactHref, contactLinkBehavior, onItemQtyChange, onItemDelete, onCheckout }: CartSlideInPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { SlideInPanel as g } from "../../atoms/SlideInPanel/SlideInPanel.js";
|
|
3
|
+
import { Text as n } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Link as I } from "../../atoms/Link/Link.js";
|
|
5
|
+
import { Button as y } from "../../atoms/Button/Button.js";
|
|
6
|
+
import { Pricing as b } from "../Pricing/Pricing.js";
|
|
7
|
+
import { QuantityInput as N } from "../QuantityInput/QuantityInput.js";
|
|
8
|
+
import { Availability as z } from "../Availability/Availability.js";
|
|
9
|
+
import { Icon as C } from "../../atoms/Icon/Icon.js";
|
|
10
|
+
import { s as t } from "../../Cart.module-9txlotpz.js";
|
|
11
|
+
function Q({
|
|
12
|
+
open: s,
|
|
13
|
+
onClose: o,
|
|
14
|
+
cart: r,
|
|
15
|
+
subtotal: l,
|
|
16
|
+
itemPriceLabel: c,
|
|
17
|
+
contactHref: d,
|
|
18
|
+
contactLinkBehavior: h,
|
|
19
|
+
onItemQtyChange: p,
|
|
20
|
+
onItemDelete: u,
|
|
21
|
+
onCheckout: v
|
|
22
|
+
}) {
|
|
23
|
+
var m;
|
|
24
|
+
return r = r || { items: [] }, /* @__PURE__ */ e(
|
|
25
|
+
g,
|
|
26
|
+
{
|
|
27
|
+
side: "right",
|
|
28
|
+
open: s,
|
|
29
|
+
onClose: o,
|
|
30
|
+
ariaLabel: "Shopping Cart",
|
|
31
|
+
children: /* @__PURE__ */ a("div", { id: "cart-panel", className: t.cartContainer, children: [
|
|
32
|
+
/* @__PURE__ */ a("div", { className: t.header, children: [
|
|
33
|
+
/* @__PURE__ */ e(n, { size: "2xl", children: "Cart" }),
|
|
34
|
+
/* @__PURE__ */ a(n, { size: "xs", colorToken: "quaternary", children: [
|
|
35
|
+
(m = r == null ? void 0 : r.items) == null ? void 0 : m.length,
|
|
36
|
+
" items in your cart"
|
|
37
|
+
] })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ e("div", { className: t.cartItems, children: r.items.length > 0 ? /* @__PURE__ */ e("ul", { children: r.items.map((i) => /* @__PURE__ */ a("li", { className: t.cartItem, children: [
|
|
40
|
+
/* @__PURE__ */ e("img", { src: i.imageUrl, alt: `${i.itemId} product image` }),
|
|
41
|
+
/* @__PURE__ */ a("div", { children: [
|
|
42
|
+
/* @__PURE__ */ a("div", { className: t.topRow, children: [
|
|
43
|
+
/* @__PURE__ */ a("div", { className: t.itemInfo, children: [
|
|
44
|
+
/* @__PURE__ */ e(n, { size: "sm", weight: "semibold", children: /* @__PURE__ */ e(I, { href: i.itemHref || `/part/${i.itemId}`, children: i.description }) }),
|
|
45
|
+
/* @__PURE__ */ a(n, { size: "sm", children: [
|
|
46
|
+
"Part # ",
|
|
47
|
+
i.itemId
|
|
48
|
+
] })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ e("button", { onClick: () => u(i), className: t.removeItem, "aria-label": "Remove item", children: /* @__PURE__ */ e(C, { iconKey: "fa-regular fa-trash", size: "sm" }) })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ a("div", { className: t.itemManagement, children: [
|
|
53
|
+
/* @__PURE__ */ a("div", { className: t.purchaseInformation, children: [
|
|
54
|
+
/* @__PURE__ */ e(
|
|
55
|
+
z,
|
|
56
|
+
{
|
|
57
|
+
availId: i.availabilityId || "",
|
|
58
|
+
availDescription: i.availability || "",
|
|
59
|
+
contactHref: d || "",
|
|
60
|
+
contactLinkBehavior: h || "new-tab"
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ e(b, { pricingLabel: c || "List Price", price: i.price })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ e(
|
|
66
|
+
N,
|
|
67
|
+
{
|
|
68
|
+
quantity: i.quantity,
|
|
69
|
+
onQuantityChange: (f) => p(i, f),
|
|
70
|
+
size: "sm"
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] })
|
|
74
|
+
] })
|
|
75
|
+
] }, i.id)) }) : /* @__PURE__ */ e("div", { className: t.noItems, children: /* @__PURE__ */ e(n, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
|
|
76
|
+
l && /* @__PURE__ */ a("div", { className: t.subtotal, children: [
|
|
77
|
+
/* @__PURE__ */ e(n, { size: "md", weight: "semibold", children: "Subtotal" }),
|
|
78
|
+
/* @__PURE__ */ e(n, { size: "md", weight: "semibold", children: l })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ e(
|
|
81
|
+
y,
|
|
82
|
+
{
|
|
83
|
+
disabled: r.items.length === 0,
|
|
84
|
+
onClick: v,
|
|
85
|
+
variant: "cta-primary",
|
|
86
|
+
size: "md",
|
|
87
|
+
className: t.checkoutButton,
|
|
88
|
+
children: "Checkout"
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] })
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
Q as CartSlideInPanel
|
|
97
|
+
};
|