@nivaro/react 0.3.138 → 0.3.140

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +36 -2
  5. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  6. package/dist/shared/components/BroadcastView.js +213 -211
  7. package/dist/shared/components/CollectionBrowserView.js +2677 -2658
  8. package/dist/shared/components/ConfigHistory.js +45 -45
  9. package/dist/shared/components/ConformanceView.js +110 -110
  10. package/dist/shared/components/DataTable.js +51 -51
  11. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  12. package/dist/shared/components/ItemEditForm.js +3038 -3027
  13. package/dist/shared/components/LiveCount.js +27 -23
  14. package/dist/shared/components/LiveTraceView.js +62 -61
  15. package/dist/shared/components/PageRenderer.js +422 -410
  16. package/dist/shared/components/ProfileView.js +199 -199
  17. package/dist/shared/components/QualityRulesView.js +70 -70
  18. package/dist/shared/components/QueryTable.js +131 -130
  19. package/dist/shared/components/RecordGraph.js +98 -98
  20. package/dist/shared/components/RecordReadView.js +287 -288
  21. package/dist/shared/components/ReportView.js +1279 -1259
  22. package/dist/shared/components/SlaRulesView.js +73 -74
  23. package/dist/shared/components/WidgetSlot.js +73 -73
  24. package/dist/shared/components/ai/AiChart.js +36 -32
  25. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  26. package/dist/shared/components/ai/TaskDo.js +87 -87
  27. package/dist/shared/components/ai/answer-formats.js +37 -30
  28. package/dist/shared/components/ai/call-log/format.js +17 -16
  29. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  30. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  31. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  32. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  33. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  34. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  35. package/dist/shared/components/cbv/column-totals.js +53 -51
  36. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  37. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  38. package/dist/shared/components/command-center/announce.js +7 -6
  39. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  40. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  41. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  42. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  43. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  44. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  45. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  46. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  47. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  48. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  49. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  50. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  51. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  52. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  53. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  54. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  55. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  56. package/dist/shared/components/item-edit/InlineTableField.js +1167 -1153
  57. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  58. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  59. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  60. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  61. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  62. package/dist/shared/components/ops-report/format.js +37 -36
  63. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  64. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  65. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  66. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  67. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  68. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  69. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  70. package/dist/shared/components/profile/DelegationCard.js +13 -12
  71. package/dist/shared/components/profile/PersonActivity.js +48 -48
  72. package/dist/shared/components/profile/PersonExtras.js +107 -107
  73. package/dist/shared/components/profile/PersonWeek.js +9 -9
  74. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  75. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  76. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  77. package/dist/shared/components/queue/QueueWorklist.js +671 -670
  78. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  79. package/dist/shared/components/support/RequestList.js +121 -121
  80. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  81. package/dist/shared/lib/activity-sentence.js +316 -278
  82. package/dist/shared/lib/format-value.js +5 -4
  83. package/dist/shared/lib/number-format.js +87 -0
  84. package/dist/shared/lib/number-kind.js +133 -0
  85. package/dist/shared/lib/utils.js +24 -20
  86. package/dist/shared/lib/watch-list.js +1 -1
  87. package/dist/shared/lib/widget-value-format.js +26 -12
  88. package/package.json +1 -1
@@ -86,11 +86,11 @@ const te = {
86
86
  MoreHorizontal: mt,
87
87
  MoreVertical: pt
88
88
  };
