@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.
@@ -1 +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)}
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 { 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";
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 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
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 x({ children: n }) {
24
- return /* @__PURE__ */ r(b, { children: n });
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 S({ children: n }) {
27
- return /* @__PURE__ */ r(b, { children: n });
47
+ function O({ children: n, hide: s, ...i }) {
48
+ return s ? null : /* @__PURE__ */ r("div", { ...i, children: n });
28
49
  }
29
- function N(n) {
30
- return p.isValidElement(n) && n.type === x;
50
+ function A(n) {
51
+ return m.isValidElement(n) && n.type === E;
31
52
  }
32
- function E(n) {
33
- return p.isValidElement(n) && n.type === S;
53
+ function B(n) {
54
+ return m.isValidElement(n) && n.type === O;
34
55
  }
35
- function te({
56
+ function se({
36
57
  isVisible: n = !0,
37
- className: H,
38
- children: T,
39
- hideDetails: I = !1,
40
- detailsMaxHeight: _ = 300,
41
- variant: d = "error"
58
+ className: s,
59
+ children: i,
60
+ hideDetails: g = !1,
61
+ detailsMaxHeight: l = 300,
62
+ variant: a = "error"
42
63
  }) {
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)
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(() => y(!1), 280);
80
+ const e = window.setTimeout(() => C(!1), 280);
60
81
  return () => window.clearTimeout(e);
61
- }, [o, g]), D(() => {
62
- if (!a)
82
+ }, [o, y]), N(() => {
83
+ if (!c)
63
84
  return;
64
- const e = window.setTimeout(() => k(!1), 1500);
85
+ const e = window.setTimeout(() => v(!1), 1500);
65
86
  return () => window.clearTimeout(e);
66
- }, [a]), !n || !s.message)
87
+ }, [c]), !n || !S)
67
88
  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)
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 = C(s.details);
92
+ const e = T(d);
72
93
  if (e.trim())
73
94
  try {
74
- await navigator.clipboard.writeText(e), k(!0);
95
+ await navigator.clipboard.writeText(e), v(!0);
75
96
  } catch {
76
- k(!1);
97
+ v(!1);
77
98
  }
78
- }, z = () => {
99
+ }, $ = () => {
79
100
  if (o) {
80
- h(!1);
101
+ w(!1);
81
102
  return;
82
103
  }
83
- y(!0), window.requestAnimationFrame(() => {
84
- h(!0);
104
+ C(!0), window.requestAnimationFrame(() => {
105
+ w(!0);
85
106
  });
86
107
  };
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: [
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
- m,
112
+ p,
92
113
  {
93
114
  iconKey: "fa-solid fa-triangle-exclamation",
94
115
  size: "md",
95
- colorToken: B
116
+ colorToken: K
96
117
  }
97
118
  ),
98
- typeof s.message == "string" || typeof s.message == "number" ? /* @__PURE__ */ r(K, { size: "md", children: s.message }) : s.message
119
+ S
99
120
  ] }),
100
- i && /* @__PURE__ */ r(
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: 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" }) })
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
- i && g && /* @__PURE__ */ c(
133
+ u && y && /* @__PURE__ */ h(
113
134
  "div",
114
135
  {
115
- className: t.errorDetails,
136
+ className: f(t.errorDetails, M),
116
137
  style: {
117
- maxHeight: o ? M : "0px",
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__ */ c(
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: a ? "Copied" : "Copy details",
129
- onClick: O,
151
+ title: c ? "Copied" : "Copy details",
152
+ onClick: W,
130
153
  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" }) })
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: s.details })
159
+ /* @__PURE__ */ r("div", { className: t.errorDetailsContent, children: d })
137
160
  ]
138
161
  }
139
162
  )
140
163
  ] });
141
164
  }
142
- const ce = Object.assign(te, {
143
- Message: x,
144
- Details: S
165
+ const _e = Object.assign(se, {
166
+ Message: E,
167
+ Details: O
145
168
  });
146
169
  export {
147
- ce as Error
170
+ _e as Error
148
171
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.157",
4
+ "version": "0.0.158",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",