@caseparts-org/caseblocks 0.0.157 → 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
CHANGED
|
@@ -1 +1 @@
|
|
|
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)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { TextProps } from '../../atoms/Text/Text';
|
|
2
3
|
export interface ErrorProps {
|
|
3
4
|
isVisible?: boolean;
|
|
4
5
|
className?: string;
|
|
@@ -8,14 +9,21 @@ export interface ErrorProps {
|
|
|
8
9
|
variant?: "error" | "warning" | "default";
|
|
9
10
|
}
|
|
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;
|
|
11
19
|
children?: ReactNode;
|
|
12
20
|
}
|
|
13
|
-
export interface ErrorDetailsProps {
|
|
21
|
+
export interface ErrorDetailsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
22
|
children?: ReactNode;
|
|
15
23
|
hide?: boolean;
|
|
16
24
|
}
|
|
17
|
-
declare function ErrorMessage({ children }: ErrorMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
declare function ErrorDetails({ children }: ErrorDetailsProps): import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
19
27
|
interface ErrorComponent extends React.FC<ErrorProps> {
|
|
20
28
|
Message: typeof ErrorMessage;
|
|
21
29
|
Details: typeof ErrorDetails;
|
|
@@ -1,148 +1,171 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import m, { useState as I, useEffect as N } from "react";
|
|
3
3
|
import { c as f } from "../../clsx-OuTLNxxd.js";
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Text as
|
|
6
|
-
import '../../assets/Error.css';const
|
|
7
|
-
error:
|
|
8
|
-
variantError:
|
|
9
|
-
variantWarning:
|
|
10
|
-
variantDefault:
|
|
11
|
-
errorHeader:
|
|
12
|
-
errorHeaderContent:
|
|
13
|
-
detailsToggleButton:
|
|
14
|
-
detailsChevron:
|
|
15
|
-
detailsChevronOpen:
|
|
16
|
-
errorDetails:
|
|
17
|
-
errorDetailsContent:
|
|
18
|
-
copyButton:
|
|
19
|
-
copyIcon:
|
|
20
|
-
checkIcon:
|
|
21
|
-
hiddenIcon:
|
|
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
22
|
};
|
|
23
|
-
function
|
|
24
|
-
|
|
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
|
+
);
|
|
25
46
|
}
|
|
26
|
-
function
|
|
27
|
-
return /* @__PURE__ */ r(
|
|
47
|
+
function O({ children: n, hide: s, ...i }) {
|
|
48
|
+
return s ? null : /* @__PURE__ */ r("div", { ...i, children: n });
|
|
28
49
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
50
|
+
function A(n) {
|
|
51
|
+
return m.isValidElement(n) && n.type === E;
|
|
31
52
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
53
|
+
function B(n) {
|
|
54
|
+
return m.isValidElement(n) && n.type === O;
|
|
34
55
|
}
|
|
35
|
-
function
|
|
56
|
+
function se({
|
|
36
57
|
isVisible: n = !0,
|
|
37
|
-
className:
|
|
38
|
-
children:
|
|
39
|
-
hideDetails:
|
|
40
|
-
detailsMaxHeight:
|
|
41
|
-
variant:
|
|
58
|
+
className: s,
|
|
59
|
+
children: i,
|
|
60
|
+
hideDetails: g = !1,
|
|
61
|
+
detailsMaxHeight: l = 300,
|
|
62
|
+
variant: a = "error"
|
|
42
63
|
}) {
|
|
43
|
-
const [o,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
}, [
|
|
57
|
-
if (o || !
|
|
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)
|
|
58
79
|
return;
|
|
59
|
-
const e = window.setTimeout(() =>
|
|
80
|
+
const e = window.setTimeout(() => C(!1), 280);
|
|
60
81
|
return () => window.clearTimeout(e);
|
|
61
|
-
}, [o,
|
|
62
|
-
if (!
|
|
82
|
+
}, [o, y]), N(() => {
|
|
83
|
+
if (!c)
|
|
63
84
|
return;
|
|
64
|
-
const e = window.setTimeout(() =>
|
|
85
|
+
const e = window.setTimeout(() => v(!1), 1500);
|
|
65
86
|
return () => window.clearTimeout(e);
|
|
66
|
-
}, [
|
|
87
|
+
}, [c]), !n || !S)
|
|
67
88
|
return null;
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
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)
|
|
70
91
|
return;
|
|
71
|
-
const e =
|
|
92
|
+
const e = T(d);
|
|
72
93
|
if (e.trim())
|
|
73
94
|
try {
|
|
74
|
-
await navigator.clipboard.writeText(e),
|
|
95
|
+
await navigator.clipboard.writeText(e), v(!0);
|
|
75
96
|
} catch {
|
|
76
|
-
|
|
97
|
+
v(!1);
|
|
77
98
|
}
|
|
78
|
-
},
|
|
99
|
+
}, $ = () => {
|
|
79
100
|
if (o) {
|
|
80
|
-
|
|
101
|
+
w(!1);
|
|
81
102
|
return;
|
|
82
103
|
}
|
|
83
|
-
|
|
84
|
-
|
|
104
|
+
C(!0), window.requestAnimationFrame(() => {
|
|
105
|
+
w(!0);
|
|
85
106
|
});
|
|
86
107
|
};
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
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: [
|
|
90
111
|
/* @__PURE__ */ r(
|
|
91
|
-
|
|
112
|
+
p,
|
|
92
113
|
{
|
|
93
114
|
iconKey: "fa-solid fa-triangle-exclamation",
|
|
94
115
|
size: "md",
|
|
95
|
-
colorToken:
|
|
116
|
+
colorToken: K
|
|
96
117
|
}
|
|
97
118
|
),
|
|
98
|
-
|
|
119
|
+
S
|
|
99
120
|
] }),
|
|
100
|
-
|
|
121
|
+
u && /* @__PURE__ */ r(
|
|
101
122
|
"button",
|
|
102
123
|
{
|
|
103
124
|
type: "button",
|
|
104
125
|
className: t.detailsToggleButton,
|
|
105
126
|
"aria-label": o ? "Hide details" : "Show details",
|
|
106
127
|
title: o ? "Hide details" : "Show details",
|
|
107
|
-
onClick:
|
|
108
|
-
children: /* @__PURE__ */ r("span", { className: f(t.detailsChevron, o && t.detailsChevronOpen), children: /* @__PURE__ */ r(
|
|
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" }) })
|
|
109
130
|
}
|
|
110
131
|
)
|
|
111
132
|
] }),
|
|
112
|
-
|
|
133
|
+
u && y && /* @__PURE__ */ h(
|
|
113
134
|
"div",
|
|
114
135
|
{
|
|
115
|
-
className: t.errorDetails,
|
|
136
|
+
className: f(t.errorDetails, M),
|
|
116
137
|
style: {
|
|
117
|
-
|
|
138
|
+
...z,
|
|
139
|
+
maxHeight: o ? V : "0px",
|
|
118
140
|
opacity: o ? 1 : 0,
|
|
119
141
|
overflowY: o ? "auto" : "hidden"
|
|
120
142
|
},
|
|
143
|
+
...R,
|
|
121
144
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ h(
|
|
123
146
|
"button",
|
|
124
147
|
{
|
|
125
148
|
type: "button",
|
|
126
149
|
className: t.copyButton,
|
|
127
150
|
"aria-label": "Copy error details",
|
|
128
|
-
title:
|
|
129
|
-
onClick:
|
|
151
|
+
title: c ? "Copied" : "Copy details",
|
|
152
|
+
onClick: W,
|
|
130
153
|
children: [
|
|
131
|
-
/* @__PURE__ */ r("span", { className: f(t.copyIcon,
|
|
132
|
-
/* @__PURE__ */ r("span", { className: f(t.checkIcon, !
|
|
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" }) })
|
|
133
156
|
]
|
|
134
157
|
}
|
|
135
158
|
),
|
|
136
|
-
/* @__PURE__ */ r("div", { className: t.errorDetailsContent, children:
|
|
159
|
+
/* @__PURE__ */ r("div", { className: t.errorDetailsContent, children: d })
|
|
137
160
|
]
|
|
138
161
|
}
|
|
139
162
|
)
|
|
140
163
|
] });
|
|
141
164
|
}
|
|
142
|
-
const
|
|
143
|
-
Message:
|
|
144
|
-
Details:
|
|
165
|
+
const _e = Object.assign(se, {
|
|
166
|
+
Message: E,
|
|
167
|
+
Details: O
|
|
145
168
|
});
|
|
146
169
|
export {
|
|
147
|
-
|
|
170
|
+
_e as Error
|
|
148
171
|
};
|