89
- function qe({ awaiting: n, dark: i }) {
89
+ function qe({ awaiting: n, dark: a }) {
90
90
  return /* @__PURE__ */ x(
91
91
  "span",
92
92
  {
93
- className: `text-[12px] font-normal italic ${i ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
93
+ className: `text-[12px] font-normal italic ${a ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
94
94
  "data-widget-awaiting": n,
95
95
  "data-tip": `Waiting for ${n} — this figure is scoped to it and shows once it is set`,
96
96
  children: [
@@ -102,12 +102,12 @@ function qe({ awaiting: n, dark: i }) {
102
102
  }
103
103
  function Re({
104
104
  label: n,
105
- value: i,
106
- display: a,
105
+ value: a,
106
+ display: i,
107
107
  loading: l,
108
108
  awaiting: u
109
109
  }) {
110
- const { prefix: g, suffix: v } = fe(i, a), b = l ? null : pe(i, a.format ?? "");
110
+ const { prefix: g, suffix: v } = fe(a, i), b = l ? null : pe(a, i.format ?? "", i);
111
111
  return (
112
112
  // Same label / value vocabulary as a field tile in the record sub-header
113
113
  // (lib/header-strip.ts) — the two kinds of cell read as one row.
@@ -122,10 +122,10 @@ function Re({
122
122
  {
123
123
  "data-header-value": !0,
124
124
  className: `${Lr} max-w-[232px] items-baseline truncate leading-tight`,
125
- children: l ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : u && i == null ? /* @__PURE__ */ t(qe, { awaiting: u }) : /* @__PURE__ */ x(
125
+ children: l ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : u && a == null ? /* @__PURE__ */ t(qe, { awaiting: u }) : /* @__PURE__ */ x(
126
126
  "span",
127
127
  {
128
- className: String(a.format ?? "").startsWith("currency") || /^[$€£¥]/.test(g) ? Cr : $r,
128
+ className: String(i.format ?? "").startsWith("currency") || /^[$€£¥]/.test(g) ? Cr : $r,
129
129
  children: [
130
130
  g,
131
131
  b,
@@ -142,8 +142,8 @@ function Re({
142
142
  }
143
143
  function Mr({
144
144
  data: n,
145
- label: i,
146
- loading: a,
145
+ label: a,
146
+ loading: i,
147
147
  widgetConfig: l,
148
148
  awaiting: u
149
149
  }) {
@@ -162,12 +162,12 @@ function Mr({
162
162
  R
163
163
  )) });
164
164
  }
165
- if (a) {
166
- const b = (l == null ? void 0 : l.value_fields) ?? [], _ = b.length > 0 ? b : [{ label: i }];
165
+ if (i) {
166
+ const b = (l == null ? void 0 : l.value_fields) ?? [], _ = b.length > 0 ? b : [{ label: a }];
167
167
  return /* @__PURE__ */ t("div", { className: g, children: _.map((R, C) => /* @__PURE__ */ t(
168
168
  Re,
169
169
  {
170
- label: R.label ?? i,
170
+ label: R.label ?? a,
171
171
  display: { prefix: R.prefix ?? "", suffix: R.suffix ?? "", format: R.format ?? "" },
172
172
  loading: !0
173
173
  },
@@ -179,7 +179,7 @@ function Mr({
179
179
  return /* @__PURE__ */ t("div", { className: g, children: /* @__PURE__ */ t(
180
180
  Re,
181
181
  {
182
- label: i,
182
+ label: a,
183
183
  value: n.value,
184
184
  display: v,
185
185
  loading: !1,
@@ -187,35 +187,35 @@ function Mr({
187
187
  }
188
188
  ) });
189
189
  }
190
- function Hr(n, i) {
191
- if (Object.hasOwn(n, i)) return n[i] ?? null;
192
- const a = i.split(".");
190
+ function Hr(n, a) {
191
+ if (Object.hasOwn(n, a)) return n[a] ?? null;
192
+ const i = a.split(".");
193
193
  let l = n;
194
- for (const u of a) {
194
+ for (const u of i) {
195
195
  if (l == null || typeof l != "object") return l ?? null;
196
196
  l = l[u];
197
197
  }
198
198
  return l ?? null;
199
199
  }
200
- function Br(n, i) {
201
- const a = {};
200
+ function Br(n, a) {
201
+ const i = {};
202
202
  for (const l of n)
203
203
  if (l.binding_type === "item_field")
204
- a[l.key] = Hr(i, l.binding_value);
204
+ i[l.key] = Hr(a, l.binding_value);
205
205
  else if (l.binding_type === "static")
206
- a[l.key] = l.binding_value;
206
+ i[l.key] = l.binding_value;
207
207
  else if (l.binding_type === "url_param" && typeof window < "u") {
208
208
  const u = new URLSearchParams(window.location.search);
209
- a[l.key] = u.get(l.binding_value) ?? null;
209
+ i[l.key] = u.get(l.binding_value) ?? null;
210
210
  }
211
- return a;
211
+ return i;
212
212
  }
213
213
  function Le({
214
214
  data: n,
215
- awaiting: i
215
+ awaiting: a
216
216
  }) {
217
- if (i && n.value == null) return /* @__PURE__ */ t(qe, { awaiting: i });
218
- const a = n.display ?? {}, { prefix: l, suffix: u } = fe(n.value, a), g = pe(n.value, a.format ?? "");
217
+ if (a && n.value == null) return /* @__PURE__ */ t(qe, { awaiting: a });
218
+ const i = n.display ?? {}, { prefix: l, suffix: u } = fe(n.value, i), g = pe(n.value, i.format ?? "", i);
219
219
  return /* @__PURE__ */ x("div", { className: "flex items-baseline gap-1", children: [
220
220
  l && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: l }),
221
221
  /* @__PURE__ */ t("span", { className: "text-2xl font-semibold text-slate-900 dark:text-slate-100", children: g }),
@@ -224,13 +224,13 @@ function Le({
224
224
  }
225
225
  function Ce({
226
226
  label: n,
227
- value: i,
228
- display: a,
227
+ value: a,
228
+ display: i,
229
229
  dark: l,
230
230
  loading: u,
231
231
  awaiting: g
232
232
  }) {
233
- const { prefix: v, suffix: b } = fe(i, a), _ = u ? null : pe(i, a.format ?? "");
233
+ const { prefix: v, suffix: b } = fe(a, i), _ = u ? null : pe(a, i.format ?? "", i);
234
234
  return /* @__PURE__ */ x("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
235
235
  /* @__PURE__ */ t(
236
236
  "span",
@@ -248,7 +248,7 @@ function Ce({
248
248
  {
249
249
  className: `animate-pulse inline-block h-3 w-14 rounded ${l ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
250
250
  }
251
- ) : g && i == null ? /* @__PURE__ */ t(qe, { awaiting: g, dark: l }) : /* @__PURE__ */ x(Ee, { children: [
251
+ ) : g && a == null ? /* @__PURE__ */ t(qe, { awaiting: g, dark: l }) : /* @__PURE__ */ x(Ee, { children: [
252
252
  v && /* @__PURE__ */ t("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: v }),
253
253
  _,
254
254
  b && /* @__PURE__ */ t("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: b })
@@ -259,13 +259,13 @@ function Ce({
259
259
  }
260
260
  function Vr({
261
261
  data: n,
262
- label: i,
263
- style: a,
262
+ label: a,
263
+ style: i,
264
264
  loading: l,
265
265
  widgetConfig: u,
266
266
  awaiting: g
267
267
  }) {
268
- const v = a === "pill-dark", b = v ? "flex items-stretch divide-x divide-slate-700 rounded-md bg-slate-800/90 border border-slate-700 overflow-hidden" : "flex items-stretch divide-x divide-slate-200 rounded-md bg-white border border-slate-200 overflow-hidden dark:bg-card dark:border-border dark:divide-border";
268
+ const v = i === "pill-dark", b = v ? "flex items-stretch divide-x divide-slate-700 rounded-md bg-slate-800/90 border border-slate-700 overflow-hidden" : "flex items-stretch divide-x divide-slate-200 rounded-md bg-white border border-slate-200 overflow-hidden dark:bg-card dark:border-border dark:divide-border";
269
269
  if (n && "values" in n) {
270
270
  const R = n.values ?? [];
271
271
  return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: b, children: R.map((C, S) => /* @__PURE__ */ t(
@@ -282,11 +282,11 @@ function Vr({
282
282
  )) });
283
283
  }
284
284
  if (l) {
285
- const R = (u == null ? void 0 : u.value_fields) ?? [], C = R.length > 0 ? R : [{ label: i }];
285
+ const R = (u == null ? void 0 : u.value_fields) ?? [], C = R.length > 0 ? R : [{ label: a }];
286
286
  return /* @__PURE__ */ t("div", { className: b, children: C.map((S, U) => /* @__PURE__ */ t(
287
287
  Ce,
288
288
  {
289
- label: S.label ?? i,
289
+ label: S.label ?? a,
290
290
  display: { prefix: S.prefix ?? "", suffix: S.suffix ?? "", format: S.format ?? "" },
291
291
  dark: v,
292
292
  loading: !0
@@ -299,7 +299,7 @@ function Vr({
299
299
  return /* @__PURE__ */ t("div", { className: b, children: /* @__PURE__ */ t(
300
300
  Ce,
301
301
  {
302
- label: i,
302
+ label: a,
303
303
  value: n.value,
304
304
  display: _,
305
305
  dark: v,
@@ -309,20 +309,20 @@ function Vr({
309
309
  ) });
310
310
  }
311
311
  function rt({ data: n }) {
312
- const i = n.values ?? [];
313
- return i.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
312
+ const a = n.values ?? [];
313
+ return a.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
314
314
  "div",
315
315
  {
316
316
  className: "grid gap-3",
317
- style: { gridTemplateColumns: `repeat(${Math.min(i.length, 3)}, minmax(0, 1fr))` },
318
- children: i.map((a, l) => {
317
+ style: { gridTemplateColumns: `repeat(${Math.min(a.length, 3)}, minmax(0, 1fr))` },
318
+ children: a.map((i, l) => {
319
319
  var b;
320
- const { prefix: u, suffix: g } = fe(a.value, a.display), v = ((b = a.display) == null ? void 0 : b.format) ?? "";
320
+ const { prefix: u, suffix: g } = fe(i.value, i.display), v = ((b = i.display) == null ? void 0 : b.format) ?? "";
321
321
  return /* @__PURE__ */ x("div", { className: "flex flex-col gap-0.5", children: [
322
- a.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: a.label }),
322
+ i.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: i.label }),
323
323
  /* @__PURE__ */ x("div", { className: "flex items-baseline gap-0.5", children: [
324
324
  u && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: u }),
325
- /* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: pe(a.value, v) }),
325
+ /* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: pe(i.value, v, i.display) }),
326
326
  g && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: g })
327
327
  ] })
328
328
  ] }, l);
@@ -331,23 +331,23 @@ function rt({ data: n }) {
331
331
  );
332
332
  }
333
333
  function Fr({ data: n }) {
334
- const i = n.rows ?? [], a = n.fields ?? [];
335
- return i.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ x("table", { className: "w-full text-[12px]", children: [
336
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: a.map((l) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: l }, l)) }) }),
337
- /* @__PURE__ */ t("tbody", { children: i.map((l, u) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: a.map((g) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(l[g] ?? "") }, g)) }, u)) })
334
+ const a = n.rows ?? [], i = n.fields ?? [];
335
+ return a.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ x("table", { className: "w-full text-[12px]", children: [
336
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: i.map((l) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: l }, l)) }) }),
337
+ /* @__PURE__ */ t("tbody", { children: a.map((l, u) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: i.map((g) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(l[g] ?? "") }, g)) }, u)) })
338
338
  ] }) });
339
339
  }
340
340
  function nt({
341
341
  data: n,
342
- widgetId: i,
343
- inputs: a,
342
+ widgetId: a,
343
+ inputs: i,
344
344
  apiBase: l,
345
345
  onAction: u
346
346
  }) {
347
347
  const g = n.buttons ?? [], [v, b] = B(null), _ = Te(), R = async (C) => {
348
348
  b(C);
349
349
  try {
350
- const S = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", E = (await (await fetch(`${l}/widgets-internal/${i}/action`, {
350
+ const S = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", E = (await (await fetch(`${l}/widgets-internal/${a}/action`, {
351
351
  method: "POST",
352
352
  headers: {
353
353
  "Content-Type": "application/json",
@@ -355,7 +355,7 @@ function nt({
355
355
  ...S ? { "x-workspace": S } : {}
356
356
  },
357
357
  credentials: _.credentials,
358
- body: JSON.stringify({ button_index: C, inputs: a })
358
+ body: JSON.stringify({ button_index: C, inputs: i })
359
359
  })).json()).data;
360
360
  if (E != null && E.redirect_url)
361
361
  try {
@@ -386,8 +386,8 @@ function nt({
386
386
  const Kr = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
387
387
  function $e({
388
388
  buttons: n,
389
- layout: i,
390
- widgetId: a,
389
+ layout: a,
390
+ widgetId: i,
391
391
  inputs: l,
392
392
  apiBase: u,
393
393
  onClientAction: g
@@ -418,7 +418,7 @@ function $e({
418
418
  const d = e.id ?? String(f);
419
419
  R(d);
420
420
  try {
421
- const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", w = (await (await fetch(`${u}/widgets-internal/${a}/action`, {
421
+ const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", w = (await (await fetch(`${u}/widgets-internal/${i}/action`, {
422
422
  method: "POST",
423
423
  headers: {
424
424
  "Content-Type": "application/json",
@@ -504,7 +504,7 @@ function $e({
504
504
  );
505
505
  }
506
506
  if (n.length === 0) return null;
507
- if (i === "split" && n.length > 1) {
507
+ if (a === "split" && n.length > 1) {
508
508
  const [e, ...f] = n, d = e.id ?? "0", p = _ === d, q = e.action === "none" || !e.action;
509
509
  let P = e.label ?? "Button", w = e.variant ?? "default";
510
510
  const k = e.action_config, M = e.toggle_input || (k == null ? void 0 : k.toggle_input) || (k == null ? void 0 : k.field) || "";
@@ -618,11 +618,11 @@ function $e({
618
618
  }
619
619
  return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: n.map((e, f) => le(e, f)) });
620
620
  }
621
- function st(n, i) {
621
+ function st(n, a) {
622
622
  var l;
623
- if (i == null) return { next: n, moved: !1 };
624
- const a = ((l = i == null ? void 0 : i.instance) == null ? void 0 : l.current_state) ?? null;
625
- return { next: a, moved: n !== void 0 && n !== a };
623
+ if (a == null) return { next: n, moved: !1 };
624
+ const i = ((l = a == null ? void 0 : a.instance) == null ? void 0 : l.current_state) ?? null;
625
+ return { next: i, moved: n !== void 0 && n !== i };
626
626
  }
627
627
  const Gr = 5e3, Jr = /* @__PURE__ */ new Set([
628
628
  se.comments,
@@ -632,15 +632,15 @@ const Gr = 5e3, Jr = /* @__PURE__ */ new Set([
632
632
  // A move refreshes widgets through the host's pipeline read (hostStepChange below).
633
633
  se.state
634
634
  ]);
635
- function Qr(n, i) {
635
+ function Qr(n, a) {
636
636
  return n.deleted ? !1 : n.changedFields === null ? !0 : n.changedFields.some(
637
- (a) => a.startsWith("$") ? !Jr.has(a) : !i.has(a)
637
+ (i) => i.startsWith("$") ? !Jr.has(i) : !a.has(i)
638
638
  );
639
639
  }
640
640
  function _n({
641
641
  widgetId: n,
642
- inputBindings: i = [],
643
- itemDraft: a = {},
642
+ inputBindings: a = [],
643
+ itemDraft: i = {},
644
644
  itemCollection: l,
645
645
  ready: u = !0,
646
646
  label: g,
@@ -696,9 +696,9 @@ function _n({
696
696
  c && clearTimeout(c), O();
697
697
  };
698
698
  }, [ae, r == null ? void 0 : r.widget_type]);
699
- const ge = a.id, je = F(/* @__PURE__ */ new Set());
700
- je.current = new Set(Object.keys(a));
701
- const at = !!r && (r.widget_type === "rollup" || r.widget_type === "review_list" || r.widget_type === "custom-query" || i.length > 0), ye = F(!1), re = F(null), Oe = F(0), Ie = F(K);
699
+ const ge = i.id, je = F(/* @__PURE__ */ new Set());
700
+ je.current = new Set(Object.keys(i));
701
+ const at = !!r && (r.widget_type === "rollup" || r.widget_type === "review_list" || r.widget_type === "custom-query" || a.length > 0), ye = F(!1), re = F(null), Oe = F(0), Ie = F(K);
702
702
  Ie.current = K;
703
703
  const we = Ne(() => {
704
704
  if (!Ie.current) {
@@ -727,9 +727,9 @@ function _n({
727
727
  []
728
728
  );
729
729
  const De = {};
730
- for (const [s, c] of Object.entries(a))
730
+ for (const [s, c] of Object.entries(i))
731
731
  s.includes(".") || (c == null || typeof c != "object") && (De[s] = c);
732
- const D = { ...De, ...Br(i, a) }, xe = Ir(), z = Je(() => {
732
+ const D = { ...De, ...Br(a, i) }, xe = Ir(), z = Je(() => {
733
733
  if ((r == null ? void 0 : r.widget_type) !== "rollup" || !xe) return null;
734
734
  const s = r.config, c = s == null ? void 0 : s.collection;
735
735
  if (!c) return null;
@@ -780,10 +780,10 @@ function _n({
780
780
  }));
781
781
  };
782
782
  if (D.record_id == null || D.record_id === "") {
783
- const s = a.id;
783
+ const s = i.id;
784
784
  s != null && s !== "" && (D.record_id = s);
785
785
  }
786
- Q.current = a.id ?? null;
786
+ Q.current = i.id ?? null;
787
787
  const ct = JSON.stringify(D) + (l ?? "") + ot, ut = vr(ct, 400);
788
788
  function We() {
789
789
  const s = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
@@ -825,8 +825,8 @@ function _n({
825
825
  try {
826
826
  const m = {
827
827
  inputs: z ? { ...D, staged: z } : D,
828
- draft: a,
829
- bindings: i,
828
+ draft: i,
829
+ bindings: a,
830
830
  item_collection: l
831
831
  };
832
832
  $.current && (m.refresh = !0, $.current = !1), L(m);
@@ -881,7 +881,7 @@ function _n({
881
881
  const s = o == null ? void 0 : o.awaiting;
882
882
  if (!Array.isArray(s) || s.length === 0) return null;
883
883
  const c = s.map((m) => {
884
- const O = i.find((h) => h.key === m && h.binding_type === "item_field");
884
+ const O = a.find((h) => h.key === m && h.binding_type === "item_field");
885
885
  return String((O == null ? void 0 : O.binding_value) ?? m).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (h) => h.toUpperCase());
886
886
  });
887
887
  return [...new Set(c)].join(", ");
@@ -1,7 +1,7 @@
1
- import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
- import { useState as v, useCallback as C } from "react";
3
- import { PieChart as x, Pie as S, Cell as w, Tooltip as f, LineChart as p, CartesianGrid as u, XAxis as b, YAxis as s, Line as L, BarChart as R, Bar as z } from "recharts";
4
- import { cn as K } from "../../lib/utils.js";
1
+ import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
+ import { useState as v, useCallback as S } from "react";
3
+ import { PieChart as w, Pie as x, Cell as p, Tooltip as h, LineChart as K, CartesianGrid as u, XAxis as b, YAxis as s, Line as L, BarChart as N, Bar as R } from "recharts";
4
+ import { cn as $ } from "../../lib/utils.js";
5
5
  const g = [
6
6
  "#0ea5e9",
7
7
  "#6366f1",
@@ -11,12 +11,16 @@ const g = [
11
11
  "#8b5cf6",
12
12
  "#14b8a6",
13
13
  "#f97316"
14
- ];
15
- function F({ spec: e, onPoint: o }) {
16
- const r = o ? (t) => t != null && o(String(t), e) : void 0, [y, m] = v(0), k = C((t) => {
14
+ ], z = new Intl.NumberFormat("en-US", { notation: "compact", maximumFractionDigits: 1 });
15
+ function O({ spec: e, onPoint: n }) {
16
+ const i = n ? (t) => t != null && n(String(t), e) : void 0, [y, f] = v(0), k = S((t) => {
17
17
  if (!t) return;
18
- m(t.getBoundingClientRect().width), new ResizeObserver(() => m(t.getBoundingClientRect().width)).observe(t);
19
- }, []), d = e.type === "pie" ? 220 : 200, h = Math.max(240, Math.min(720, y || 400)), i = (t) => Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(t % 1e3 === 0 ? 0 : 1)}k` : t.toLocaleString(), c = {
18
+ f(t.getBoundingClientRect().width), new ResizeObserver(() => f(t.getBoundingClientRect().width)).observe(t);
19
+ }, []), d = e.type === "pie" ? 220 : 200, c = Math.max(240, Math.min(720, y || 400)), o = (t) => {
20
+ if (!Number.isFinite(t)) return String(t);
21
+ const r = Math.abs(t), C = r >= 1e3 ? z.format(r).replace(/K$/, "k") : r.toLocaleString();
22
+ return `${t < 0 ? "-" : ""}${e.unit === "currency" ? "$" : ""}${C}`;
23
+ }, m = {
20
24
  contentStyle: {
21
25
  background: "#0f172a",
22
26
  border: "1px solid #334155",
@@ -27,18 +31,18 @@ function F({ spec: e, onPoint: o }) {
27
31
  itemStyle: { color: "#f8fafc" },
28
32
  labelStyle: { color: "#cbd5e1" }
29
33
  };
30
- return /* @__PURE__ */ n(
34
+ return /* @__PURE__ */ l(
31
35
  "div",
32
36
  {
33
37
  ref: k,
34
38
  "data-ai-chart": e.type,
35
- "data-ai-chart-drill": o ? "" : void 0,
36
- className: K("my-2 w-full", o && "[&_.recharts-wrapper]:cursor-pointer"),
39
+ "data-ai-chart-drill": n ? "" : void 0,
40
+ className: $("my-2 w-full", n && "[&_.recharts-wrapper]:cursor-pointer"),
37
41
  children: [
38
42
  e.title && /* @__PURE__ */ a("div", { className: "mb-1 text-[0.9em] font-medium text-muted-foreground", children: e.title }),
39
- e.type === "pie" ? /* @__PURE__ */ n(x, { width: h, height: d, children: [
43
+ e.type === "pie" ? /* @__PURE__ */ l(w, { width: c, height: d, children: [
40
44
  /* @__PURE__ */ a(
41
- S,
45
+ x,
42
46
  {
43
47
  data: e.data,
44
48
  dataKey: "value",
@@ -46,26 +50,26 @@ function F({ spec: e, onPoint: o }) {
46
50
  cx: "50%",
47
51
  cy: "50%",
48
52
  outerRadius: 80,
49
- label: ({ name: t, percent: l }) => `${t} ${Math.round((l ?? 0) * 100)}%`,
53
+ label: ({ name: t, percent: r }) => `${t} ${Math.round((r ?? 0) * 100)}%`,
50
54
  labelLine: !1,
51
- onClick: r ? (t) => r((t == null ? void 0 : t.label) ?? (t == null ? void 0 : t.name)) : void 0,
52
- children: e.data.map((t, l) => /* @__PURE__ */ a(w, { fill: g[l % g.length] }, t.label))
55
+ onClick: i ? (t) => i((t == null ? void 0 : t.label) ?? (t == null ? void 0 : t.name)) : void 0,
56
+ children: e.data.map((t, r) => /* @__PURE__ */ a(p, { fill: g[r % g.length] }, t.label))
53
57
  }
54
58
  ),
55
- /* @__PURE__ */ a(f, { ...c, formatter: (t) => i(Number(t)) })
56
- ] }) : e.type === "line" ? /* @__PURE__ */ n(
57
- p,
59
+ /* @__PURE__ */ a(h, { ...m, formatter: (t) => o(Number(t)) })
60
+ ] }) : e.type === "line" ? /* @__PURE__ */ l(
61
+ K,
58
62
  {
59
- width: h,
63
+ width: c,
60
64
  height: d,
61
65
  data: e.data,
62
66
  margin: { left: 4, right: 12 },
63
- onClick: r ? (t) => r(t == null ? void 0 : t.activeLabel) : void 0,
67
+ onClick: i ? (t) => i(t == null ? void 0 : t.activeLabel) : void 0,
64
68
  children: [
65
69
  /* @__PURE__ */ a(u, { strokeDasharray: "3 3", stroke: "currentColor", opacity: 0.12 }),
66
70
  /* @__PURE__ */ a(b, { dataKey: "label", tick: { fontSize: 11 }, interval: "preserveStartEnd" }),
67
- /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: i, width: 44 }),
68
- /* @__PURE__ */ a(f, { ...c, formatter: (t) => i(Number(t)) }),
71
+ /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: o, width: 44 }),
72
+ /* @__PURE__ */ a(h, { ...m, formatter: (t) => o(Number(t)) }),
69
73
  /* @__PURE__ */ a(
70
74
  L,
71
75
  {
@@ -78,14 +82,14 @@ function F({ spec: e, onPoint: o }) {
78
82
  )
79
83
  ]
80
84
  }
81
- ) : /* @__PURE__ */ n(
82
- R,
85
+ ) : /* @__PURE__ */ l(
86
+ N,
83
87
  {
84
- width: h,
88
+ width: c,
85
89
  height: d,
86
90
  data: e.data,
87
91
  margin: { left: 4, right: 12 },
88
- onClick: r ? (t) => r(t == null ? void 0 : t.activeLabel) : void 0,
92
+ onClick: i ? (t) => i(t == null ? void 0 : t.activeLabel) : void 0,
89
93
  children: [
90
94
  /* @__PURE__ */ a(u, { strokeDasharray: "3 3", stroke: "currentColor", opacity: 0.12 }),
91
95
  /* @__PURE__ */ a(
@@ -99,9 +103,9 @@ function F({ spec: e, onPoint: o }) {
99
103
  height: e.data.length > 8 ? 56 : 30
100
104
  }
101
105
  ),
102
- /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: i, width: 44 }),
103
- /* @__PURE__ */ a(f, { ...c, formatter: (t) => i(Number(t)) }),
104
- /* @__PURE__ */ a(z, { dataKey: "value", fill: "#0ea5e9", radius: [3, 3, 0, 0] })
106
+ /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: o, width: 44 }),
107
+ /* @__PURE__ */ a(h, { ...m, formatter: (t) => o(Number(t)) }),
108
+ /* @__PURE__ */ a(R, { dataKey: "value", fill: "#0ea5e9", radius: [3, 3, 0, 0] })
105
109
  ]
106
110
  }
107
111
  )
@@ -110,5 +114,5 @@ function F({ spec: e, onPoint: o }) {
110
114
  );
111
115
  }
112
116
  export {
113
- F as AiChart
117
+ O as AiChart
114
118
  };