@caseparts-org/caseblocks 0.0.156 → 0.0.158
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/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/Error/Error.d.ts +32 -0
- package/dist/molecules/Error/Error.js +171 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._error_lchwg_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) var(--spacing-spacing-1xs);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_lchwg_16{border-color:var(--border-border-error-warning);background-color:color-mix(in srgb,var(--color-alerts-error-warning) 8%,transparent)}._variantWarning_lchwg_21{border-color:var(--border-border-warning);background-color:color-mix(in srgb,var(--color-alerts-warning) 8%,transparent)}._variantDefault_lchwg_26{border-color:var(--border-border-primary);background-color:var(--surface-surface-primary)}._errorHeader_lchwg_31{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--spacing-spacing-2xs)}._errorHeaderContent_lchwg_40{min-width:0;display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs)}._detailsToggleButton_lchwg_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_lchwg_48:hover,._detailsToggleButton_lchwg_48:focus-visible{background-color:var(--surface-surface-secondary)}._detailsChevron_lchwg_66{display:inline-flex;align-items:center;justify-content:center;transform:rotate(0);transition:transform .2s ease}._detailsChevronOpen_lchwg_74{transform:rotate(180deg)}._errorDetails_lchwg_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_lchwg_94{padding-top:var(--spacing-spacing-3xs);padding-right:2rem}._copyButton_lchwg_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_lchwg_114,._checkIcon_lchwg_115{position:absolute;display:inline-flex;align-items:center;justify-content:center}._hiddenIcon_lchwg_122{opacity:0;pointer-events:none}._copyButton_lchwg_99:hover,._copyButton_lchwg_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
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { TextProps } from '../../atoms/Text/Text';
|
|
3
|
+
export interface ErrorProps {
|
|
4
|
+
isVisible?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
hideDetails?: boolean;
|
|
8
|
+
detailsMaxHeight?: number | string;
|
|
9
|
+
variant?: "error" | "warning" | "default";
|
|
10
|
+
}
|
|
11
|
+
export interface ErrorMessageProps {
|
|
12
|
+
as?: TextProps["as"];
|
|
13
|
+
size?: TextProps["size"];
|
|
14
|
+
variant?: TextProps["variant"];
|
|
15
|
+
weight?: TextProps["weight"];
|
|
16
|
+
colorToken?: TextProps["colorToken"];
|
|
17
|
+
hideAt?: TextProps["hideAt"];
|
|
18
|
+
className?: string;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export interface ErrorDetailsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
hide?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare function ErrorMessage({ as, size, variant, weight, colorToken, hideAt, className, children, }: ErrorMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare function ErrorDetails({ children, hide, ...otherProps }: ErrorDetailsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
27
|
+
interface ErrorComponent extends React.FC<ErrorProps> {
|
|
28
|
+
Message: typeof ErrorMessage;
|
|
29
|
+
Details: typeof ErrorDetails;
|
|
30
|
+
}
|
|
31
|
+
export declare const Error: ErrorComponent;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import m, { useState as I, useEffect as N } from "react";
|
|
3
|
+
import { c as f } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { Icon as p } from "../../atoms/Icon/Icon.js";
|
|
5
|
+
import { Text as q } from "../../atoms/Text/Text.js";
|
|
6
|
+
import '../../assets/Error.css';const F = "_error_lchwg_1", U = "_variantError_lchwg_16", Y = "_variantWarning_lchwg_21", G = "_variantDefault_lchwg_26", J = "_errorHeader_lchwg_31", P = "_errorHeaderContent_lchwg_40", Q = "_detailsToggleButton_lchwg_48", X = "_detailsChevron_lchwg_66", Z = "_detailsChevronOpen_lchwg_74", ee = "_errorDetails_lchwg_78", te = "_errorDetailsContent_lchwg_94", re = "_copyButton_lchwg_99", ne = "_copyIcon_lchwg_114", oe = "_checkIcon_lchwg_115", ae = "_hiddenIcon_lchwg_122", t = {
|
|
7
|
+
error: F,
|
|
8
|
+
variantError: U,
|
|
9
|
+
variantWarning: Y,
|
|
10
|
+
variantDefault: G,
|
|
11
|
+
errorHeader: J,
|
|
12
|
+
errorHeaderContent: P,
|
|
13
|
+
detailsToggleButton: Q,
|
|
14
|
+
detailsChevron: X,
|
|
15
|
+
detailsChevronOpen: Z,
|
|
16
|
+
errorDetails: ee,
|
|
17
|
+
errorDetailsContent: te,
|
|
18
|
+
copyButton: re,
|
|
19
|
+
copyIcon: ne,
|
|
20
|
+
checkIcon: oe,
|
|
21
|
+
hiddenIcon: ae
|
|
22
|
+
};
|
|
23
|
+
function E({
|
|
24
|
+
as: n,
|
|
25
|
+
size: s = "md",
|
|
26
|
+
variant: i = "body",
|
|
27
|
+
weight: g = "regular",
|
|
28
|
+
colorToken: l = "inherit",
|
|
29
|
+
hideAt: a,
|
|
30
|
+
className: b,
|
|
31
|
+
children: o
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ r(
|
|
34
|
+
q,
|
|
35
|
+
{
|
|
36
|
+
as: n,
|
|
37
|
+
size: s,
|
|
38
|
+
variant: i,
|
|
39
|
+
weight: g,
|
|
40
|
+
colorToken: l,
|
|
41
|
+
hideAt: a,
|
|
42
|
+
className: b,
|
|
43
|
+
children: o
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function O({ children: n, hide: s, ...i }) {
|
|
48
|
+
return s ? null : /* @__PURE__ */ r("div", { ...i, children: n });
|
|
49
|
+
}
|
|
50
|
+
function A(n) {
|
|
51
|
+
return m.isValidElement(n) && n.type === E;
|
|
52
|
+
}
|
|
53
|
+
function B(n) {
|
|
54
|
+
return m.isValidElement(n) && n.type === O;
|
|
55
|
+
}
|
|
56
|
+
function se({
|
|
57
|
+
isVisible: n = !0,
|
|
58
|
+
className: s,
|
|
59
|
+
children: i,
|
|
60
|
+
hideDetails: g = !1,
|
|
61
|
+
detailsMaxHeight: l = 300,
|
|
62
|
+
variant: a = "error"
|
|
63
|
+
}) {
|
|
64
|
+
const [o, w] = I(!1), [y, C] = I(!1), [c, v] = I(!1), D = m.Children.toArray(i), k = D.find(
|
|
65
|
+
(e) => B(e) && !e.props.hide
|
|
66
|
+
), x = D.find(A), H = D.filter(
|
|
67
|
+
(e) => !B(e) && !A(e)
|
|
68
|
+
), S = x ? /* @__PURE__ */ r(E, { ...x.props }) : H.length > 0 ? H : null, _ = g || !k ? null : k.props, d = _ == null ? void 0 : _.children, u = d != null && d !== !1, {
|
|
69
|
+
children: ie,
|
|
70
|
+
hide: le,
|
|
71
|
+
className: M,
|
|
72
|
+
style: z,
|
|
73
|
+
...R
|
|
74
|
+
} = _ ?? {};
|
|
75
|
+
if (N(() => {
|
|
76
|
+
u || (w(!1), C(!1));
|
|
77
|
+
}, [u]), N(() => {
|
|
78
|
+
if (o || !y)
|
|
79
|
+
return;
|
|
80
|
+
const e = window.setTimeout(() => C(!1), 280);
|
|
81
|
+
return () => window.clearTimeout(e);
|
|
82
|
+
}, [o, y]), N(() => {
|
|
83
|
+
if (!c)
|
|
84
|
+
return;
|
|
85
|
+
const e = window.setTimeout(() => v(!1), 1500);
|
|
86
|
+
return () => window.clearTimeout(e);
|
|
87
|
+
}, [c]), !n || !S)
|
|
88
|
+
return null;
|
|
89
|
+
const j = t[`variant${a[0].toUpperCase()}${a.slice(1)}`], K = a === "warning" ? "warning" : a === "default" ? "default" : "error-warning", V = typeof l == "number" ? `${l}px` : l, T = (e) => e == null || typeof e == "boolean" ? "" : typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map((L) => T(L)).join("") : m.isValidElement(e) ? T(e.props.children) : "", W = async () => {
|
|
90
|
+
if (!u)
|
|
91
|
+
return;
|
|
92
|
+
const e = T(d);
|
|
93
|
+
if (e.trim())
|
|
94
|
+
try {
|
|
95
|
+
await navigator.clipboard.writeText(e), v(!0);
|
|
96
|
+
} catch {
|
|
97
|
+
v(!1);
|
|
98
|
+
}
|
|
99
|
+
}, $ = () => {
|
|
100
|
+
if (o) {
|
|
101
|
+
w(!1);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
C(!0), window.requestAnimationFrame(() => {
|
|
105
|
+
w(!0);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return /* @__PURE__ */ h("div", { className: f(t.error, j, s), children: [
|
|
109
|
+
/* @__PURE__ */ h("div", { className: t.errorHeader, children: [
|
|
110
|
+
/* @__PURE__ */ h("div", { className: t.errorHeaderContent, children: [
|
|
111
|
+
/* @__PURE__ */ r(
|
|
112
|
+
p,
|
|
113
|
+
{
|
|
114
|
+
iconKey: "fa-solid fa-triangle-exclamation",
|
|
115
|
+
size: "md",
|
|
116
|
+
colorToken: K
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
S
|
|
120
|
+
] }),
|
|
121
|
+
u && /* @__PURE__ */ r(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
type: "button",
|
|
125
|
+
className: t.detailsToggleButton,
|
|
126
|
+
"aria-label": o ? "Hide details" : "Show details",
|
|
127
|
+
title: o ? "Hide details" : "Show details",
|
|
128
|
+
onClick: $,
|
|
129
|
+
children: /* @__PURE__ */ r("span", { className: f(t.detailsChevron, o && t.detailsChevronOpen), children: /* @__PURE__ */ r(p, { iconKey: "fa-light fa-chevron-down", size: "sm", colorToken: "default" }) })
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] }),
|
|
133
|
+
u && y && /* @__PURE__ */ h(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: f(t.errorDetails, M),
|
|
137
|
+
style: {
|
|
138
|
+
...z,
|
|
139
|
+
maxHeight: o ? V : "0px",
|
|
140
|
+
opacity: o ? 1 : 0,
|
|
141
|
+
overflowY: o ? "auto" : "hidden"
|
|
142
|
+
},
|
|
143
|
+
...R,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ h(
|
|
146
|
+
"button",
|
|
147
|
+
{
|
|
148
|
+
type: "button",
|
|
149
|
+
className: t.copyButton,
|
|
150
|
+
"aria-label": "Copy error details",
|
|
151
|
+
title: c ? "Copied" : "Copy details",
|
|
152
|
+
onClick: W,
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ r("span", { className: f(t.copyIcon, c && t.hiddenIcon), children: /* @__PURE__ */ r(p, { iconKey: "fa-regular fa-copy", size: "sm", colorToken: "default" }) }),
|
|
155
|
+
/* @__PURE__ */ r("span", { className: f(t.checkIcon, !c && t.hiddenIcon), children: /* @__PURE__ */ r(p, { iconKey: "fa-regular fa-check", size: "sm", colorToken: "default" }) })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ r("div", { className: t.errorDetailsContent, children: d })
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] });
|
|
164
|
+
}
|
|
165
|
+
const _e = Object.assign(se, {
|
|
166
|
+
Message: E,
|
|
167
|
+
Details: O
|
|
168
|
+
});
|
|
169
|
+
export {
|
|
170
|
+
_e as Error
|
|
171
|
+
};
|
|
@@ -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
|
+
};
|