@nivaro/react 0.3.50 → 0.3.51

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 (29) hide show
  1. package/dist/hooks/useSessionRecorder.js +1 -1
  2. package/dist/index.d.ts +13 -3
  3. package/dist/shared/components/ItemEditForm.js +4720 -4593
  4. package/dist/shared/components/QueryTable.js +337 -324
  5. package/dist/shared/components/ReportView.js +105 -99
  6. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  7. package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
  8. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  9. package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
  10. package/dist/shared/components/item-edit/FieldRow.js +287 -265
  11. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  12. package/dist/shared/components/item-edit/InlineTableField.js +491 -466
  13. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  14. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  15. package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
  16. package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
  17. package/dist/shared/components/item-edit/UserChip.js +233 -200
  18. package/dist/shared/components/item-edit/header-midair.js +51 -0
  19. package/dist/shared/components/item-edit/line-midair.js +76 -70
  20. package/dist/shared/components/panels/CommentPanel.js +290 -284
  21. package/dist/shared/components/panels/ItemLockBanner.js +30 -30
  22. package/dist/shared/components/panels/PipelinePanel.js +956 -901
  23. package/dist/shared/components/panels/TaskPanel.js +71 -61
  24. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  25. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  26. package/dist/shared/components/queue/QueueWorklist.js +141 -130
  27. package/dist/shared/lib/draft-store.js +48 -34
  28. package/dist/shared/lib/query-stats.js +60 -60
  29. package/package.json +1 -1
@@ -11,7 +11,7 @@ import { useOnlineUsers as Qe } from "../../lib/use-online-users.js";
11
11
  import { SearchHighlight as Be } from "../SearchHighlight.js";
12
12
  import { UserAvatar as et } from "../UserAvatar.js";
13
13
  import { userOptionFilter as tt, cn as J } from "../../lib/utils.js";
14
- import { applyDisplayTemplate as N } from "./helpers.js";
14
+ import { applyDisplayTemplate as k } from "./helpers.js";
15
15
  import { collidingIds as rt, disambiguators as nt } from "./option-disambiguate.js";
16
16
  import { usePickerMissReport as st } from "./picker-miss.js";
17
17
  import { useLatestSearch as it, narrowLocally as ot } from "./picker-search.js";
