@caseparts-org/caseblocks 0.0.158 → 0.0.159
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 -1
- package/dist/molecules/Error/Error.js +38 -38
- package/package.json +1 -1
package/dist/assets/Error.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._error_9tpem_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_9tpem_16{border-color:var(--border-border-error-warning);background-color:color-mix(in srgb,var(--color-alerts-error-warning) 8%,transparent)}._variantWarning_9tpem_21{border-color:var(--border-border-warning);background-color:color-mix(in srgb,var(--color-alerts-warning) 8%,transparent)}._variantDefault_9tpem_26{border-color:var(--border-border-primary);background-color:var(--surface-surface-primary)}._errorHeader_9tpem_31{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--spacing-spacing-2xs)}._errorHeaderContent_9tpem_40{min-width:0;display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs)}._detailsToggleButton_9tpem_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_9tpem_48:hover,._detailsToggleButton_9tpem_48:focus-visible{background-color:var(--surface-surface-secondary)}._detailsChevron_9tpem_66{display:inline-flex;align-items:center;justify-content:center;transform:rotate(0);transition:transform .2s ease}._detailsChevronOpen_9tpem_74{transform:rotate(180deg)}._errorDetails_9tpem_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!important;width:100%;transition:max-height .28s ease,opacity .2s ease}._errorDetailsContent_9tpem_94{padding-top:var(--spacing-spacing-3xs);padding-right:2rem}._copyButton_9tpem_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_9tpem_114,._checkIcon_9tpem_115{position:absolute;display:inline-flex;align-items:center;justify-content:center}._hiddenIcon_9tpem_122{opacity:0;pointer-events:none}._copyButton_9tpem_99:hover,._copyButton_9tpem_99:focus-visible{background-color:var(--surface-surface-secondary)}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { c as
|
|
4
|
-
import { Icon as
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import h, { useState as w, useEffect as N } from "react";
|
|
3
|
+
import { c as m } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { Icon as _ } from "../../atoms/Icon/Icon.js";
|
|
5
5
|
import { Text as q } from "../../atoms/Text/Text.js";
|
|
6
|
-
import '../../assets/Error.css';const F = "
|
|
6
|
+
import '../../assets/Error.css';const F = "_error_9tpem_1", U = "_variantError_9tpem_16", Y = "_variantWarning_9tpem_21", G = "_variantDefault_9tpem_26", J = "_errorHeader_9tpem_31", P = "_errorHeaderContent_9tpem_40", Q = "_detailsToggleButton_9tpem_48", X = "_detailsChevron_9tpem_66", Z = "_detailsChevronOpen_9tpem_74", ee = "_errorDetails_9tpem_78", te = "_errorDetailsContent_9tpem_94", re = "_copyButton_9tpem_99", ne = "_copyIcon_9tpem_114", oe = "_checkIcon_9tpem_115", ae = "_hiddenIcon_9tpem_122", t = {
|
|
7
7
|
error: F,
|
|
8
8
|
variantError: U,
|
|
9
9
|
variantWarning: Y,
|
|
@@ -24,7 +24,7 @@ function E({
|
|
|
24
24
|
as: n,
|
|
25
25
|
size: s = "md",
|
|
26
26
|
variant: i = "body",
|
|
27
|
-
weight:
|
|
27
|
+
weight: y = "regular",
|
|
28
28
|
colorToken: l = "inherit",
|
|
29
29
|
hideAt: a,
|
|
30
30
|
className: b,
|
|
@@ -36,7 +36,7 @@ function E({
|
|
|
36
36
|
as: n,
|
|
37
37
|
size: s,
|
|
38
38
|
variant: i,
|
|
39
|
-
weight:
|
|
39
|
+
weight: y,
|
|
40
40
|
colorToken: l,
|
|
41
41
|
hideAt: a,
|
|
42
42
|
className: b,
|
|
@@ -48,68 +48,68 @@ function O({ children: n, hide: s, ...i }) {
|
|
|
48
48
|
return s ? null : /* @__PURE__ */ r("div", { ...i, children: n });
|
|
49
49
|
}
|
|
50
50
|
function A(n) {
|
|
51
|
-
return
|
|
51
|
+
return h.isValidElement(n) && n.type === E;
|
|
52
52
|
}
|
|
53
53
|
function B(n) {
|
|
54
|
-
return
|
|
54
|
+
return h.isValidElement(n) && n.type === O;
|
|
55
55
|
}
|
|
56
56
|
function se({
|
|
57
57
|
isVisible: n = !0,
|
|
58
58
|
className: s,
|
|
59
59
|
children: i,
|
|
60
|
-
hideDetails:
|
|
60
|
+
hideDetails: y = !1,
|
|
61
61
|
detailsMaxHeight: l = 300,
|
|
62
62
|
variant: a = "error"
|
|
63
63
|
}) {
|
|
64
|
-
const [o,
|
|
64
|
+
const [o, g] = w(!1), [C, v] = w(!1), [c, D] = w(!1), T = h.Children.toArray(i), k = T.find(
|
|
65
65
|
(e) => B(e) && !e.props.hide
|
|
66
|
-
), x =
|
|
66
|
+
), x = T.find(A), H = T.filter(
|
|
67
67
|
(e) => !B(e) && !A(e)
|
|
68
|
-
), S = x ? /* @__PURE__ */ r(E, { ...x.props }) : H.length > 0 ? H : null,
|
|
68
|
+
), S = x ? /* @__PURE__ */ r(E, { ...x.props }) : H.length > 0 ? H : null, f = y || !k ? null : k.props, d = f == null ? void 0 : f.children, u = d != null && d !== !1, {
|
|
69
69
|
children: ie,
|
|
70
70
|
hide: le,
|
|
71
71
|
className: M,
|
|
72
72
|
style: z,
|
|
73
73
|
...R
|
|
74
|
-
} =
|
|
74
|
+
} = f ?? {};
|
|
75
75
|
if (N(() => {
|
|
76
|
-
u || (
|
|
76
|
+
u || (g(!1), v(!1));
|
|
77
77
|
}, [u]), N(() => {
|
|
78
|
-
if (o || !
|
|
78
|
+
if (o || !C)
|
|
79
79
|
return;
|
|
80
|
-
const e = window.setTimeout(() =>
|
|
80
|
+
const e = window.setTimeout(() => v(!1), 280);
|
|
81
81
|
return () => window.clearTimeout(e);
|
|
82
|
-
}, [o,
|
|
82
|
+
}, [o, C]), N(() => {
|
|
83
83
|
if (!c)
|
|
84
84
|
return;
|
|
85
|
-
const e = window.setTimeout(() =>
|
|
85
|
+
const e = window.setTimeout(() => D(!1), 1500);
|
|
86
86
|
return () => window.clearTimeout(e);
|
|
87
87
|
}, [c]), !n || !S)
|
|
88
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,
|
|
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, I = (e) => e == null || typeof e == "boolean" ? "" : typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map((L) => I(L)).join("") : h.isValidElement(e) ? I(e.props.children) : "", W = async () => {
|
|
90
90
|
if (!u)
|
|
91
91
|
return;
|
|
92
|
-
const e =
|
|
92
|
+
const e = I(d);
|
|
93
93
|
if (e.trim())
|
|
94
94
|
try {
|
|
95
|
-
await navigator.clipboard.writeText(e),
|
|
95
|
+
await navigator.clipboard.writeText(e), D(!0);
|
|
96
96
|
} catch {
|
|
97
|
-
|
|
97
|
+
D(!1);
|
|
98
98
|
}
|
|
99
99
|
}, $ = () => {
|
|
100
100
|
if (o) {
|
|
101
|
-
|
|
101
|
+
g(!1);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
v(!0), window.requestAnimationFrame(() => {
|
|
105
|
+
g(!0);
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */ p("div", { className: m(t.error, j, s), children: [
|
|
109
|
+
/* @__PURE__ */ p("div", { className: t.errorHeader, children: [
|
|
110
|
+
/* @__PURE__ */ p("div", { className: t.errorHeaderContent, children: [
|
|
111
111
|
/* @__PURE__ */ r(
|
|
112
|
-
|
|
112
|
+
_,
|
|
113
113
|
{
|
|
114
114
|
iconKey: "fa-solid fa-triangle-exclamation",
|
|
115
115
|
size: "md",
|
|
@@ -126,14 +126,14 @@ function se({
|
|
|
126
126
|
"aria-label": o ? "Hide details" : "Show details",
|
|
127
127
|
title: o ? "Hide details" : "Show details",
|
|
128
128
|
onClick: $,
|
|
129
|
-
children: /* @__PURE__ */ r("span", { className:
|
|
129
|
+
children: /* @__PURE__ */ r("span", { className: m(t.detailsChevron, o && t.detailsChevronOpen), children: /* @__PURE__ */ r(_, { iconKey: "fa-light fa-chevron-down", size: "sm", colorToken: "default" }) })
|
|
130
130
|
}
|
|
131
131
|
)
|
|
132
132
|
] }),
|
|
133
|
-
u &&
|
|
133
|
+
u && C && /* @__PURE__ */ p(
|
|
134
134
|
"div",
|
|
135
135
|
{
|
|
136
|
-
className:
|
|
136
|
+
className: m(t.errorDetails, M),
|
|
137
137
|
style: {
|
|
138
138
|
...z,
|
|
139
139
|
maxHeight: o ? V : "0px",
|
|
@@ -142,7 +142,7 @@ function se({
|
|
|
142
142
|
},
|
|
143
143
|
...R,
|
|
144
144
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ p(
|
|
146
146
|
"button",
|
|
147
147
|
{
|
|
148
148
|
type: "button",
|
|
@@ -151,8 +151,8 @@ function se({
|
|
|
151
151
|
title: c ? "Copied" : "Copy details",
|
|
152
152
|
onClick: W,
|
|
153
153
|
children: [
|
|
154
|
-
/* @__PURE__ */ r("span", { className:
|
|
155
|
-
/* @__PURE__ */ r("span", { className:
|
|
154
|
+
/* @__PURE__ */ r("span", { className: m(t.copyIcon, c && t.hiddenIcon), children: /* @__PURE__ */ r(_, { iconKey: "fa-regular fa-copy", size: "sm", colorToken: "default" }) }),
|
|
155
|
+
/* @__PURE__ */ r("span", { className: m(t.checkIcon, !c && t.hiddenIcon), children: /* @__PURE__ */ r(_, { iconKey: "fa-regular fa-check", size: "sm", colorToken: "default" }) })
|
|
156
156
|
]
|
|
157
157
|
}
|
|
158
158
|
),
|
|
@@ -162,10 +162,10 @@ function se({
|
|
|
162
162
|
)
|
|
163
163
|
] });
|
|
164
164
|
}
|
|
165
|
-
const
|
|
165
|
+
const fe = Object.assign(se, {
|
|
166
166
|
Message: E,
|
|
167
167
|
Details: O
|
|
168
168
|
});
|
|
169
169
|
export {
|
|
170
|
-
|
|
170
|
+
fe as Error
|
|
171
171
|
};
|