@voltro/ui 0.52.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 { FORM_KEY_FIELD as c, FORM_REDIRECT_FIELD as l, formActionPath as u, useAgentChat as d, useConnection as f, useDataCopilot as p, useDataTable as m, useFormBinding as h, useFormFlash as g, useFormSkeleton as ee, useQueryField as te, useQueryFilters as ne, useRecord as re, useTableSkeleton as ie, 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
- }, w = (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
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,180 +86,189 @@ 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
- }, E = {
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: w,
120
- checkbox: T,
121
- switch: T,
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
- }, D = e({}), ae = (e) => {
227
- let n = t(D), 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(D.Provider, {
241
+ return /* @__PURE__ */ o(O.Provider, {
232
242
  value: i,
233
243
  children: e.children
234
244
  });
235
- }, O = (e) => t(D)[e] ?? E[e] ?? E.custom, k = e(null), oe = () => {
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
- }, A = (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
264
  }, j = ({ name: e, children: t }) => {
253
- let n = oe(), r = n.fields.find((t) => t.name === e), i = O(r?.widget ?? "custom");
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 = A(n, r);
267
+ let a = me(n, r);
256
268
  return t ? t(a) : /* @__PURE__ */ o(i, { ...a });
257
269
  };
258
- function se(e) {
259
- let t = e.formKey ?? e.mutation, n = g(t), r = h(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
273
  ...e.defaults ? { defaults: e.defaults } : {},
262
274
  ...n === void 0 ? {} : { flash: n }
@@ -265,7 +277,7 @@ function se(e) {
265
277
  t !== void 0 && e.onSuccess && e.onSuccess(t);
266
278
  });
267
279
  };
268
- return /* @__PURE__ */ o(k.Provider, {
280
+ return /* @__PURE__ */ o(A.Provider, {
269
281
  value: r,
270
282
  children: /* @__PURE__ */ s("form", {
271
283
  ...e.action === !1 ? {} : {
@@ -286,7 +298,10 @@ function se(e) {
286
298
  name: l,
287
299
  value: e.redirectTo
288
300
  }),
289
- e.children ? e.children(r) : r.fields.map((e) => /* @__PURE__ */ o(j, { name: e.name }, e.name)),
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)),
290
305
  r.formError === void 0 ? null : /* @__PURE__ */ o("p", {
291
306
  role: "alert",
292
307
  "data-voltro-form-error": "",
@@ -335,6 +350,23 @@ var M = {
335
350
  messageLabel: "Message",
336
351
  send: "Send"
337
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
+ },
338
370
  appAgent: {
339
371
  toolsSummary: (e) => `${e} tools · acts as you`,
340
372
  needsConfirm: "needs confirm"
@@ -363,7 +395,7 @@ var M = {
363
395
  howToGetToken: "How do I get a token?",
364
396
  loading: "Loading…"
365
397
  }
366
- }, N = e(M), ce = (e, t) => ({
398
+ }, N = e(M), ge = (e, t) => ({
367
399
  filters: {
368
400
  ...e.filters,
369
401
  ...t.filters
@@ -388,6 +420,10 @@ var M = {
388
420
  ...e.agentChat,
389
421
  ...t.agentChat
390
422
  },
423
+ comments: {
424
+ ...e.comments,
425
+ ...t.comments
426
+ },
391
427
  appAgent: {
392
428
  ...e.appAgent,
393
429
  ...t.appAgent
@@ -405,15 +441,15 @@ var M = {
405
441
  ...t.connectAccount
406
442
  }
407
443
  });
408
- function le(e) {
409
- let n = t(N), i = r(() => ce(n, e.strings), [n, e.strings]);
444
+ function _e(e) {
445
+ let n = t(N), i = r(() => ge(n, e.strings), [n, e.strings]);
410
446
  return /* @__PURE__ */ o(N.Provider, {
411
447
  value: i,
412
448
  children: e.children
413
449
  });
414
450
  }
415
- var P = () => t(N), ue = (e) => {
416
- let t = te(e.api, e.source, {
451
+ var P = () => t(N), F = (e) => {
452
+ let t = ne(e.api, e.source, {
417
453
  skipUntilTerm: !0,
418
454
  ...e.labelField === void 0 ? {} : { labelField: e.labelField },
419
455
  ...e.valueField === void 0 ? {} : { valueField: e.valueField },
@@ -467,48 +503,48 @@ var P = () => t(N), ue = (e) => {
467
503
  })
468
504
  ]
469
505
  });
470
- }, de = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e), fe = (e, t) => e ? t === "asc" ? "ascending" : "descending" : "none";
471
- function pe(e) {
472
- let { api: t, query: n, emptyText: r, loadingText: i, loadMoreText: c, renderCell: l, rowActions: u, rowKey: d, ...f } = e, p = P().dataTable, h = m(t, n, f);
473
- 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", {
474
510
  "data-voltro-datatable-loading": !0,
475
511
  "aria-busy": "true",
476
512
  children: i ?? "Loading…"
477
- }) : h.rows.length === 0 ? /* @__PURE__ */ o("p", {
513
+ }) : m.rows.length === 0 ? /* @__PURE__ */ o("p", {
478
514
  "data-voltro-datatable-empty": !0,
479
515
  children: r ?? "No rows."
480
516
  }) : /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s("table", {
481
517
  "data-voltro-datatable": n,
482
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [h.columns.map((e) => {
483
- 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";
484
520
  return /* @__PURE__ */ o("th", {
485
- "aria-sort": fe(t, n),
521
+ "aria-sort": ve(t, n),
486
522
  scope: "col",
487
523
  children: /* @__PURE__ */ s("button", {
488
524
  type: "button",
489
- onClick: () => h.toggleSort(e.name),
525
+ onClick: () => m.toggleSort(e.name),
490
526
  children: [e.label, t ? n === "asc" ? " ▲" : " ▼" : ""]
491
527
  })
492
528
  }, e.name);
493
529
  }), u ? /* @__PURE__ */ o("th", {
494
530
  scope: "col",
495
531
  children: p.actions
496
- }) : null] }) }), /* @__PURE__ */ o("tbody", { children: h.rows.map((e, t) => /* @__PURE__ */ s("tr", { children: [h.columns.map((t) => /* @__PURE__ */ o("td", {
532
+ }) : null] }) }), /* @__PURE__ */ o("tbody", { children: m.rows.map((e, t) => /* @__PURE__ */ s("tr", { children: [m.columns.map((t) => /* @__PURE__ */ o("td", {
497
533
  "data-column": t.name,
498
- children: l ? l(e, t) : de(e[t.name])
534
+ children: l ? l(e, t) : I(e[t.name])
499
535
  }, t.name)), u ? /* @__PURE__ */ o("td", { children: u(e) }) : null] }, d ? d(e) : String(e.id ?? t))) })]
500
- }), h.hasMore ? /* @__PURE__ */ o("button", {
536
+ }), m.hasMore ? /* @__PURE__ */ o("button", {
501
537
  type: "button",
502
538
  "data-voltro-datatable-more": !0,
503
- onClick: () => h.loadMore(),
539
+ onClick: () => m.loadMore(),
504
540
  children: c ?? "Load more"
505
541
  }) : null] });
506
542
  }
507
543
  //#endregion
508
544
  //#region src/workflow.tsx
509
- var me = (e) => e === "succeeded" ? "✓" : e === "failed" ? "✗" : "…";
510
- function F(e) {
511
- let { api: t, runId: n, loadingText: r, emptyText: i } = e, a = P().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);
512
548
  return c.loading ? /* @__PURE__ */ o("p", {
513
549
  "data-voltro-workflow-loading": !0,
514
550
  "aria-busy": "true",
@@ -528,7 +564,7 @@ function F(e) {
528
564
  children: [
529
565
  /* @__PURE__ */ o("span", {
530
566
  "aria-hidden": "true",
531
- children: me(e.status)
567
+ children: be(e.status)
532
568
  }),
533
569
  " ",
534
570
  e.stepName,
@@ -553,8 +589,8 @@ function F(e) {
553
589
  })
554
590
  });
555
591
  }
556
- function I(e) {
557
- let { api: t, runId: n } = e, r = P().workflow, i = _(t, n);
592
+ function Se(e) {
593
+ let { api: t, runId: n } = e, r = P().workflow, i = v(t, n);
558
594
  if (i.loading || i.status === void 0) return /* @__PURE__ */ o("span", {
559
595
  "data-voltro-workflow-badge": !0,
560
596
  "data-status": "loading",
@@ -571,7 +607,7 @@ function I(e) {
571
607
  }) : null]
572
608
  });
573
609
  }
574
- function L(e) {
610
+ function Ce(e) {
575
611
  let { when: t, onApprove: n, onReject: r, approveLabel: i, rejectLabel: a, pending: c } = e;
576
612
  return t ? /* @__PURE__ */ s("div", {
577
613
  "data-voltro-approval-controls": !0,
@@ -594,15 +630,15 @@ function L(e) {
594
630
  }
595
631
  //#endregion
596
632
  //#region src/presence.tsx
597
- var R = (e, t) => {
633
+ var L = (e, t) => {
598
634
  let n = e.meta?.[t];
599
635
  return typeof n == "string" ? n : void 0;
600
- }, 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) => {
601
637
  let t = e.trim().split(/\s+/).filter(Boolean);
602
638
  return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
603
639
  };
604
- function he(e) {
605
- let { members: t, max: n = 5, nameOf: r = z, renderAvatar: i } = e, a = P().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;
606
642
  return /* @__PURE__ */ s("div", {
607
643
  "data-voltro-presence-avatars": !0,
608
644
  role: "group",
@@ -613,7 +649,7 @@ function he(e) {
613
649
  "data-avatar": !0,
614
650
  title: t,
615
651
  "aria-label": t,
616
- children: B(t)
652
+ children: z(t)
617
653
  }, e.key);
618
654
  }), l > 0 ? /* @__PURE__ */ s("span", {
619
655
  "data-avatar-overflow": !0,
@@ -622,33 +658,33 @@ function he(e) {
622
658
  }) : null]
623
659
  });
624
660
  }
625
- var V = (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);
626
- function ge(e) {
627
- let { members: t, selfKey: n, field: r, verb: i = "editing", nameOf: a = z } = e, s = P().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));
628
664
  return c.length === 0 ? null : /* @__PURE__ */ o("span", {
629
665
  "data-voltro-editing-indicator": !0,
630
666
  "data-field": r,
631
667
  role: "status",
632
- children: V(c.map(a), i, s)
668
+ children: B(c.map(a), i, s)
633
669
  });
634
670
  }
635
671
  //#endregion
636
672
  //#region src/agentChat.tsx
637
- var H = (e) => typeof e.text == "string" ? e.text : "";
638
- function _e({ text: e }) {
673
+ var V = (e) => typeof e.text == "string" ? e.text : "";
674
+ function Ee({ text: e }) {
639
675
  let t = P().agentChat;
640
676
  return /* @__PURE__ */ s("details", {
641
677
  "data-part": "reasoning",
642
678
  children: [/* @__PURE__ */ o("summary", { children: t.reasoning }), /* @__PURE__ */ o("span", { children: e })]
643
679
  });
644
680
  }
645
- function U({ part: e }) {
681
+ function H({ part: e }) {
646
682
  switch (e.type) {
647
683
  case "text": return /* @__PURE__ */ o("span", {
648
684
  "data-part": "text",
649
- children: H(e)
685
+ children: V(e)
650
686
  });
651
- case "reasoning": return /* @__PURE__ */ o(_e, { text: H(e) });
687
+ case "reasoning": return /* @__PURE__ */ o(Ee, { text: V(e) });
652
688
  case "tool": {
653
689
  let t = e;
654
690
  return /* @__PURE__ */ s("span", {
@@ -688,14 +724,14 @@ function U({ part: e }) {
688
724
  });
689
725
  }
690
726
  }
691
- function W({ message: e }) {
727
+ function U({ message: e }) {
692
728
  let t = e.parts ?? [];
693
729
  return /* @__PURE__ */ s("div", {
694
730
  "data-voltro-agent-message": !0,
695
731
  "data-role": e.role,
696
732
  "data-streaming": e.streaming ? "true" : void 0,
697
733
  "aria-busy": e.streaming ? "true" : void 0,
698
- children: [t.length > 0 ? t.map((e, t) => /* @__PURE__ */ o(U, { part: e }, t)) : /* @__PURE__ */ o("span", {
734
+ children: [t.length > 0 ? t.map((e, t) => /* @__PURE__ */ o(H, { part: e }, t)) : /* @__PURE__ */ o("span", {
699
735
  "data-part": "text",
700
736
  children: e.content
701
737
  }), e.streaming ? /* @__PURE__ */ o("span", {
@@ -705,10 +741,10 @@ function W({ message: e }) {
705
741
  }) : null]
706
742
  });
707
743
  }
708
- function G(e) {
709
- let { api: t, agent: n, threadId: r, placeholder: a, sendLabel: c, emptyText: l } = e, u = P().agentChat, f = d(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 = () => {
710
746
  let e = p.trim();
711
- e.length === 0 || f.sending || (m(""), f.send(e));
747
+ e.length === 0 || d.sending || (m(""), d.send(e));
712
748
  };
713
749
  return /* @__PURE__ */ s("div", {
714
750
  "data-voltro-agent-chat": n,
@@ -716,11 +752,11 @@ function G(e) {
716
752
  "data-messages": !0,
717
753
  role: "log",
718
754
  "aria-live": "polite",
719
- "aria-busy": f.streaming ? "true" : void 0,
720
- 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", {
721
757
  "data-empty": !0,
722
758
  children: l ?? "No messages yet."
723
- }) : f.messages.map((e) => /* @__PURE__ */ o(W, { message: e }, e.id))
759
+ }) : d.messages.map((e) => /* @__PURE__ */ o(U, { message: e }, e.id))
724
760
  }), /* @__PURE__ */ s("form", {
725
761
  "data-composer": !0,
726
762
  onSubmit: (e) => {
@@ -731,22 +767,22 @@ function G(e) {
731
767
  onChange: (e) => m(e.target.value),
732
768
  placeholder: a ?? u.messagePlaceholder,
733
769
  "aria-label": u.messageLabel,
734
- disabled: f.sending
770
+ disabled: d.sending
735
771
  }), /* @__PURE__ */ o("button", {
736
772
  type: "submit",
737
- disabled: f.sending || p.trim().length === 0,
773
+ disabled: d.sending || p.trim().length === 0,
738
774
  children: c ?? u.send
739
775
  })]
740
776
  })]
741
777
  });
742
778
  }
743
- function ve(e) {
744
- let t = d(e.api, e.agent, { threadId: e.threadId });
779
+ function De(e) {
780
+ let t = f(e.api, e.agent, { threadId: e.threadId });
745
781
  return e.children(t);
746
782
  }
747
783
  //#endregion
748
784
  //#region src/appAgent.tsx
749
- function ye(e) {
785
+ function Oe(e) {
750
786
  let { tools: t, showTools: n, ...r } = e, i = P().appAgent, a = (n ?? (t !== void 0 && t.length > 0)) && t && t.length > 0;
751
787
  return /* @__PURE__ */ s("div", {
752
788
  "data-voltro-app-agent": r.agent,
@@ -767,17 +803,17 @@ function ye(e) {
767
803
  }) : null
768
804
  ]
769
805
  }, e.name)) })]
770
- }) : null, /* @__PURE__ */ o(G, { ...r })]
806
+ }) : null, /* @__PURE__ */ o(W, { ...r })]
771
807
  });
