@caseparts-org/caseblocks 0.0.206 → 0.0.207
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/Availability.css +1 -1
- package/dist/assets/DropdownButton.css +1 -0
- package/dist/atoms/DropdownButton/DropdownButton.d.ts +26 -0
- package/dist/atoms/DropdownButton/DropdownButton.js +126 -0
- package/dist/atoms/DropdownButton/DropdownButton.stories.d.ts +13 -0
- package/dist/atoms/DropdownButton/DropdownButton.stories.js +33 -0
- package/dist/atoms/Popover/Popover.d.ts +1 -0
- package/dist/atoms/Popover/Popover.js +44 -43
- package/dist/main-client.d.ts +2 -0
- package/dist/main-client.js +51 -49
- package/dist/main-server.d.ts +1 -1
- package/dist/molecules/Availability/Availability.d.ts +14 -5
- package/dist/molecules/Availability/Availability.js +61 -30
- package/dist/molecules/Availability/Availability.stories.d.ts +14 -13
- package/dist/molecules/Availability/Availability.stories.js +81 -46
- package/dist/molecules/Cart/Cart.d.ts +3 -3
- package/dist/molecules/Cart/Cart.stories.d.ts +15 -0
- package/dist/molecules/Cart/Cart.stories.js +4 -6
- package/dist/molecules/Cart/CartPart.d.ts +4 -5
- package/dist/molecules/Cart/CartPart.js +41 -42
- package/dist/molecules/Cart/CartPart.stories.d.ts +3 -3
- package/dist/molecules/Cart/CartPart.stories.js +30 -20
- package/dist/molecules/Cart/CartSlideInPanel.d.ts +1 -4
- package/dist/molecules/Cart/CartSlideInPanel.js +12 -16
- package/dist/organisms/MainNav/MainNav.stories.js +6 -8
- package/dist/organisms/Product/Product.d.ts +1 -1
- package/dist/organisms/Product/Product.js +76 -77
- package/dist/organisms/Product/Product.stories.d.ts +0 -11
- package/dist/organisms/Product/Product.stories.js +12 -25
- package/package.json +1 -1
|
@@ -1,36 +1,67 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { Text as
|
|
4
|
-
import {
|
|
5
|
-
import '../../assets/Availability.css';const
|
|
6
|
-
availability:
|
|
7
|
-
|
|
8
|
-
available:
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as l, jsxs as s, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { c as _ } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { Text as t } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Tooltip as f } from "../../atoms/Tooltip/Tooltip.js";
|
|
5
|
+
import '../../assets/Availability.css';const b = "_availability_9rzvh_1", z = "_tooltipContent_9rzvh_5", g = "_available_9rzvh_18", w = "_limited_9rzvh_21", C = "_discontinued_9rzvh_24", c = {
|
|
6
|
+
availability: b,
|
|
7
|
+
tooltipContent: z,
|
|
8
|
+
available: g,
|
|
9
|
+
"in-stock": "_in-stock_9rzvh_18",
|
|
10
|
+
limited: w,
|
|
11
|
+
discontinued: C
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
+
function T({
|
|
13
14
|
availId: i,
|
|
14
|
-
availDescription:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
availDescription: e,
|
|
16
|
+
availClassName: d,
|
|
17
|
+
enableTooltip: r = !1,
|
|
18
|
+
inventory: a
|
|
18
19
|
}) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
const o = /* @__PURE__ */ l(t, { size: "xs", className: _(c.availability, c[i], d), children: e });
|
|
21
|
+
return r && a && i !== "not-found" ? /* @__PURE__ */ l(
|
|
22
|
+
f,
|
|
23
|
+
{
|
|
24
|
+
closeDelay: 0,
|
|
25
|
+
openDelay: 250,
|
|
26
|
+
position: "top center",
|
|
27
|
+
trigger: o,
|
|
28
|
+
children: /* @__PURE__ */ l(k, { availabilityId: i, inventory: a })
|
|
29
|
+
}
|
|
30
|
+
) : o;
|
|
31
|
+
}
|
|
32
|
+
function k({ availabilityId: i, inventory: e }) {
|
|
33
|
+
var r, a, o, n, h, u;
|
|
34
|
+
const d = (((r = e == null ? void 0 : e.MPK) == null ? void 0 : r.Unreserved) ?? 0) + (((a = e == null ? void 0 : e.SEA) == null ? void 0 : a.Unreserved) ?? 0) + (((o = e == null ? void 0 : e.STL) == null ? void 0 : o.Unreserved) ?? 0);
|
|
35
|
+
if (i === "in-stock" || i === "limited") {
|
|
36
|
+
const m = i === "in-stock" ? "Additional quantity will be backordered. If you need more than we have at any one warehouse, a CSR will contact you with options." : "Once our stock is depleted, this item will no longer be available.";
|
|
37
|
+
return /* @__PURE__ */ s("div", { className: c.tooltipContent, children: [
|
|
38
|
+
/* @__PURE__ */ s(t, { size: "sm", children: [
|
|
39
|
+
"We currently have (",
|
|
40
|
+
d,
|
|
41
|
+
") in stock across our three warehouses:"
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ s("ul", { children: [
|
|
44
|
+
/* @__PURE__ */ l("li", { children: /* @__PURE__ */ s(t, { size: "sm", children: [
|
|
45
|
+
"(",
|
|
46
|
+
((n = e == null ? void 0 : e.MPK) == null ? void 0 : n.Unreserved) ?? 0,
|
|
47
|
+
") Los Angeles"
|
|
48
|
+
] }) }),
|
|
49
|
+
/* @__PURE__ */ l("li", { children: /* @__PURE__ */ s(t, { size: "sm", children: [
|
|
50
|
+
"(",
|
|
51
|
+
((h = e == null ? void 0 : e.STL) == null ? void 0 : h.Unreserved) ?? 0,
|
|
52
|
+
") St. Louis"
|
|
53
|
+
] }) }),
|
|
54
|
+
/* @__PURE__ */ l("li", { children: /* @__PURE__ */ s(t, { size: "sm", children: [
|
|
55
|
+
"(",
|
|
56
|
+
((u = e == null ? void 0 : e.SEA) == null ? void 0 : u.Unreserved) ?? 0,
|
|
57
|
+
") Seattle"
|
|
58
|
+
] }) })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ l(t, { size: "sm", children: m })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
return i === "available" ? /* @__PURE__ */ l("div", { className: c.tooltipContent, children: /* @__PURE__ */ l(t, { size: "sm", children: "While this part is not currently in stock, we will arrange to get it to you asap, and your CSR will keep you advised of the lead time." }) }) : i === "discontinued" ? /* @__PURE__ */ l("div", { className: c.tooltipContent, children: /* @__PURE__ */ l(t, { size: "sm", children: "Unfortunately, this item is no longer available to purchase." }) }) : /* @__PURE__ */ l(p, {});
|
|
33
64
|
}
|
|
34
65
|
export {
|
|
35
|
-
|
|
66
|
+
T as Availability
|
|
36
67
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
|
-
import { AvailabilityProps
|
|
2
|
+
import { AvailabilityProps } from './Availability';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
component: (props: AvailabilityProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,19 +18,18 @@ declare const meta: {
|
|
|
18
18
|
control: "text";
|
|
19
19
|
description: string;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
availClassName: {
|
|
22
22
|
control: "text";
|
|
23
23
|
description: string;
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
control:
|
|
27
|
-
type: "inline-radio";
|
|
28
|
-
};
|
|
29
|
-
options: ContactUsLinkBehavior[];
|
|
25
|
+
enableTooltip: {
|
|
26
|
+
control: "boolean";
|
|
30
27
|
description: string;
|
|
31
28
|
};
|
|
32
|
-
|
|
33
|
-
control:
|
|
29
|
+
inventory: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "object";
|
|
32
|
+
};
|
|
34
33
|
description: string;
|
|
35
34
|
};
|
|
36
35
|
};
|
|
@@ -39,8 +38,10 @@ declare const meta: {
|
|
|
39
38
|
};
|
|
40
39
|
export default meta;
|
|
41
40
|
type Story = StoryObj<typeof meta>;
|
|
42
|
-
export declare const
|
|
41
|
+
export declare const InStock: Story;
|
|
43
42
|
export declare const Limited: Story;
|
|
44
|
-
export declare const
|
|
45
|
-
export declare const
|
|
46
|
-
export declare const
|
|
43
|
+
export declare const Discontinued: Story;
|
|
44
|
+
export declare const Available: Story;
|
|
45
|
+
export declare const NotFound: Story;
|
|
46
|
+
export declare const InStockWithTooltip: Story;
|
|
47
|
+
export declare const LimitedWithTooltip: Story;
|
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Availability as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Availability as o } from "./Availability.js";
|
|
3
|
+
const a = (e) => /* @__PURE__ */ i(o, { ...e }), t = {
|
|
4
|
+
MPK: { Unreserved: 5, Available: 5 },
|
|
5
|
+
SEA: { Unreserved: 3, Available: 3 },
|
|
6
|
+
STL: { Unreserved: 8, Available: 8 }
|
|
7
|
+
}, r = {
|
|
4
8
|
title: "Case Parts/Molecules/Availability",
|
|
5
|
-
component:
|
|
9
|
+
component: a,
|
|
6
10
|
parameters: {
|
|
7
11
|
layout: "centered"
|
|
8
12
|
},
|
|
9
13
|
argTypes: {
|
|
10
14
|
availId: {
|
|
11
15
|
control: { type: "select" },
|
|
12
|
-
options: ["
|
|
16
|
+
options: ["in-stock", "limited", "discontinued", "available", "not-found"],
|
|
13
17
|
description: "Determines variant / rendering mode"
|
|
14
18
|
},
|
|
15
19
|
availDescription: {
|
|
16
20
|
control: "text",
|
|
17
21
|
description: "Displayed text content"
|
|
18
22
|
},
|
|
19
|
-
contactHref: {
|
|
20
|
-
control: "text",
|
|
21
|
-
description: 'Href for the contact link (used only when id === "contact")'
|
|
22
|
-
},
|
|
23
|
-
contactLinkBehavior: {
|
|
24
|
-
control: { type: "inline-radio" },
|
|
25
|
-
options: ["same-tab", "new-tab"],
|
|
26
|
-
description: "Whether the contact link opens in the same or new tab"
|
|
27
|
-
},
|
|
28
23
|
availClassName: {
|
|
29
24
|
control: "text",
|
|
30
25
|
description: "Optional custom className"
|
|
26
|
+
},
|
|
27
|
+
enableTooltip: {
|
|
28
|
+
control: "boolean",
|
|
29
|
+
description: "Enable tooltip with inventory details"
|
|
30
|
+
},
|
|
31
|
+
inventory: {
|
|
32
|
+
control: { type: "object" },
|
|
33
|
+
description: "Warehouse inventory data for tooltip"
|
|
31
34
|
}
|
|
32
35
|
},
|
|
33
36
|
args: {
|
|
34
37
|
// Default (can be overridden in each story)
|
|
35
|
-
availId: "
|
|
36
|
-
availDescription: "
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
availId: "in-stock",
|
|
39
|
+
availDescription: "In stock",
|
|
40
|
+
availClassName: "",
|
|
41
|
+
enableTooltip: !0,
|
|
42
|
+
inventory: t
|
|
40
43
|
},
|
|
41
44
|
tags: ["autodocs"]
|
|
42
|
-
},
|
|
43
|
-
name: "
|
|
45
|
+
}, l = {
|
|
46
|
+
name: "In Stock",
|
|
44
47
|
args: {
|
|
45
|
-
availId: "
|
|
48
|
+
availId: "in-stock",
|
|
46
49
|
availDescription: "In stock"
|
|
47
50
|
},
|
|
48
51
|
parameters: {
|
|
@@ -52,7 +55,7 @@ const i = (a) => /* @__PURE__ */ t(e, { ...a }), c = {
|
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
|
-
},
|
|
58
|
+
}, c = {
|
|
56
59
|
name: "Limited",
|
|
57
60
|
args: {
|
|
58
61
|
availId: "limited",
|
|
@@ -65,11 +68,11 @@ const i = (a) => /* @__PURE__ */ t(e, { ...a }), c = {
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
|
-
},
|
|
69
|
-
name: "
|
|
71
|
+
}, d = {
|
|
72
|
+
name: "Discontinued",
|
|
70
73
|
args: {
|
|
71
|
-
availId: "
|
|
72
|
-
availDescription: "
|
|
74
|
+
availId: "discontinued",
|
|
75
|
+
availDescription: "Discontinued"
|
|
73
76
|
},
|
|
74
77
|
parameters: {
|
|
75
78
|
docs: {
|
|
@@ -78,42 +81,74 @@ const i = (a) => /* @__PURE__ */ t(e, { ...a }), c = {
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
}
|
|
84
|
+
}, v = {
|
|
85
|
+
name: "Available",
|
|
86
|
+
args: {
|
|
87
|
+
availId: "available",
|
|
88
|
+
availDescription: "Available"
|
|
89
|
+
},
|
|
90
|
+
parameters: {
|
|
91
|
+
docs: {
|
|
92
|
+
description: {
|
|
93
|
+
story: "Shows an alternative availability state."
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
81
97
|
}, p = {
|
|
82
|
-
name: "
|
|
98
|
+
name: "Not Found",
|
|
83
99
|
args: {
|
|
84
|
-
availId: "
|
|
85
|
-
availDescription: "
|
|
86
|
-
contactHref: "/contact",
|
|
87
|
-
contactLinkBehavior: "same-tab"
|
|
100
|
+
availId: "not-found",
|
|
101
|
+
availDescription: "Not found"
|
|
88
102
|
},
|
|
89
103
|
parameters: {
|
|
90
104
|
docs: {
|
|
91
105
|
description: {
|
|
92
|
-
story: "
|
|
106
|
+
story: "Shows the not found / error state."
|
|
93
107
|
}
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
|
-
},
|
|
97
|
-
name: "
|
|
110
|
+
}, m = {
|
|
111
|
+
name: "In Stock with Tooltip",
|
|
98
112
|
args: {
|
|
99
|
-
availId: "
|
|
100
|
-
availDescription: "
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
availId: "in-stock",
|
|
114
|
+
availDescription: "In stock",
|
|
115
|
+
enableTooltip: !0,
|
|
116
|
+
inventory: t
|
|
117
|
+
},
|
|
118
|
+
parameters: {
|
|
119
|
+
docs: {
|
|
120
|
+
description: {
|
|
121
|
+
story: "Shows in-stock state with warehouse inventory tooltip on hover."
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, y = {
|
|
126
|
+
name: "Limited with Tooltip",
|
|
127
|
+
args: {
|
|
128
|
+
availId: "limited",
|
|
129
|
+
availDescription: "Limited stock",
|
|
130
|
+
enableTooltip: !0,
|
|
131
|
+
inventory: {
|
|
132
|
+
MPK: { Unreserved: 1, Available: 1 },
|
|
133
|
+
SEA: { Unreserved: 0, Available: 0 },
|
|
134
|
+
STL: { Unreserved: 2, Available: 2 }
|
|
135
|
+
}
|
|
103
136
|
},
|
|
104
137
|
parameters: {
|
|
105
138
|
docs: {
|
|
106
139
|
description: {
|
|
107
|
-
story:
|
|
140
|
+
story: "Shows limited-stock state with low inventory tooltip on hover."
|
|
108
141
|
}
|
|
109
142
|
}
|
|
110
143
|
}
|
|
111
144
|
};
|
|
112
145
|
export {
|
|
113
|
-
|
|
114
|
-
d as
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
146
|
+
v as Available,
|
|
147
|
+
d as Discontinued,
|
|
148
|
+
l as InStock,
|
|
149
|
+
m as InStockWithTooltip,
|
|
150
|
+
c as Limited,
|
|
151
|
+
y as LimitedWithTooltip,
|
|
152
|
+
p as NotFound,
|
|
153
|
+
r as default
|
|
119
154
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { AvailabilityId } from '../Availability/Availability';
|
|
2
3
|
export interface CartItem {
|
|
3
4
|
id: string | number;
|
|
4
5
|
itemId: string | undefined;
|
|
@@ -13,7 +14,7 @@ export interface CartItem {
|
|
|
13
14
|
model?: string;
|
|
14
15
|
serial?: string;
|
|
15
16
|
availability?: string;
|
|
16
|
-
availabilityId?:
|
|
17
|
+
availabilityId?: AvailabilityId;
|
|
17
18
|
custom?: string;
|
|
18
19
|
[key: string]: any;
|
|
19
20
|
}
|
|
@@ -30,7 +31,6 @@ export interface ShoppingCartHandle {
|
|
|
30
31
|
close: () => void;
|
|
31
32
|
toggle: () => void;
|
|
32
33
|
}
|
|
33
|
-
interface CartProps extends CartPropsBase, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
34
|
+
export interface CartProps extends CartPropsBase, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
34
35
|
}
|
|
35
36
|
export declare const ShoppingCart: React.ForwardRefExoticComponent<CartProps & React.RefAttributes<ShoppingCartHandle>>;
|
|
36
|
-
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<import('./Cart').CartProps & React.RefAttributes<import('./Cart').ShoppingCartHandle>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const EmptyCart: Story;
|
|
14
|
+
export declare const LargeCart: Story;
|
|
15
|
+
export declare const SmallCart: Story;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as d, Fragment as s, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c } from "react";
|
|
3
3
|
import { ShoppingCart as n } from "./Cart.js";
|
|
4
4
|
import { CartSlideInPanel as m } from "./CartSlideInPanel.js";
|
|
5
5
|
const C = {
|
|
@@ -39,8 +39,8 @@ function I(a) {
|
|
|
39
39
|
).toFixed(2)}`;
|
|
40
40
|
}
|
|
41
41
|
const r = (a) => {
|
|
42
|
-
const [l, t] =
|
|
43
|
-
return /* @__PURE__ */ d(
|
|
42
|
+
const [l, t] = c(!1);
|
|
43
|
+
return /* @__PURE__ */ d(s, { children: [
|
|
44
44
|
/* @__PURE__ */ o(
|
|
45
45
|
n,
|
|
46
46
|
{
|
|
@@ -57,8 +57,6 @@ const r = (a) => {
|
|
|
57
57
|
cart: a.cart,
|
|
58
58
|
subtotal: I(a.cart),
|
|
59
59
|
itemPriceLabel: "List Price",
|
|
60
|
-
contactHref: "#",
|
|
61
|
-
contactLinkBehavior: "new-tab",
|
|
62
60
|
onItemDelete: () => alert("Delete"),
|
|
63
61
|
onItemQtyChange: () => alert("Qty Change"),
|
|
64
62
|
onUnitEditClick: () => alert("Edit MMS"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AvailabilityId, Inventory } from '../Availability/Availability';
|
|
3
3
|
export interface CartPartProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title"> {
|
|
4
4
|
imageUrl?: string;
|
|
5
5
|
imageAlt?: string;
|
|
@@ -12,10 +12,9 @@ export interface CartPartProps extends Omit<React.LiHTMLAttributes<HTMLLIElement
|
|
|
12
12
|
model?: string;
|
|
13
13
|
serial?: string;
|
|
14
14
|
custom?: boolean;
|
|
15
|
-
availabilityId?:
|
|
15
|
+
availabilityId?: AvailabilityId;
|
|
16
16
|
availability?: string;
|
|
17
|
-
|
|
18
|
-
contactLinkBehavior?: ContactUsLinkBehavior;
|
|
17
|
+
inventory?: Inventory;
|
|
19
18
|
priceLabel?: string;
|
|
20
19
|
price?: string;
|
|
21
20
|
quantity?: number;
|
|
@@ -25,4 +24,4 @@ export interface CartPartProps extends Omit<React.LiHTMLAttributes<HTMLLIElement
|
|
|
25
24
|
onUnitEditClick?: () => void;
|
|
26
25
|
requiresUnitDetails?: boolean;
|
|
27
26
|
}
|
|
28
|
-
export declare function CartPart({ imageUrl, imageAlt, title, titleHref, onTitleNavigate, partNumber, unit, make, model, serial, custom, availabilityId, availability,
|
|
27
|
+
export declare function CartPart({ imageUrl, imageAlt, title, titleHref, onTitleNavigate, partNumber, unit, make, model, serial, custom, availabilityId, availability, inventory, priceLabel, price, quantity, maxQuantity, onQuantityChange, onRemove, onUnitEditClick, requiresUnitDetails, className, ...otherProps }: CartPartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Link as
|
|
3
|
-
import { Text as
|
|
4
|
-
import { Image as
|
|
5
|
-
import { Availability as
|
|
6
|
-
import { Pricing as
|
|
7
|
-
import { QuantityInput as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
import { c as
|
|
2
|
+
import { Link as q } from "../../atoms/Link/Link.js";
|
|
3
|
+
import { Text as m } from "../../atoms/Text/Text.js";
|
|
4
|
+
import { Image as v } from "../../atoms/Image/Image.js";
|
|
5
|
+
import { Availability as R } from "../Availability/Availability.js";
|
|
6
|
+
import { Pricing as A } from "../Pricing/Pricing.js";
|
|
7
|
+
import { QuantityInput as B } from "../QuantityInput/QuantityInput.js";
|
|
8
|
+
import { Icon as n } from "../../atoms/Icon/Icon.js";
|
|
9
|
+
import { Tooltip as D } from "../../atoms/Tooltip/Tooltip.js";
|
|
10
|
+
import { c as F } from "../../clsx-OuTLNxxd.js";
|
|
11
11
|
import { s as i } from "../../Cart.module-CqE2A_OG.js";
|
|
12
12
|
function $({
|
|
13
13
|
imageUrl: g,
|
|
14
14
|
imageAlt: I = "Product image",
|
|
15
|
-
title:
|
|
15
|
+
title: c,
|
|
16
16
|
titleHref: d,
|
|
17
17
|
onTitleNavigate: t,
|
|
18
18
|
partNumber: f,
|
|
@@ -22,47 +22,46 @@ function $({
|
|
|
22
22
|
serial: K,
|
|
23
23
|
custom: x,
|
|
24
24
|
availabilityId: P,
|
|
25
|
-
availability:
|
|
26
|
-
|
|
27
|
-
contactLinkBehavior: w = "new-tab",
|
|
25
|
+
availability: u,
|
|
26
|
+
inventory: S,
|
|
28
27
|
priceLabel: M = "List Price",
|
|
29
|
-
price:
|
|
28
|
+
price: h,
|
|
30
29
|
quantity: p,
|
|
31
30
|
maxQuantity: l,
|
|
32
31
|
onQuantityChange: b,
|
|
33
32
|
onRemove: y,
|
|
34
|
-
onUnitEditClick:
|
|
33
|
+
onUnitEditClick: o,
|
|
35
34
|
requiresUnitDetails: j = !1,
|
|
36
|
-
className:
|
|
37
|
-
...
|
|
35
|
+
className: w,
|
|
36
|
+
...C
|
|
38
37
|
}) {
|
|
39
|
-
function
|
|
38
|
+
function L(r) {
|
|
40
39
|
r.defaultPrevented || r.button === 0 && (r.metaKey || r.altKey || r.ctrlKey || r.shiftKey || r.currentTarget.target && r.currentTarget.target !== "_self" || t == null || t(r));
|
|
41
40
|
}
|
|
42
|
-
const
|
|
43
|
-
return /* @__PURE__ */ a("li", { className:
|
|
44
|
-
/* @__PURE__ */ e(
|
|
41
|
+
const s = k || [z, N, K].filter(Boolean).join(" / "), T = typeof l == "number" && Number.isFinite(l) ? l : void 0;
|
|
42
|
+
return /* @__PURE__ */ a("li", { className: F(i.cartItem, w), ...C, children: [
|
|
43
|
+
/* @__PURE__ */ e(v, { height: 50, width: 50, src: g || "", alt: I, className: i.itemImage }),
|
|
45
44
|
/* @__PURE__ */ a("div", { children: [
|
|
46
45
|
/* @__PURE__ */ a("div", { className: i.topRow, children: [
|
|
47
46
|
/* @__PURE__ */ a("div", { className: i.itemInfo, children: [
|
|
48
|
-
/* @__PURE__ */ e(
|
|
49
|
-
f != null && /* @__PURE__ */ a(
|
|
50
|
-
/* @__PURE__ */ e(
|
|
47
|
+
/* @__PURE__ */ e(m, { size: "sm", weight: "semibold", children: d ? /* @__PURE__ */ e(q, { href: d, onClick: L, children: c }) : c }),
|
|
48
|
+
f != null && /* @__PURE__ */ a(m, { size: "sm", children: [
|
|
49
|
+
/* @__PURE__ */ e(m, { colorToken: "quaternary", size: "xs", children: x ? "Specs " : "Part # " }),
|
|
51
50
|
f
|
|
52
51
|
] }),
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
s && o && (j ? /* @__PURE__ */ e(
|
|
53
|
+
D,
|
|
55
54
|
{
|
|
56
55
|
trigger: /* @__PURE__ */ a(
|
|
57
56
|
"button",
|
|
58
57
|
{
|
|
59
|
-
onClick:
|
|
58
|
+
onClick: o,
|
|
60
59
|
className: i.editUnit,
|
|
61
60
|
"aria-label": "Edit make, model, and serial",
|
|
62
61
|
type: "button",
|
|
63
62
|
children: [
|
|
64
|
-
/* @__PURE__ */ e(
|
|
65
|
-
|
|
63
|
+
/* @__PURE__ */ e(n, { iconKey: "fa-light fa-file-pen", size: "sm" }),
|
|
64
|
+
s
|
|
66
65
|
]
|
|
67
66
|
}
|
|
68
67
|
),
|
|
@@ -71,38 +70,38 @@ function $({
|
|
|
71
70
|
) : /* @__PURE__ */ a(
|
|
72
71
|
"button",
|
|
73
72
|
{
|
|
74
|
-
onClick:
|
|
73
|
+
onClick: o,
|
|
75
74
|
className: i.editUnit,
|
|
76
75
|
"aria-label": "Edit make, model, and serial",
|
|
77
76
|
type: "button",
|
|
78
77
|
children: [
|
|
79
|
-
/* @__PURE__ */ e(
|
|
80
|
-
|
|
78
|
+
/* @__PURE__ */ e(n, { iconKey: "fa-light fa-file-pen", size: "sm" }),
|
|
79
|
+
s
|
|
81
80
|
]
|
|
82
81
|
}
|
|
83
82
|
))
|
|
84
83
|
] }),
|
|
85
|
-
y && /* @__PURE__ */ e("button", { onClick: y, className: i.removeItem, "aria-label": "Remove item", type: "button", children: /* @__PURE__ */ e(
|
|
84
|
+
y && /* @__PURE__ */ e("button", { onClick: y, className: i.removeItem, "aria-label": "Remove item", type: "button", children: /* @__PURE__ */ e(n, { iconKey: "fa-regular fa-trash", size: "sm" }) })
|
|
86
85
|
] }),
|
|
87
86
|
/* @__PURE__ */ a("div", { className: i.itemManagement, children: [
|
|
88
87
|
/* @__PURE__ */ a("div", { className: i.purchaseInformation, children: [
|
|
89
|
-
/* @__PURE__ */ e("div", { className: i.availabilitySlot, children:
|
|
90
|
-
|
|
88
|
+
/* @__PURE__ */ e("div", { className: i.availabilitySlot, children: u && /* @__PURE__ */ e(
|
|
89
|
+
R,
|
|
91
90
|
{
|
|
92
|
-
availId: P || "",
|
|
93
|
-
availDescription:
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
availId: P || "not-found",
|
|
92
|
+
availDescription: u,
|
|
93
|
+
enableTooltip: !0,
|
|
94
|
+
inventory: S
|
|
96
95
|
}
|
|
97
96
|
) }),
|
|
98
|
-
/* @__PURE__ */ e("div", { className: i.priceSlot, children:
|
|
97
|
+
/* @__PURE__ */ e("div", { className: i.priceSlot, children: h && /* @__PURE__ */ e(A, { pricingLabel: M, price: h }) })
|
|
99
98
|
] }),
|
|
100
99
|
typeof p == "number" && b && /* @__PURE__ */ e("div", { className: i.quantitySlot, children: /* @__PURE__ */ e(
|
|
101
|
-
|
|
100
|
+
B,
|
|
102
101
|
{
|
|
103
102
|
quantity: p,
|
|
104
103
|
onQuantityChange: b,
|
|
105
|
-
max:
|
|
104
|
+
max: T,
|
|
106
105
|
size: "sm"
|
|
107
106
|
}
|
|
108
107
|
) })
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { CartPart } from './CartPart';
|
|
3
|
+
import { Inventory } from '../Availability/Availability';
|
|
3
4
|
declare const meta: {
|
|
4
5
|
title: string;
|
|
5
6
|
component: typeof CartPart;
|
|
@@ -18,10 +19,9 @@ declare const meta: {
|
|
|
18
19
|
model: string;
|
|
19
20
|
serial: string;
|
|
20
21
|
custom: false;
|
|
21
|
-
availabilityId:
|
|
22
|
+
availabilityId: "in-stock";
|
|
22
23
|
availability: string;
|
|
23
|
-
|
|
24
|
-
contactLinkBehavior: "new-tab";
|
|
24
|
+
inventory: Inventory;
|
|
25
25
|
priceLabel: string;
|
|
26
26
|
price: string;
|
|
27
27
|
quantity: number;
|