@@ -54,7 +54,7 @@ function dt({
54
54
  requiredParent: F,
55
55
  facets: o,
56
56
  fieldKey: C,
57
- narrowedBy: l,
57
+ narrowedBy: a,
58
58
  pinned: f,
59
59
  missPlacement: _,
60
60
  defaultOpen: Fe,
@@ -76,9 +76,9 @@ function dt({
76
76
  }, [c]), j(() => {
77
77
  if (!c) return;
78
78
  const e = (i) => {
79
- var a;
79
+ var l;
80
80
  const t = i.target;
81
- (a = t == null ? void 0 : t.closest) != null && a.call(t, "[data-nvr-combobox-panel]") || H.current && !H.current.contains(i.target) && P(!1);
81
+ (l = t == null ? void 0 : t.closest) != null && l.call(t, "[data-nvr-combobox-panel]") || H.current && !H.current.contains(i.target) && P(!1);
82
82
  };
83
83
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
84
84
  }, [c]);
@@ -91,18 +91,18 @@ function dt({
91
91
  const e = () => {
92
92
  const i = H.current;
93
93
  if (!i) return;
94
- const t = i.getBoundingClientRect(), a = i.closest('[role="dialog"]') ?? document.body;
95
- Oe(a);
96
- const ke = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, Ne = t.left, Se = ke ? t.top - 4 : t.bottom + 4, qe = {
94
+ const t = i.getBoundingClientRect(), l = i.closest('[role="dialog"]') ?? document.body;
95
+ Oe(l);
96
+ const Ne = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, ke = t.left, Se = Ne ? t.top - 4 : t.bottom + 4, qe = {
97
97
  minWidth: t.width,
98
98
  zIndex: 120,
99
- ...ke ? { transform: "translateY(-100%)" } : {}
99
+ ...Ne ? { transform: "translateY(-100%)" } : {}
100
100
  };
101
- if (a === document.body)
102
- ee({ position: "fixed", left: Ne, top: Se, ...qe });
101
+ if (l === document.body)
102
+ ee({ position: "fixed", left: ke, top: Se, ...qe });
103
103
  else {
104
- const _e = a.getBoundingClientRect();
105
- ee({ position: "absolute", left: Ne - _e.left, top: Se - _e.top, ...qe });
104
+ const _e = l.getBoundingClientRect();
105
+ ee({ position: "absolute", left: ke - _e.left, top: Se - _e.top, ...qe });
106
106
  }
107
107
  };
108
108
  return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
@@ -130,7 +130,7 @@ function dt({
130
130
  const e = {};
131
131
  for (const i of o ?? []) {
132
132
  const t = he.find(
133
- (a) => a.many_collection === n && a.many_field === i.field && !a.junction_field
133
+ (l) => l.many_collection === n && l.many_field === i.field && !l.junction_field
134
134
  );
135
135
  t != null && t.one_collection && (e[i.field] = t.one_collection);
136
136
  }
@@ -147,7 +147,7 @@ function dt({
147
147
  const e = [...Y.matchAll(/\{\{([\w.]+)\}\}/g)].map((i) => i[1]);
148
148
  if (e.length)
149
149
  return ["id", ...e].join(",");
150
- }, [Y]), k = ne ? JSON.stringify(ne) : void 0, U = m && !/^-?label$/.test(m) ? m : void 0, {
150
+ }, [Y]), N = ne ? JSON.stringify(ne) : void 0, U = m && !/^-?label$/.test(m) ? m : void 0, {
151
151
  data: h,
152
152
  isFetching: O,
153
153
  isPlaceholderData: be
@@ -156,7 +156,7 @@ function dt({
156
156
  "relation-opts",
157
157
  n,
158
158
  L,
159
- k,
159
+ N,
160
160
  b,
161
161
  U ?? ""
162
162
  ],
@@ -165,7 +165,7 @@ function dt({
165
165
  limit: 200,
166
166
  picker: "1",
167
167
  ...L ? { search: L } : {},
168
- ...k ? { filter: k } : {},
168
+ ...N ? { filter: N } : {},
169
169
  ...b ? { fields: b } : {},
170
170
  ...U ? { sort: U } : {}
171
171
  })
@@ -173,14 +173,14 @@ function dt({
173
173
  // Wait for the display template: it decides `fields`, and starting before
174
174
  // it lands sent the whole first page twice.
175
175
  enabled: c && !Ie,
176
- staleTime: k ? 0 : 3e4,
176
+ staleTime: N ? 0 : 3e4,
177
177
  // A new SEARCH keeps the previous answer on screen (narrowed locally below)
178
178
  // instead of blanking the list behind a spinner. A changed filter, sort or
179
179
  // template never does — those rows may no longer be allowed.
180
180
  placeholderData: (e, i) => {
181
181
  const t = i == null ? void 0 : i.queryKey;
182
182
  if (!(!e || !t))
183
- return t[1] === n && t[3] === k && t[4] === b && t[5] === (U ?? "") ? e : void 0;
183
+ return t[1] === n && t[3] === N && t[4] === b && t[5] === (U ?? "") ? e : void 0;
184
184
  }
185
185
  });
186
186
  j(() => Ee(O), [O]), st({
@@ -203,7 +203,7 @@ function dt({
203
203
  enabled: !!x && c,
204
204
  staleTime: 6e4
205
205
  }), Me = JSON.stringify(g ? { _and: [{ id: { _eq: r } }, g] } : { id: { _eq: r } }), { data: X } = S({
206
- queryKey: ["relation-avail", n, String(r), k],
206
+ queryKey: ["relation-avail", n, String(r), N],
207
207
  queryFn: () => T.request(
208
208
  R(`/items/${n}`, {
209
209
  filter: Me,
@@ -217,7 +217,7 @@ function dt({
217
217
  // the pin is available by construction — never probe it, never flag it.
218
218
  enabled: !!r && !!W && String(r) !== x,
219
219
  staleTime: 3e4
220
- }), M = !!r && String(r) !== x && X !== void 0 && X.length === 0, G = I(null), se = I(!1), xe = `${n}|${k ?? ""}`, De = () => {
220
+ }), M = !!r && String(r) !== x && X !== void 0 && X.length === 0, G = I(null), se = I(!1), xe = `${n}|${N ?? ""}`, De = () => {
221
221
  se.current = !0, G.current = xe, d(null);
222
222
  }, V = r == null || r === "";
223
223
  j(() => {
@@ -230,26 +230,26 @@ function dt({
230
230
  limit: 2,
231
231
  picker: "1",
232
232
  fields: "id",
233
- ...k ? { filter: k } : {}
233
+ ...N ? { filter: N } : {}
234
234
  })
235
235
  ).then((i) => {
236
- var a;
236
+ var l;
237
237
  const t = i.data ?? [];
238
- t.length === 1 && ((a = t[0]) == null ? void 0 : a.id) != null && d(t[0].id);
238
+ t.length === 1 && ((l = t[0]) == null ? void 0 : l.id) != null && d(t[0].id);
239
239
  }).catch(() => {
240
240
  G.current = null;
241
241
  }));
242
- }, [p, y, V, n, k]);
243
- const w = Y, ye = r && W ? N(w, W) : null, ie = !be && v === L, Z = K(
242
+ }, [p, y, V, n, N]);
243
+ const w = Y, ye = r && W ? k(w, W) : null, ie = !be && v === L, Z = K(
244
244
  () => ot(
245
245
  h ?? [],
246
- (e) => N(w, e) || `#${e.id}`,
246
+ (e) => k(w, e) || `#${e.id}`,
247
247
  v,
248
248
  ie
249
249
  ),
250
250
  [h, w, v, ie]
251
251
  ), Q = K(
252
- () => rt(h ?? [], (e) => N(w, e) || `#${e.id}`),
252
+ () => rt(h ?? [], (e) => k(w, e) || `#${e.id}`),
253
253
  [h, w]
254
254
  ), { data: D } = S({
255
255
  queryKey: ["relation-opts-dups", n, Q.join(",")],
@@ -268,12 +268,12 @@ function dt({
268
268
  const e = new Map(
269
269
  (h ?? []).map((t) => [
270
270
  String(t.id),
271
- (N(w, t) || `#${t.id}`).trim().toLowerCase()
271
+ (k(w, t) || `#${t.id}`).trim().toLowerCase()
272
272
  ])
273
273
  ), i = /* @__PURE__ */ new Map();
274
274
  for (const t of D) {
275
- const a = e.get(String(t.id));
276
- a !== void 0 && i.set(a, [...i.get(a) ?? [], t]);
275
+ const l = e.get(String(t.id));
276
+ l !== void 0 && i.set(l, [...i.get(l) ?? [], t]);
277
277
  }
278
278
  return nt(
279
279
  [...i.values()],
@@ -350,7 +350,7 @@ function dt({
350
350
  {
351
351
  collection: i,
352
352
  value: re[e.field] ?? null,
353
- onChange: (t) => Ke((a) => ({ ...a, [e.field]: t })),
353
+ onChange: (t) => Ke((l) => ({ ...l, [e.field]: t })),
354
354
  placeholder: "Any",
355
355
  optionSort: e.sort,
356
356
  extraFilter: e.filter
@@ -414,43 +414,45 @@ function dt({
414
414
  children: String(r) === x && /* @__PURE__ */ s(Ce, { className: "h-2.5 w-2.5 text-white" })
415
415
  }
416
416
  ),
417
- /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: A ? N(w, A) || `#${x}` : `#${x}` }),
417
+ /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: A ? k(w, A) || `#${x}` : `#${x}` }),
418
418
  /* @__PURE__ */ s("span", { className: "shrink-0 rounded bg-nvr-cyan/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-slate-700 dark:text-foreground", children: (f == null ? void 0 : f.tag) ?? "Default" })
419
419
  ]
420
420
  }
421
421
  ),
422
- h === void 0 && O ? /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ s(B, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : Z.length === 0 && !ie ? /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "Searching…" }) : Z.length === 0 ? l && l.labels.length > 0 && !v.trim() ? /* @__PURE__ */ u("div", { className: "px-3 py-2 text-[12px] leading-5 text-muted-foreground", children: [
422
+ h === void 0 && O ? /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ s(B, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : Z.length === 0 && !ie ? /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "Searching…" }) : Z.length === 0 ? a && a.labels.length > 0 && !v.trim() ? /* @__PURE__ */ u("div", { className: "px-3 py-2 text-[12px] leading-5 text-muted-foreground", children: [
423
423
  /* @__PURE__ */ u("p", { children: [
424
424
  "No options for",
425
425
  " ",
426
- /* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: l.labels.join(" · ") }),
427
- l.onClear ? " — clear one to widen the list:" : "."
426
+ /* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: a.labels.join(" · ") }),
427
+ a.onClear ? " — clear one to widen the list:" : "."
428
428
  ] }),
429
- l.onClear && /* @__PURE__ */ s("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: l.keys.map((e, i) => /* @__PURE__ */ u(
430
- "button",
431
- {
432
- type: "button",
433
- onClick: (t) => {
434
- var a;
435
- t.stopPropagation(), (a = l.onClear) == null || a.call(l, e);
429
+ a.onClear && /* @__PURE__ */ s("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: a.keys.map(
430
+ (e, i) => a.clearable && !a.clearable.includes(e) ? null : /* @__PURE__ */ u(
431
+ "button",
432
+ {
433
+ type: "button",
434
+ onClick: (t) => {
435
+ var l;
436
+ t.stopPropagation(), (l = a.onClear) == null || l.call(a, e);
437
+ },
438
+ className: "rounded-md border border-border bg-background px-2 py-0.5 text-[11.5px] font-medium text-foreground transition-colors duration-150 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
439
+ children: [
440
+ "Clear ",
441
+ a.labels[i] ?? e
442
+ ]
436
443
  },
437
- className: "rounded-md border border-border bg-background px-2 py-0.5 text-[11.5px] font-medium text-foreground transition-colors duration-150 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
438
- children: [
439
- "Clear ",
440
- l.labels[i] ?? e
441
- ]
442
- },
443
- e
444
- )) })
444
+ e
445
+ )
446
+ ) })
445
447
  ] }) : /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: v.trim() ? `No results for “${v.trim()}”` : "No results" }) : (U ? [...Z] : [...Z].sort(
446
448
  (e, i) => Ze(
447
- N(w, e),
448
- N(w, i),
449
+ k(w, e),
450
+ k(w, i),
449
451
  v,
450
452
  m === "-label"
451
453
  )
452
454
  )).filter((e) => !x || String(e.id) !== x).map((e) => {
453
- const i = N(w, e) || `#${e.id}`, t = String(e.id) === String(r);
455
+ const i = k(w, e) || `#${e.id}`, t = String(e.id) === String(r);
454
456
  return /* @__PURE__ */ u(
455
457
  "button",
456
458
  {
@@ -506,7 +508,7 @@ function dt({
506
508
  collection: n,
507
509
  search: L,
508
510
  filter: ne,
509
- narrowedLabels: (l == null ? void 0 : l.labels) ?? [],
511
+ narrowedLabels: (a == null ? void 0 : a.labels) ?? [],
510
512
  auto: (h ?? []).length === 0 && !!L
511
513
  }
512
514
  )
@@ -550,12 +552,12 @@ function ct({
550
552
  if (C && !o)
551
553
  return /* @__PURE__ */ s("p", { className: "border-t border-border px-3 py-1.5 text-[11px] text-muted-foreground", children: "Checking what narrows this list…" });
552
554
  if (!o) return null;
553
- const l = [], f = r ? `match “${r}”` : "exist";
554
- return o.by_field_filter > 0 && l.push(
555
+ const a = [], f = r ? `match “${r}”` : "exist";
556
+ return o.by_field_filter > 0 && a.push(
555
557
  `${o.by_field_filter.toLocaleString()} more ${f} but this field only offers ${y.length ? `records that fit ${y.join(" · ")}` : "records its filter allows"}.`
556
- ), o.by_exclusions > 0 && l.push(
558
+ ), o.by_exclusions > 0 && a.push(
557
559
  `${o.by_exclusions.toLocaleString()} ${o.by_exclusions === 1 ? "is" : "are"} hidden from pickers by an admin.`
558
- ), o.scopes.length > 0 && l.push(`Your ${o.scopes.join(", ")} access narrows what you can pick here.`), o.row_filter && l.push("Your role only sees some of these records."), l.length === 0 && l.push(
560
+ ), o.scopes.length > 0 && a.push(`Your ${o.scopes.join(", ")} access narrows what you can pick here.`), o.row_filter && a.push("Your role only sees some of these records."), a.length === 0 && a.push(
559
561
  r ? `Nothing else you can see matches “${r}”.` : "Nothing narrows this list — every record you can see is offered."
560
562
  ), /* @__PURE__ */ s(
561
563
  "div",
@@ -564,7 +566,7 @@ function ct({
564
566
  "data-picker-narrowing": !0,
565
567
  "data-picker-narrowing-field": o.by_field_filter,
566
568
  "data-picker-narrowing-excluded": o.by_exclusions,
567
- children: l.map((_) => /* @__PURE__ */ s("p", { children: _ }, _))
569
+ children: a.map((_) => /* @__PURE__ */ s("p", { children: _ }, _))
568
570
  }
569
571
  );
570
572
  }
@@ -596,7 +598,7 @@ function Ct({
596
598
  const o = m.title || m.filename_download || m.filename_disk || String(r);
597
599
  return /* @__PURE__ */ s("span", { children: o });
598
600
  }
599
- return /* @__PURE__ */ s("span", { children: N(d, m) });
601
+ return /* @__PURE__ */ s("span", { children: k(d, m) });
600
602
  }
601
603
  export {
602
604
  Ct as RelatedItemLabel,