772
808
  }
773
809
  //#endregion
774
810
  //#region src/dataCopilot.tsx
775
- var be = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : typeof e == "object" ? JSON.stringify(e) : String(e), xe = (e) => {
811
+ var ke = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : typeof e == "object" ? JSON.stringify(e) : String(e), Ae = (e) => {
776
812
  let t = /* @__PURE__ */ new Set(), n = [];
777
813
  for (let r of e) for (let e of Object.keys(r)) t.has(e) || (t.add(e), n.push(e));
778
814
  return n;
779
815
  };
780
- function K(e) {
816
+ function G(e) {
781
817
  let { answer: t, emptyText: n } = e;
782
818
  if (t === void 0) return null;
783
819
  if (!t.ok) return /* @__PURE__ */ o("p", {
@@ -789,7 +825,7 @@ function K(e) {
789
825
  "data-voltro-data-copilot-empty": !0,
790
826
  children: n ?? "No rows."
791
827
  });
792
- let r = xe(t.rows);
828
+ let r = Ae(t.rows);
793
829
  return /* @__PURE__ */ s("table", {
794
830
  "data-voltro-data-copilot-results": !0,
795
831
  children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
@@ -797,12 +833,12 @@ function K(e) {
797
833
  children: e
798
834
  }, e)) }) }), /* @__PURE__ */ o("tbody", { children: t.rows.map((e, t) => /* @__PURE__ */ o("tr", { children: r.map((t) => /* @__PURE__ */ o("td", {
799
835
  "data-column": t,
800
- children: be(e[t])
836
+ children: ke(e[t])
801
837
  }, t)) }, String(e.id ?? t))) })]
