@caseparts-org/caseblocks 0.0.39 → 0.0.41

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.
Files changed (41) hide show
  1. package/dist/assets/AddToCart.css +1 -0
  2. package/dist/assets/AnimatedCheckmark.css +1 -0
  3. package/dist/assets/Availability.css +1 -0
  4. package/dist/assets/Button.css +1 -1
  5. package/dist/assets/Pricing.css +1 -0
  6. package/dist/assets/Product.css +1 -0
  7. package/dist/assets/QuantityInput.css +1 -1
  8. package/dist/assets/StatefulButton.css +1 -0
  9. package/dist/atoms/Button/Button.js +21 -21
  10. package/dist/atoms/Image/Image.d.ts +21 -0
  11. package/dist/atoms/Image/Image.js +23 -0
  12. package/dist/atoms/Link/Link.d.ts +2 -1
  13. package/dist/atoms/Link/Link.js +40 -39
  14. package/dist/main-client.d.ts +13 -1
  15. package/dist/main-client.js +44 -29
  16. package/dist/main-server.d.ts +2 -0
  17. package/dist/main-server.js +10 -8
  18. package/dist/molecules/AddToCart/AddToCart.d.ts +17 -0
  19. package/dist/molecules/AddToCart/AddToCart.js +64 -0
  20. package/dist/molecules/AddToCart/AddToCart.stories.d.ts +74 -0
  21. package/dist/molecules/AddToCart/AddToCart.stories.js +106 -0
  22. package/dist/molecules/Availability/Availability.d.ts +9 -0
  23. package/dist/molecules/Availability/Availability.js +36 -0
  24. package/dist/molecules/Availability/Availability.stories.d.ts +46 -0
  25. package/dist/molecules/Availability/Availability.stories.js +119 -0
  26. package/dist/molecules/Pricing/Pricing.d.ts +6 -0
  27. package/dist/molecules/Pricing/Pricing.js +15 -0
  28. package/dist/molecules/Pricing/Pricing.stories.d.ts +43 -0
  29. package/dist/molecules/Pricing/Pricing.stories.js +49 -0
  30. package/dist/molecules/QuantityInput/QuantityInput.js +29 -29
  31. package/dist/molecules/StatefulButton/AnimatedCheckmark.d.ts +6 -0
  32. package/dist/molecules/StatefulButton/AnimatedCheckmark.js +60 -0
  33. package/dist/molecules/StatefulButton/StatefulButton.d.ts +16 -0
  34. package/dist/molecules/StatefulButton/StatefulButton.js +37 -0
  35. package/dist/molecules/StatefulButton/StatefulButton.stories.d.ts +64 -0
  36. package/dist/molecules/StatefulButton/StatefulButton.stories.js +66 -0
  37. package/dist/organisms/Product/Product.d.ts +22 -0
  38. package/dist/organisms/Product/Product.js +113 -0
  39. package/dist/organisms/Product/Product.stories.d.ts +79 -0
  40. package/dist/organisms/Product/Product.stories.js +110 -0
  41. 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
+ };
@@ -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
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.39",
4
+ "version": "0.0.41",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",