@declarion/react 0.106.0 → 0.110.0

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.
Files changed (43) hide show
  1. package/dist-lib/api/agents.js +9 -7
  2. package/dist-lib/api/audience.js +12 -0
  3. package/dist-lib/api/auth.js +1 -1
  4. package/dist-lib/api/client.js +101 -93
  5. package/dist-lib/api/schema.js +31 -31
  6. package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
  7. package/dist-lib/components/agents/ChatAttachments.js +154 -0
  8. package/dist-lib/components/agents/transcript-runs.js +1 -1
  9. package/dist-lib/components/chrome/AssociationTabs.js +89 -75
  10. package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
  11. package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
  12. package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
  13. package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
  14. package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
  15. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
  16. package/dist-lib/components/fields/RefCombobox.js +53 -48
  17. package/dist-lib/components/fields/index.js +1 -0
  18. package/dist-lib/components/file-widgets/DocumentCard.js +1 -1
  19. package/dist-lib/components/file-widgets/FileList.js +1 -1
  20. package/dist-lib/components/file-widgets/Grid.js +1 -1
  21. package/dist-lib/components/file-widgets/upload.js +64 -61
  22. package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
  23. package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
  24. package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
  25. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
  26. package/dist-lib/components/params/ParamsBlock.js +18 -15
  27. package/dist-lib/components/params/param-editors.js +60 -54
  28. package/dist-lib/components/primitives/RetryButton.js +14 -0
  29. package/dist-lib/components/primitives/StatTile.js +42 -34
  30. package/dist-lib/hooks/useAgentConversation.js +122 -109
  31. package/dist-lib/hooks/useAuth.js +4 -1
  32. package/dist-lib/hooks/useParams.js +54 -52
  33. package/dist-lib/hooks/useSchema.js +25 -30
  34. package/dist-lib/hooks/useTimelineData.js +26 -24
  35. package/dist-lib/index.d.ts +90 -6
  36. package/dist-lib/index.js +95 -93
  37. package/dist-lib/lib/read-display-state.js +19 -0
  38. package/dist-lib/stores/auth.js +35 -34
  39. package/dist-lib/test/seed-schema.js +4 -3
  40. package/dist-lib/testing.d.ts +1 -1
  41. package/dist-lib/types/fieldType.js +1 -1
  42. package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-C4MeAgoS.d.ts} +3 -1
  43. package/package.json +1 -1
@@ -3,16 +3,17 @@ import { useSchema as t } from "../../hooks/useSchema.js";
3
3
  import { Icon as n } from "../primitives/Icons.js";
4
4
  import { Btn as r } from "../primitives/Btn.js";
5
5
  import { useText as i } from "../../hooks/useText.js";
6
- import { Spinner as a } from "../primitives/Spinner.js";
7
- import { FieldLabel as o } from "../primitives/Fields.js";
8
- import { ModalFrame as s } from "../shared/ModalFrame.js";
9
- import { ConfirmDialog as c } from "../shared/ConfirmDialog.js";
10
- import { renderField as l } from "../fields/index.js";
11
- import { refLabel as u, useRefRecords as d } from "../../hooks/useRefRecords.js";
12
- import { useState as f } from "react";
13
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
6
+ import { RetryButton as a } from "../primitives/RetryButton.js";
7
+ import { Spinner as o } from "../primitives/Spinner.js";
8
+ import { FieldLabel as s } from "../primitives/Fields.js";
9
+ import { ModalFrame as c } from "../shared/ModalFrame.js";
10
+ import { ConfirmDialog as l } from "../shared/ConfirmDialog.js";
11
+ import { renderField as u } from "../fields/index.js";
12
+ import { refLabel as d, useRefRecords as f } from "../../hooks/useRefRecords.js";
13
+ import { useState as p } from "react";
14
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
14
15
  //#region src/components/params/param-editors.tsx
