@voltro/ui 0.51.0 → 0.53.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/dist/index.js CHANGED
@@ -1,16 +1,17 @@
1
1
  import { createContext as e, useContext as t, useId as n, useMemo as r, useState as i } from "react";
2
2
  import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
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 g, useWorkflowRunState as _ } from "@voltro/client";
3
+ import { FORM_KEY_FIELD as c, FORM_REDIRECT_FIELD as l, formActionPath as u, formSections as d, useAgentChat as f, useConnection as p, useDataCopilot as m, useDataTable as h, useFormBinding as g, useFormFlash as ee, useFormSkeleton as te, useQueryField as ne, useQueryFilters as re, useRecord as _, useTableSkeleton as ie, useWorkflowRunState as v } from "@voltro/client";
4
+ import { useComments as ae } from "@voltro/plugin-comments/web";
4
5
  //#region src/widgets.tsx
5
- var v = (e) => e == null ? "" : String(e), y = ({ required: e }) => e ? /* @__PURE__ */ o("span", {
6
+ var y = (e) => e == null ? "" : String(e), b = ({ required: e }) => e ? /* @__PURE__ */ o("span", {
6
7
  "aria-hidden": "true",
7
8
  children: " *"
8
- }) : null, b = (e) => /* @__PURE__ */ s("div", {
9
+ }) : null, x = (e) => /* @__PURE__ */ s("div", {
9
10
  "data-voltro-field": !0,
10
11
  children: [
11
12
  /* @__PURE__ */ s("label", {
12
13
  htmlFor: e.id,
13
- children: [e.label, /* @__PURE__ */ o(y, { required: e.required })]
14
+ children: [e.label, /* @__PURE__ */ o(b, { required: e.required })]
14
15
  }),
15
16
  e.description === void 0 ? null : /* @__PURE__ */ o("p", {
16
17
  id: `${e.id}-desc`,
@@ -24,12 +25,12 @@ var v = (e) => e == null ? "" : String(e), y = ({ required: e }) => e ? /* @__PU
24
25
  children: e.error
25
26
  })
26
27
  ]
27
- }), x = (e, t, n) => {
28
+ }), S = (e, t, n) => {
28
29
  let r = [t === void 0 ? "" : `${e}-desc`, n === void 0 ? "" : `${e}-error`].filter(Boolean);
29
30
  return r.length > 0 ? r.join(" ") : void 0;
30
- }, S = (e) => e ? !0 : void 0, C = (e, t) => (r) => {
31
+ }, C = (e) => e ? !0 : void 0, w = (e, t) => (r) => {
31
32
  let i = n();
32
- return /* @__PURE__ */ o(b, {
33
+ return /* @__PURE__ */ o(x, {
33
34
  id: i,
34
35
  label: r.label,
35
36
  required: r.required,
@@ -39,18 +40,19 @@ var v = (e) => e == null ? "" : String(e), y = ({ required: e }) => e ? /* @__PU
39
40
  id: i,
40
41
  type: e,
41
42
  name: r.name,
42
- value: v(r.value),
43
+ value: y(r.value),
43
44
  onChange: (e) => r.onChange(t(e.target.value)),
45
+ onBlur: r.onBlur,
44
46
  disabled: r.disabled,
45
47
  required: r.required,
46
- "aria-required": S(r.required),
48
+ "aria-required": C(r.required),
47
49
  "aria-invalid": r.error !== void 0,
48
- "aria-describedby": x(i, r.description, r.error)
50
+ "aria-describedby": S(i, r.description, r.error)
49
51
  })
50
52
  });
51
- }, te = (e) => {
53
+ }, oe = (e) => {
52
54
  let t = n();
53
- return /* @__PURE__ */ o(b, {
55
+ return /* @__PURE__ */ o(x, {
54
56
  id: t,
55
57
  label: e.label,
56
58
  required: e.required,
@@ -59,18 +61,19 @@ var v = (e) => e == null ? "" : String(e), y = ({ required: e }) => e ? /* @__PU
59
61
  children: /* @__PURE__ */ o("textarea", {
60
62
  id: t,
61
63
  name: e.name,
62
- value: v(e.value),
64
+ value: y(e.value),
63
65
  onChange: (t) => e.onChange(t.target.value),
64
66
  disabled: e.disabled,
67
+ onBlur: e.onBlur,
65
68
  required: e.required,
66
- "aria-required": S(e.required),
69
+ "aria-required": C(e.required),
67
70
  "aria-invalid": e.error !== void 0,
68
- "aria-describedby": x(t, e.description, e.error)
71
+ "aria-describedby": S(t, e.description, e.error)
69
72
  })
70
73
  });
71
- }, w = (e) => {
74
+ }, T = (e) => {
72
75
  let t = n();
73
- return /* @__PURE__ */ o(b, {
76
+ return /* @__PURE__ */ o(x, {
74
77
  id: t,
75
78
  label: e.label,
76
79
  required: e.required,
@@ -83,198 +86,233 @@ var v = (e) => e == null ? "" : String(e), y = ({ required: e }) => e ? /* @__PU
83
86
  checked: e.value === !0,
84
87
  onChange: (t) => e.onChange(t.target.checked),
85
88
  disabled: e.disabled,
86
- "aria-required": S(e.required),
89
+ onBlur: e.onBlur,
90
+ "aria-required": C(e.required),
87
91
  "aria-invalid": e.error !== void 0,
88
- "aria-describedby": x(t, e.description, e.error)
92
+ "aria-describedby": S(t, e.description, e.error)
89
93
  })
90
94
  });
91
- }, T = {
92
- text: C("text", (e) => e),
93
- number: C("number", (e) => e === "" ? void 0 : Number(e)),
94
- date: C("date", (e) => e),
95
- datetime: C("datetime-local", (e) => e),
96
- daterange: C("text", (e) => e),
97
- file: (e) => {
98
- let t = n();
99
- return /* @__PURE__ */ o(b, {
95
+ }, se = (e) => {
96
+ let t = n();
97
+ return /* @__PURE__ */ o(x, {
98
+ id: t,
99
+ label: e.label,
100
+ required: e.required,
101
+ description: e.description,
102
+ error: e.error,
103
+ children: /* @__PURE__ */ s("select", {
100
104
  id: t,
101
- label: e.label,
105
+ name: e.name,
106
+ value: y(e.value),
107
+ onChange: (t) => e.onChange(t.target.value),
108
+ disabled: e.disabled,
109
+ onBlur: e.onBlur,
102
110
  required: e.required,
103
- description: e.description,
104
- error: e.error,
105
- children: /* @__PURE__ */ o("input", {
106
- id: t,
107
- type: "file",
108
- name: e.name,
109
- onChange: (t) => e.onChange(t.target.files?.[0] ?? null),
110
- disabled: e.disabled,
111
- required: e.required,
112
- "aria-required": S(e.required),
113
- "aria-invalid": e.error !== void 0,
114
- "aria-describedby": x(t, e.description, e.error)
111
+ "aria-required": C(e.required),
112
+ "aria-invalid": e.error !== void 0,
113
+ "aria-describedby": S(t, e.description, e.error),
114
+ children: [/* @__PURE__ */ o("option", {
115
+ value: "",
116
+ children: "—"
117
+ }), (e.options ?? []).map((e) => /* @__PURE__ */ o("option", {
118
+ value: e.value,
119
+ children: e.label
120
+ }, e.value))]
121
+ })
122
+ });
123
+ }, ce = (e) => {
124
+ let t = n();
125
+ return /* @__PURE__ */ s("fieldset", {
126
+ "data-voltro-field": !0,
127
+ "aria-invalid": e.error !== void 0,
128
+ "aria-required": C(e.required),
129
+ "aria-describedby": S(t, e.description, e.error),
130
+ children: [
131
+ /* @__PURE__ */ s("legend", { children: [e.label, /* @__PURE__ */ o(b, { required: e.required })] }),
132
+ e.description === void 0 ? null : /* @__PURE__ */ o("p", {
133
+ id: `${t}-desc`,
134
+ "data-voltro-field-hint": !0,
135
+ children: e.description
136
+ }),
137
+ (e.options ?? []).map((n) => {
138
+ let r = `${t}-${n.value}`;
139
+ return /* @__PURE__ */ s("span", { children: [/* @__PURE__ */ o("input", {
140
+ id: r,
141
+ type: "radio",
142
+ name: e.name,
143
+ value: n.value,
144
+ checked: y(e.value) === n.value,
145
+ onChange: () => e.onChange(n.value),
146
+ disabled: e.disabled,
147
+ onBlur: e.onBlur
148
+ }), /* @__PURE__ */ o("label", {
149
+ htmlFor: r,
150
+ children: n.label
151
+ })] }, n.value);
152
+ }),
153
+ e.error === void 0 ? null : /* @__PURE__ */ o("p", {
154
+ id: `${t}-error`,
155
+ role: "alert",
156
+ children: e.error
115
157
  })
116
- });
117
- },
118
- "async-select": C("text", (e) => e),
119
- textarea: te,
120
- checkbox: w,
121
- switch: w,
122
- select: (e) => {
123
- let t = n();
124
- return /* @__PURE__ */ o(b, {
158
+ ]
159
+ });
160
+ }, le = (e) => {
161
+ let t = n(), r = Array.isArray(e.value) ? e.value.map(String) : [];
162
+ return /* @__PURE__ */ o(x, {
163
+ id: t,
164
+ label: e.label,
165
+ required: e.required,
166
+ description: e.description,
167
+ error: e.error,
168
+ children: /* @__PURE__ */ o("select", {
125
169
  id: t,
126
- label: e.label,
127
- required: e.required,
128
- description: e.description,
129
- error: e.error,
130
- children: /* @__PURE__ */ s("select", {
131
- id: t,
132
- name: e.name,
133
- value: v(e.value),
134
- onChange: (t) => e.onChange(t.target.value),
135
- disabled: e.disabled,
136
- required: e.required,
137
- "aria-required": S(e.required),
138
- "aria-invalid": e.error !== void 0,
139
- "aria-describedby": x(t, e.description, e.error),
140
- children: [/* @__PURE__ */ o("option", {
141
- value: "",
142
- children: "—"
143
- }), (e.options ?? []).map((e) => /* @__PURE__ */ o("option", {
144
- value: e.value,
145
- children: e.label
146
- }, e.value))]
147
- })
148
- });
149
- },
150
- radio: (e) => {
151
- let t = n();
152
- return /* @__PURE__ */ s("fieldset", {
153
- "data-voltro-field": !0,
170
+ name: e.name,
171
+ multiple: !0,
172
+ value: r,
173
+ onChange: (t) => e.onChange(Array.from(t.target.selectedOptions, (e) => e.value)),
174
+ disabled: e.disabled,
175
+ onBlur: e.onBlur,
176
+ "aria-required": C(e.required),
154
177
  "aria-invalid": e.error !== void 0,
155
- "aria-required": S(e.required),
156
- "aria-describedby": x(t, e.description, e.error),
157
- children: [
158
- /* @__PURE__ */ s("legend", { children: [e.label, /* @__PURE__ */ o(y, { 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
- }),
164
- (e.options ?? []).map((n) => {
165
- let r = `${t}-${n.value}`;
166
- return /* @__PURE__ */ s("span", { children: [/* @__PURE__ */ o("input", {
167
- id: r,
168
- type: "radio",
169
- name: e.name,
170
- value: n.value,
171
- checked: v(e.value) === n.value,
172
- onChange: () => e.onChange(n.value),
173
- disabled: e.disabled
174
- }), /* @__PURE__ */ o("label", {
175
- htmlFor: r,
176
- children: n.label
177
- })] }, n.value);
178
- }),
179
- e.error === void 0 ? null : /* @__PURE__ */ o("p", {
180
- id: `${t}-error`,
181
- role: "alert",
182
- children: e.error
183
- })
184
- ]
185
- });
186
- },
187
- "multi-select": (e) => {
188
- let t = n(), r = Array.isArray(e.value) ? e.value.map(String) : [];
189
- return /* @__PURE__ */ o(b, {
178
+ "aria-describedby": S(t, e.description, e.error),
179
+ children: (e.options ?? []).map((e) => /* @__PURE__ */ o("option", {
180
+ value: e.value,
181
+ children: e.label
182
+ }, e.value))
183
+ })
184
+ });
185
+ }, ue = (e) => /* @__PURE__ */ o("input", {
186
+ type: "hidden",
187
+ name: e.name,
188
+ value: y(e.value),
189
+ readOnly: !0
190
+ }), de = (e) => {
191
+ let t = n();
192
+ return /* @__PURE__ */ o(x, {
193
+ id: t,
194
+ label: e.label,
195
+ required: e.required,
196
+ description: e.description,
197
+ error: e.error,
198
+ children: /* @__PURE__ */ o("input", {
190
199
  id: t,
191
- label: e.label,
200
+ type: "file",
201
+ name: e.name,
202
+ onChange: (t) => e.onChange(t.target.files?.[0] ?? null),
203
+ disabled: e.disabled,
204
+ onBlur: e.onBlur,
192
205
  required: e.required,
193
- description: e.description,
194
- error: e.error,
195
- children: /* @__PURE__ */ o("select", {
196
- id: t,
197
- name: e.name,
198
- multiple: !0,
199
- value: r,
200
- onChange: (t) => e.onChange(Array.from(t.target.selectedOptions, (e) => e.value)),
201
- disabled: e.disabled,
202
- "aria-required": S(e.required),
203
- "aria-invalid": e.error !== void 0,
204
- "aria-describedby": x(t, e.description, e.error),
205
- children: (e.options ?? []).map((e) => /* @__PURE__ */ o("option", {
206
- value: e.value,
207
- children: e.label
208
- }, e.value))
209
- })
210
- });
211
- },
212
- hidden: (e) => /* @__PURE__ */ o("input", {
213
- type: "hidden",
214
- name: e.name,
215
- value: v(e.value),
216
- readOnly: !0
217
- }),
218
- custom: (e) => /* @__PURE__ */ s("div", {
219
- "data-voltro-field": !0,
220
- "data-voltro-custom": !0,
221
- children: [/* @__PURE__ */ s("label", { children: [e.label, /* @__PURE__ */ o(y, { required: e.required })] }), /* @__PURE__ */ o("p", {
222
- role: "note",
223
- children: `No default widget for "${e.name}" provide a render-prop via <Field>.`
224
- })]
225
- })
226
- }, E = e({}), D = (e) => {
227
- let n = t(E), i = r(() => ({
206
+ "aria-required": C(e.required),
207
+ "aria-invalid": e.error !== void 0,
208
+ "aria-describedby": S(t, e.description, e.error)
209
+ })
210
+ });
211
+ }, E = (e) => /* @__PURE__ */ s("div", {
212
+ "data-voltro-field": !0,
213
+ "data-voltro-custom": !0,
214
+ children: [/* @__PURE__ */ s("label", { children: [e.label, /* @__PURE__ */ o(b, { required: e.required })] }), /* @__PURE__ */ o("p", {
215
+ role: "note",
216
+ children: `No default widget for "${e.name}" provide a render-prop via <Field>.`
217
+ })]
218
+ }), D = {
219
+ text: w("text", (e) => e),
220
+ number: w("number", (e) => e === "" ? void 0 : Number(e)),
221
+ date: w("date", (e) => e),
222
+ datetime: w("datetime-local", (e) => e),
223
+ daterange: w("text", (e) => e),
224
+ file: de,
225
+ "async-select": w("text", (e) => e),
226
+ textarea: oe,
227
+ checkbox: T,
228
+ switch: T,
229
+ select: se,
230
+ radio: ce,
231
+ "multi-select": le,
232
+ hidden: ue,
233
+ array: E,
234
+ reference: E,
235
+ custom: E
236
+ }, O = e({}), fe = (e) => {
237
+ let n = t(O), i = r(() => ({
228
238
  ...n,
229
239
  ...e.widgets
230
240
  }), [n, e.widgets]);
231
- return /* @__PURE__ */ o(E.Provider, {
241
+ return /* @__PURE__ */ o(O.Provider, {
232
242
  value: i,
233
243
  children: e.children
234
244
  });
235
- }, O = (e) => t(E)[e] ?? T[e] ?? T.custom, k = e(null), ne = () => {
236
- let e = t(k);
245
+ }, k = (e) => t(O)[e] ?? D[e] ?? D.custom, A = e(null), pe = () => {
246
+ let e = t(A);
237
247
  if (e === null) throw Error("<Field> must be rendered inside <AutoForm>");
238
248
  return e;
239
- }, re = (e, t) => {
240
- let n = e.errors[t.name], r = t.jsonSchema.description;
249
+ }, me = (e, t) => {
250
+ let n = e.field(t.name);
241
251
  return {
242
252
  name: t.name,
243
253
  label: t.label,
244
- value: e.values[t.name],
245
- onChange: (n) => e.setValue(t.name, n),
254
+ value: n.value,
255
+ onChange: n.setValue,
256
+ onBlur: n.onBlur,
246
257
  required: t.required,
247
258
  disabled: e.pending,
248
- ...n === void 0 ? {} : { error: n },
259
+ ...n.error === void 0 ? {} : { error: n.error },
249
260
  ...t.options ? { options: t.options } : {},
250
- ...typeof r == "string" && r.length > 0 ? { description: r } : {}
261
+ ...n.description === void 0 ? {} : { description: n.description },
262
+ ...t.reference === void 0 ? {} : { reference: t.reference }
251
263
  };
252
- }, A = ({ name: e, children: t }) => {
253
- let n = ne(), r = n.fields.find((t) => t.name === e), i = O(r?.widget ?? "custom");
264
+ }, j = ({ name: e, children: t }) => {
265
+ let n = pe(), r = n.fields.find((t) => t.name === e), i = k(r?.widget ?? "custom");
254
266
  if (r === void 0) return null;
255
- let a = re(n, r);
267
+ let a = me(n, r);
256
268
  return t ? t(a) : /* @__PURE__ */ o(i, { ...a });
257
269
  };
258
- function j(e) {
259
- let t = f(e.api, e.mutation, {
270
+ function he(e) {
271
+ let t = e.formKey ?? e.mutation, n = ee(t), r = g(e.api, e.mutation, {
260
272
  ...e.schema ? { schema: e.schema } : {},
261
- ...e.defaults ? { defaults: e.defaults } : {}
262
- });
263
- return /* @__PURE__ */ o(k.Provider, {
264
- value: t,
273
+ ...e.defaults ? { defaults: e.defaults } : {},
274
+ ...n === void 0 ? {} : { flash: n }
275
+ }), i = (t) => {
276
+ t.preventDefault(), r.submit().then((t) => {
277
+ t !== void 0 && e.onSuccess && e.onSuccess(t);
278
+ });
279
+ };
280
+ return /* @__PURE__ */ o(A.Provider, {
281
+ value: r,
265
282
  children: /* @__PURE__ */ s("form", {
266
- onSubmit: (n) => {
267
- n.preventDefault(), t.submit().then((t) => {
268
- t !== void 0 && e.onSuccess && e.onSuccess(t);
269
- });
283
+ ...e.action === !1 ? {} : {
284
+ action: u(e.mutation),
285
+ method: "post"
270
286
  },
287
+ onSubmit: i,
271
288
  noValidate: !0,
272
289
  "data-voltro-autoform": e.mutation,
273
- children: [e.children ? e.children(t) : t.fields.map((e) => /* @__PURE__ */ o(A, { name: e.name }, e.name)), /* @__PURE__ */ o("button", {
274
- type: "submit",
275
- disabled: t.pending,
276
- children: e.submitLabel ?? "Submit"
277
- })]
290
+ children: [
291
+ e.action === !1 ? null : /* @__PURE__ */ o("input", {
292
+ type: "hidden",
293
+ name: c,
294
+ value: t
295
+ }),
296
+ e.action === !1 || e.redirectTo === void 0 ? null : /* @__PURE__ */ o("input", {
297
+ type: "hidden",
298
+ name: l,
299
+ value: e.redirectTo
300
+ }),
301
+ e.children ? e.children(r) : d(r.fields).map((e, t) => e.name === void 0 ? e.fields.map((e) => /* @__PURE__ */ o(j, { name: e.name }, e.name)) : /* @__PURE__ */ s("fieldset", {
302
+ "data-voltro-section": e.name,
303
+ children: [/* @__PURE__ */ o("legend", { children: e.label ?? e.name }), e.fields.map((e) => /* @__PURE__ */ o(j, { name: e.name }, e.name))]
304
+ }, e.name)),
305
+ r.formError === void 0 ? null : /* @__PURE__ */ o("p", {
306
+ role: "alert",
307
+ "data-voltro-form-error": "",
308
+ children: r.formError
309
+ }),
310
+ /* @__PURE__ */ o("button", {
311
+ type: "submit",
312
+ disabled: r.pending,
313
+ children: e.submitLabel ?? "Submit"
314
+ })
315
+ ]
278
316
  })
279
317
  });
280
318
  }
@@ -312,6 +350,23 @@ var M = {
312
350
  messageLabel: "Message",
313
351
  send: "Send"
314
352
  },
353
+ comments: {
354
+ comment: "Comment",
355
+ reply: "Reply",
356
+ replyPlaceholder: "Reply… (@name to mention)",
357
+ replyLabel: "Reply",
358
+ newPlaceholder: "Start a discussion… (@name to mention)",
359
+ newLabel: "New comment",
360
+ resolve: "Resolve",
361
+ reopen: "Reopen",
362
+ markRead: "Mark read",
363
+ edit: "Edit",
364
+ edited: "edited",
365
+ editLabel: "Edit comment",
366
+ save: "Save",
367
+ remove: "Delete",
368
+ react: "React"
369
+ },
315
370
  appAgent: {
316
371
  toolsSummary: (e) => `${e} tools · acts as you`,
317
372
  needsConfirm: "needs confirm"
@@ -340,7 +395,7 @@ var M = {
340
395
  howToGetToken: "How do I get a token?",
341
396
  loading: "Loading…"
342
397
  }
343
- }, N = e(M), P = (e, t) => ({
398
+ }, N = e(M), ge = (e, t) => ({
344
399
  filters: {
345
400
  ...e.filters,
346
401
  ...t.filters
@@ -365,6 +420,10 @@ var M = {
365
420
  ...e.agentChat,
366
421
  ...t.agentChat
367
422
  },
423
+ comments: {
424
+ ...e.comments,
425
+ ...t.comments
426
+ },
368
427
  appAgent: {
369
428
  ...e.appAgent,
370
429
  ...t.appAgent
@@ -382,21 +441,21 @@ var M = {
382
441
  ...t.connectAccount
383
442
  }
384
443
  });
385
- function F(e) {
386
- let n = t(N), i = r(() => P(n, e.strings), [n, e.strings]);
444
+ function _e(e) {
445
+ let n = t(N), i = r(() => ge(n, e.strings), [n, e.strings]);
387
446
  return /* @__PURE__ */ o(N.Provider, {
388
447
  value: i,
389
448
  children: e.children
390
449
  });
391
450
  }
392
- var I = () => t(N), ie = (e) => {
393
- let t = m(e.api, e.source, {
451
+ var P = () => t(N), F = (e) => {
452
+ let t = ne(e.api, e.source, {
394
453
  skipUntilTerm: !0,
395
454
  ...e.labelField === void 0 ? {} : { labelField: e.labelField },
396
455
  ...e.valueField === void 0 ? {} : { valueField: e.valueField },
397
456
  ...e.input === void 0 ? {} : { input: e.input },
398
457
  ...e.debounceMs === void 0 ? {} : { debounceMs: e.debounceMs }
399
- }), r = I().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`;
458
+ }), r = P().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`;
400
459
  return /* @__PURE__ */ s("div", {
401
460
  "data-voltro-field": !0,
402
461
  "data-voltro-async-select": !0,
@@ -444,48 +503,48 @@ var I = () => t(N), ie = (e) => {
444
503
  })
445
504
  ]
446
505
  });
447
- }, ae = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e), oe = (e, t) => e ? t === "asc" ? "ascending" : "descending" : "none";
448
- function L(e) {
449
- let { api: t, query: n, emptyText: r, loadingText: i, loadMoreText: c, renderCell: l, rowActions: u, rowKey: f, ...p } = e, m = I().dataTable, h = d(t, n, p);
450
- return h.loading ? /* @__PURE__ */ o("p", {
506
+ }, I = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e), ve = (e, t) => e ? t === "asc" ? "ascending" : "descending" : "none";
507
+ function ye(e) {
508
+ let { api: t, query: n, emptyText: r, loadingText: i, loadMoreText: c, renderCell: l, rowActions: u, rowKey: d, ...f } = e, p = P().dataTable, m = h(t, n, f);
509
+ return m.loading ? /* @__PURE__ */ o("p", {
451
510
  "data-voltro-datatable-loading": !0,
452
511
  "aria-busy": "true",
453
512
  children: i ?? "Loading…"
454
- }) : h.rows.length === 0 ? /* @__PURE__ */ o("p", {
513
+ }) : m.rows.length === 0 ? /* @__PURE__ */ o("p", {
455
514
  "data-voltro-datatable-empty": !0,
456
515
  children: r ?? "No rows."
457
516
  }) : /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s("table", {
458
517
  "data-voltro-datatable": n,
459
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [h.columns.map((e) => {
460
- let t = h.sort?.column === e.name, n = h.sort?.direction ?? "asc";
518
+ children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [m.columns.map((e) => {
519
+ let t = m.sort?.column === e.name, n = m.sort?.direction ?? "asc";
461
520
  return /* @__PURE__ */ o("th", {
462
- "aria-sort": oe(t, n),
521
+ "aria-sort": ve(t, n),
463
522
  scope: "col",
464
523
  children: /* @__PURE__ */ s("button", {
465
524
  type: "button",
466
- onClick: () => h.toggleSort(e.name),
525
+ onClick: () => m.toggleSort(e.name),
467
526
  children: [e.label, t ? n === "asc" ? " ▲" : " ▼" : ""]
468
527
  })
469
528
  }, e.name);
470
529
  }), u ? /* @__PURE__ */ o("th", {
471
530
  scope: "col",
472
- children: m.actions
473
- }) : null] }) }), /* @__PURE__ */ o("tbody", { children: h.rows.map((e, t) => /* @__PURE__ */ s("tr", { children: [h.columns.map((t) => /* @__PURE__ */ o("td", {
531
+ children: p.actions
532
+ }) : null] }) }), /* @__PURE__ */ o("tbody", { children: m.rows.map((e, t) => /* @__PURE__ */ s("tr", { children: [m.columns.map((t) => /* @__PURE__ */ o("td", {
474
533
  "data-column": t.name,
475
- children: l ? l(e, t) : ae(e[t.name])
476
- }, t.name)), u ? /* @__PURE__ */ o("td", { children: u(e) }) : null] }, f ? f(e) : String(e.id ?? t))) })]
477
- }), h.hasMore ? /* @__PURE__ */ o("button", {
534
+ children: l ? l(e, t) : I(e[t.name])
535
+ }, t.name)), u ? /* @__PURE__ */ o("td", { children: u(e) }) : null] }, d ? d(e) : String(e.id ?? t))) })]
536
+ }), m.hasMore ? /* @__PURE__ */ o("button", {
478
537
  type: "button",
479
538
  "data-voltro-datatable-more": !0,
480
- onClick: () => h.loadMore(),
539
+ onClick: () => m.loadMore(),
481
540
  children: c ?? "Load more"
482
541
  }) : null] });
483
542
  }
484
543
  //#endregion
485
544
  //#region src/workflow.tsx
486
- var se = (e) => e === "succeeded" ? "✓" : e === "failed" ? "✗" : "…";
487
- function ce(e) {
488
- let { api: t, runId: n, loadingText: r, emptyText: i } = e, a = I().workflow, c = _(t, n);
545
+ var be = (e) => e === "succeeded" ? "✓" : e === "failed" ? "✗" : "…";
546
+ function xe(e) {
547
+ let { api: t, runId: n, loadingText: r, emptyText: i } = e, a = P().workflow, c = v(t, n);
489
548
  return c.loading ? /* @__PURE__ */ o("p", {
490
549
  "data-voltro-workflow-loading": !0,
491
550
  "aria-busy": "true",
@@ -505,7 +564,7 @@ function ce(e) {
505
564
  children: [
506
565
  /* @__PURE__ */ o("span", {
507
566
  "aria-hidden": "true",
508
- children: se(e.status)
567
+ children: be(e.status)
509
568
  }),
510
569
  " ",
511
570
  e.stepName,
@@ -530,8 +589,8 @@ function ce(e) {
530
589
  })
531
590
  });
532
591
  }
533
- function le(e) {
534
- let { api: t, runId: n } = e, r = I().workflow, i = _(t, n);
592
+ function Se(e) {
593
+ let { api: t, runId: n } = e, r = P().workflow, i = v(t, n);
535
594
  if (i.loading || i.status === void 0) return /* @__PURE__ */ o("span", {
536
595
  "data-voltro-workflow-badge": !0,
537
596
  "data-status": "loading",
@@ -548,7 +607,7 @@ function le(e) {
548
607
  }) : null]
549
608
  });
550
609
  }
551
- function ue(e) {
610
+ function Ce(e) {
552
611
  let { when: t, onApprove: n, onReject: r, approveLabel: i, rejectLabel: a, pending: c } = e;
553
612
  return t ? /* @__PURE__ */ s("div", {
554
613
  "data-voltro-approval-controls": !0,
@@ -571,15 +630,15 @@ function ue(e) {
571
630
  }
572
631
  //#endregion
573
632
  //#region src/presence.tsx
574
- var R = (e, t) => {
633
+ var L = (e, t) => {
575
634
  let n = e.meta?.[t];
576
635
  return typeof n == "string" ? n : void 0;
577
- }, z = (e) => R(e, "name") ?? R(e, "displayName") ?? e.key, B = (e) => {
636
+ }, R = (e) => L(e, "name") ?? L(e, "displayName") ?? e.key, z = (e) => {
578
637
  let t = e.trim().split(/\s+/).filter(Boolean);
579
638
  return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
580
639
  };
581
- function V(e) {
582
- let { members: t, max: n = 5, nameOf: r = z, renderAvatar: i } = e, a = I().presence, c = t.slice(0, n), l = t.length - c.length;
640
+ function we(e) {
641
+ let { members: t, max: n = 5, nameOf: r = R, renderAvatar: i } = e, a = P().presence, c = t.slice(0, n), l = t.length - c.length;
583
642
  return /* @__PURE__ */ s("div", {
584
643
  "data-voltro-presence-avatars": !0,
585
644
  role: "group",
@@ -590,7 +649,7 @@ function V(e) {
590
649
  "data-avatar": !0,
591
650
  title: t,
592
651
  "aria-label": t,
593
- children: B(t)
652
+ children: z(t)
594
653
  }, e.key);
595
654
  }), l > 0 ? /* @__PURE__ */ s("span", {
596
655
  "data-avatar-overflow": !0,
@@ -599,33 +658,33 @@ function V(e) {
599
658
  }) : null]
600
659
  });
601
660
  }
602
- var H = (e, t, n = M.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 de(e) {
604
- let { members: t, selfKey: n, field: r, verb: i = "editing", nameOf: a = z } = e, s = I().presence, c = t.filter((e) => !(n !== void 0 && e.key === n || r !== void 0 && R(e, "field") !== r));
661
+ var B = (e, t, n = M.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);
662
+ function Te(e) {
663
+ let { members: t, selfKey: n, field: r, verb: i = "editing", nameOf: a = R } = e, s = P().presence, c = t.filter((e) => !(n !== void 0 && e.key === n || r !== void 0 && L(e, "field") !== r));
605
664
  return c.length === 0 ? null : /* @__PURE__ */ o("span", {
606
665
  "data-voltro-editing-indicator": !0,
607
666
  "data-field": r,
608
667
  role: "status",
609
- children: H(c.map(a), i, s)
668
+ children: B(c.map(a), i, s)
610
669
  });
611
670
  }
612
671
  //#endregion
613
672
  //#region src/agentChat.tsx
614
- var U = (e) => typeof e.text == "string" ? e.text : "";
615
- function fe({ text: e }) {
616
- let t = I().agentChat;
673
+ var V = (e) => typeof e.text == "string" ? e.text : "";
674
+ function Ee({ text: e }) {
675
+ let t = P().agentChat;
617
676
  return /* @__PURE__ */ s("details", {
618
677
  "data-part": "reasoning",
619
678
  children: [/* @__PURE__ */ o("summary", { children: t.reasoning }), /* @__PURE__ */ o("span", { children: e })]
620
679
  });
621
680
  }
622
- function W({ part: e }) {
681
+ function H({ part: e }) {
623
682
  switch (e.type) {
624
683
  case "text": return /* @__PURE__ */ o("span", {
625
684
  "data-part": "text",
626
- children: U(e)
685
+ children: V(e)
627
686
  });
628
- case "reasoning": return /* @__PURE__ */ o(fe, { text: U(e) });
687
+ case "reasoning": return /* @__PURE__ */ o(Ee, { text: V(e) });
629
688
  case "tool": {
630
689
  let t = e;
631
690
  return /* @__PURE__ */ s("span", {
@@ -665,14 +724,14 @@ function W({ part: e }) {
665
724
  });
666
725
  }
667
726
  }
668
- function G({ message: e }) {
727
+ function U({ message: e }) {
669
728
  let t = e.parts ?? [];
670
729
  return /* @__PURE__ */ s("div", {
671
730
  "data-voltro-agent-message": !0,
672
731
  "data-role": e.role,
673
732
  "data-streaming": e.streaming ? "true" : void 0,
674
733
  "aria-busy": e.streaming ? "true" : void 0,
675
- children: [t.length > 0 ? t.map((e, t) => /* @__PURE__ */ o(W, { part: e }, t)) : /* @__PURE__ */ o("span", {
734
+ children: [t.length > 0 ? t.map((e, t) => /* @__PURE__ */ o(H, { part: e }, t)) : /* @__PURE__ */ o("span", {
676
735
  "data-part": "text",
677
736
  children: e.content
678
737
  }), e.streaming ? /* @__PURE__ */ o("span", {
@@ -682,10 +741,10 @@ function G({ message: e }) {
682
741
  }) : null]
683
742
  });
684
743
  }
685
- function K(e) {
686
- let { api: t, agent: n, threadId: r, placeholder: a, sendLabel: l, emptyText: u } = e, d = I().agentChat, f = c(t, n, { threadId: r }), [p, m] = i(""), h = () => {
744
+ function W(e) {
745
+ let { api: t, agent: n, threadId: r, placeholder: a, sendLabel: c, emptyText: l } = e, u = P().agentChat, d = f(t, n, { threadId: r }), [p, m] = i(""), h = () => {
687
746
  let e = p.trim();
688
- e.length === 0 || f.sending || (m(""), f.send(e));
747
+ e.length === 0 || d.sending || (m(""), d.send(e));
689
748
  };
690
749
  return /* @__PURE__ */ s("div", {
691
750
  "data-voltro-agent-chat": n,
@@ -693,11 +752,11 @@ function K(e) {
693
752
  "data-messages": !0,
694
753
  role: "log",
695
754
  "aria-live": "polite",
696
- "aria-busy": f.streaming ? "true" : void 0,
697
- children: f.messages.length === 0 && !f.loading ? /* @__PURE__ */ o("p", {
755
+ "aria-busy": d.streaming ? "true" : void 0,
756
+ children: d.messages.length === 0 && !d.loading ? /* @__PURE__ */ o("p", {
698
757
  "data-empty": !0,
699
- children: u ?? "No messages yet."
700
- }) : f.messages.map((e) => /* @__PURE__ */ o(G, { message: e }, e.id))
758
+ children: l ?? "No messages yet."
759
+ }) : d.messages.map((e) => /* @__PURE__ */ o(U, { message: e }, e.id))
701
760
  }), /* @__PURE__ */ s("form", {
702
761
  "data-composer": !0,
703
762
  onSubmit: (e) => {
@@ -706,25 +765,25 @@ function K(e) {
706
765
  children: [/* @__PURE__ */ o("input", {
707
766
  value: p,
708
767
  onChange: (e) => m(e.target.value),
709
- placeholder: a ?? d.messagePlaceholder,
710
- "aria-label": d.messageLabel,
711
- disabled: f.sending
768
+ placeholder: a ?? u.messagePlaceholder,
769
+ "aria-label": u.messageLabel,
770
+ disabled: d.sending
712
771
  }), /* @__PURE__ */ o("button", {
713
772
  type: "submit",
714
- disabled: f.sending || p.trim().length === 0,
715
- children: l ?? d.send
773
+ disabled: d.sending || p.trim().length === 0,
774
+ children: c ?? u.send
716
775
  })]
717
776
  })]
718
777
  });
719
778
  }
720
- function pe(e) {
721
- let t = c(e.api, e.agent, { threadId: e.threadId });
779
+ function De(e) {
780
+ let t = f(e.api, e.agent, { threadId: e.threadId });
722
781
  return e.children(t);
723
782
  }
724
783
  //#endregion
725
784
  //#region src/appAgent.tsx
726
- function me(e) {
727
- let { tools: t, showTools: n, ...r } = e, i = I().appAgent, a = (n ?? (t !== void 0 && t.length > 0)) && t && t.length > 0;
785
+ function Oe(e) {
786
+ let { tools: t, showTools: n, ...r } = e, i = P().appAgent, a = (n ?? (t !== void 0 && t.length > 0)) && t && t.length > 0;
728
787
  return /* @__PURE__ */ s("div", {
729
788
  "data-voltro-app-agent": r.agent,
730
789
  children: [a ? /* @__PURE__ */ s("details", {
@@ -744,17 +803,17 @@ function me(e) {
744
803
  }) : null
745
804
  ]
746
805
  }, e.name)) })]
747
- }) : null, /* @__PURE__ */ o(K, { ...r })]
806
+ }) : null, /* @__PURE__ */ o(W, { ...r })]
748
807
  });
749
808
  }
750
809
  //#endregion
751
810
  //#region src/dataCopilot.tsx
752
- var he = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : typeof e == "object" ? JSON.stringify(e) : String(e), ge = (e) => {
811
+ var ke = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : typeof e == "object" ? JSON.stringify(e) : String(e), Ae = (e) => {
753
812
  let t = /* @__PURE__ */ new Set(), n = [];
754
813
  for (let r of e) for (let e of Object.keys(r)) t.has(e) || (t.add(e), n.push(e));
755
814
  return n;
756
815
  };
757
- function q(e) {
816
+ function G(e) {
758
817
  let { answer: t, emptyText: n } = e;
759
818
  if (t === void 0) return null;
760
819
  if (!t.ok) return /* @__PURE__ */ o("p", {
@@ -766,7 +825,7 @@ function q(e) {
766
825
  "data-voltro-data-copilot-empty": !0,
767
826
  children: n ?? "No rows."
768
827
  });
769
- let r = ge(t.rows);
828
+ let r = Ae(t.rows);
770
829
  return /* @__PURE__ */ s("table", {
771
830
  "data-voltro-data-copilot-results": !0,
772
831
  children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
@@ -774,13 +833,13 @@ function q(e) {
774
833
  children: e
775
834
  }, e)) }) }), /* @__PURE__ */ o("tbody", { children: t.rows.map((e, t) => /* @__PURE__ */ o("tr", { children: r.map((t) => /* @__PURE__ */ o("td", {
776
835
  "data-column": t,
777
- children: he(e[t])
836
+ children: ke(e[t])
778
837
  }, t)) }, String(e.id ?? t))) })]
779
838
  });
780
839
  }
781
- function _e(e) {
782
- let { api: t, action: n, placeholder: r, askLabel: a, emptyText: c } = e, l = u(t, n), [d, f] = i(""), p = () => {
783
- let e = d.trim();
840
+ function je(e) {
841
+ let { api: t, action: n, placeholder: r, askLabel: a, emptyText: c } = e, l = m(t, n), [u, d] = i(""), f = () => {
842
+ let e = u.trim();
784
843
  e.length === 0 || l.pending || l.ask(e);
785
844
  };
786
845
  return /* @__PURE__ */ s("div", {
@@ -788,24 +847,24 @@ function _e(e) {
788
847
  children: [/* @__PURE__ */ s("form", {
789
848
  "data-composer": !0,
790
849
  onSubmit: (e) => {
791
- e.preventDefault(), p();
850
+ e.preventDefault(), f();
792
851
  },
793
852
  children: [/* @__PURE__ */ o("input", {
794
- value: d,
795
- onChange: (e) => f(e.target.value),
853
+ value: u,
854
+ onChange: (e) => d(e.target.value),
796
855
  placeholder: r ?? "Ask about your data…",
797
856
  "aria-label": "Ask about your data",
798
857
  disabled: l.pending
799
858
  }), /* @__PURE__ */ o("button", {
800
859
  type: "submit",
801
- disabled: l.pending || d.trim().length === 0,
860
+ disabled: l.pending || u.trim().length === 0,
802
861
  children: a ?? "Ask"
803
862
  })]
804
863
  }), /* @__PURE__ */ o("div", {
805
864
  "data-answer": !0,
806
865
  "aria-live": "polite",
807
866
  "aria-busy": l.pending ? "true" : void 0,
808
- children: l.error === void 0 ? /* @__PURE__ */ o(q, {
867
+ children: l.error === void 0 ? /* @__PURE__ */ o(G, {
809
868
  answer: l.answer,
810
869
  ...c === void 0 ? {} : { emptyText: c }
811
870
  }) : /* @__PURE__ */ o("p", {
@@ -816,13 +875,13 @@ function _e(e) {
816
875
  })]
817
876
  });
818
877
  }
819
- function ve(e) {
820
- let t = u(e.api, e.action);
878
+ function Me(e) {
879
+ let t = m(e.api, e.action);
821
880
  return e.children(t);
822
881
  }
823
882
  //#endregion
824
883
  //#region src/skeleton.tsx
825
- var J = ({ w: e }) => /* @__PURE__ */ o("span", {
884
+ var K = ({ w: e }) => /* @__PURE__ */ o("span", {
826
885
  "data-skeleton-bar": !0,
827
886
  style: {
828
887
  display: "inline-block",
@@ -832,45 +891,55 @@ var J = ({ w: e }) => /* @__PURE__ */ o("span", {
832
891
  },
833
892
  "aria-hidden": "true"
834
893
  });
835
- function ye(e) {
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}`);
894
+ function Ne(e) {
895
+ let t = te(e.api, e.mutation), n = t.length > 0 ? t.length : e.fallbackFields ?? 3, r = t.length > 0 ? d(t) : [{
896
+ name: void 0,
897
+ label: void 0,
898
+ fields: Array.from({ length: n }, (e, t) => ({ name: `f${t}` }))
899
+ }];
837
900
  return /* @__PURE__ */ o("div", {
838
901
  "data-voltro-form-skeleton": e.mutation,
839
902
  "aria-busy": "true",
840
903
  "aria-hidden": "true",
841
- children: r.map((e) => /* @__PURE__ */ s("div", {
842
- "data-skeleton-field": !0,
843
- children: [/* @__PURE__ */ o(J, { w: "30%" }), /* @__PURE__ */ o(J, {})]
844
- }, e))
904
+ children: r.map((e, t) => /* @__PURE__ */ s("div", {
905
+ ...e.name === void 0 ? {} : { "data-skeleton-section": e.name },
906
+ children: [e.name !== void 0 && /* @__PURE__ */ o("div", {
907
+ "data-skeleton-section-title": !0,
908
+ children: /* @__PURE__ */ o(K, { w: "40%" })
909
+ }), e.fields.map((e) => /* @__PURE__ */ s("div", {
910
+ "data-skeleton-field": !0,
911
+ children: [/* @__PURE__ */ o(K, { w: "30%" }), /* @__PURE__ */ o(K, {})]
912
+ }, e.name))]
913
+ }, e.name ?? `_${t}`))
845
914
  });
846
915
  }
847
- function be(e) {
848
- let t = g(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;
916
+ function Pe(e) {
917
+ let t = ie(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;
849
918
  return /* @__PURE__ */ s("table", {
850
919
  "data-voltro-table-skeleton": e.query,
851
920
  "aria-busy": "true",
852
921
  "aria-hidden": "true",
853
922
  children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
854
923
  scope: "col",
855
- children: /* @__PURE__ */ o(J, { w: "60%" })
924
+ children: /* @__PURE__ */ o(K, { w: "60%" })
856
925
  }, e)) }) }), /* @__PURE__ */ o("tbody", { children: Array.from({ length: i }, (e, t) => /* @__PURE__ */ o("tr", {
857
926
  "data-skeleton-row": !0,
858
- children: r.map((e) => /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(J, {}) }, e))
927
+ children: r.map((e) => /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(K, {}) }, e))
859
928
  }, t)) })]
860
929
  });
861
930
  }
862
931
  //#endregion
863
932
  //#region src/filters.tsx
864
- var Y = (e) => e == null ? "" : String(e);
865
- function xe(e) {
866
- let { filter: t, value: n, onChange: r } = e, i = I().filters, a = {
933
+ var q = (e) => e == null ? "" : String(e);
934
+ function Fe(e) {
935
+ let { filter: t, value: n, onChange: r } = e, i = P().filters, a = {
867
936
  "data-filter": t.name,
868
937
  "aria-label": t.label
869
938
  };
870
939
  switch (t.kind) {
871
940
  case "select": return /* @__PURE__ */ s("select", {
872
941
  ...a,
873
- value: Y(n),
942
+ value: q(n),
874
943
  onChange: (e) => r(e.target.value || void 0),
875
944
  children: [/* @__PURE__ */ o("option", {
876
945
  value: "",
@@ -905,7 +974,7 @@ function xe(e) {
905
974
  children: [/* @__PURE__ */ o("input", {
906
975
  "aria-label": `${t.label} from`,
907
976
  type: e,
908
- value: Y(i.gte),
977
+ value: q(i.gte),
909
978
  onChange: (e) => r({
910
979
  ...i,
911
980
  gte: e.target.value || void 0
@@ -913,7 +982,7 @@ function xe(e) {
913
982
  }), /* @__PURE__ */ o("input", {
914
983
  "aria-label": `${t.label} to`,
915
984
  type: e,
916
- value: Y(i.lte),
985
+ value: q(i.lte),
917
986
  onChange: (e) => r({
918
987
  ...i,
919
988
  lte: e.target.value || void 0
@@ -924,13 +993,13 @@ function xe(e) {
924
993
  default: return /* @__PURE__ */ o("input", {
925
994
  ...a,
926
995
  type: "text",
927
- value: Y(n),
996
+ value: q(n),
928
997
  onChange: (e) => r(e.target.value || void 0)
929
998
  });
930
999
  }
931
1000
  }
932
- function Se(e) {
933
- let t = h(e.api, e.query, e.initial ? { initial: e.initial } : {}), n = I().filters;
1001
+ function J(e) {
1002
+ let t = re(e.api, e.query, e.initial ? { initial: e.initial } : {}), n = P().filters;
934
1003
  return /* @__PURE__ */ s("div", {
935
1004
  "data-voltro-query-filters": e.query,
936
1005
  children: [/* @__PURE__ */ s("div", {
@@ -940,7 +1009,7 @@ function Se(e) {
940
1009
  children: [
941
1010
  t.filters.map((e) => /* @__PURE__ */ s("label", {
942
1011
  "data-filter-label": !0,
943
- children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o(xe, {
1012
+ children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o(Fe, {
944
1013
  filter: e,
945
1014
  value: t.values[e.name],
946
1015
  onChange: (n) => t.setFilter(e.name, n)
@@ -962,25 +1031,25 @@ function Se(e) {
962
1031
  }
963
1032
  //#endregion
964
1033
  //#region src/recordView.tsx
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);
966
- function Ce({ name: e, items: t }) {
967
- let n = I().recordView;
1034
+ var Y = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), X = (e) => Array.isArray(e) && e.every((e) => typeof e == "object" && !!e), Z = (e) => e == null ? "—" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e);
1035
+ function Ie({ name: e, items: t }) {
1036
+ let n = P().recordView;
968
1037
  if (t.length === 0) return /* @__PURE__ */ o("p", {
969
1038
  "data-relation": e,
970
1039
  "data-empty": !0,
971
- children: n.emptyRelation(X(e).toLowerCase())
1040
+ children: n.emptyRelation(Y(e).toLowerCase())
972
1041
  });
973
1042
  let r = Object.keys(t[0]);
974
1043
  return /* @__PURE__ */ s("table", {
975
1044
  "data-relation": e,
976
1045
  children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
977
1046
  scope: "col",
978
- children: X(e)
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))) })]
1047
+ children: Y(e)
1048
+ }, e)) }) }), /* @__PURE__ */ o("tbody", { children: t.map((e, t) => /* @__PURE__ */ o("tr", { children: r.map((t) => /* @__PURE__ */ o("td", { children: Z(e[t]) }, t)) }, String(e.id ?? t))) })]
980
1049
  });
981
1050
  }
982
- function we(e) {
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 ?? {});
1051
+ function Le(e) {
1052
+ let { api: t, query: n, input: r, fields: i, renderField: a, renderRelation: c, loadingText: l, emptyText: u } = e, { record: d, loading: f } = _(t, n, r ?? {});
984
1053
  if (f) return /* @__PURE__ */ o("p", {
985
1054
  "data-voltro-record-loading": !0,
986
1055
  "aria-busy": "true",
@@ -990,18 +1059,18 @@ function we(e) {
990
1059
  "data-voltro-record-empty": !0,
991
1060
  children: u ?? "Not found."
992
1061
  });
993
- let p = Object.entries(d), m = p.filter(([e, t]) => !Z(t) && (i === void 0 || i.includes(e))), h = p.filter(([, e]) => Z(e)), g = i === void 0 ? m : i.map((e) => [e, d[e]]).filter(([, e]) => !Z(e));
1062
+ let p = Object.entries(d), m = p.filter(([e, t]) => !X(t) && (i === void 0 || i.includes(e))), h = p.filter(([, e]) => X(e)), g = i === void 0 ? m : i.map((e) => [e, d[e]]).filter(([, e]) => !X(e));
994
1063
  return /* @__PURE__ */ s("div", {
995
1064
  "data-voltro-record-view": n,
996
1065
  children: [/* @__PURE__ */ o("dl", {
997
1066
  "data-record-fields": !0,
998
1067
  children: g.map(([e, t]) => /* @__PURE__ */ s("div", {
999
1068
  "data-field": e,
1000
- children: [/* @__PURE__ */ o("dt", { children: X(e) }), /* @__PURE__ */ o("dd", { children: a ? a(e, t, d) : Q(t) })]
1069
+ children: [/* @__PURE__ */ o("dt", { children: Y(e) }), /* @__PURE__ */ o("dd", { children: a ? a(e, t, d) : Z(t) })]
1001
1070
  }, e))
1002
1071
  }), h.map(([e, t]) => /* @__PURE__ */ s("section", {
1003
1072
  "data-record-relation": e,
1004
- children: [/* @__PURE__ */ o("h3", { children: X(e) }), c ? c(e, t, d) : /* @__PURE__ */ o(Ce, {
1073
+ children: [/* @__PURE__ */ o("h3", { children: Y(e) }), c ? c(e, t, d) : /* @__PURE__ */ o(Ie, {
1005
1074
  name: e,
1006
1075
  items: t
1007
1076
  })]
@@ -1010,7 +1079,7 @@ function we(e) {
1010
1079
  }
1011
1080
  //#endregion
1012
1081
  //#region src/connectAccount.tsx
1013
- var Te = (e, t) => {
1082
+ var Re = (e, t) => {
1014
1083
  switch (e.status) {
1015
1084
  case "connected": return e.accountLabel === null ? t.connected : t.connectedAs(e.accountLabel);
1016
1085
  case "expired": return t.expired;
@@ -1018,15 +1087,15 @@ var Te = (e, t) => {
1018
1087
  case "error": return t.errored;
1019
1088
  default: return t.notConnected;
1020
1089
  }
1021
- }, Ee = ({ api: e, connectionId: t, ...n }) => {
1022
- let r = l(e, t);
1023
- return /* @__PURE__ */ o($, {
1090
+ }, ze = ({ api: e, connectionId: t, ...n }) => {
1091
+ let r = p(e, t);
1092
+ return /* @__PURE__ */ o(Q, {
1024
1093
  connection: r,
1025
1094
  loading: r.loading,
1026
1095
  ...n
1027
1096
  });
1028
- }, $ = ({ connection: e, instructionsUrl: t, loading: n = !1, children: r, className: c }) => {
1029
- let l = I().connectAccount, [u, d] = i("");
1097
+ }, Q = ({ connection: e, instructionsUrl: t, loading: n = !1, children: r, className: c }) => {
1098
+ let l = P().connectAccount, [u, d] = i("");
1030
1099
  if (r !== void 0) return r(e);
1031
1100
  if (n) return /* @__PURE__ */ o("div", {
1032
1101
  className: c,
@@ -1045,7 +1114,7 @@ var Te = (e, t) => {
1045
1114
  " — ",
1046
1115
  /* @__PURE__ */ o("span", {
1047
1116
  role: e.needsAttention ? "alert" : void 0,
1048
- children: Te(e, l)
1117
+ children: Re(e, l)
1049
1118
  })
1050
1119
  ] }), e.connected || e.needsAttention ? /* @__PURE__ */ s(a, { children: [e.needsAttention && e.kind === "oauth2" && /* @__PURE__ */ o("button", {
1051
1120
  type: "button",
@@ -1101,6 +1170,157 @@ var Te = (e, t) => {
1101
1170
  ]
1102
1171
  })]
1103
1172
  });
1104
- };
1173
+ }, $ = (e) => [...e.matchAll(/@([\w.-]+)/g)].map((e) => e[1]);
1174
+ function Be({ comment: e, onReact: t, onRemove: n, onEdit: r }) {
1175
+ let a = P().comments, [c, l] = i(!1), [u, d] = i(e.body);
1176
+ return /* @__PURE__ */ s("li", {
1177
+ "data-comment": e.id,
1178
+ "data-author": e.authorSubjectId,
1179
+ children: [
1180
+ /* @__PURE__ */ o("span", {
1181
+ "data-comment-author": !0,
1182
+ children: e.authorSubjectId
1183
+ }),
1184
+ c ? /* @__PURE__ */ s("form", {
1185
+ "data-comment-edit": !0,
1186
+ onSubmit: (e) => {
1187
+ e.preventDefault(), r(u), l(!1);
1188
+ },
1189
+ children: [/* @__PURE__ */ o("input", {
1190
+ value: u,
1191
+ onChange: (e) => d(e.target.value),
1192
+ "aria-label": a.editLabel
1193
+ }), /* @__PURE__ */ o("button", {
1194
+ type: "submit",
1195
+ children: a.save
1196
+ })]
1197
+ }) : /* @__PURE__ */ s("p", {
1198
+ "data-comment-body": !0,
1199
+ children: [e.body, e.editedAt ? /* @__PURE__ */ s("em", {
1200
+ "data-comment-edited": !0,
1201
+ children: [
1202
+ " (",
1203
+ a.edited,
1204
+ ")"
1205
+ ]
1206
+ }) : null]
1207
+ }),
1208
+ /* @__PURE__ */ s("span", {
1209
+ "data-comment-reactions": !0,
1210
+ children: [e.reactions.map((e) => /* @__PURE__ */ s("button", {
1211
+ type: "button",
1212
+ "data-reaction": e.emoji,
1213
+ "data-mine": e.mine || void 0,
1214
+ onClick: () => t(e.emoji),
1215
+ children: [
1216
+ e.emoji,
1217
+ " ",
1218
+ e.count
1219
+ ]
1220
+ }, e.emoji)), /* @__PURE__ */ o("button", {
1221
+ type: "button",
1222
+ "data-reaction-add": !0,
1223
+ onClick: () => t("👍"),
1224
+ "aria-label": a.react,
1225
+ children: "+👍"
1226
+ })]
1227
+ }),
1228
+ /* @__PURE__ */ s("span", {
1229
+ "data-comment-actions": !0,
1230
+ children: [/* @__PURE__ */ o("button", {
1231
+ type: "button",
1232
+ onClick: () => l((e) => !e),
1233
+ children: a.edit
1234
+ }), /* @__PURE__ */ o("button", {
1235
+ type: "button",
1236
+ onClick: n,
1237
+ children: a.remove
1238
+ })]
1239
+ })
1240
+ ]
1241
+ });
1242
+ }
1243
+ function Ve({ thread: e, api: t }) {
1244
+ let n = P().comments, [r, a] = i("");
1245
+ return /* @__PURE__ */ s("section", {
1246
+ "data-thread": e.id,
1247
+ "data-status": e.status,
1248
+ children: [
1249
+ /* @__PURE__ */ s("header", {
1250
+ "data-thread-header": !0,
1251
+ children: [
1252
+ e.unreadCount > 0 ? /* @__PURE__ */ o("span", {
1253
+ "data-thread-unread": !0,
1254
+ children: e.unreadCount
1255
+ }) : null,
1256
+ /* @__PURE__ */ o("button", {
1257
+ type: "button",
1258
+ "data-thread-resolve": !0,
1259
+ onClick: () => void t.resolve(e.id, e.status !== "resolved"),
1260
+ children: e.status === "resolved" ? n.reopen : n.resolve
1261
+ }),
1262
+ /* @__PURE__ */ o("button", {
1263
+ type: "button",
1264
+ "data-thread-markread": !0,
1265
+ onClick: () => void t.markRead(e.id),
1266
+ children: n.markRead
1267
+ })
1268
+ ]
1269
+ }),
1270
+ /* @__PURE__ */ o("ul", {
1271
+ "data-thread-comments": !0,
1272
+ children: e.comments.map((e) => /* @__PURE__ */ o(Be, {
1273
+ comment: e,
1274
+ onReact: (n) => void t.react(e.id, n),
1275
+ onRemove: () => void t.remove(e.id),
1276
+ onEdit: (n) => void t.edit(e.id, n)
1277
+ }, e.id))
1278
+ }),
1279
+ /* @__PURE__ */ s("form", {
1280
+ "data-thread-reply": !0,
1281
+ onSubmit: (n) => {
1282
+ n.preventDefault(), r.trim() !== "" && (t.create(r, {
1283
+ threadId: e.id,
1284
+ mentions: $(r)
1285
+ }), a(""));
1286
+ },
1287
+ children: [/* @__PURE__ */ o("input", {
1288
+ value: r,
1289
+ onChange: (e) => a(e.target.value),
1290
+ placeholder: n.replyPlaceholder,
1291
+ "aria-label": n.replyLabel
1292
+ }), /* @__PURE__ */ o("button", {
1293
+ type: "submit",
1294
+ children: n.reply
1295
+ })]
1296
+ })
1297
+ ]
1298
+ });
1299
+ }
1300
+ function He({ anchor: e, api: t = "app" }) {
1301
+ let n = P().comments, r = ae(e, t), [a, c] = i("");
1302
+ return /* @__PURE__ */ s("div", {
1303
+ "data-comments": !0,
1304
+ "data-anchor": e,
1305
+ children: [r.threads.map((e) => /* @__PURE__ */ o(Ve, {
1306
+ thread: e,
1307
+ api: r
1308
+ }, e.id)), /* @__PURE__ */ s("form", {
1309
+ "data-comments-new": !0,
1310
+ onSubmit: (e) => {
1311
+ e.preventDefault(), a.trim() !== "" && (r.create(a, { mentions: $(a) }), c(""));
1312
+ },
1313
+ children: [/* @__PURE__ */ o("input", {
1314
+ value: a,
1315
+ onChange: (e) => c(e.target.value),
1316
+ placeholder: n.newPlaceholder,
1317
+ "aria-label": n.newLabel
1318
+ }), /* @__PURE__ */ o("button", {
1319
+ type: "submit",
1320
+ children: n.comment
1321
+ })]
1322
+ })]
1323
+ });
1324
+ }
1105
1325
  //#endregion
1106
- export { K as AgentChat, G as AgentMessageView, W as AgentPartView, pe as AgentStream, me as AppAgent, ue as ApprovalControls, ie as AsyncSelect, j as AutoForm, $ as ConnectAccount, Ee as ConnectAccountFor, _e as DataCopilot, q as DataCopilotAnswer, ve as DataCopilotStream, L as DataTable, de as EditingIndicator, A as Field, ye as FormSkeleton, V as PresenceAvatars, Se as QueryFilters, we as RecordView, be as TableSkeleton, F as UiStringsProvider, D as WidgetRegistryProvider, ce as WorkflowProgress, le as WorkflowStatusBadge, M as defaultUiStrings, T as defaultWidgets, B as initials, H as summarizeEditors, I as useUiStrings, O as useWidget };
1326
+ export { W as AgentChat, U as AgentMessageView, H as AgentPartView, De as AgentStream, Oe as AppAgent, Ce as ApprovalControls, F as AsyncSelect, he as AutoForm, He as CommentsThread, Q as ConnectAccount, ze as ConnectAccountFor, je as DataCopilot, G as DataCopilotAnswer, Me as DataCopilotStream, ye as DataTable, Te as EditingIndicator, j as Field, Ne as FormSkeleton, we as PresenceAvatars, J as QueryFilters, Le as RecordView, Pe as TableSkeleton, _e as UiStringsProvider, fe as WidgetRegistryProvider, xe as WorkflowProgress, Se as WorkflowStatusBadge, M as defaultUiStrings, D as defaultWidgets, z as initials, B as summarizeEditors, P as useUiStrings, k as useWidget };