@voltro/ui 0.28.0 → 0.30.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.
- package/CHANGELOG.md +655 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +139 -107
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,12 +2,20 @@ import { createContext as e, useContext as t, useId as n, useMemo as r, useState
|
|
|
2
2
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
3
|
import { useAgentChat as c, useConnection as l, useDataCopilot as u, useDataTable as d, useFormBinding as f, useFormSkeleton as p, useQueryField as m, useQueryFilters as h, useRecord as ee, useTableSkeleton as te, useWorkflowRunState as g } from "@voltro/client";
|
|
4
4
|
//#region src/widgets.tsx
|
|
5
|
-
var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */
|
|
5
|
+
var _ = (e) => e == null ? "" : String(e), v = ({ required: e }) => e ? /* @__PURE__ */ o("span", {
|
|
6
|
+
"aria-hidden": "true",
|
|
7
|
+
children: " *"
|
|
8
|
+
}) : null, y = (e) => /* @__PURE__ */ s("div", {
|
|
6
9
|
"data-voltro-field": !0,
|
|
7
10
|
children: [
|
|
8
11
|
/* @__PURE__ */ s("label", {
|
|
9
12
|
htmlFor: e.id,
|
|
10
|
-
children: [e.label,
|
|
13
|
+
children: [e.label, /* @__PURE__ */ o(v, { required: e.required })]
|
|
14
|
+
}),
|
|
15
|
+
e.description === void 0 ? null : /* @__PURE__ */ o("p", {
|
|
16
|
+
id: `${e.id}-desc`,
|
|
17
|
+
"data-voltro-field-hint": !0,
|
|
18
|
+
children: e.description
|
|
11
19
|
}),
|
|
12
20
|
e.children,
|
|
13
21
|
e.error === void 0 ? null : /* @__PURE__ */ o("p", {
|
|
@@ -16,12 +24,16 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
16
24
|
children: e.error
|
|
17
25
|
})
|
|
18
26
|
]
|
|
19
|
-
}),
|
|
27
|
+
}), b = (e, t, n) => {
|
|
28
|
+
let r = [t === void 0 ? "" : `${e}-desc`, n === void 0 ? "" : `${e}-error`].filter(Boolean);
|
|
29
|
+
return r.length > 0 ? r.join(" ") : void 0;
|
|
30
|
+
}, x = (e) => e ? !0 : void 0, S = (e, t) => (r) => {
|
|
20
31
|
let i = n();
|
|
21
|
-
return /* @__PURE__ */ o(
|
|
32
|
+
return /* @__PURE__ */ o(y, {
|
|
22
33
|
id: i,
|
|
23
34
|
label: r.label,
|
|
24
35
|
required: r.required,
|
|
36
|
+
description: r.description,
|
|
25
37
|
error: r.error,
|
|
26
38
|
children: /* @__PURE__ */ o("input", {
|
|
27
39
|
id: i,
|
|
@@ -31,16 +43,18 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
31
43
|
onChange: (e) => r.onChange(t(e.target.value)),
|
|
32
44
|
disabled: r.disabled,
|
|
33
45
|
required: r.required,
|
|
46
|
+
"aria-required": x(r.required),
|
|
34
47
|
"aria-invalid": r.error !== void 0,
|
|
35
|
-
"aria-describedby":
|
|
48
|
+
"aria-describedby": b(i, r.description, r.error)
|
|
36
49
|
})
|
|
37
50
|
});
|
|
38
|
-
},
|
|
51
|
+
}, ne = (e) => {
|
|
39
52
|
let t = n();
|
|
40
|
-
return /* @__PURE__ */ o(
|
|
53
|
+
return /* @__PURE__ */ o(y, {
|
|
41
54
|
id: t,
|
|
42
55
|
label: e.label,
|
|
43
56
|
required: e.required,
|
|
57
|
+
description: e.description,
|
|
44
58
|
error: e.error,
|
|
45
59
|
children: /* @__PURE__ */ o("textarea", {
|
|
46
60
|
id: t,
|
|
@@ -49,16 +63,18 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
49
63
|
onChange: (t) => e.onChange(t.target.value),
|
|
50
64
|
disabled: e.disabled,
|
|
51
65
|
required: e.required,
|
|
66
|
+
"aria-required": x(e.required),
|
|
52
67
|
"aria-invalid": e.error !== void 0,
|
|
53
|
-
"aria-describedby":
|
|
68
|
+
"aria-describedby": b(t, e.description, e.error)
|
|
54
69
|
})
|
|
55
70
|
});
|
|
56
|
-
},
|
|
71
|
+
}, C = (e) => {
|
|
57
72
|
let t = n();
|
|
58
|
-
return /* @__PURE__ */ o(
|
|
73
|
+
return /* @__PURE__ */ o(y, {
|
|
59
74
|
id: t,
|
|
60
75
|
label: e.label,
|
|
61
76
|
required: e.required,
|
|
77
|
+
description: e.description,
|
|
62
78
|
error: e.error,
|
|
63
79
|
children: /* @__PURE__ */ o("input", {
|
|
64
80
|
id: t,
|
|
@@ -67,22 +83,24 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
67
83
|
checked: e.value === !0,
|
|
68
84
|
onChange: (t) => e.onChange(t.target.checked),
|
|
69
85
|
disabled: e.disabled,
|
|
86
|
+
"aria-required": x(e.required),
|
|
70
87
|
"aria-invalid": e.error !== void 0,
|
|
71
|
-
"aria-describedby":
|
|
88
|
+
"aria-describedby": b(t, e.description, e.error)
|
|
72
89
|
})
|
|
73
90
|
});
|
|
74
|
-
},
|
|
75
|
-
text:
|
|
76
|
-
number:
|
|
77
|
-
date:
|
|
78
|
-
datetime:
|
|
79
|
-
daterange:
|
|
91
|
+
}, w = {
|
|
92
|
+
text: S("text", (e) => e),
|
|
93
|
+
number: S("number", (e) => e === "" ? void 0 : Number(e)),
|
|
94
|
+
date: S("date", (e) => e),
|
|
95
|
+
datetime: S("datetime-local", (e) => e),
|
|
96
|
+
daterange: S("text", (e) => e),
|
|
80
97
|
file: (e) => {
|
|
81
98
|
let t = n();
|
|
82
|
-
return /* @__PURE__ */ o(
|
|
99
|
+
return /* @__PURE__ */ o(y, {
|
|
83
100
|
id: t,
|
|
84
101
|
label: e.label,
|
|
85
102
|
required: e.required,
|
|
103
|
+
description: e.description,
|
|
86
104
|
error: e.error,
|
|
87
105
|
children: /* @__PURE__ */ o("input", {
|
|
88
106
|
id: t,
|
|
@@ -91,21 +109,23 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
91
109
|
onChange: (t) => e.onChange(t.target.files?.[0] ?? null),
|
|
92
110
|
disabled: e.disabled,
|
|
93
111
|
required: e.required,
|
|
112
|
+
"aria-required": x(e.required),
|
|
94
113
|
"aria-invalid": e.error !== void 0,
|
|
95
|
-
"aria-describedby":
|
|
114
|
+
"aria-describedby": b(t, e.description, e.error)
|
|
96
115
|
})
|
|
97
116
|
});
|
|
98
117
|
},
|
|
99
|
-
"async-select":
|
|
100
|
-
textarea:
|
|
101
|
-
checkbox:
|
|
102
|
-
switch:
|
|
118
|
+
"async-select": S("text", (e) => e),
|
|
119
|
+
textarea: ne,
|
|
120
|
+
checkbox: C,
|
|
121
|
+
switch: C,
|
|
103
122
|
select: (e) => {
|
|
104
123
|
let t = n();
|
|
105
|
-
return /* @__PURE__ */ o(
|
|
124
|
+
return /* @__PURE__ */ o(y, {
|
|
106
125
|
id: t,
|
|
107
126
|
label: e.label,
|
|
108
127
|
required: e.required,
|
|
128
|
+
description: e.description,
|
|
109
129
|
error: e.error,
|
|
110
130
|
children: /* @__PURE__ */ s("select", {
|
|
111
131
|
id: t,
|
|
@@ -114,8 +134,9 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
114
134
|
onChange: (t) => e.onChange(t.target.value),
|
|
115
135
|
disabled: e.disabled,
|
|
116
136
|
required: e.required,
|
|
137
|
+
"aria-required": x(e.required),
|
|
117
138
|
"aria-invalid": e.error !== void 0,
|
|
118
|
-
"aria-describedby":
|
|
139
|
+
"aria-describedby": b(t, e.description, e.error),
|
|
119
140
|
children: [/* @__PURE__ */ o("option", {
|
|
120
141
|
value: "",
|
|
121
142
|
children: "—"
|
|
@@ -131,8 +152,15 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
131
152
|
return /* @__PURE__ */ s("fieldset", {
|
|
132
153
|
"data-voltro-field": !0,
|
|
133
154
|
"aria-invalid": e.error !== void 0,
|
|
155
|
+
"aria-required": x(e.required),
|
|
156
|
+
"aria-describedby": b(t, e.description, e.error),
|
|
134
157
|
children: [
|
|
135
|
-
/* @__PURE__ */ s("legend", { children: [e.label,
|
|
158
|
+
/* @__PURE__ */ s("legend", { children: [e.label, /* @__PURE__ */ o(v, { required: e.required })] }),
|
|
159
|
+
e.description === void 0 ? null : /* @__PURE__ */ o("p", {
|
|
160
|
+
id: `${t}-desc`,
|
|
161
|
+
"data-voltro-field-hint": !0,
|
|
162
|
+
children: e.description
|
|
163
|
+
}),
|
|
136
164
|
(e.options ?? []).map((n) => {
|
|
137
165
|
let r = `${t}-${n.value}`;
|
|
138
166
|
return /* @__PURE__ */ s("span", { children: [/* @__PURE__ */ o("input", {
|
|
@@ -149,6 +177,7 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
149
177
|
})] }, n.value);
|
|
150
178
|
}),
|
|
151
179
|
e.error === void 0 ? null : /* @__PURE__ */ o("p", {
|
|
180
|
+
id: `${t}-error`,
|
|
152
181
|
role: "alert",
|
|
153
182
|
children: e.error
|
|
154
183
|
})
|
|
@@ -157,10 +186,11 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
157
186
|
},
|
|
158
187
|
"multi-select": (e) => {
|
|
159
188
|
let t = n(), r = Array.isArray(e.value) ? e.value.map(String) : [];
|
|
160
|
-
return /* @__PURE__ */ o(
|
|
189
|
+
return /* @__PURE__ */ o(y, {
|
|
161
190
|
id: t,
|
|
162
191
|
label: e.label,
|
|
163
192
|
required: e.required,
|
|
193
|
+
description: e.description,
|
|
164
194
|
error: e.error,
|
|
165
195
|
children: /* @__PURE__ */ o("select", {
|
|
166
196
|
id: t,
|
|
@@ -169,8 +199,9 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
169
199
|
value: r,
|
|
170
200
|
onChange: (t) => e.onChange(Array.from(t.target.selectedOptions, (e) => e.value)),
|
|
171
201
|
disabled: e.disabled,
|
|
202
|
+
"aria-required": x(e.required),
|
|
172
203
|
"aria-invalid": e.error !== void 0,
|
|
173
|
-
"aria-describedby":
|
|
204
|
+
"aria-describedby": b(t, e.description, e.error),
|
|
174
205
|
children: (e.options ?? []).map((e) => /* @__PURE__ */ o("option", {
|
|
175
206
|
value: e.value,
|
|
176
207
|
children: e.label
|
|
@@ -187,26 +218,26 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
187
218
|
custom: (e) => /* @__PURE__ */ s("div", {
|
|
188
219
|
"data-voltro-field": !0,
|
|
189
220
|
"data-voltro-custom": !0,
|
|
190
|
-
children: [/* @__PURE__ */ s("label", { children: [e.label,
|
|
221
|
+
children: [/* @__PURE__ */ s("label", { children: [e.label, /* @__PURE__ */ o(v, { required: e.required })] }), /* @__PURE__ */ o("p", {
|
|
191
222
|
role: "note",
|
|
192
223
|
children: `No default widget for "${e.name}" — provide a render-prop via <Field>.`
|
|
193
224
|
})]
|
|
194
225
|
})
|
|
195
|
-
},
|
|
196
|
-
let n = t(
|
|
226
|
+
}, T = e({}), E = (e) => {
|
|
227
|
+
let n = t(T), i = r(() => ({
|
|
197
228
|
...n,
|
|
198
229
|
...e.widgets
|
|
199
230
|
}), [n, e.widgets]);
|
|
200
|
-
return /* @__PURE__ */ o(
|
|
231
|
+
return /* @__PURE__ */ o(T.Provider, {
|
|
201
232
|
value: i,
|
|
202
233
|
children: e.children
|
|
203
234
|
});
|
|
204
|
-
},
|
|
205
|
-
let e = t(
|
|
235
|
+
}, D = (e) => t(T)[e] ?? w[e] ?? w.custom, O = e(null), re = () => {
|
|
236
|
+
let e = t(O);
|
|
206
237
|
if (e === null) throw Error("<Field> must be rendered inside <AutoForm>");
|
|
207
238
|
return e;
|
|
208
|
-
},
|
|
209
|
-
let n = e.errors[t.name];
|
|
239
|
+
}, ie = (e, t) => {
|
|
240
|
+
let n = e.errors[t.name], r = t.jsonSchema.description;
|
|
210
241
|
return {
|
|
211
242
|
name: t.name,
|
|
212
243
|
label: t.label,
|
|
@@ -215,20 +246,21 @@ var _ = (e) => e == null ? "" : String(e), v = (e) => /* @__PURE__ */ s("div", {
|
|
|
215
246
|
required: t.required,
|
|
216
247
|
disabled: e.pending,
|
|
217
248
|
...n === void 0 ? {} : { error: n },
|
|
218
|
-
...t.options ? { options: t.options } : {}
|
|
249
|
+
...t.options ? { options: t.options } : {},
|
|
250
|
+
...typeof r == "string" && r.length > 0 ? { description: r } : {}
|
|
219
251
|
};
|
|
220
|
-
},
|
|
221
|
-
let n =
|
|
252
|
+
}, k = ({ name: e, children: t }) => {
|
|
253
|
+
let n = re(), r = n.fields.find((t) => t.name === e), i = D(r?.widget ?? "custom");
|
|
222
254
|
if (r === void 0) return null;
|
|
223
|
-
let a =
|
|
255
|
+
let a = ie(n, r);
|
|
224
256
|
return t ? t(a) : /* @__PURE__ */ o(i, { ...a });
|
|
225
257
|
};
|
|
226
|
-
function
|
|
258
|
+
function A(e) {
|
|
227
259
|
let t = f(e.api, e.mutation, {
|
|
228
260
|
...e.schema ? { schema: e.schema } : {},
|
|
229
261
|
...e.defaults ? { defaults: e.defaults } : {}
|
|
230
262
|
});
|
|
231
|
-
return /* @__PURE__ */ o(
|
|
263
|
+
return /* @__PURE__ */ o(O.Provider, {
|
|
232
264
|
value: t,
|
|
233
265
|
children: /* @__PURE__ */ s("form", {
|
|
234
266
|
onSubmit: (n) => {
|
|
@@ -238,7 +270,7 @@ function j(e) {
|
|
|
238
270
|
},
|
|
239
271
|
noValidate: !0,
|
|
240
272
|
"data-voltro-autoform": e.mutation,
|
|
241
|
-
children: [e.children ? e.children(t) : t.fields.map((e) => /* @__PURE__ */ o(
|
|
273
|
+
children: [e.children ? e.children(t) : t.fields.map((e) => /* @__PURE__ */ o(k, { name: e.name }, e.name)), /* @__PURE__ */ o("button", {
|
|
242
274
|
type: "submit",
|
|
243
275
|
disabled: t.pending,
|
|
244
276
|
children: e.submitLabel ?? "Submit"
|
|
@@ -248,7 +280,7 @@ function j(e) {
|
|
|
248
280
|
}
|
|
249
281
|
//#endregion
|
|
250
282
|
//#region src/strings.tsx
|
|
251
|
-
var
|
|
283
|
+
var j = {
|
|
252
284
|
filters: {
|
|
253
285
|
clear: "Clear",
|
|
254
286
|
filtersLabel: "Filters",
|
|
@@ -308,7 +340,7 @@ var M = {
|
|
|
308
340
|
howToGetToken: "How do I get a token?",
|
|
309
341
|
loading: "Loading…"
|
|
310
342
|
}
|
|
311
|
-
},
|
|
343
|
+
}, M = e(j), N = (e, t) => ({
|
|
312
344
|
filters: {
|
|
313
345
|
...e.filters,
|
|
314
346
|
...t.filters
|
|
@@ -350,21 +382,21 @@ var M = {
|
|
|
350
382
|
...t.connectAccount
|
|
351
383
|
}
|
|
352
384
|
});
|
|
353
|
-
function
|
|
354
|
-
let n = t(
|
|
355
|
-
return /* @__PURE__ */ o(
|
|
385
|
+
function P(e) {
|
|
386
|
+
let n = t(M), i = r(() => N(n, e.strings), [n, e.strings]);
|
|
387
|
+
return /* @__PURE__ */ o(M.Provider, {
|
|
356
388
|
value: i,
|
|
357
389
|
children: e.children
|
|
358
390
|
});
|
|
359
391
|
}
|
|
360
|
-
var
|
|
392
|
+
var F = () => t(M), ae = (e) => {
|
|
361
393
|
let t = m(e.api, e.source, {
|
|
362
394
|
skipUntilTerm: !0,
|
|
363
395
|
...e.labelField === void 0 ? {} : { labelField: e.labelField },
|
|
364
396
|
...e.valueField === void 0 ? {} : { valueField: e.valueField },
|
|
365
397
|
...e.input === void 0 ? {} : { input: e.input },
|
|
366
398
|
...e.debounceMs === void 0 ? {} : { debounceMs: e.debounceMs }
|
|
367
|
-
}), r =
|
|
399
|
+
}), r = F().asyncSelect, i = n(), a = e.value === void 0 || e.value === null ? "" : String(e.value), c = a !== "" && t.options.some((e) => e.value === a), l = `${i}-error`;
|
|
368
400
|
return /* @__PURE__ */ s("div", {
|
|
369
401
|
"data-voltro-field": !0,
|
|
370
402
|
"data-voltro-async-select": !0,
|
|
@@ -412,9 +444,9 @@ var P = () => t(N), ie = (e) => {
|
|
|
412
444
|
})
|
|
413
445
|
]
|
|
414
446
|
});
|
|
415
|
-
},
|
|
416
|
-
function
|
|
417
|
-
let { api: t, query: n, emptyText: r, loadingText: i, loadMoreText: c, renderCell: l, rowActions: u, rowKey: f, ...p } = e, m =
|
|
447
|
+
}, oe = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e), se = (e, t) => e ? t === "asc" ? "ascending" : "descending" : "none";
|
|
448
|
+
function ce(e) {
|
|
449
|
+
let { api: t, query: n, emptyText: r, loadingText: i, loadMoreText: c, renderCell: l, rowActions: u, rowKey: f, ...p } = e, m = F().dataTable, h = d(t, n, p);
|
|
418
450
|
return h.loading ? /* @__PURE__ */ o("p", {
|
|
419
451
|
"data-voltro-datatable-loading": !0,
|
|
420
452
|
"aria-busy": "true",
|
|
@@ -427,7 +459,7 @@ function se(e) {
|
|
|
427
459
|
children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [h.columns.map((e) => {
|
|
428
460
|
let t = h.sort?.column === e.name, n = h.sort?.direction ?? "asc";
|
|
429
461
|
return /* @__PURE__ */ o("th", {
|
|
430
|
-
"aria-sort":
|
|
462
|
+
"aria-sort": se(t, n),
|
|
431
463
|
scope: "col",
|
|
432
464
|
children: /* @__PURE__ */ s("button", {
|
|
433
465
|
type: "button",
|
|
@@ -440,7 +472,7 @@ function se(e) {
|
|
|
440
472
|
children: m.actions
|
|
441
473
|
}) : null] }) }), /* @__PURE__ */ o("tbody", { children: h.rows.map((e, t) => /* @__PURE__ */ s("tr", { children: [h.columns.map((t) => /* @__PURE__ */ o("td", {
|
|
442
474
|
"data-column": t.name,
|
|
443
|
-
children: l ? l(e, t) :
|
|
475
|
+
children: l ? l(e, t) : oe(e[t.name])
|
|
444
476
|
}, t.name)), u ? /* @__PURE__ */ o("td", { children: u(e) }) : null] }, f ? f(e) : String(e.id ?? t))) })]
|
|
445
477
|
}), h.hasMore ? /* @__PURE__ */ o("button", {
|
|
446
478
|
type: "button",
|
|
@@ -451,9 +483,9 @@ function se(e) {
|
|
|
451
483
|
}
|
|
452
484
|
//#endregion
|
|
453
485
|
//#region src/workflow.tsx
|
|
454
|
-
var
|
|
455
|
-
function
|
|
456
|
-
let { api: t, runId: n, loadingText: r, emptyText: i } = e, a =
|
|
486
|
+
var le = (e) => e === "succeeded" ? "✓" : e === "failed" ? "✗" : "…";
|
|
487
|
+
function ue(e) {
|
|
488
|
+
let { api: t, runId: n, loadingText: r, emptyText: i } = e, a = F().workflow, c = g(t, n);
|
|
457
489
|
return c.loading ? /* @__PURE__ */ o("p", {
|
|
458
490
|
"data-voltro-workflow-loading": !0,
|
|
459
491
|
"aria-busy": "true",
|
|
@@ -473,7 +505,7 @@ function le(e) {
|
|
|
473
505
|
children: [
|
|
474
506
|
/* @__PURE__ */ o("span", {
|
|
475
507
|
"aria-hidden": "true",
|
|
476
|
-
children:
|
|
508
|
+
children: le(e.status)
|
|
477
509
|
}),
|
|
478
510
|
" ",
|
|
479
511
|
e.stepName,
|
|
@@ -498,8 +530,8 @@ function le(e) {
|
|
|
498
530
|
})
|
|
499
531
|
});
|
|
500
532
|
}
|
|
501
|
-
function
|
|
502
|
-
let { api: t, runId: n } = e, r =
|
|
533
|
+
function de(e) {
|
|
534
|
+
let { api: t, runId: n } = e, r = F().workflow, i = g(t, n);
|
|
503
535
|
if (i.loading || i.status === void 0) return /* @__PURE__ */ o("span", {
|
|
504
536
|
"data-voltro-workflow-badge": !0,
|
|
505
537
|
"data-status": "loading",
|
|
@@ -516,7 +548,7 @@ function ue(e) {
|
|
|
516
548
|
}) : null]
|
|
517
549
|
});
|
|
518
550
|
}
|
|
519
|
-
function
|
|
551
|
+
function fe(e) {
|
|
520
552
|
let { when: t, onApprove: n, onReject: r, approveLabel: i, rejectLabel: a, pending: c } = e;
|
|
521
553
|
return t ? /* @__PURE__ */ s("div", {
|
|
522
554
|
"data-voltro-approval-controls": !0,
|
|
@@ -539,15 +571,15 @@ function de(e) {
|
|
|
539
571
|
}
|
|
540
572
|
//#endregion
|
|
541
573
|
//#region src/presence.tsx
|
|
542
|
-
var
|
|
574
|
+
var I = (e, t) => {
|
|
543
575
|
let n = e.meta?.[t];
|
|
544
576
|
return typeof n == "string" ? n : void 0;
|
|
545
|
-
},
|
|
577
|
+
}, L = (e) => I(e, "name") ?? I(e, "displayName") ?? e.key, R = (e) => {
|
|
546
578
|
let t = e.trim().split(/\s+/).filter(Boolean);
|
|
547
579
|
return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
|
|
548
580
|
};
|
|
549
|
-
function
|
|
550
|
-
let { members: t, max: n = 5, nameOf: r =
|
|
581
|
+
function z(e) {
|
|
582
|
+
let { members: t, max: n = 5, nameOf: r = L, renderAvatar: i } = e, a = F().presence, c = t.slice(0, n), l = t.length - c.length;
|
|
551
583
|
return /* @__PURE__ */ s("div", {
|
|
552
584
|
"data-voltro-presence-avatars": !0,
|
|
553
585
|
role: "group",
|
|
@@ -558,7 +590,7 @@ function R(e) {
|
|
|
558
590
|
"data-avatar": !0,
|
|
559
591
|
title: t,
|
|
560
592
|
"aria-label": t,
|
|
561
|
-
children:
|
|
593
|
+
children: R(t)
|
|
562
594
|
}, e.key);
|
|
563
595
|
}), l > 0 ? /* @__PURE__ */ s("span", {
|
|
564
596
|
"data-avatar-overflow": !0,
|
|
@@ -567,21 +599,21 @@ function R(e) {
|
|
|
567
599
|
}) : null]
|
|
568
600
|
});
|
|
569
601
|
}
|
|
570
|
-
var
|
|
571
|
-
function
|
|
572
|
-
let { members: t, selfKey: n, field: r, verb: i = "editing", nameOf: a =
|
|
602
|
+
var B = (e, t, n = j.presence) => e.length === 0 ? "" : e.length === 1 ? n.editingOne(e[0], t) : e.length === 2 ? n.editingTwo(e[0], e[1], t) : n.editingMany(e[0], e.length - 1, t);
|
|
603
|
+
function V(e) {
|
|
604
|
+
let { members: t, selfKey: n, field: r, verb: i = "editing", nameOf: a = L } = e, s = F().presence, c = t.filter((e) => !(n !== void 0 && e.key === n || r !== void 0 && I(e, "field") !== r));
|
|
573
605
|
return c.length === 0 ? null : /* @__PURE__ */ o("span", {
|
|
574
606
|
"data-voltro-editing-indicator": !0,
|
|
575
607
|
"data-field": r,
|
|
576
608
|
role: "status",
|
|
577
|
-
children:
|
|
609
|
+
children: B(c.map(a), i, s)
|
|
578
610
|
});
|
|
579
611
|
}
|
|
580
612
|
//#endregion
|
|
581
613
|
//#region src/agentChat.tsx
|
|
582
|
-
var
|
|
583
|
-
function
|
|
584
|
-
let t =
|
|
614
|
+
var H = (e) => typeof e.text == "string" ? e.text : "";
|
|
615
|
+
function pe({ text: e }) {
|
|
616
|
+
let t = F().agentChat;
|
|
585
617
|
return /* @__PURE__ */ s("details", {
|
|
586
618
|
"data-part": "reasoning",
|
|
587
619
|
children: [/* @__PURE__ */ o("summary", { children: t.reasoning }), /* @__PURE__ */ o("span", { children: e })]
|
|
@@ -591,9 +623,9 @@ function U({ part: e }) {
|
|
|
591
623
|
switch (e.type) {
|
|
592
624
|
case "text": return /* @__PURE__ */ o("span", {
|
|
593
625
|
"data-part": "text",
|
|
594
|
-
children:
|
|
626
|
+
children: H(e)
|
|
595
627
|
});
|
|
596
|
-
case "reasoning": return /* @__PURE__ */ o(
|
|
628
|
+
case "reasoning": return /* @__PURE__ */ o(pe, { text: H(e) });
|
|
597
629
|
case "tool": {
|
|
598
630
|
let t = e;
|
|
599
631
|
return /* @__PURE__ */ s("span", {
|
|
@@ -651,7 +683,7 @@ function W({ message: e }) {
|
|
|
651
683
|
});
|
|
652
684
|
}
|
|
653
685
|
function G(e) {
|
|
654
|
-
let { api: t, agent: n, threadId: r, placeholder: a, sendLabel: l, emptyText: u } = e, d =
|
|
686
|
+
let { api: t, agent: n, threadId: r, placeholder: a, sendLabel: l, emptyText: u } = e, d = F().agentChat, f = c(t, n, { threadId: r }), [p, m] = i(""), h = () => {
|
|
655
687
|
let e = p.trim();
|
|
656
688
|
e.length === 0 || f.sending || (m(""), f.send(e));
|
|
657
689
|
};
|
|
@@ -685,14 +717,14 @@ function G(e) {
|
|
|
685
717
|
})]
|
|
686
718
|
});
|
|
687
719
|
}
|
|
688
|
-
function
|
|
720
|
+
function me(e) {
|
|
689
721
|
let t = c(e.api, e.agent, { threadId: e.threadId });
|
|
690
722
|
return e.children(t);
|
|
691
723
|
}
|
|
692
724
|
//#endregion
|
|
693
725
|
//#region src/appAgent.tsx
|
|
694
|
-
function
|
|
695
|
-
let { tools: t, showTools: n, ...r } = e, i =
|
|
726
|
+
function he(e) {
|
|
727
|
+
let { tools: t, showTools: n, ...r } = e, i = F().appAgent, a = (n ?? (t !== void 0 && t.length > 0)) && t && t.length > 0;
|
|
696
728
|
return /* @__PURE__ */ s("div", {
|
|
697
729
|
"data-voltro-app-agent": r.agent,
|
|
698
730
|
children: [a ? /* @__PURE__ */ s("details", {
|
|
@@ -717,12 +749,12 @@ function pe(e) {
|
|
|
717
749
|
}
|
|
718
750
|
//#endregion
|
|
719
751
|
//#region src/dataCopilot.tsx
|
|
720
|
-
var
|
|
752
|
+
var ge = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : typeof e == "object" ? JSON.stringify(e) : String(e), K = (e) => {
|
|
721
753
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
722
754
|
for (let r of e) for (let e of Object.keys(r)) t.has(e) || (t.add(e), n.push(e));
|
|
723
755
|
return n;
|
|
724
756
|
};
|
|
725
|
-
function
|
|
757
|
+
function q(e) {
|
|
726
758
|
let { answer: t, emptyText: n } = e;
|
|
727
759
|
if (t === void 0) return null;
|
|
728
760
|
if (!t.ok) return /* @__PURE__ */ o("p", {
|
|
@@ -734,7 +766,7 @@ function K(e) {
|
|
|
734
766
|
"data-voltro-data-copilot-empty": !0,
|
|
735
767
|
children: n ?? "No rows."
|
|
736
768
|
});
|
|
737
|
-
let r =
|
|
769
|
+
let r = K(t.rows);
|
|
738
770
|
return /* @__PURE__ */ s("table", {
|
|
739
771
|
"data-voltro-data-copilot-results": !0,
|
|
740
772
|
children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
|
|
@@ -742,11 +774,11 @@ function K(e) {
|
|
|
742
774
|
children: e
|
|
743
775
|
}, e)) }) }), /* @__PURE__ */ o("tbody", { children: t.rows.map((e, t) => /* @__PURE__ */ o("tr", { children: r.map((t) => /* @__PURE__ */ o("td", {
|
|
744
776
|
"data-column": t,
|
|
745
|
-
children:
|
|
777
|
+
children: ge(e[t])
|
|
746
778
|
}, t)) }, String(e.id ?? t))) })]
|
|
747
779
|
});
|
|
748
780
|
}
|
|
749
|
-
function
|
|
781
|
+
function _e(e) {
|
|
750
782
|
let { api: t, action: n, placeholder: r, askLabel: a, emptyText: c } = e, l = u(t, n), [d, f] = i(""), p = () => {
|
|
751
783
|
let e = d.trim();
|
|
752
784
|
e.length === 0 || l.pending || l.ask(e);
|
|
@@ -773,7 +805,7 @@ function ge(e) {
|
|
|
773
805
|
"data-answer": !0,
|
|
774
806
|
"aria-live": "polite",
|
|
775
807
|
"aria-busy": l.pending ? "true" : void 0,
|
|
776
|
-
children: l.error === void 0 ? /* @__PURE__ */ o(
|
|
808
|
+
children: l.error === void 0 ? /* @__PURE__ */ o(q, {
|
|
777
809
|
answer: l.answer,
|
|
778
810
|
...c === void 0 ? {} : { emptyText: c }
|
|
779
811
|
}) : /* @__PURE__ */ o("p", {
|
|
@@ -784,13 +816,13 @@ function ge(e) {
|
|
|
784
816
|
})]
|
|
785
817
|
});
|
|
786
818
|
}
|
|
787
|
-
function
|
|
819
|
+
function ve(e) {
|
|
788
820
|
let t = u(e.api, e.action);
|
|
789
821
|
return e.children(t);
|
|
790
822
|
}
|
|
791
823
|
//#endregion
|
|
792
824
|
//#region src/skeleton.tsx
|
|
793
|
-
var
|
|
825
|
+
var J = ({ w: e }) => /* @__PURE__ */ o("span", {
|
|
794
826
|
"data-skeleton-bar": !0,
|
|
795
827
|
style: {
|
|
796
828
|
display: "inline-block",
|
|
@@ -800,7 +832,7 @@ var q = ({ w: e }) => /* @__PURE__ */ o("span", {
|
|
|
800
832
|
},
|
|
801
833
|
"aria-hidden": "true"
|
|
802
834
|
});
|
|
803
|
-
function
|
|
835
|
+
function ye(e) {
|
|
804
836
|
let t = p(e.api, e.mutation), n = t.length > 0 ? t.length : e.fallbackFields ?? 3, r = t.length > 0 ? t.map((e) => e.name) : Array.from({ length: n }, (e, t) => `f${t}`);
|
|
805
837
|
return /* @__PURE__ */ o("div", {
|
|
806
838
|
"data-voltro-form-skeleton": e.mutation,
|
|
@@ -808,11 +840,11 @@ function ve(e) {
|
|
|
808
840
|
"aria-hidden": "true",
|
|
809
841
|
children: r.map((e) => /* @__PURE__ */ s("div", {
|
|
810
842
|
"data-skeleton-field": !0,
|
|
811
|
-
children: [/* @__PURE__ */ o(
|
|
843
|
+
children: [/* @__PURE__ */ o(J, { w: "30%" }), /* @__PURE__ */ o(J, {})]
|
|
812
844
|
}, e))
|
|
813
845
|
});
|
|
814
846
|
}
|
|
815
|
-
function
|
|
847
|
+
function be(e) {
|
|
816
848
|
let t = te(e.api, e.query), n = t.length > 0 ? t.length : e.fallbackColumns ?? 4, r = t.length > 0 ? t.map((e) => e.name) : Array.from({ length: n }, (e, t) => `c${t}`), i = e.rows ?? 5;
|
|
817
849
|
return /* @__PURE__ */ s("table", {
|
|
818
850
|
"data-voltro-table-skeleton": e.query,
|
|
@@ -820,18 +852,18 @@ function J(e) {
|
|
|
820
852
|
"aria-hidden": "true",
|
|
821
853
|
children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
|
|
822
854
|
scope: "col",
|
|
823
|
-
children: /* @__PURE__ */ o(
|
|
855
|
+
children: /* @__PURE__ */ o(J, { w: "60%" })
|
|
824
856
|
}, e)) }) }), /* @__PURE__ */ o("tbody", { children: Array.from({ length: i }, (e, t) => /* @__PURE__ */ o("tr", {
|
|
825
857
|
"data-skeleton-row": !0,
|
|
826
|
-
children: r.map((e) => /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(
|
|
858
|
+
children: r.map((e) => /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(J, {}) }, e))
|
|
827
859
|
}, t)) })]
|
|
828
860
|
});
|
|
829
861
|
}
|
|
830
862
|
//#endregion
|
|
831
863
|
//#region src/filters.tsx
|
|
832
864
|
var Y = (e) => e == null ? "" : String(e);
|
|
833
|
-
function
|
|
834
|
-
let { filter: t, value: n, onChange: r } = e, i =
|
|
865
|
+
function xe(e) {
|
|
866
|
+
let { filter: t, value: n, onChange: r } = e, i = F().filters, a = {
|
|
835
867
|
"data-filter": t.name,
|
|
836
868
|
"aria-label": t.label
|
|
837
869
|
};
|
|
@@ -897,8 +929,8 @@ function ye(e) {
|
|
|
897
929
|
});
|
|
898
930
|
}
|
|
899
931
|
}
|
|
900
|
-
function
|
|
901
|
-
let t = h(e.api, e.query, e.initial ? { initial: e.initial } : {}), n =
|
|
932
|
+
function Se(e) {
|
|
933
|
+
let t = h(e.api, e.query, e.initial ? { initial: e.initial } : {}), n = F().filters;
|
|
902
934
|
return /* @__PURE__ */ s("div", {
|
|
903
935
|
"data-voltro-query-filters": e.query,
|
|
904
936
|
children: [/* @__PURE__ */ s("div", {
|
|
@@ -908,7 +940,7 @@ function be(e) {
|
|
|
908
940
|
children: [
|
|
909
941
|
t.filters.map((e) => /* @__PURE__ */ s("label", {
|
|
910
942
|
"data-filter-label": !0,
|
|
911
|
-
children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o(
|
|
943
|
+
children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o(xe, {
|
|
912
944
|
filter: e,
|
|
913
945
|
value: t.values[e.name],
|
|
914
946
|
onChange: (n) => t.setFilter(e.name, n)
|
|
@@ -931,8 +963,8 @@ function be(e) {
|
|
|
931
963
|
//#endregion
|
|
932
964
|
//#region src/recordView.tsx
|
|
933
965
|
var X = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), Z = (e) => Array.isArray(e) && e.every((e) => typeof e == "object" && !!e), Q = (e) => e == null ? "—" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e);
|
|
934
|
-
function
|
|
935
|
-
let n =
|
|
966
|
+
function Ce({ name: e, items: t }) {
|
|
967
|
+
let n = F().recordView;
|
|
936
968
|
if (t.length === 0) return /* @__PURE__ */ o("p", {
|
|
937
969
|
"data-relation": e,
|
|
938
970
|
"data-empty": !0,
|
|
@@ -947,7 +979,7 @@ function xe({ name: e, items: t }) {
|
|
|
947
979
|
}, e)) }) }), /* @__PURE__ */ o("tbody", { children: t.map((e, t) => /* @__PURE__ */ o("tr", { children: r.map((t) => /* @__PURE__ */ o("td", { children: Q(e[t]) }, t)) }, String(e.id ?? t))) })]
|
|
948
980
|
});
|
|
949
981
|
}
|
|
950
|
-
function
|
|
982
|
+
function we(e) {
|
|
951
983
|
let { api: t, query: n, input: r, fields: i, renderField: a, renderRelation: c, loadingText: l, emptyText: u } = e, { record: d, loading: f } = ee(t, n, r ?? {});
|
|
952
984
|
if (f) return /* @__PURE__ */ o("p", {
|
|
953
985
|
"data-voltro-record-loading": !0,
|
|
@@ -969,7 +1001,7 @@ function Se(e) {
|
|
|
969
1001
|
}, e))
|
|
970
1002
|
}), h.map(([e, t]) => /* @__PURE__ */ s("section", {
|
|
971
1003
|
"data-record-relation": e,
|
|
972
|
-
children: [/* @__PURE__ */ o("h3", { children: X(e) }), c ? c(e, t, d) : /* @__PURE__ */ o(
|
|
1004
|
+
children: [/* @__PURE__ */ o("h3", { children: X(e) }), c ? c(e, t, d) : /* @__PURE__ */ o(Ce, {
|
|
973
1005
|
name: e,
|
|
974
1006
|
items: t
|
|
975
1007
|
})]
|
|
@@ -978,7 +1010,7 @@ function Se(e) {
|
|
|
978
1010
|
}
|
|
979
1011
|
//#endregion
|
|
980
1012
|
//#region src/connectAccount.tsx
|
|
981
|
-
var
|
|
1013
|
+
var Te = (e, t) => {
|
|
982
1014
|
switch (e.status) {
|
|
983
1015
|
case "connected": return e.accountLabel === null ? t.connected : t.connectedAs(e.accountLabel);
|
|
984
1016
|
case "expired": return t.expired;
|
|
@@ -986,7 +1018,7 @@ var Ce = (e, t) => {
|
|
|
986
1018
|
case "error": return t.errored;
|
|
987
1019
|
default: return t.notConnected;
|
|
988
1020
|
}
|
|
989
|
-
},
|
|
1021
|
+
}, Ee = ({ api: e, connectionId: t, ...n }) => {
|
|
990
1022
|
let r = l(e, t);
|
|
991
1023
|
return /* @__PURE__ */ o($, {
|
|
992
1024
|
connection: r,
|
|
@@ -994,7 +1026,7 @@ var Ce = (e, t) => {
|
|
|
994
1026
|
...n
|
|
995
1027
|
});
|
|
996
1028
|
}, $ = ({ connection: e, instructionsUrl: t, loading: n = !1, children: r, className: c }) => {
|
|
997
|
-
let l =
|
|
1029
|
+
let l = F().connectAccount, [u, d] = i("");
|
|
998
1030
|
if (r !== void 0) return r(e);
|
|
999
1031
|
if (n) return /* @__PURE__ */ o("div", {
|
|
1000
1032
|
className: c,
|
|
@@ -1013,7 +1045,7 @@ var Ce = (e, t) => {
|
|
|
1013
1045
|
" — ",
|
|
1014
1046
|
/* @__PURE__ */ o("span", {
|
|
1015
1047
|
role: e.needsAttention ? "alert" : void 0,
|
|
1016
|
-
children:
|
|
1048
|
+
children: Te(e, l)
|
|
1017
1049
|
})
|
|
1018
1050
|
] }), e.connected || e.needsAttention ? /* @__PURE__ */ s(a, { children: [e.needsAttention && e.kind === "oauth2" && /* @__PURE__ */ o("button", {
|
|
1019
1051
|
type: "button",
|
|
@@ -1071,4 +1103,4 @@ var Ce = (e, t) => {
|
|
|
1071
1103
|
});
|
|
1072
1104
|
};
|
|
1073
1105
|
//#endregion
|
|
1074
|
-
export { G as AgentChat, W as AgentMessageView, U as AgentPartView,
|
|
1106
|
+
export { G as AgentChat, W as AgentMessageView, U as AgentPartView, me as AgentStream, he as AppAgent, fe as ApprovalControls, ae as AsyncSelect, A as AutoForm, $ as ConnectAccount, Ee as ConnectAccountFor, _e as DataCopilot, q as DataCopilotAnswer, ve as DataCopilotStream, ce as DataTable, V as EditingIndicator, k as Field, ye as FormSkeleton, z as PresenceAvatars, Se as QueryFilters, we as RecordView, be as TableSkeleton, P as UiStringsProvider, E as WidgetRegistryProvider, ue as WorkflowProgress, de as WorkflowStatusBadge, j as defaultUiStrings, w as defaultWidgets, R as initials, B as summarizeEditors, F as useUiStrings, D as useWidget };
|