15
- var g = {
16
+ var _ = {
16
17
  object: ["params.source.object", "Record"],
17
18
  user: ["params.source.user", "User"],
18
19
  role: ["params.source.role", "Role"],
@@ -21,19 +22,19 @@ var g = {
21
22
  yaml: ["params.source.yaml", "Default"],
22
23
  none: ["params.source.none", "Not set"]
23
24
  };
24
- function _(e, t) {
25
- let n = g[t];
25
+ function v(e, t) {
26
+ let n = _[t];
26
27
  return n ? e(n[0], n[1]) : t;
27
28
  }
28
- var v = n["undo-2"];
29
- function y({ param: e, description: t, onReset: n }) {
30
- let a = i(), [o, s] = f(!1);
31
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
29
+ var y = n["undo-2"];
30
+ function b({ param: e, description: t, onReset: n }) {
31
+ let a = i(), [o, s] = p(!1);
32
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(r, {
32
33
  size: "xs",
33
- icon: /* @__PURE__ */ m(v, { size: 12 }),
34
+ icon: /* @__PURE__ */ h(y, { size: 12 }),
34
35
  onClick: () => s(!0),
35
36
  children: a("params.reset", "Reset to default")
36
- }), /* @__PURE__ */ m(c, {
37
+ }), /* @__PURE__ */ h(l, {
37
38
  open: o,
38
39
  onOpenChange: s,
39
40
  title: a("params.reset_confirm.title", "Reset {name} to default?", { name: a(e.name) || e.code }),
@@ -42,8 +43,8 @@ function y({ param: e, description: t, onReset: n }) {
42
43
  onConfirm: () => n(e)
43
44
  })] });
44
45
  }
45
- function b({ text: e }) {
46
- return /* @__PURE__ */ h("div", {
46
+ function x({ text: e, onRetry: t }) {
47
+ return /* @__PURE__ */ g("div", {
47
48
  style: {
48
49
  padding: "8px 10px",
49
50
  background: "var(--danger-soft)",
@@ -51,24 +52,29 @@ function b({ text: e }) {
51
52
  fontSize: 11.5,
52
53
  color: "var(--danger)",
53
54
  display: "flex",
54
- gap: 6
55
+ gap: 6,
56
+ alignItems: "center"
55
57
  },
56
- children: [/* @__PURE__ */ m(n.info, { size: 13 }), /* @__PURE__ */ m("span", { children: e })]
58
+ children: [
59
+ /* @__PURE__ */ h(n.info, { size: 13 }),
60
+ /* @__PURE__ */ h("span", { children: e }),
61
+ t && /* @__PURE__ */ h(a, { onRetry: t })
62
+ ]
57
63
  });
58
64
  }
59
- function x(e) {
65
+ function S(e) {
60
66
  let n = i(), { data: r } = t(), a = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
61
67
  ref: e.ref,
62
68
  value: e.value
63
- }] : []), { refs: o } = d(a, void 0, r?.entities);
64
- return (e) => e.ref?.entity ? u(n, o, e.ref, e.value, r?.entities) : void 0;
69
+ }] : []), { refs: o } = f(a, void 0, r?.entities);
70
+ return (e) => e.ref?.entity ? d(n, o, e.ref, e.value, r?.entities) : void 0;
65
71
  }
66
- function S({ type: t, value: n, values: r, label: a, maxWidth: o = 180 }) {
72
+ function C({ type: t, value: n, values: r, label: a, maxWidth: o = 180 }) {
67
73
  let s = i(), c = (t) => {
68
74
  let n = r?.find((e) => e.code === t);
69
75
  return n && s(n.name) || e(t);
70
76
  }, l;
71
- return l = a === void 0 ? n == null ? "—" : r && r.length > 0 ? (Array.isArray(n) ? n.map(c).join(", ") : c(n)) || "—" : t === "bool" ? n ? s("params.value.on", "On") : s("params.value.off", "Off") : t === "multilang" || t === "multilang_text" ? s(n) || "—" : t === "multilang_array" && Array.isArray(n) ? n.map((e) => s(e)).join(", ") || "—" : t === "json" || t === "structure" ? Array.isArray(n) ? `[${n.map((t) => t && typeof t == "object" ? "{…}" : e(t)).join(", ")}]` : n && typeof n == "object" ? `{${Object.keys(n).join(", ")}}` : e(n) : e(n) : a, /* @__PURE__ */ m("span", {
77
+ return l = a === void 0 ? n == null ? "—" : r && r.length > 0 ? (Array.isArray(n) ? n.map(c).join(", ") : c(n)) || "—" : t === "bool" ? n ? s("params.value.on", "On") : s("params.value.off", "Off") : t === "multilang" || t === "multilang_text" ? s(n) || "—" : t === "multilang_array" && Array.isArray(n) ? n.map((e) => s(e)).join(", ") || "—" : t === "json" || t === "structure" ? Array.isArray(n) ? `[${n.map((t) => t && typeof t == "object" ? "{…}" : e(t)).join(", ")}]` : n && typeof n == "object" ? `{${Object.keys(n).join(", ")}}` : e(n) : e(n) : a, /* @__PURE__ */ h("span", {
72
78
  className: "mono",
73
79
  title: l,
74
80
  style: {
@@ -84,15 +90,15 @@ function S({ type: t, value: n, values: r, label: a, maxWidth: o = 180 }) {
84
90
  children: l
85
91
  });
86
92
  }
87
- function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
88
- let d = i(), [p, g] = f(() => T(e, t)), [_, v] = f(!1), [y, x] = f(null);
93
+ function w({ param: e, current: t, error: a, onCancel: l, onSave: u }) {
94
+ let d = i(), [f, m] = p(() => E(e, t)), [_, v] = p(!1), [y, b] = p(null);
89
95
  async function S() {
90
- x(null);
96
+ b(null);
91
97
  let e;
92
98
  try {
93
- e = E(d, p);
99
+ e = D(d, f);
94
100
  } catch (e) {
95
- x(String(e instanceof Error ? e.message : e));
101
+ b(String(e instanceof Error ? e.message : e));
96
102
  return;
97
103
  }
98
104
  v(!0);
@@ -102,21 +108,21 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
102
108
  v(!1);
103
109
  }
104
110
  }
105
- return /* @__PURE__ */ h(s, {
111
+ return /* @__PURE__ */ g(c, {
106
112
  label: d(e.name) || e.code,
107
113
  maxWidth: 440,
108
114
  onClose: l,
109
115
  testId: "param-edit-dialog",
110
116
  children: [
111
- /* @__PURE__ */ h("div", {
117
+ /* @__PURE__ */ g("div", {
112
118
  style: { padding: "14px 18px 0" },
113
- children: [/* @__PURE__ */ m("div", {
119
+ children: [/* @__PURE__ */ h("div", {
114
120
  style: {
115
121
  fontSize: 14,
116
122
  fontWeight: 600
117
123
  },
118
124
  children: d(e.name) || e.code
119
- }), e.description && /* @__PURE__ */ m("div", {
125
+ }), e.description && /* @__PURE__ */ h("div", {
120
126
  style: {
121
127
  fontSize: 11.5,
122
128
  color: "var(--text-3)",
@@ -125,7 +131,7 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
125
131
  children: d(e.description)
126
132
  })]
127
133
  }),
128
- /* @__PURE__ */ h("div", {
134
+ /* @__PURE__ */ g("div", {
129
135
  style: {
130
136
  padding: "12px 18px 16px",
131
137
  display: "flex",
@@ -134,16 +140,16 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
134
140
  overflowY: "auto"
135
141
  },
136
142
  children: [
137
- /* @__PURE__ */ m(o, { children: d("params.value", "Value") }),
138
- /* @__PURE__ */ m(w, {
143
+ /* @__PURE__ */ h(s, { children: d("params.value", "Value") }),
144
+ /* @__PURE__ */ h(T, {
139
145
  param: e,
140
- value: p,
141
- onChange: g
146
+ value: f,
147
+ onChange: m
142
148
  }),
143
- (y || c) && /* @__PURE__ */ m(b, { text: y || c })
149
+ (y || a) && /* @__PURE__ */ h(x, { text: y || a })
144
150
  ]
145
151
  }),
146
- /* @__PURE__ */ h("div", {
152
+ /* @__PURE__ */ g("div", {
147
153
  style: {
148
154
  padding: "10px 16px",
149
155
  borderTop: "1px solid var(--divider)",
@@ -153,14 +159,14 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
153
159
  flexShrink: 0
154
160
  },
155
161
  children: [
156
- /* @__PURE__ */ m("div", { style: { flex: 1 } }),
157
- /* @__PURE__ */ m(r, {
162
+ /* @__PURE__ */ h("div", { style: { flex: 1 } }),
163
+ /* @__PURE__ */ h(r, {
158
164
  onClick: l,
159
165
  children: d("dialog.cancel", "Cancel")
160
166
  }),
161
- /* @__PURE__ */ m(r, {
167
+ /* @__PURE__ */ h(r, {
162
168
  kind: "primary",
163
- icon: m(_ ? a : n.check, { size: 13 }),
169
+ icon: h(_ ? o : n.check, { size: 13 }),
164
170
  onClick: S,
165
171
  disabled: _,
166
172
  children: _ ? d("dialog.saving", "Saving…") : d("dialog.save", "Save")
@@ -170,14 +176,14 @@ function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
170
176
  ]
171
177
  });
172
178
  }
173
- function w({ param: e, value: t, onChange: n }) {
179
+ function T({ param: e, value: t, onChange: n }) {
174
180
  let r = i(), a = {
175
181
  type: e.type,
176
182
  structure: e.structure,
177
183
  values: e.values,
178
184
  ref: e.ref
179
185
  };
180
- return /* @__PURE__ */ m(p, { children: l({
186
+ return /* @__PURE__ */ h(m, { children: u({
181
187
  field: a,
182
188
  fieldName: e.code,
183
189
  value: t,
@@ -186,23 +192,23 @@ function w({ param: e, value: t, onChange: n }) {
186
192
  t: r
187
193
  }) });
188
194
  }
189
- function T(e, t) {
195
+ function E(e, t) {
190
196
  return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? {} : t ?? null;
191
197
  }
192
- function E(e, t) {
198
+ function D(e, t) {
193
199
  if (t == null) throw Error(e("params.value.required", "Enter a value."));
194
200
  return t;
195
201
  }
196
- var D = /* @__PURE__ */ new Set([
202
+ var O = /* @__PURE__ */ new Set([
197
203
  "server",
198
204
  "database",
199
205
  "auth",
200
206
  "sso",
201
207
  "seeder"
202
208
  ]);
203
- function O(e) {
209
+ function k(e) {
204
210
  let t = e.scopes ?? [];
205
- return t.length === 0 ? !D.has(e.category ?? "") : t.includes("tenant");
211
+ return t.length === 0 ? !O.has(e.category ?? "") : t.includes("tenant");
206
212
  }
207
213
  //#endregion
208
- export { C as EditParamDialog, b as ErrorLine, y as ResetParamControl, S as ValuePreview, _ as paramSourceName, O as paramTenantEditable, x as useParamRefLabels };
214
+ export { w as EditParamDialog, x as ErrorLine, b as ResetParamControl, C as ValuePreview, v as paramSourceName, k as paramTenantEditable, S as useParamRefLabels };
@@ -0,0 +1,14 @@
1
+ import { Btn as e } from "./Btn.js";
2
+ import { useText as t } from "../../hooks/useText.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/primitives/RetryButton.tsx
5
+ function r({ onRetry: r }) {
6
+ let i = t();
7
+ return /* @__PURE__ */ n(e, {
8
+ size: "xs",
9
+ onClick: r,
10
+ children: i("control.retry", "Retry")
11
+ });
12
+ }
13
+ //#endregion
14
+ export { r as RetryButton };
@@ -1,17 +1,18 @@
1
- import { useId as e } from "react";
2
- import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
1
+ import { RetryButton as e } from "./RetryButton.js";
2
+ import { useId as t } from "react";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
3
4
  //#region src/components/primitives/StatTile.tsx
4
- var i = {
5
+ var a = {
5
6
  neutral: "var(--text)",
6
7
  good: "var(--success)",
7
8
  warn: "var(--warn)",
8
9
  bad: "var(--danger)",
9
10
  accent: "var(--accent)"
10
11
  };
11
- function a({ label: a, value: o, unit: s, tone: c = "neutral", delta: l, note: u, footer: d, loading: f = !1, error: p, href: m }) {
12
- let h = e(), g = p != null && p !== !1, _ = /* @__PURE__ */ r("article", {
13
- "aria-labelledby": h,
14
- "aria-busy": f || void 0,
12
+ function o({ label: o, value: s, unit: c, tone: l = "neutral", delta: u, note: d, footer: f, loading: p = !1, error: m, onRetry: h, href: g }) {
13
+ let _ = t(), v = m != null && m !== !1, y = /* @__PURE__ */ i("article", {
14
+ "aria-labelledby": _,
15
+ "aria-busy": p || void 0,
15
16
  style: {
16
17
  display: "flex",
17
18
  flexDirection: "column",
@@ -23,24 +24,24 @@ function a({ label: a, value: o, unit: s, tone: c = "neutral", delta: l, note: u
23
24
  minWidth: 0
24
25
  },
25
26
  children: [
26
- /* @__PURE__ */ n("h3", {
27
- id: h,
27
+ /* @__PURE__ */ r("h3", {
28
+ id: _,
28
29
  style: {
29
30
  margin: 0,
30
31
  fontSize: 12,
31
32
  fontWeight: 500,
32
33
  color: "var(--text-3)"
33
34
  },
34
- children: a
35
+ children: o
35
36
  }),
36
- /* @__PURE__ */ n("div", {
37
+ /* @__PURE__ */ r("div", {
37
38
  style: {
38
39
  display: "flex",
39
40
  alignItems: "baseline",
40
41
  gap: 8,
41
42
  minHeight: 32
42
43
  },
43
- children: f ? /* @__PURE__ */ n("span", {
44
+ children: p ? /* @__PURE__ */ r("span", {
44
45
  "aria-hidden": !0,
45
46
  style: {
46
47
  width: 72,
@@ -48,61 +49,68 @@ function a({ label: a, value: o, unit: s, tone: c = "neutral", delta: l, note: u
48
49
  borderRadius: "var(--radius-sm)",
49
50
  background: "var(--surface-2)"
50
51
  }
51
- }) : g ? null : /* @__PURE__ */ r(t, { children: [
52
- /* @__PURE__ */ n("strong", {
52
+ }) : v ? null : /* @__PURE__ */ i(n, { children: [
53
+ /* @__PURE__ */ r("strong", {
53
54
  style: {
54
55
  fontSize: 24,
55
56
  fontWeight: 600,
56
57
  lineHeight: 1.1,
57
- color: i[c],
58
+ color: a[l],
58
59
  fontVariantNumeric: "tabular-nums"
59
60
  },
60
- children: o
61
+ children: s
61
62
  }),
62
- s !== void 0 && /* @__PURE__ */ n("span", {
63
+ c !== void 0 && /* @__PURE__ */ r("span", {
63
64
  style: {
64
65
  fontSize: 12,
65
66
  color: "var(--text-3)"
66
67
  },
67
- children: s
68
+ children: c
68
69
  }),
69
- l && /* @__PURE__ */ n("span", {
70
+ u && /* @__PURE__ */ r("span", {
70
71
  style: {
71
72
  fontSize: 12,
72
73
  fontWeight: 500,
73
- color: i[l.tone ?? "neutral"]
74
+ color: a[u.tone ?? "neutral"]
74
75
  },
75
- children: l.text
76
+ children: u.text
76
77
  })
77
78
  ] })
78
79
  }),
79
- g ? /* @__PURE__ */ n("div", {
80
- role: "alert",
80
+ v ? /* @__PURE__ */ i("div", {
81
81
  style: {
82
- fontSize: 12,
83
- color: "var(--danger)"
82
+ display: "flex",
83
+ alignItems: "center",
84
+ gap: 8
84
85
  },
85
- children: p
86
- }) : u !== void 0 && /* @__PURE__ */ n("div", {
86
+ children: [/* @__PURE__ */ r("div", {
87
+ role: "alert",
88
+ style: {
89
+ fontSize: 12,
90
+ color: "var(--danger)"
91
+ },
92
+ children: m
93
+ }), h && /* @__PURE__ */ r(e, { onRetry: h })]
94
+ }) : d !== void 0 && /* @__PURE__ */ r("div", {
87
95
  style: {
88
96
  fontSize: 12,
89
97
  color: "var(--text-3)"
90
98
  },
91
- children: u
99
+ children: d
92
100
  }),
93
- !f && !g && d
101
+ !p && !v && f
94
102
  ]
95
103
  });
96
- return m ? /* @__PURE__ */ n("a", {
97
- href: m,
104
+ return !g || v && h ? y : /* @__PURE__ */ r("a", {
105
+ href: g,
98
106
  style: {
99
107
  display: "block",
100
108
  color: "inherit",
101
109
  textDecoration: "none",
102
110
  borderRadius: "var(--radius-lg)"
103
111
  },
104
- children: _
105
- }) : _;
112
+ children: y
113
+ });
106
114
  }
107
115
  //#endregion
108
- export { a as StatTile };
116
+ export { o as StatTile };