802
838
  });
803
839
  }
804
- function Se(e) {
805
- let { api: t, action: n, placeholder: r, askLabel: a, emptyText: c } = e, l = p(t, n), [u, d] = i(""), f = () => {
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 = () => {
806
842
  let e = u.trim();
807
843
  e.length === 0 || l.pending || l.ask(e);
808
844
  };
@@ -828,7 +864,7 @@ function Se(e) {
828
864
  "data-answer": !0,
829
865
  "aria-live": "polite",
830
866
  "aria-busy": l.pending ? "true" : void 0,
831
- children: l.error === void 0 ? /* @__PURE__ */ o(K, {
867
+ children: l.error === void 0 ? /* @__PURE__ */ o(G, {
832
868
  answer: l.answer,
833
869
  ...c === void 0 ? {} : { emptyText: c }
834
870
  }) : /* @__PURE__ */ o("p", {
@@ -839,13 +875,13 @@ function Se(e) {
839
875
  })]
840
876
  });
841
877
  }
842
- function Ce(e) {
843
- let t = p(e.api, e.action);
878
+ function Me(e) {
879
+ let t = m(e.api, e.action);
844
880
  return e.children(t);
845
881
  }
846
882
  //#endregion
847
883
  //#region src/skeleton.tsx
848
- var q = ({ w: e }) => /* @__PURE__ */ o("span", {
884
+ var K = ({ w: e }) => /* @__PURE__ */ o("span", {
849
885
  "data-skeleton-bar": !0,
850
886
  style: {
851
887
  display: "inline-block",
@@ -855,19 +891,29 @@ var q = ({ w: e }) => /* @__PURE__ */ o("span", {
855
891
  },
856
892
  "aria-hidden": "true"
857
893
  });
858
- function we(e) {
859
- let t = ee(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
+ }];
860
900
  return /* @__PURE__ */ o("div", {
861
901
  "data-voltro-form-skeleton": e.mutation,
862
902
  "aria-busy": "true",
863
903
  "aria-hidden": "true",
864
- children: r.map((e) => /* @__PURE__ */ s("div", {
865
- "data-skeleton-field": !0,
866
- children: [/* @__PURE__ */ o(q, { w: "30%" }), /* @__PURE__ */ o(q, {})]
867
- }, 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}`))
868
914
  });
869
915
  }
870
- function Te(e) {
916
+ function Pe(e) {
871
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;
872
918
  return /* @__PURE__ */ s("table", {
873
919
  "data-voltro-table-skeleton": e.query,
@@ -875,17 +921,17 @@ function Te(e) {
875
921
  "aria-hidden": "true",
876
922
  children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
877
923
  scope: "col",
878
- children: /* @__PURE__ */ o(q, { w: "60%" })
924
+ children: /* @__PURE__ */ o(K, { w: "60%" })
879
925
  }, e)) }) }), /* @__PURE__ */ o("tbody", { children: Array.from({ length: i }, (e, t) => /* @__PURE__ */ o("tr", {
880
926
  "data-skeleton-row": !0,
881
- children: r.map((e) => /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(q, {}) }, e))
927
+ children: r.map((e) => /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(K, {}) }, e))
882
928
  }, t)) })]
883
929
  });
884
930
  }
885
931
  //#endregion
886
932
  //#region src/filters.tsx
887
- var J = (e) => e == null ? "" : String(e);
888
- function Y(e) {
933
+ var q = (e) => e == null ? "" : String(e);
934
+ function Fe(e) {
889
935
  let { filter: t, value: n, onChange: r } = e, i = P().filters, a = {
890
936
  "data-filter": t.name,
891
937
  "aria-label": t.label
@@ -893,7 +939,7 @@ function Y(e) {
893
939
  switch (t.kind) {
894
940
  case "select": return /* @__PURE__ */ s("select", {
895
941
  ...a,
896
- value: J(n),
942
+ value: q(n),
897
943
  onChange: (e) => r(e.target.value || void 0),
898
944
  children: [/* @__PURE__ */ o("option", {
899
945
  value: "",
@@ -928,7 +974,7 @@ function Y(e) {
928
974
  children: [/* @__PURE__ */ o("input", {
929
975
  "aria-label": `${t.label} from`,
930
976
  type: e,
931
- value: J(i.gte),
977
+ value: q(i.gte),
932
978
  onChange: (e) => r({
933
979
  ...i,
934
980
  gte: e.target.value || void 0
@@ -936,7 +982,7 @@ function Y(e) {
936
982
  }), /* @__PURE__ */ o("input", {
937
983
  "aria-label": `${t.label} to`,
938
984
  type: e,
939
- value: J(i.lte),
985
+ value: q(i.lte),
940
986
  onChange: (e) => r({
941
987
  ...i,
942
988
  lte: e.target.value || void 0
@@ -947,13 +993,13 @@ function Y(e) {
947
993
  default: return /* @__PURE__ */ o("input", {
948
994
  ...a,
949
995
  type: "text",
950
- value: J(n),
996
+ value: q(n),
951
997
  onChange: (e) => r(e.target.value || void 0)
952
998
  });
953
999
  }
954
1000
  }
955
- function Ee(e) {
956
- let t = ne(e.api, e.query, e.initial ? { initial: e.initial } : {}), n = P().filters;
1001
+ function J(e) {
1002
+ let t = re(e.api, e.query, e.initial ? { initial: e.initial } : {}), n = P().filters;
957
1003
  return /* @__PURE__ */ s("div", {
958
1004
  "data-voltro-query-filters": e.query,
959
1005
  children: [/* @__PURE__ */ s("div", {
@@ -963,7 +1009,7 @@ function Ee(e) {
963
1009
  children: [
964
1010
  t.filters.map((e) => /* @__PURE__ */ s("label", {
965
1011
  "data-filter-label": !0,
966
- children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o(Y, {
1012
+ children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o(Fe, {
967
1013
  filter: e,
968
1014
  value: t.values[e.name],
969
1015
  onChange: (n) => t.setFilter(e.name, n)
@@ -985,25 +1031,25 @@ function Ee(e) {
985
1031
  }
986
1032
  //#endregion
987
1033
  //#region src/recordView.tsx
988
- 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);
989
- function De({ name: e, items: t }) {
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 }) {
990
1036
  let n = P().recordView;
991
1037
  if (t.length === 0) return /* @__PURE__ */ o("p", {
992
1038
  "data-relation": e,
993
1039
  "data-empty": !0,
994
- children: n.emptyRelation(X(e).toLowerCase())
1040
+ children: n.emptyRelation(Y(e).toLowerCase())
995
1041
  });
996
1042
  let r = Object.keys(t[0]);
997
1043
  return /* @__PURE__ */ s("table", {
998
1044
  "data-relation": e,
999
1045
  children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
1000
1046
  scope: "col",
1001
- children: X(e)
1002
- }, 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))) })]
1003
1049
  });
1004
1050
  }
1005
- function Oe(e) {
1006
- let { api: t, query: n, input: r, fields: i, renderField: a, renderRelation: c, loadingText: l, emptyText: u } = e, { record: d, loading: f } = re(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 ?? {});
1007
1053
  if (f) return /* @__PURE__ */ o("p", {
1008
1054
  "data-voltro-record-loading": !0,
1009
1055
  "aria-busy": "true",
@@ -1013,18 +1059,18 @@ function Oe(e) {
1013
1059
  "data-voltro-record-empty": !0,
1014
1060
  children: u ?? "Not found."
1015
1061
  });
1016
- 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));
1017
1063
  return /* @__PURE__ */ s("div", {
1018
1064
  "data-voltro-record-view": n,
1019
1065
  children: [/* @__PURE__ */ o("dl", {
1020
1066
  "data-record-fields": !0,
1021
1067
  children: g.map(([e, t]) => /* @__PURE__ */ s("div", {
1022
1068
  "data-field": e,
1023
- 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) })]
1024
1070
  }, e))
1025
1071
  }), h.map(([e, t]) => /* @__PURE__ */ s("section", {
1026
1072
  "data-record-relation": e,
1027
- children: [/* @__PURE__ */ o("h3", { children: X(e) }), c ? c(e, t, d) : /* @__PURE__ */ o(De, {
1073
+ children: [/* @__PURE__ */ o("h3", { children: Y(e) }), c ? c(e, t, d) : /* @__PURE__ */ o(Ie, {
1028
1074
  name: e,
1029
1075
  items: t
1030
1076
  })]
@@ -1033,7 +1079,7 @@ function Oe(e) {
1033
1079
  }
1034
1080
  //#endregion
1035
1081
  //#region src/connectAccount.tsx
1036
- var ke = (e, t) => {
1082
+ var Re = (e, t) => {
1037
1083
  switch (e.status) {
1038
1084
  case "connected": return e.accountLabel === null ? t.connected : t.connectedAs(e.accountLabel);
1039
1085
  case "expired": return t.expired;
@@ -1041,14 +1087,14 @@ var ke = (e, t) => {
1041
1087
  case "error": return t.errored;
1042
1088
  default: return t.notConnected;
1043
1089
  }
1044
- }, Ae = ({ api: e, connectionId: t, ...n }) => {
1045
- let r = f(e, t);
1046
- return /* @__PURE__ */ o($, {
1090
+ }, ze = ({ api: e, connectionId: t, ...n }) => {
1091
+ let r = p(e, t);
1092
+ return /* @__PURE__ */ o(Q, {
1047
1093
  connection: r,
1048
1094
  loading: r.loading,
1049
1095
  ...n
1050
1096
  });
1051
- }, $ = ({ connection: e, instructionsUrl: t, loading: n = !1, children: r, className: c }) => {
1097
+ }, Q = ({ connection: e, instructionsUrl: t, loading: n = !1, children: r, className: c }) => {
1052
1098
  let l = P().connectAccount, [u, d] = i("");
1053
1099
  if (r !== void 0) return r(e);
1054
1100
  if (n) return /* @__PURE__ */ o("div", {
@@ -1068,7 +1114,7 @@ var ke = (e, t) => {
1068
1114
  " — ",
1069
1115
  /* @__PURE__ */ o("span", {
1070
1116
  role: e.needsAttention ? "alert" : void 0,
1071
- children: ke(e, l)
1117
+ children: Re(e, l)
1072
1118
  })
1073
1119
  ] }), e.connected || e.needsAttention ? /* @__PURE__ */ s(a, { children: [e.needsAttention && e.kind === "oauth2" && /* @__PURE__ */ o("button", {
1074
1120
  type: "button",
@@ -1124,6 +1170,157 @@ var ke = (e, t) => {
1124
1170
  ]
1125
1171
  })]
1126
1172
  });
1127
- };
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
+ }
1128
1325
  //#endregion
1129
- export { G as AgentChat, W as AgentMessageView, U as AgentPartView, ve as AgentStream, ye as AppAgent, L as ApprovalControls, ue as AsyncSelect, se as AutoForm, $ as ConnectAccount, Ae as ConnectAccountFor, Se as DataCopilot, K as DataCopilotAnswer, Ce as DataCopilotStream, pe as DataTable, ge as EditingIndicator, j as Field, we as FormSkeleton, he as PresenceAvatars, Ee as QueryFilters, Oe as RecordView, Te as TableSkeleton, le as UiStringsProvider, ae as WidgetRegistryProvider, F as WorkflowProgress, I as WorkflowStatusBadge, M as defaultUiStrings, E as defaultWidgets, B as initials, V as summarizeEditors, P 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 };