@caseparts-org/caseblocks 0.0.155 → 0.0.157
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-gkb4IOVS.js +19 -0
- package/dist/assets/Cart.css +1 -1
- package/dist/assets/Error.css +1 -0
- package/dist/main-client.d.ts +2 -0
- package/dist/main-client.js +22 -20
- package/dist/main.d.ts +2 -0
- package/dist/main.js +14 -12
- package/dist/molecules/Cart/Cart.js +1 -1
- package/dist/molecules/Cart/CartSlideInPanel.js +51 -48
- package/dist/molecules/Error/Error.d.ts +24 -0
- package/dist/molecules/Error/Error.js +148 -0
- package/dist/molecules/Error/Error.stories.d.ts +16 -0
- package/dist/molecules/Error/Error.stories.js +105 -0
- package/package.json +1 -1
- package/dist/Cart.module-9txlotpz.js +0 -18
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './assets/Cart.css';const t = "_cartIconButton_1dh0n_2", n = "_count_1dh0n_9", o = "_cartContainer_1dh0n_24", e = "_headerWrapper_1dh0n_35", _ = "_header_1dh0n_35", c = "_cartItems_1dh0n_53", a = "_topRow_1dh0n_78", r = "_itemInfo_1dh0n_84", s = "_purchaseInformation_1dh0n_89", h = "_itemManagement_1dh0n_96", m = "_removeItem_1dh0n_114", d = "_noItems_1dh0n_124", u = "_subtotal_1dh0n_131", I = "_checkoutButton_1dh0n_138", p = {
|
|
2
|
+
cartIconButton: t,
|
|
3
|
+
count: n,
|
|
4
|
+
cartContainer: o,
|
|
5
|
+
headerWrapper: e,
|
|
6
|
+
header: _,
|
|
7
|
+
cartItems: c,
|
|
8
|
+
topRow: a,
|
|
9
|
+
itemInfo: r,
|
|
10
|
+
purchaseInformation: s,
|
|
11
|
+
itemManagement: h,
|
|
12
|
+
removeItem: m,
|
|
13
|
+
noItems: d,
|
|
14
|
+
subtotal: u,
|
|
15
|
+
checkoutButton: I
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
p as s
|
|
19
|
+
};
|
package/dist/assets/Cart.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._cartIconButton_1dh0n_2{position:relative;border:none;padding:0;margin:0;background-color:transparent}._count_1dh0n_9{position:absolute;top:0;left:14px;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_1dh0n_24{height:100vh;width:100%;min-width:320px;max-width:375px;box-sizing:border-box;display:grid;grid-template-rows:auto 1fr auto auto;gap:var(--spacing-1);padding:var(--spacing-1)}._headerWrapper_1dh0n_35{display:flex;flex-direction:row;align-items:flex-start;gap:var(--spacing-spacing-2xs)}._headerWrapper_1dh0n_35>button{padding:0;margin:0;background-color:transparent;border:none}._header_1dh0n_35{display:flex;flex-direction:column;align-items:flex-start;width:100%}._cartItems_1dh0n_53{height:100%;overflow-y:auto;overflow-x:hidden}._cartItems_1dh0n_53 ul{margin:0;padding:0}._cartItems_1dh0n_53 li{display:grid;grid-template-columns:auto 1fr;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)}._cartItems_1dh0n_53 li:first-of-type{border-top:1px solid var(--color-neutrals-neutral-2)}._topRow_1dh0n_78{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between}._itemInfo_1dh0n_84{display:flex;flex-direction:column;align-items:flex-start}._purchaseInformation_1dh0n_89{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;width:100%}._itemManagement_1dh0n_96{display:flex;flex-direction:column;align-items:flex-end;gap:var(--spacing-spacing-3xs)}._cartItems_1dh0n_53 li p{margin:0;padding:0;word-wrap:break-word;white-space:normal;overflow-wrap:break-word}._cartItems_1dh0n_53 img{height:40px;width:40px;object-fit:contain}._removeItem_1dh0n_114{border:none;background-color:transparent;padding:0;margin:0;cursor:pointer;width:min-content;height:min-content}._noItems_1dh0n_124{display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%}._subtotal_1dh0n_131{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--spacing-0-5)}._checkoutButton_1dh0n_138{width:100%}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._error_10jtk_1{display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:100%;overflow-x:hidden;gap:var(--spacing-spacing-2xs);padding:var(--spacing-spacing-2xs);border:1px solid var(--border-border-error-warning);border-radius:var(--border-radius-sm);background-color:color-mix(in srgb,var(--color-alerts-error-warning) 8%,transparent);transition:all .3s ease-in}._variantError_10jtk_16{border-color:var(--border-border-error-warning);background-color:color-mix(in srgb,var(--color-alerts-error-warning) 8%,transparent)}._variantWarning_10jtk_21{border-color:var(--border-border-warning);background-color:color-mix(in srgb,var(--color-alerts-warning) 8%,transparent)}._variantDefault_10jtk_26{border-color:var(--border-border-primary);background-color:var(--surface-surface-primary)}._errorHeader_10jtk_31{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--spacing-spacing-2xs)}._errorHeaderContent_10jtk_40{min-width:0;display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs)}._detailsToggleButton_10jtk_48{width:1.5rem;height:1.5rem;border:none;border-radius:var(--border-radius-xs);background:transparent;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}._detailsToggleButton_10jtk_48:hover,._detailsToggleButton_10jtk_48:focus-visible{background-color:var(--surface-surface-secondary)}._detailsChevron_10jtk_66{display:inline-flex;align-items:center;justify-content:center;transform:rotate(0);transition:transform .2s ease}._detailsChevronOpen_10jtk_74{transform:rotate(180deg)}._errorDetails_10jtk_78{position:relative;padding:var(--spacing-spacing-2xs);border:1px solid var(--border-border-primary);background-color:var(--surface-surface-primary);border-radius:var(--border-radius-sm);overflow:hidden;white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word;overflow-wrap:anywhere;font-family:monospace;width:100%;transition:max-height .28s ease,opacity .2s ease}._errorDetailsContent_10jtk_94{padding-top:var(--spacing-spacing-3xs);padding-right:2rem}._copyButton_10jtk_99{position:absolute;top:var(--spacing-spacing-3xs);right:var(--spacing-spacing-3xs);width:1.5rem;height:1.5rem;border:none;border-radius:var(--border-radius-xs);background:transparent;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}._copyIcon_10jtk_114,._checkIcon_10jtk_115{position:absolute;display:inline-flex;align-items:center;justify-content:center}._hiddenIcon_10jtk_122{opacity:0;pointer-events:none}._copyButton_10jtk_99:hover,._copyButton_10jtk_99:focus-visible{background-color:var(--surface-surface-secondary)}
|
package/dist/main-client.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export { ImageViewer } from './molecules/ImageViewer/ImageViewer';
|
|
|
34
34
|
export type { ImageViewerProps } from './molecules/ImageViewer/ImageViewer';
|
|
35
35
|
export { Table } from './molecules/Table/Table';
|
|
36
36
|
export type { TableProps, TableAlign, ColumnsProps, ColumnProps, BodyProps, RowProps, CellProps, TableComponent } from './molecules/Table/Table';
|
|
37
|
+
export { Error } from './molecules/Error/Error';
|
|
38
|
+
export type { ErrorProps, ErrorMessageProps, ErrorDetailsProps } from './molecules/Error/Error';
|
|
37
39
|
export { MainNav } from './organisms/MainNav/MainNav';
|
|
38
40
|
export type { MainNavProps } from './organisms/MainNav/MainNav';
|
|
39
41
|
export { ChipSelector } from './organisms/ChipSelector/ChipSelector';
|
package/dist/main-client.js
CHANGED
|
@@ -15,10 +15,10 @@ import { configureImage as b } from "./atoms/Image/configureImage.js";
|
|
|
15
15
|
import { getHideAtStyles as F } from "./atoms/HideAt.js";
|
|
16
16
|
import { Logo as N } from "./molecules/Logo/Logo.js";
|
|
17
17
|
import { SearchBox as z } from "./molecules/SearchBox/SearchBox.js";
|
|
18
|
-
import { QuantityInput as
|
|
19
|
-
import { Pricing as
|
|
20
|
-
import { Availability as
|
|
21
|
-
import { Avatar as
|
|
18
|
+
import { QuantityInput as G } from "./molecules/QuantityInput/QuantityInput.js";
|
|
19
|
+
import { Pricing as Q } from "./molecules/Pricing/Pricing.js";
|
|
20
|
+
import { Availability as Z } from "./molecules/Availability/Availability.js";
|
|
21
|
+
import { Avatar as q } from "./molecules/Avatar/Avatar.js";
|
|
22
22
|
import { BannerCard as J } from "./molecules/BannerCard/BannerCard.js";
|
|
23
23
|
import { CardLink as U } from "./molecules/CardLink/CardLink.js";
|
|
24
24
|
import { Breadcrumbs as X } from "./molecules/Breadcrumbs/Breadcrumbs.js";
|
|
@@ -40,29 +40,31 @@ import { AddToCart as vo } from "./molecules/AddToCart/AddToCart.js";
|
|
|
40
40
|
import { Modal as ho } from "./molecules/Modal/Modal.js";
|
|
41
41
|
import { ImageViewer as yo } from "./molecules/ImageViewer/ImageViewer.js";
|
|
42
42
|
import { T as Ho } from "./Table-BX4PtCNE.js";
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
43
|
+
import { Error as Vo } from "./molecules/Error/Error.js";
|
|
44
|
+
import { MainNav as Eo } from "./organisms/MainNav/MainNav.js";
|
|
45
|
+
import { ChipSelector as Oo } from "./organisms/ChipSelector/ChipSelector.js";
|
|
46
|
+
import { Product as Ro } from "./organisms/Product/Product.js";
|
|
47
|
+
import { Carousel as jo } from "./organisms/Carousel/Carousel.js";
|
|
48
|
+
import { Footer as Do } from "./organisms/Footer/Footer.js";
|
|
49
|
+
import { default as Ko } from "./organisms/SpinZoomViewer/SpinZoomViewer.js";
|
|
49
50
|
export {
|
|
50
51
|
so as Account,
|
|
51
52
|
vo as AddToCart,
|
|
52
53
|
Mo as AnimatedCheckMark,
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
Z as Availability,
|
|
55
|
+
q as Avatar,
|
|
55
56
|
J as BannerCard,
|
|
56
57
|
X as Breadcrumbs,
|
|
57
58
|
e as Button,
|
|
58
59
|
U as CardLink,
|
|
59
|
-
|
|
60
|
+
jo as Carousel,
|
|
60
61
|
Po as CartSlideInPanel,
|
|
61
62
|
Co as Chip,
|
|
62
|
-
|
|
63
|
+
Oo as ChipSelector,
|
|
63
64
|
f as Column,
|
|
65
|
+
Vo as Error,
|
|
64
66
|
p as Flex,
|
|
65
|
-
|
|
67
|
+
Do as Footer,
|
|
66
68
|
x as Grid,
|
|
67
69
|
n as Head,
|
|
68
70
|
oo as HorizontalScroll,
|
|
@@ -72,20 +74,20 @@ export {
|
|
|
72
74
|
P as Link,
|
|
73
75
|
L as LinkButton,
|
|
74
76
|
N as Logo,
|
|
75
|
-
|
|
77
|
+
Eo as MainNav,
|
|
76
78
|
po as Markdown,
|
|
77
79
|
ho as Modal,
|
|
78
80
|
_ as NotFound,
|
|
79
81
|
uo as Popover,
|
|
80
82
|
fo as PreprocessedMarkdown,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
Q as Pricing,
|
|
84
|
+
Ro as Product,
|
|
85
|
+
G as QuantityInput,
|
|
84
86
|
u as Root,
|
|
85
87
|
z as SearchBox,
|
|
86
88
|
s as Separator,
|
|
87
89
|
eo as SlideInPanel,
|
|
88
|
-
|
|
90
|
+
Ko as SpinZoomViewer,
|
|
89
91
|
Ao as StatefulButton,
|
|
90
92
|
Ho as Table,
|
|
91
93
|
C as Text,
|
package/dist/main.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export type { ChipProps } from './molecules/Chip/Chip';
|
|
|
22
22
|
export { Logo } from './molecules/Logo/Logo';
|
|
23
23
|
export { SearchBox } from './molecules/SearchBox/SearchBox';
|
|
24
24
|
export type { SearchBoxProps } from './molecules/SearchBox/SearchBox';
|
|
25
|
+
export { Error } from './molecules/Error/Error';
|
|
26
|
+
export type { ErrorProps, ErrorMessageProps, ErrorDetailsProps, } from './molecules/Error/Error';
|
|
25
27
|
export { ToggleView } from './molecules/ToggleView/ToggleView';
|
|
26
28
|
export type { ToggleViewProps, ToggleOptionProps, ToggleOptionBaseProps, } from './molecules/ToggleView/ToggleView';
|
|
27
29
|
export { MainNav } from './organisms/MainNav/MainNav';
|
package/dist/main.js
CHANGED
|
@@ -9,29 +9,31 @@ import { Text as S } from "./atoms/Text/Text.js";
|
|
|
9
9
|
import { Input as v } from "./atoms/Input/Input.js";
|
|
10
10
|
import { Account as B } from "./molecules/Account/Account.js";
|
|
11
11
|
import { Avatar as T } from "./molecules/Avatar/Avatar.js";
|
|
12
|
-
import { Chip as
|
|
13
|
-
import { Logo as
|
|
14
|
-
import { SearchBox as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
12
|
+
import { Chip as E } from "./molecules/Chip/Chip.js";
|
|
13
|
+
import { Logo as G } from "./molecules/Logo/Logo.js";
|
|
14
|
+
import { SearchBox as L } from "./molecules/SearchBox/SearchBox.js";
|
|
15
|
+
import { Error as N } from "./molecules/Error/Error.js";
|
|
16
|
+
import { ToggleView as V } from "./molecules/ToggleView/ToggleView.js";
|
|
17
|
+
import { MainNav as j } from "./organisms/MainNav/MainNav.js";
|
|
18
|
+
import { ChipSelector as q } from "./organisms/ChipSelector/ChipSelector.js";
|
|
18
19
|
export {
|
|
19
20
|
B as Account,
|
|
20
21
|
T as Avatar,
|
|
21
22
|
e as Button,
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
E as Chip,
|
|
24
|
+
q as ChipSelector,
|
|
24
25
|
m as Column,
|
|
26
|
+
N as Error,
|
|
25
27
|
p as Flex,
|
|
26
28
|
f as Grid,
|
|
27
29
|
n as Head,
|
|
28
30
|
i as Icon,
|
|
29
31
|
v as Input,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
G as Logo,
|
|
33
|
+
j as MainNav,
|
|
32
34
|
u as Root,
|
|
33
|
-
|
|
35
|
+
L as SearchBox,
|
|
34
36
|
h as Separator,
|
|
35
37
|
S as Text,
|
|
36
|
-
|
|
38
|
+
V as ToggleView
|
|
37
39
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
|
2
2
|
import l from "react";
|
|
3
3
|
import { Icon as g } from "../../atoms/Icon/Icon.js";
|
|
4
4
|
import { Text as p } from "../../atoms/Text/Text.js";
|
|
5
|
-
import { s as m } from "../../Cart.module-
|
|
5
|
+
import { s as m } from "../../Cart.module-gkb4IOVS.js";
|
|
6
6
|
const S = l.forwardRef(function({
|
|
7
7
|
cart: i,
|
|
8
8
|
open: t = !1,
|
|
@@ -1,86 +1,89 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { SlideInPanel as
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { SlideInPanel as y } from "../../atoms/SlideInPanel/SlideInPanel.js";
|
|
3
3
|
import { Text as n } from "../../atoms/Text/Text.js";
|
|
4
|
-
import { Link as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Pricing as
|
|
7
|
-
import { QuantityInput as
|
|
8
|
-
import { Availability as
|
|
9
|
-
import { Icon as
|
|
10
|
-
import { s as r } from "../../Cart.module-
|
|
4
|
+
import { Link as I } from "../../atoms/Link/Link.js";
|
|
5
|
+
import { Button as b } from "../../atoms/Button/Button.js";
|
|
6
|
+
import { Pricing as N } from "../Pricing/Pricing.js";
|
|
7
|
+
import { QuantityInput as z } from "../QuantityInput/QuantityInput.js";
|
|
8
|
+
import { Availability as k } from "../Availability/Availability.js";
|
|
9
|
+
import { Icon as c } from "../../atoms/Icon/Icon.js";
|
|
10
|
+
import { s as r } from "../../Cart.module-gkb4IOVS.js";
|
|
11
11
|
function H({
|
|
12
|
-
open:
|
|
13
|
-
onClose:
|
|
14
|
-
cart:
|
|
15
|
-
subtotal:
|
|
16
|
-
itemPriceLabel:
|
|
17
|
-
contactHref:
|
|
18
|
-
contactLinkBehavior:
|
|
19
|
-
onItemQtyChange:
|
|
20
|
-
onItemDelete:
|
|
12
|
+
open: o,
|
|
13
|
+
onClose: l,
|
|
14
|
+
cart: t,
|
|
15
|
+
subtotal: m,
|
|
16
|
+
itemPriceLabel: d,
|
|
17
|
+
contactHref: h,
|
|
18
|
+
contactLinkBehavior: p,
|
|
19
|
+
onItemQtyChange: u,
|
|
20
|
+
onItemDelete: f,
|
|
21
21
|
onCheckout: v
|
|
22
22
|
}) {
|
|
23
23
|
var s;
|
|
24
|
-
return
|
|
25
|
-
|
|
24
|
+
return t = t || { items: [] }, /* @__PURE__ */ e(
|
|
25
|
+
y,
|
|
26
26
|
{
|
|
27
27
|
side: "right",
|
|
28
|
-
open:
|
|
29
|
-
onClose:
|
|
28
|
+
open: o,
|
|
29
|
+
onClose: l,
|
|
30
30
|
ariaLabel: "Shopping Cart",
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
children: /* @__PURE__ */ a("div", { id: "cart-panel", className: r.cartContainer, children: [
|
|
32
|
+
/* @__PURE__ */ a("div", { className: r.headerWrapper, children: [
|
|
33
|
+
/* @__PURE__ */ a("div", { className: r.header, children: [
|
|
34
|
+
/* @__PURE__ */ e(n, { size: "2xl", children: "Cart" }),
|
|
35
|
+
/* @__PURE__ */ a(n, { size: "xs", colorToken: "quaternary", children: [
|
|
36
|
+
(s = t == null ? void 0 : t.items) == null ? void 0 : s.length,
|
|
37
|
+
" items in your cart"
|
|
38
|
+
] })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ e("button", { onClick: l, children: /* @__PURE__ */ e(c, { iconKey: "fa-regular fa-xmark", size: "md" }) })
|
|
38
41
|
] }),
|
|
39
|
-
/* @__PURE__ */ e("div", { className: r.cartItems, children:
|
|
42
|
+
/* @__PURE__ */ e("div", { className: r.cartItems, children: t.items.length > 0 ? /* @__PURE__ */ e("ul", { children: t.items.map((i) => /* @__PURE__ */ a("li", { className: r.cartItem, children: [
|
|
40
43
|
/* @__PURE__ */ e("img", { src: i.imageUrl, alt: `${i.itemId} product image` }),
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */ e(n, { size: "sm", weight: "semibold", children: /* @__PURE__ */ e(
|
|
45
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ a("div", { children: [
|
|
45
|
+
/* @__PURE__ */ a("div", { className: r.topRow, children: [
|
|
46
|
+
/* @__PURE__ */ a("div", { className: r.itemInfo, children: [
|
|
47
|
+
/* @__PURE__ */ e(n, { size: "sm", weight: "semibold", children: /* @__PURE__ */ e(I, { href: i.itemHref || `/part/${i.itemId}`, children: i.description }) }),
|
|
48
|
+
/* @__PURE__ */ a(n, { size: "sm", children: [
|
|
46
49
|
/* @__PURE__ */ e(n, { colorToken: "quaternary", size: "xs", children: i.custom ? "Specs " : "Part # " }),
|
|
47
50
|
i.itemId
|
|
48
51
|
] })
|
|
49
52
|
] }),
|
|
50
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
53
|
+
/* @__PURE__ */ e("button", { onClick: () => f(i), className: r.removeItem, "aria-label": "Remove item", children: /* @__PURE__ */ e(c, { iconKey: "fa-regular fa-trash", size: "sm" }) })
|
|
51
54
|
] }),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ a("div", { className: r.itemManagement, children: [
|
|
56
|
+
/* @__PURE__ */ a("div", { className: r.purchaseInformation, children: [
|
|
54
57
|
/* @__PURE__ */ e(
|
|
55
|
-
|
|
58
|
+
k,
|
|
56
59
|
{
|
|
57
60
|
availId: i.availabilityId || "",
|
|
58
61
|
availDescription: i.availability || "",
|
|
59
|
-
contactHref:
|
|
60
|
-
contactLinkBehavior:
|
|
62
|
+
contactHref: h || "",
|
|
63
|
+
contactLinkBehavior: p || "new-tab"
|
|
61
64
|
}
|
|
62
65
|
),
|
|
63
|
-
/* @__PURE__ */ e(
|
|
66
|
+
/* @__PURE__ */ e(N, { pricingLabel: d || "List Price", price: i.price })
|
|
64
67
|
] }),
|
|
65
68
|
/* @__PURE__ */ e(
|
|
66
|
-
|
|
69
|
+
z,
|
|
67
70
|
{
|
|
68
71
|
quantity: i.quantity,
|
|
69
|
-
onQuantityChange: (
|
|
72
|
+
onQuantityChange: (g) => u(i, g),
|
|
70
73
|
size: "sm"
|
|
71
74
|
}
|
|
72
75
|
)
|
|
73
76
|
] })
|
|
74
77
|
] })
|
|
75
78
|
] }, i.id)) }) : /* @__PURE__ */ e("div", { className: r.noItems, children: /* @__PURE__ */ e(n, { as: "p", size: "sm", children: "No items in your cart yet" }) }) }),
|
|
76
|
-
|
|
79
|
+
m && /* @__PURE__ */ a("div", { className: r.subtotal, children: [
|
|
77
80
|
/* @__PURE__ */ e(n, { size: "md", weight: "semibold", children: "Subtotal" }),
|
|
78
|
-
/* @__PURE__ */ e(n, { size: "md", weight: "semibold", children:
|
|
81
|
+
/* @__PURE__ */ e(n, { size: "md", weight: "semibold", children: m })
|
|
79
82
|
] }),
|
|
80
83
|
/* @__PURE__ */ e(
|
|
81
|
-
|
|
84
|
+
b,
|
|
82
85
|
{
|
|
83
|
-
disabled:
|
|
86
|
+
disabled: t.items.length === 0,
|
|
84
87
|
onClick: v,
|
|
85
88
|
variant: "cta-primary",
|
|
86
89
|
size: "md",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
export interface ErrorProps {
|
|
3
|
+
isVisible?: boolean;
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
hideDetails?: boolean;
|
|
7
|
+
detailsMaxHeight?: number | string;
|
|
8
|
+
variant?: "error" | "warning" | "default";
|
|
9
|
+
}
|
|
10
|
+
export interface ErrorMessageProps {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface ErrorDetailsProps {
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
hide?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function ErrorMessage({ children }: ErrorMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function ErrorDetails({ children }: ErrorDetailsProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
interface ErrorComponent extends React.FC<ErrorProps> {
|
|
20
|
+
Message: typeof ErrorMessage;
|
|
21
|
+
Details: typeof ErrorDetails;
|
|
22
|
+
}
|
|
23
|
+
export declare const Error: ErrorComponent;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsxs as c, jsx as r, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import p, { useState as v, useMemo as R, useEffect as D } from "react";
|
|
3
|
+
import { c as f } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { Icon as m } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import { Text as K } from "../../atoms/Text/Text.js";
|
|
6
|
+
import '../../assets/Error.css';const V = "_error_10jtk_1", W = "_variantError_10jtk_16", $ = "_variantWarning_10jtk_21", F = "_variantDefault_10jtk_26", L = "_errorHeader_10jtk_31", q = "_errorHeaderContent_10jtk_40", U = "_detailsToggleButton_10jtk_48", Y = "_detailsChevron_10jtk_66", G = "_detailsChevronOpen_10jtk_74", J = "_errorDetails_10jtk_78", P = "_errorDetailsContent_10jtk_94", Q = "_copyButton_10jtk_99", X = "_copyIcon_10jtk_114", Z = "_checkIcon_10jtk_115", ee = "_hiddenIcon_10jtk_122", t = {
|
|
7
|
+
error: V,
|
|
8
|
+
variantError: W,
|
|
9
|
+
variantWarning: $,
|
|
10
|
+
variantDefault: F,
|
|
11
|
+
errorHeader: L,
|
|
12
|
+
errorHeaderContent: q,
|
|
13
|
+
detailsToggleButton: U,
|
|
14
|
+
detailsChevron: Y,
|
|
15
|
+
detailsChevronOpen: G,
|
|
16
|
+
errorDetails: J,
|
|
17
|
+
errorDetailsContent: P,
|
|
18
|
+
copyButton: Q,
|
|
19
|
+
copyIcon: X,
|
|
20
|
+
checkIcon: Z,
|
|
21
|
+
hiddenIcon: ee
|
|
22
|
+
};
|
|
23
|
+
function x({ children: n }) {
|
|
24
|
+
return /* @__PURE__ */ r(b, { children: n });
|
|
25
|
+
}
|
|
26
|
+
function S({ children: n }) {
|
|
27
|
+
return /* @__PURE__ */ r(b, { children: n });
|
|
28
|
+
}
|
|
29
|
+
function N(n) {
|
|
30
|
+
return p.isValidElement(n) && n.type === x;
|
|
31
|
+
}
|
|
32
|
+
function E(n) {
|
|
33
|
+
return p.isValidElement(n) && n.type === S;
|
|
34
|
+
}
|
|
35
|
+
function te({
|
|
36
|
+
isVisible: n = !0,
|
|
37
|
+
className: H,
|
|
38
|
+
children: T,
|
|
39
|
+
hideDetails: I = !1,
|
|
40
|
+
detailsMaxHeight: _ = 300,
|
|
41
|
+
variant: d = "error"
|
|
42
|
+
}) {
|
|
43
|
+
const [o, h] = v(!1), [g, y] = v(!1), [a, k] = v(!1), s = R(() => {
|
|
44
|
+
const e = p.Children.toArray(T), u = e.find(
|
|
45
|
+
(l) => E(l) && !l.props.hide
|
|
46
|
+
), w = e.find(N), j = e.filter(
|
|
47
|
+
(l) => !E(l) && !N(l)
|
|
48
|
+
);
|
|
49
|
+
return {
|
|
50
|
+
message: w ? w.props.children : j.length > 0 ? j : null,
|
|
51
|
+
details: I ? null : u ? u.props.children : null
|
|
52
|
+
};
|
|
53
|
+
}, [T, I]), i = !!s.details;
|
|
54
|
+
if (D(() => {
|
|
55
|
+
i || (h(!1), y(!1));
|
|
56
|
+
}, [i]), D(() => {
|
|
57
|
+
if (o || !g)
|
|
58
|
+
return;
|
|
59
|
+
const e = window.setTimeout(() => y(!1), 280);
|
|
60
|
+
return () => window.clearTimeout(e);
|
|
61
|
+
}, [o, g]), D(() => {
|
|
62
|
+
if (!a)
|
|
63
|
+
return;
|
|
64
|
+
const e = window.setTimeout(() => k(!1), 1500);
|
|
65
|
+
return () => window.clearTimeout(e);
|
|
66
|
+
}, [a]), !n || !s.message)
|
|
67
|
+
return null;
|
|
68
|
+
const A = t[`variant${d[0].toUpperCase()}${d.slice(1)}`], B = d === "warning" ? "warning" : d === "default" ? "default" : "error-warning", M = typeof _ == "number" ? `${_}px` : _, C = (e) => e == null || typeof e == "boolean" ? "" : typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map((u) => C(u)).join("") : p.isValidElement(e) ? C(e.props.children) : "", O = async () => {
|
|
69
|
+
if (!i)
|
|
70
|
+
return;
|
|
71
|
+
const e = C(s.details);
|
|
72
|
+
if (e.trim())
|
|
73
|
+
try {
|
|
74
|
+
await navigator.clipboard.writeText(e), k(!0);
|
|
75
|
+
} catch {
|
|
76
|
+
k(!1);
|
|
77
|
+
}
|
|
78
|
+
}, z = () => {
|
|
79
|
+
if (o) {
|
|
80
|
+
h(!1);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
y(!0), window.requestAnimationFrame(() => {
|
|
84
|
+
h(!0);
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
return /* @__PURE__ */ c("div", { className: f(t.error, A, H), children: [
|
|
88
|
+
/* @__PURE__ */ c("div", { className: t.errorHeader, children: [
|
|
89
|
+
/* @__PURE__ */ c("div", { className: t.errorHeaderContent, children: [
|
|
90
|
+
/* @__PURE__ */ r(
|
|
91
|
+
m,
|
|
92
|
+
{
|
|
93
|
+
iconKey: "fa-solid fa-triangle-exclamation",
|
|
94
|
+
size: "md",
|
|
95
|
+
colorToken: B
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
typeof s.message == "string" || typeof s.message == "number" ? /* @__PURE__ */ r(K, { size: "md", children: s.message }) : s.message
|
|
99
|
+
] }),
|
|
100
|
+
i && /* @__PURE__ */ r(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
type: "button",
|
|
104
|
+
className: t.detailsToggleButton,
|
|
105
|
+
"aria-label": o ? "Hide details" : "Show details",
|
|
106
|
+
title: o ? "Hide details" : "Show details",
|
|
107
|
+
onClick: z,
|
|
108
|
+
children: /* @__PURE__ */ r("span", { className: f(t.detailsChevron, o && t.detailsChevronOpen), children: /* @__PURE__ */ r(m, { iconKey: "fa-light fa-chevron-down", size: "sm", colorToken: "default" }) })
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] }),
|
|
112
|
+
i && g && /* @__PURE__ */ c(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: t.errorDetails,
|
|
116
|
+
style: {
|
|
117
|
+
maxHeight: o ? M : "0px",
|
|
118
|
+
opacity: o ? 1 : 0,
|
|
119
|
+
overflowY: o ? "auto" : "hidden"
|
|
120
|
+
},
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ c(
|
|
123
|
+
"button",
|
|
124
|
+
{
|
|
125
|
+
type: "button",
|
|
126
|
+
className: t.copyButton,
|
|
127
|
+
"aria-label": "Copy error details",
|
|
128
|
+
title: a ? "Copied" : "Copy details",
|
|
129
|
+
onClick: O,
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ r("span", { className: f(t.copyIcon, a && t.hiddenIcon), children: /* @__PURE__ */ r(m, { iconKey: "fa-regular fa-copy", size: "sm", colorToken: "default" }) }),
|
|
132
|
+
/* @__PURE__ */ r("span", { className: f(t.checkIcon, !a && t.hiddenIcon), children: /* @__PURE__ */ r(m, { iconKey: "fa-regular fa-check", size: "sm", colorToken: "default" }) })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ r("div", { className: t.errorDetailsContent, children: s.details })
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
const ce = Object.assign(te, {
|
|
143
|
+
Message: x,
|
|
144
|
+
Details: S
|
|
145
|
+
});
|
|
146
|
+
export {
|
|
147
|
+
ce as Error
|
|
148
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
interface DemoArgs {
|
|
3
|
+
isVisible: boolean;
|
|
4
|
+
hideDetails: boolean;
|
|
5
|
+
detailsMaxHeight: number;
|
|
6
|
+
variant: "error" | "warning" | "default";
|
|
7
|
+
message: string;
|
|
8
|
+
details: string;
|
|
9
|
+
}
|
|
10
|
+
declare const meta: Meta<DemoArgs>;
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<DemoArgs>;
|
|
13
|
+
export declare const Playground: Story;
|
|
14
|
+
export declare const ComposedChildren: Story;
|
|
15
|
+
export declare const WithoutDetails: Story;
|
|
16
|
+
export declare const Hidden: Story;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { Error as i } from "./Error.js";
|
|
3
|
+
const o = {
|
|
4
|
+
title: "Case Parts/Molecules/Error",
|
|
5
|
+
component: i,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `
|
|
12
|
+
A composed error message component.
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
- \`<Error />\` as the root wrapper
|
|
16
|
+
- \`<Error.Message />\` for the primary message
|
|
17
|
+
- \`<Error.Details />\` for expandable diagnostic details
|
|
18
|
+
`.trim()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
isVisible: {
|
|
24
|
+
control: { type: "boolean" },
|
|
25
|
+
description: "Controls whether the message is rendered."
|
|
26
|
+
},
|
|
27
|
+
hideDetails: {
|
|
28
|
+
control: { type: "boolean" },
|
|
29
|
+
description: "Force-hide details content and toggle even when provided."
|
|
30
|
+
},
|
|
31
|
+
detailsMaxHeight: {
|
|
32
|
+
control: { type: "number", min: 80, max: 800, step: 10 },
|
|
33
|
+
description: "Maximum details panel height in px before vertical scrolling."
|
|
34
|
+
},
|
|
35
|
+
variant: {
|
|
36
|
+
control: { type: "radio" },
|
|
37
|
+
options: ["error", "warning", "default"],
|
|
38
|
+
description: "Visual style variant."
|
|
39
|
+
},
|
|
40
|
+
message: {
|
|
41
|
+
control: { type: "text" },
|
|
42
|
+
description: "Primary message text."
|
|
43
|
+
},
|
|
44
|
+
details: {
|
|
45
|
+
control: { type: "text" },
|
|
46
|
+
description: "Details text shown in expandable panel."
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
args: {
|
|
50
|
+
isVisible: !0,
|
|
51
|
+
hideDetails: !1,
|
|
52
|
+
detailsMaxHeight: 300,
|
|
53
|
+
variant: "error",
|
|
54
|
+
message: "We could not load your cart.",
|
|
55
|
+
details: `Request failed with status 503.
|
|
56
|
+
TraceId: 3de8c8ff-33b7-49c8-a4b7-739f1f3a11a9`
|
|
57
|
+
}
|
|
58
|
+
}, n = {
|
|
59
|
+
render: (e) => /* @__PURE__ */ t("div", { style: { width: 640 }, children: /* @__PURE__ */ s(
|
|
60
|
+
i,
|
|
61
|
+
{
|
|
62
|
+
isVisible: e.isVisible,
|
|
63
|
+
hideDetails: e.hideDetails,
|
|
64
|
+
detailsMaxHeight: e.detailsMaxHeight,
|
|
65
|
+
variant: e.variant,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ t(i.Message, { children: e.message }),
|
|
68
|
+
/* @__PURE__ */ t(i.Details, { children: e.details })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
) })
|
|
72
|
+
}, l = {
|
|
73
|
+
args: {
|
|
74
|
+
message: "Inventory service reported a warning.",
|
|
75
|
+
details: `The data source responded with stale data.
|
|
76
|
+
Last refresh: 7m 12s ago.`,
|
|
77
|
+
variant: "warning"
|
|
78
|
+
}
|
|
79
|
+
}, d = {
|
|
80
|
+
render: (e) => /* @__PURE__ */ t("div", { style: { width: 640 }, children: /* @__PURE__ */ t(
|
|
81
|
+
i,
|
|
82
|
+
{
|
|
83
|
+
isVisible: e.isVisible,
|
|
84
|
+
hideDetails: e.hideDetails,
|
|
85
|
+
detailsMaxHeight: e.detailsMaxHeight,
|
|
86
|
+
variant: e.variant,
|
|
87
|
+
children: /* @__PURE__ */ t(i.Message, { children: e.message })
|
|
88
|
+
}
|
|
89
|
+
) }),
|
|
90
|
+
args: {
|
|
91
|
+
message: "An unknown issue occurred.",
|
|
92
|
+
variant: "default"
|
|
93
|
+
}
|
|
94
|
+
}, c = {
|
|
95
|
+
args: {
|
|
96
|
+
isVisible: !1
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
export {
|
|
100
|
+
l as ComposedChildren,
|
|
101
|
+
c as Hidden,
|
|
102
|
+
n as Playground,
|
|
103
|
+
d as WithoutDetails,
|
|
104
|
+
o as default
|
|
105
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import './assets/Cart.css';const t = "_cartIconButton_pkqoj_2", o = "_count_pkqoj_9", n = "_cartContainer_pkqoj_24", e = "_header_pkqoj_35", _ = "_cartItems_pkqoj_40", c = "_topRow_pkqoj_65", a = "_itemInfo_pkqoj_71", s = "_purchaseInformation_pkqoj_76", r = "_itemManagement_pkqoj_83", m = "_removeItem_pkqoj_101", p = "_noItems_pkqoj_111", u = "_subtotal_pkqoj_118", I = "_checkoutButton_pkqoj_125", k = {
|
|
2
|
-
cartIconButton: t,
|
|
3
|
-
count: o,
|
|
4
|
-
cartContainer: n,
|
|
5
|
-
header: e,
|
|
6
|
-
cartItems: _,
|
|
7
|
-
topRow: c,
|
|
8
|
-
itemInfo: a,
|
|
9
|
-
purchaseInformation: s,
|
|
10
|
-
itemManagement: r,
|
|
11
|
-
removeItem: m,
|
|
12
|
-
noItems: p,
|
|
13
|
-
subtotal: u,
|
|
14
|
-
checkoutButton: I
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
k as s
|
|
18
|
-
};
|