@caseparts-org/caseblocks 0.0.38 → 0.0.40
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/AddToCart.css +1 -0
- package/dist/assets/AnimatedCheckmark.css +1 -0
- package/dist/assets/Availability.css +1 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/MainNav.css +1 -1
- package/dist/assets/Pricing.css +1 -0
- package/dist/assets/Product.css +1 -0
- package/dist/assets/QuantityInput.css +1 -1
- package/dist/assets/StatefulButton.css +1 -0
- package/dist/atoms/Button/Button.js +21 -21
- package/dist/atoms/Image/Image.d.ts +21 -0
- package/dist/atoms/Image/Image.js +23 -0
- package/dist/atoms/Link/Link.d.ts +2 -1
- package/dist/atoms/Link/Link.js +40 -39
- package/dist/main-client.d.ts +11 -1
- package/dist/main-client.js +44 -29
- package/dist/main-server.d.ts +4 -0
- package/dist/main-server.js +22 -18
- package/dist/molecules/AddToCart/AddToCart.d.ts +17 -0
- package/dist/molecules/AddToCart/AddToCart.js +64 -0
- package/dist/molecules/AddToCart/AddToCart.stories.d.ts +74 -0
- package/dist/molecules/AddToCart/AddToCart.stories.js +106 -0
- package/dist/molecules/Availability/Availability.d.ts +9 -0
- package/dist/molecules/Availability/Availability.js +36 -0
- package/dist/molecules/Availability/Availability.stories.d.ts +46 -0
- package/dist/molecules/Availability/Availability.stories.js +119 -0
- package/dist/molecules/Pricing/Pricing.d.ts +6 -0
- package/dist/molecules/Pricing/Pricing.js +15 -0
- package/dist/molecules/Pricing/Pricing.stories.d.ts +43 -0
- package/dist/molecules/Pricing/Pricing.stories.js +49 -0
- package/dist/molecules/QuantityInput/QuantityInput.js +29 -29
- package/dist/molecules/StatefulButton/AnimatedCheckmark.d.ts +6 -0
- package/dist/molecules/StatefulButton/AnimatedCheckmark.js +60 -0
- package/dist/molecules/StatefulButton/StatefulButton.d.ts +16 -0
- package/dist/molecules/StatefulButton/StatefulButton.js +37 -0
- package/dist/molecules/StatefulButton/StatefulButton.stories.d.ts +64 -0
- package/dist/molecules/StatefulButton/StatefulButton.stories.js +66 -0
- package/dist/organisms/MainNav/MainNav.js +21 -21
- package/dist/organisms/Product/Product.d.ts +22 -0
- package/dist/organisms/Product/Product.js +113 -0
- package/dist/organisms/Product/Product.stories.d.ts +79 -0
- package/dist/organisms/Product/Product.stories.js +110 -0
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { StatefulButton, StatefulButtonProps } from './StatefulButton';
|
|
3
|
+
/**
|
|
4
|
+
* Stories for StatefulButton.
|
|
5
|
+
* Wrapper over Button that swaps its inner content when `completed` is true.
|
|
6
|
+
* Exposes all Button props (size, variant, disabled, etc.) plus:
|
|
7
|
+
* - completed: boolean
|
|
8
|
+
* - text: label before completion
|
|
9
|
+
* - completedText: label after completion
|
|
10
|
+
*/
|
|
11
|
+
declare const meta: {
|
|
12
|
+
title: string;
|
|
13
|
+
component: typeof StatefulButton;
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: string;
|
|
16
|
+
};
|
|
17
|
+
argTypes: {
|
|
18
|
+
onClick: {
|
|
19
|
+
action: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
completed: {
|
|
23
|
+
control: "boolean";
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
text: {
|
|
27
|
+
control: "text";
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
completedText: {
|
|
31
|
+
control: "text";
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
disabled: {
|
|
35
|
+
control: "boolean";
|
|
36
|
+
};
|
|
37
|
+
size: {
|
|
38
|
+
control: {
|
|
39
|
+
type: "select";
|
|
40
|
+
};
|
|
41
|
+
options: string[];
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
variant: {
|
|
45
|
+
control: {
|
|
46
|
+
type: "select";
|
|
47
|
+
};
|
|
48
|
+
options: string[];
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
className: {
|
|
52
|
+
control: "text";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
args: StatefulButtonProps;
|
|
56
|
+
tags: string[];
|
|
57
|
+
};
|
|
58
|
+
export default meta;
|
|
59
|
+
type Story = StoryObj<typeof meta>;
|
|
60
|
+
export declare const Default: Story;
|
|
61
|
+
export declare const Completed: Story;
|
|
62
|
+
export declare const Disabled: Story;
|
|
63
|
+
export declare const CustomText: Story;
|
|
64
|
+
export declare const Interactive: Story;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import d from "react";
|
|
3
|
+
import { StatefulButton as l } from "./StatefulButton.js";
|
|
4
|
+
const u = {
|
|
5
|
+
title: "Case Parts/Molecules/StatefulButton",
|
|
6
|
+
component: l,
|
|
7
|
+
parameters: { layout: "centered" },
|
|
8
|
+
argTypes: {
|
|
9
|
+
onClick: { action: "clicked", description: "Click handler" },
|
|
10
|
+
completed: { control: "boolean", description: "Completed (added) state" },
|
|
11
|
+
text: { control: "text", description: "Label before completion" },
|
|
12
|
+
completedText: { control: "text", description: "Label after completion" },
|
|
13
|
+
disabled: { control: "boolean" },
|
|
14
|
+
size: {
|
|
15
|
+
control: { type: "select" },
|
|
16
|
+
options: ["xxs", "xs", "sm", "md", "lg", "xl"],
|
|
17
|
+
description: "Button size"
|
|
18
|
+
},
|
|
19
|
+
variant: {
|
|
20
|
+
control: { type: "select" },
|
|
21
|
+
options: ["primary", "secondary", "cta-primary", "tertiary", "destructive"],
|
|
22
|
+
description: "Visual variant"
|
|
23
|
+
},
|
|
24
|
+
className: { control: "text" }
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
completed: !0,
|
|
28
|
+
text: "Add",
|
|
29
|
+
completedText: "Added!",
|
|
30
|
+
disabled: !1,
|
|
31
|
+
size: "md",
|
|
32
|
+
variant: "cta-primary"
|
|
33
|
+
},
|
|
34
|
+
tags: ["autodocs"]
|
|
35
|
+
}, x = {}, f = {
|
|
36
|
+
name: "Completed State",
|
|
37
|
+
args: { completed: !0 }
|
|
38
|
+
}, C = {
|
|
39
|
+
args: { disabled: !0 }
|
|
40
|
+
}, b = {
|
|
41
|
+
args: { text: "Add Part", completedText: "Done" }
|
|
42
|
+
}, r = (e) => {
|
|
43
|
+
const [c, t] = d.useState(!1);
|
|
44
|
+
return /* @__PURE__ */ a(
|
|
45
|
+
l,
|
|
46
|
+
{
|
|
47
|
+
...e,
|
|
48
|
+
completed: c,
|
|
49
|
+
onClick: (n) => {
|
|
50
|
+
var o;
|
|
51
|
+
(o = e.onClick) == null || o.call(e, n), t(!0), setTimeout(() => t(!1), 1600);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}, y = {
|
|
56
|
+
args: { text: "Add", completedText: "Added!" },
|
|
57
|
+
render: (e) => /* @__PURE__ */ a(r, { ...e })
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
f as Completed,
|
|
61
|
+
b as CustomText,
|
|
62
|
+
x as Default,
|
|
63
|
+
C as Disabled,
|
|
64
|
+
y as Interactive,
|
|
65
|
+
u as default
|
|
66
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
2
|
import { Text as p } from "../../atoms/Text/Text.js";
|
|
3
3
|
import { Link as f } from "../../atoms/Link/Link.js";
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as b } from "../../atoms/Icon/Icon.js";
|
|
5
5
|
import { Flex as s } from "../../atoms/Flex/Flex.js";
|
|
6
|
-
import { Grid as
|
|
6
|
+
import { Grid as k, Column as j } from "../../atoms/Grid/Grid.js";
|
|
7
7
|
import { Logo as D } from "../../molecules/Logo/Logo.js";
|
|
8
8
|
import { SearchBox as d } from "../../molecules/SearchBox/SearchBox.js";
|
|
9
9
|
import { HamburgerMenu as z } from "../../molecules/HamburgerMenu/HamburgerMenu.js";
|
|
@@ -11,7 +11,7 @@ import { ShoppingCart as F } from "../../molecules/Cart/Cart.js";
|
|
|
11
11
|
import { Account as I } from "../../molecules/Account/Account.js";
|
|
12
12
|
import { CategoryNav as U } from "../../molecules/CategoryNav/CategoryNav.js";
|
|
13
13
|
import { c as M } from "../../clsx-OuTLNxxd.js";
|
|
14
|
-
import '../../assets/MainNav.css';const Q = "
|
|
14
|
+
import '../../assets/MainNav.css';const Q = "_main_hvdtw_1", B = "_topNav_hvdtw_8", G = "_operations_hvdtw_15", H = "_search_hvdtw_22", K = "_siteLink_hvdtw_25", P = "_accountArea_hvdtw_29", S = "_category_hvdtw_41", T = "_menuList_hvdtw_63", i = {
|
|
15
15
|
main: Q,
|
|
16
16
|
topNav: B,
|
|
17
17
|
operations: G,
|
|
@@ -29,18 +29,18 @@ function re({
|
|
|
29
29
|
aboutUsRoute: _,
|
|
30
30
|
accountRoute: u,
|
|
31
31
|
contactRoute: l,
|
|
32
|
-
cart:
|
|
33
|
-
cartSubtotal:
|
|
34
|
-
onLoginClick:
|
|
32
|
+
cart: v,
|
|
33
|
+
cartSubtotal: N,
|
|
34
|
+
onLoginClick: w,
|
|
35
35
|
onSearch: h,
|
|
36
|
-
onItemQtyChange:
|
|
37
|
-
onItemDelete:
|
|
38
|
-
onItemEdit:
|
|
39
|
-
onCheckout:
|
|
40
|
-
className:
|
|
41
|
-
...
|
|
36
|
+
onItemQtyChange: A,
|
|
37
|
+
onItemDelete: g,
|
|
38
|
+
onItemEdit: x,
|
|
39
|
+
onCheckout: L,
|
|
40
|
+
className: C,
|
|
41
|
+
...y
|
|
42
42
|
}) {
|
|
43
|
-
return /* @__PURE__ */ e(
|
|
43
|
+
return /* @__PURE__ */ e(k, { ...y, gridWrapperClassName: M(i.main, C), children: /* @__PURE__ */ n(j, { span: 12, children: [
|
|
44
44
|
/* @__PURE__ */ n(
|
|
45
45
|
s,
|
|
46
46
|
{
|
|
@@ -67,19 +67,19 @@ function re({
|
|
|
67
67
|
{
|
|
68
68
|
account: a,
|
|
69
69
|
accountRoute: u,
|
|
70
|
-
onLoginClick:
|
|
70
|
+
onLoginClick: w,
|
|
71
71
|
className: i.avatar
|
|
72
72
|
}
|
|
73
73
|
) }),
|
|
74
74
|
/* @__PURE__ */ e(
|
|
75
75
|
F,
|
|
76
76
|
{
|
|
77
|
-
cart:
|
|
78
|
-
onItemDelete:
|
|
79
|
-
onItemEdit:
|
|
80
|
-
onItemQtyChange:
|
|
81
|
-
onCheckout:
|
|
82
|
-
subtotal:
|
|
77
|
+
cart: v,
|
|
78
|
+
onItemDelete: g,
|
|
79
|
+
onItemEdit: x,
|
|
80
|
+
onItemQtyChange: A,
|
|
81
|
+
onCheckout: L,
|
|
82
|
+
subtotal: N
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
85
|
/* @__PURE__ */ e(z, { hideAt: ["lg"], children: /* @__PURE__ */ n("ul", { className: i.menuList, children: [
|
|
@@ -90,7 +90,7 @@ function re({
|
|
|
90
90
|
t && t.map((c) => /* @__PURE__ */ e("li", { className: i.category, children: /* @__PURE__ */ n(f, { href: c.route, children: [
|
|
91
91
|
/* @__PURE__ */ e(p, { size: "sm", weight: "semibold", children: c.label }),
|
|
92
92
|
/* @__PURE__ */ e(
|
|
93
|
-
|
|
93
|
+
b,
|
|
94
94
|
{
|
|
95
95
|
iconKey: "fa-solid fa-chevron-right",
|
|
96
96
|
title: "Navigate",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AvailabilityProps } from '../../molecules/Availability/Availability';
|
|
2
|
+
export type ProductView = "Card" | "Tile";
|
|
3
|
+
export interface ProductProps extends AvailabilityProps {
|
|
4
|
+
productView: ProductView;
|
|
5
|
+
productDescription: string;
|
|
6
|
+
availDescription: string;
|
|
7
|
+
productHref: string;
|
|
8
|
+
itemKey: number;
|
|
9
|
+
partNumber: string;
|
|
10
|
+
availability: string;
|
|
11
|
+
priceLabel: string;
|
|
12
|
+
price: string;
|
|
13
|
+
imgSrc: string;
|
|
14
|
+
attributes?: {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
18
|
+
className?: string;
|
|
19
|
+
onAddToCart: (_itemKey: number, _quantity: number) => void;
|
|
20
|
+
onClose?: (_itemKey: number) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function Product({ productView, itemKey, partNumber, productDescription, availDescription, availId, contactHref, contactLinkBehavior, productHref, priceLabel, price, imgSrc, attributes, className, onAddToCart, onClose, ...otherProps }: ProductProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsxs as r, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Image as N } from "../../atoms/Image/Image.js";
|
|
3
|
+
import { Link as g } from "../../atoms/Link/Link.js";
|
|
4
|
+
import { Text as n } from "../../atoms/Text/Text.js";
|
|
5
|
+
import { Availability as I } from "../../molecules/Availability/Availability.js";
|
|
6
|
+
import { Pricing as b } from "../../molecules/Pricing/Pricing.js";
|
|
7
|
+
import { AddToCart as v } from "../../molecules/AddToCart/AddToCart.js";
|
|
8
|
+
import { Icon as P } from "../../atoms/Icon/Icon.js";
|
|
9
|
+
import { c as w } from "../../clsx-OuTLNxxd.js";
|
|
10
|
+
import '../../assets/Product.css';const R = "_productCard_e649x_1", A = "_productInformation_e649x_21", D = "_purchaseInformation_e649x_27", j = "_addToCart_e649x_35", k = "_addToCartButton_e649x_38", $ = "_productTile_e649x_43", y = "_topRow_e649x_64", L = "_productData_e649x_88", q = "_purchase_e649x_27", E = "_attributeContainer_e649x_125", t = {
|
|
11
|
+
productCard: R,
|
|
12
|
+
productInformation: A,
|
|
13
|
+
purchaseInformation: D,
|
|
14
|
+
addToCart: j,
|
|
15
|
+
addToCartButton: k,
|
|
16
|
+
productTile: $,
|
|
17
|
+
topRow: y,
|
|
18
|
+
productData: L,
|
|
19
|
+
purchase: q,
|
|
20
|
+
attributeContainer: E
|
|
21
|
+
};
|
|
22
|
+
function X({
|
|
23
|
+
productView: z,
|
|
24
|
+
itemKey: c,
|
|
25
|
+
partNumber: a,
|
|
26
|
+
productDescription: l,
|
|
27
|
+
availDescription: m,
|
|
28
|
+
availId: d,
|
|
29
|
+
contactHref: u,
|
|
30
|
+
contactLinkBehavior: p,
|
|
31
|
+
productHref: h,
|
|
32
|
+
priceLabel: _,
|
|
33
|
+
price: e,
|
|
34
|
+
imgSrc: f,
|
|
35
|
+
attributes: i,
|
|
36
|
+
className: C,
|
|
37
|
+
onAddToCart: x,
|
|
38
|
+
onClose: T,
|
|
39
|
+
...B
|
|
40
|
+
}) {
|
|
41
|
+
return z === "Card" ? /* @__PURE__ */ r("div", { className: w(t.productCard, C), children: [
|
|
42
|
+
/* @__PURE__ */ o(N, { src: f, alt: `${a} product image` }),
|
|
43
|
+
/* @__PURE__ */ r("div", { className: t.productInformation, children: [
|
|
44
|
+
/* @__PURE__ */ o(g, { href: h, children: l }),
|
|
45
|
+
/* @__PURE__ */ r(n, { size: "sm", className: t.partNumber, children: [
|
|
46
|
+
"Part # ",
|
|
47
|
+
a
|
|
48
|
+
] })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ r("div", { className: t.purchaseInformation, children: [
|
|
51
|
+
d && /* @__PURE__ */ o(
|
|
52
|
+
I,
|
|
53
|
+
{
|
|
54
|
+
availId: d,
|
|
55
|
+
availDescription: m,
|
|
56
|
+
contactHref: u,
|
|
57
|
+
contactLinkBehavior: p
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
e && /* @__PURE__ */ o(b, { pricingLabel: _, price: e })
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ o(
|
|
63
|
+
v,
|
|
64
|
+
{
|
|
65
|
+
itemKey: c,
|
|
66
|
+
onAdd: x,
|
|
67
|
+
className: t.addToCart,
|
|
68
|
+
addButtonClassName: t.addToCartButton,
|
|
69
|
+
size: "md",
|
|
70
|
+
buttonDoneText: ""
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }) : /* @__PURE__ */ r("div", { className: w(t.productTile, C), ...B, children: [
|
|
74
|
+
/* @__PURE__ */ o(N, { src: f, alt: `${a} product image` }),
|
|
75
|
+
/* @__PURE__ */ r("div", { className: t.productData, children: [
|
|
76
|
+
/* @__PURE__ */ r("div", { className: t.topRow, children: [
|
|
77
|
+
/* @__PURE__ */ r("div", { className: t.productInformation, children: [
|
|
78
|
+
/* @__PURE__ */ o(g, { href: h, children: l }),
|
|
79
|
+
/* @__PURE__ */ r(n, { size: "sm", className: t.partNumber, children: [
|
|
80
|
+
"Part # ",
|
|
81
|
+
a
|
|
82
|
+
] })
|
|
83
|
+
] }),
|
|
84
|
+
T && /* @__PURE__ */ o("button", { onClick: () => T(c), children: /* @__PURE__ */ o(P, { size: "sm", iconKey: "fa-light fa-xmark" }) })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ r("div", { className: t.purchase, children: [
|
|
87
|
+
/* @__PURE__ */ r("div", { className: t.purchaseInformation, children: [
|
|
88
|
+
d && /* @__PURE__ */ o(
|
|
89
|
+
I,
|
|
90
|
+
{
|
|
91
|
+
availId: d,
|
|
92
|
+
availDescription: m,
|
|
93
|
+
contactHref: u,
|
|
94
|
+
contactLinkBehavior: p
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
e && /* @__PURE__ */ o(b, { pricingLabel: _, price: e })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ o(v, { itemKey: c, onAdd: x, className: t.addToCart, addButtonClassName: t.addToCartButton })
|
|
100
|
+
] }),
|
|
101
|
+
i && i.length > 0 && /* @__PURE__ */ o("ul", { className: t.attributeContainer, children: i.map((s) => /* @__PURE__ */ r("li", { children: [
|
|
102
|
+
/* @__PURE__ */ r(n, { size: "xs", weight: "light", children: [
|
|
103
|
+
s.label,
|
|
104
|
+
":"
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ o(n, { size: "xs", weight: "semibold", children: s.value })
|
|
107
|
+
] }, s.value)) })
|
|
108
|
+
] })
|
|
109
|
+
] });
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
X as Product
|
|
113
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { Product, ProductProps, ProductView } from './Product';
|
|
3
|
+
/**
|
|
4
|
+
* Product organism story.
|
|
5
|
+
* Combines Image, Link, Availability, Pricing, and AddToCart.
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: {
|
|
8
|
+
title: string;
|
|
9
|
+
component: typeof Product;
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: string;
|
|
12
|
+
};
|
|
13
|
+
argTypes: {
|
|
14
|
+
productView: {
|
|
15
|
+
control: {
|
|
16
|
+
type: "inline-radio";
|
|
17
|
+
};
|
|
18
|
+
options: ProductView[];
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
availId: {
|
|
22
|
+
control: {
|
|
23
|
+
type: "select";
|
|
24
|
+
};
|
|
25
|
+
options: string[];
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
availDescription: {
|
|
29
|
+
control: "text";
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
contactHref: {
|
|
33
|
+
control: "text";
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
contactLinkBehavior: {
|
|
37
|
+
control: {
|
|
38
|
+
type: "inline-radio";
|
|
39
|
+
};
|
|
40
|
+
options: string[];
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
productDescription: {
|
|
44
|
+
control: "text";
|
|
45
|
+
};
|
|
46
|
+
productHref: {
|
|
47
|
+
control: "text";
|
|
48
|
+
};
|
|
49
|
+
partNumber: {
|
|
50
|
+
control: "text";
|
|
51
|
+
};
|
|
52
|
+
priceLabel: {
|
|
53
|
+
control: "text";
|
|
54
|
+
};
|
|
55
|
+
price: {
|
|
56
|
+
control: "text";
|
|
57
|
+
};
|
|
58
|
+
imgSrc: {
|
|
59
|
+
control: "text";
|
|
60
|
+
};
|
|
61
|
+
itemKey: {
|
|
62
|
+
control: "number";
|
|
63
|
+
};
|
|
64
|
+
onAddToCart: {
|
|
65
|
+
action: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
args: ProductProps;
|
|
70
|
+
tags: string[];
|
|
71
|
+
};
|
|
72
|
+
export default meta;
|
|
73
|
+
type Story = StoryObj<typeof meta>;
|
|
74
|
+
export declare const Default: Story;
|
|
75
|
+
export declare const LimitedStock: Story;
|
|
76
|
+
export declare const Unavailable: Story;
|
|
77
|
+
export declare const ContactForAvailability: Story;
|
|
78
|
+
export declare const TileView: Story;
|
|
79
|
+
export declare const DifferentPriceLabel: Story;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Product as a } from "./Product.js";
|
|
2
|
+
const o = [
|
|
3
|
+
{ label: "Color", value: "Gray" },
|
|
4
|
+
{ label: "Brand", value: "Kason" },
|
|
5
|
+
{ label: "Finish", value: "Chrome" },
|
|
6
|
+
{ label: "Application", value: "Freezer/Cooler" },
|
|
7
|
+
{ label: "Type", value: "Hydraulic" },
|
|
8
|
+
{ label: "Offset", value: "Flush" },
|
|
9
|
+
{ label: "Style", value: "Walk-in" },
|
|
10
|
+
{ label: "Vendor Part #", value: "10921000-01" },
|
|
11
|
+
{ label: "Attribute", value: "Placeholder" },
|
|
12
|
+
{ label: "Attribute", value: "Placeholder" },
|
|
13
|
+
{ label: "Attribute", value: "Placeholder" }
|
|
14
|
+
], r = {
|
|
15
|
+
title: "Case Parts/Organisms/Product",
|
|
16
|
+
component: a,
|
|
17
|
+
parameters: { layout: "centered" },
|
|
18
|
+
argTypes: {
|
|
19
|
+
productView: {
|
|
20
|
+
control: { type: "inline-radio" },
|
|
21
|
+
options: ["Card", "Tile"],
|
|
22
|
+
description: "Visual presentation variant"
|
|
23
|
+
},
|
|
24
|
+
availId: {
|
|
25
|
+
control: { type: "select" },
|
|
26
|
+
options: ["available", "limited", "unavailable", "contact"],
|
|
27
|
+
description: "Availability variant"
|
|
28
|
+
},
|
|
29
|
+
availDescription: {
|
|
30
|
+
control: "text",
|
|
31
|
+
description: "Availability text"
|
|
32
|
+
},
|
|
33
|
+
contactHref: {
|
|
34
|
+
control: "text",
|
|
35
|
+
description: "Contact link (only for contact variant)"
|
|
36
|
+
},
|
|
37
|
+
contactLinkBehavior: {
|
|
38
|
+
control: { type: "inline-radio" },
|
|
39
|
+
options: ["same-tab", "new-tab"],
|
|
40
|
+
description: "Contact link target behavior"
|
|
41
|
+
},
|
|
42
|
+
productDescription: { control: "text" },
|
|
43
|
+
productHref: { control: "text" },
|
|
44
|
+
partNumber: { control: "text" },
|
|
45
|
+
priceLabel: { control: "text" },
|
|
46
|
+
price: { control: "text" },
|
|
47
|
+
imgSrc: { control: "text" },
|
|
48
|
+
itemKey: { control: "number" },
|
|
49
|
+
onAddToCart: { action: "addToCart", description: "(itemKey, quantity)" }
|
|
50
|
+
},
|
|
51
|
+
args: {
|
|
52
|
+
productView: "Card",
|
|
53
|
+
itemKey: 101,
|
|
54
|
+
partNumber: "PN-44567",
|
|
55
|
+
productDescription: "Example Replacement Part Long Description",
|
|
56
|
+
productHref: "https://mobiledev.caseparts.com/part/1092-01/Kason-1092-Hydraulic-Door-Closer",
|
|
57
|
+
availId: "available",
|
|
58
|
+
availDescription: "In stock",
|
|
59
|
+
contactHref: "https://dev.caseparts.com/account/contactus",
|
|
60
|
+
contactLinkBehavior: "new-tab",
|
|
61
|
+
priceLabel: "List Price",
|
|
62
|
+
price: "$129.99",
|
|
63
|
+
imgSrc: "https://www.caseparts.com/Ortery/360/Optimized/1092-01_/1092-01_04.webp",
|
|
64
|
+
attributes: o,
|
|
65
|
+
onAddToCart: (t, e) => {
|
|
66
|
+
alert(`Add to cart (story) ${JSON.stringify({ itemKey: t, quantity: e })}`);
|
|
67
|
+
},
|
|
68
|
+
onClose: (t) => {
|
|
69
|
+
alert(`On close clicked ${t}`);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
tags: ["autodocs"]
|
|
73
|
+
}, l = {}, c = {
|
|
74
|
+
args: {
|
|
75
|
+
availId: "limited",
|
|
76
|
+
availDescription: "Limited stock"
|
|
77
|
+
}
|
|
78
|
+
}, n = {
|
|
79
|
+
args: {
|
|
80
|
+
availId: "unavailable",
|
|
81
|
+
availDescription: "Out of stock",
|
|
82
|
+
priceLabel: "Last Known"
|
|
83
|
+
}
|
|
84
|
+
}, s = {
|
|
85
|
+
args: {
|
|
86
|
+
availId: "contact",
|
|
87
|
+
availDescription: "Contact for availability",
|
|
88
|
+
contactLinkBehavior: "new-tab",
|
|
89
|
+
contactHref: "https://dev.caseparts.com/account/contactus"
|
|
90
|
+
}
|
|
91
|
+
}, p = {
|
|
92
|
+
args: {
|
|
93
|
+
productView: "Tile",
|
|
94
|
+
productDescription: "Tile View Product"
|
|
95
|
+
}
|
|
96
|
+
}, d = {
|
|
97
|
+
args: {
|
|
98
|
+
priceLabel: "Member",
|
|
99
|
+
price: "$118.49"
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
s as ContactForAvailability,
|
|
104
|
+
l as Default,
|
|
105
|
+
d as DifferentPriceLabel,
|
|
106
|
+
c as LimitedStock,
|
|
107
|
+
p as TileView,
|
|
108
|
+
n as Unavailable,
|
|
109
|
+
r as default
|
|
110
|
+
};
|