@nivaro/react 0.3.99 → 0.3.100

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 (43) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +38 -13
  5. package/dist/index.js +182 -180
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/CollectionBrowserView.js +516 -503
  8. package/dist/shared/components/ItemEditForm.js +3021 -3019
  9. package/dist/shared/components/JobsTray.js +20 -16
  10. package/dist/shared/components/MyWorkView.js +133 -126
  11. package/dist/shared/components/NotificationBell.js +314 -288
  12. package/dist/shared/components/RecordCompare.js +38 -40
  13. package/dist/shared/components/RecordReadView.js +119 -119
  14. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  15. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  16. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  17. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  18. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  19. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  20. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  21. package/dist/shared/components/item-edit/related-missing.js +75 -19
  22. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  23. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  24. package/dist/shared/components/panels/BackgroundMove.js +175 -0
  25. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  26. package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
  27. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  28. package/dist/shared/lib/commands.js +18 -14
  29. package/dist/shared/lib/error-hints.js +1 -1
  30. package/dist/shared/lib/job-failure-text.js +12 -0
  31. package/dist/shared/lib/move-failure.js +9 -0
  32. package/dist/shared/lib/obligation-banner.js +15 -14
  33. package/dist/shared/lib/partner-failure.js +71 -0
  34. package/dist/shared/lib/prefetch.js +73 -73
  35. package/dist/shared/lib/replay-checkout.js +18 -13
  36. package/dist/shared/lib/replay-context.js +90 -77
  37. package/dist/shared/lib/replay-idle.js +21 -0
  38. package/dist/shared/lib/replay-socket.js +21 -17
  39. package/dist/shared/lib/rum.js +56 -51
  40. package/dist/shared/lib/safe-error.js +17 -13
  41. package/dist/shared/lib/stale-chunk.js +69 -26
  42. package/dist/shared/lib/system-collections.js +20 -0
  43. package/package.json +1 -1
@@ -24,7 +24,7 @@ function je({
24
24
  maxValues: c
25
25
  }) {
26
26
  var K, T;
27
- const r = U(), m = e.many_field ?? "", f = e.junction_field ?? (() => {
27
+ const r = U(), u = e.many_field ?? "", f = e.junction_field ?? (() => {
28
28
  const t = a.find(
29
29
  (s) => s.many_collection === e.many_collection && s.id !== e.id
30
30
  );
@@ -41,23 +41,23 @@ function je({
41
41
  }), o = g ?? ((T = b == null ? void 0 : b.find(
42
42
  (t) => t.many_collection === e.many_collection && t.many_field === f && !!t.one_collection
43
43
  )) == null ? void 0 : T.one_collection) ?? null, { data: d = [] } = $({
44
- queryKey: ["m2m-items", e.many_collection, m, n],
44
+ queryKey: ["m2m-items", e.many_collection, u, n],
45
45
  queryFn: () => r.request(
46
46
  L(`/items/${e.many_collection}`, {
47
- filter: JSON.stringify({ [m]: { _eq: n } }),
47
+ filter: JSON.stringify({ [u]: { _eq: n } }),
48
48
  limit: 200,
49
49
  fields: `id,${f}`
50
50
  })
51
51
  ).then((t) => t.data ?? []),
52
52
  staleTime: 3e4,
53
53
  enabled: !!n && n !== "new"
54
- }), u = o ? void 0 : [...a, ...b ?? []].find(
54
+ }), m = o ? void 0 : [...a, ...b ?? []].find(
55
55
  (t) => t.many_collection === e.many_collection && t.many_field === f && !!t.one_collection_field
56
- ), k = (u == null ? void 0 : u.one_collection_field) ?? null, E = u ? $e(u) : null, { data: F = [] } = $({
57
- queryKey: ["summary-m2a-items", e.many_collection, m, n, k],
56
+ ), k = (m == null ? void 0 : m.one_collection_field) ?? null, E = m ? $e(m) : null, { data: F = [] } = $({
57
+ queryKey: ["summary-m2a-items", e.many_collection, u, n, k],
58
58
  queryFn: () => r.request(
59
59
  L(`/items/${e.many_collection}`, {
60
- filter: JSON.stringify({ [m]: { _eq: n } }),
60
+ filter: JSON.stringify({ [u]: { _eq: n } }),
61
61
  limit: 200,
62
62
  fields: `id,${f},${k}`
63
63
  })
@@ -151,7 +151,15 @@ function de(e) {
151
151
  }
152
152
  function X({ collection: e, id: n }) {
153
153
  const a = de(e);
154
- return /* @__PURE__ */ i(se, { collection: e, id: n, displayTemplate: a ?? void 0 });
154
+ return /* @__PURE__ */ i(
155
+ se,
156
+ {
157
+ collection: e,
158
+ id: n,
159
+ displayTemplate: a ?? void 0,
160
+ explainMissing: !0
161
+ }
162
+ );
155
163
  }
156
164
  const Me = ["name", "title", "label", "subject", "description", "line_number"], Ce = ["amount", "total", "cost"], C = (e) => {
157
165
  if (typeof e == "number") return Number.isFinite(e) ? e : null;
@@ -168,8 +176,8 @@ function ve(e) {
168
176
  of: (l) => {
169
177
  const c = n ? C(l[n]) : null;
170
178
  if (c !== null) return c;
171
- const r = C(l.price), m = C(l.quantity);
172
- return r !== null && m !== null ? Math.round(r * m * 100) / 100 : null;
179
+ const r = C(l.price), u = C(l.quantity);
180
+ return r !== null && u !== null ? Math.round(r * u * 100) / 100 : null;
173
181
  }
174
182
  } : e.some((l) => C(l.quantity) !== null) ? { currency: !1, of: (l) => C(l.quantity) } : null;
175
183
  }
@@ -205,10 +213,10 @@ const Ke = ["cifa", "item", "catalog_item", "product", "part", "material"], Ae =
205
213
  function Pe(e, n, a) {
206
214
  const l = e.filter(
207
215
  (r) => r.many_collection === n && !!r.many_field && r.many_field !== a && !r.junction_field && !!r.one_collection && !Ae.has(r.one_collection)
208
- ), c = Ke.map((r) => l.find((m) => m.many_field === r)).find(Boolean) ?? l[0];
216
+ ), c = Ke.map((r) => l.find((u) => u.many_field === r)).find(Boolean) ?? l[0];
209
217
  return c != null && c.many_field && c.one_collection ? { field: c.many_field, collection: c.one_collection } : null;
210
218
  }
211
- function me({
219
+ function ue({
212
220
  relatedCollection: e,
213
221
  manyField: n,
214
222
  parentId: a,
@@ -216,7 +224,7 @@ function me({
216
224
  expanded: c
217
225
  }) {
218
226
  var K, T;
219
- const r = U(), m = ke(ce), f = l && Object.keys(l).length > 0 ? {
227
+ const r = U(), u = ke(ce), f = l && Object.keys(l).length > 0 ? {
220
228
  _and: [
221
229
  { [n]: { _eq: a } },
222
230
  Object.fromEntries(
@@ -249,26 +257,26 @@ function me({
249
257
  return ((s = t.data) == null ? void 0 : s.relations) ?? [];
250
258
  }),
251
259
  staleTime: 10 * 6e4
252
- }), d = Pe(o, e, n), u = Re(b), k = [...new Set(u.map((t) => t.split(".")[0]))], E = u.length ? JSON.stringify((p ?? []).map((t) => [t.id, ...k.map((s) => t[s] ?? null)])) : "", { data: F } = $({
260
+ }), d = Pe(o, e, n), m = Re(b), k = [...new Set(m.map((t) => t.split(".")[0]))], E = m.length ? JSON.stringify((p ?? []).map((t) => [t.id, ...k.map((s) => t[s] ?? null)])) : "", { data: F } = $({
253
261
  queryKey: [
254
262
  "o2m-summary-labels",
255
263
  e,
256
264
  n,
257
265
  a,
258
266
  l ? JSON.stringify(l) : "",
259
- u.join(","),
267
+ m.join(","),
260
268
  E
261
269
  ],
262
270
  queryFn: () => r.request(
263
271
  L(`/items/${e}`, {
264
272
  filter: JSON.stringify(f),
265
- fields: ["id", ...u].join(","),
273
+ fields: ["id", ...m].join(","),
266
274
  limit: H
267
275
  })
268
276
  ).then((t) => t.data ?? []).catch(() => []),
269
- enabled: u.length > 0 && !!a && a !== "new" && ((p == null ? void 0 : p.length) ?? 0) > 0,
277
+ enabled: m.length > 0 && !!a && a !== "new" && ((p == null ? void 0 : p.length) ?? 0) > 0,
270
278
  staleTime: 6e4
271
- }), I = new Map((F ?? []).map((t) => [String(t.id), t])), O = `${e}.${n}`, w = (K = m.deletes) == null ? void 0 : K.get(O), R = (((T = m.rows) == null ? void 0 : T.get(O)) ?? []).filter(
279
+ }), I = new Map((F ?? []).map((t) => [String(t.id), t])), O = `${e}.${n}`, w = (K = u.deletes) == null ? void 0 : K.get(O), R = (((T = u.rows) == null ? void 0 : T.get(O)) ?? []).filter(
272
280
  (t) => Oe(t, l)
273
281
  ), S = [
274
282
  ...(p ?? []).filter((t) => !(w != null && w.has(String(t.id)))),
@@ -300,7 +308,7 @@ function me({
300
308
  className: "flex items-baseline justify-between gap-2 text-[11px] text-slate-500 dark:text-slate-400",
301
309
  children: [
302
310
  /* @__PURE__ */ i("span", { className: "truncate", children: Ee(
303
- De(t, I.get(String(t.id)), u),
311
+ De(t, I.get(String(t.id)), m),
304
312
  b ?? null
305
313
  ) ?? (d && t[d.field] != null && t[d.field] !== "" ? /* @__PURE__ */ i(X, { collection: d.collection, id: t[d.field] }) : `Row ${s + 1}`) }),
306
314
  _ && _.of(t) !== null && /* @__PURE__ */ i("span", { className: "shrink-0 tabular-nums", children: (() => {
@@ -336,8 +344,8 @@ function Ie({
336
344
  itemId: c,
337
345
  staging: r
338
346
  }) {
339
- const m = e.interface ?? "", f = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
340
- if (!f.has(m) && c) {
347
+ const u = e.interface ?? "", f = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
348
+ if (!f.has(u) && c) {
341
349
  const o = a.find(
342
350
  (d) => !d.junction_field && (d.one_field === e.field || d.many_collection === e.field) && (d.one_collection === l || d.one_collection == null)
343
351
  );
@@ -350,7 +358,7 @@ function Ie({
350
358
  }
351
359
  })();
352
360
  return /* @__PURE__ */ i(
353
- me,
361
+ ue,
354
362
  {
355
363
  relatedCollection: o.many_collection,
356
364
  manyField: o.many_field,
@@ -360,17 +368,17 @@ function Ie({
360
368
  );
361
369
  }
362
370
  }
363
- if (f.has(m) && c) {
371
+ if (f.has(u) && c) {
364
372
  const o = a.find(
365
- (u) => u.one_collection === l && (u.one_field === e.field || u.junction_field != null && u.many_collection === e.field)
373
+ (m) => m.one_collection === l && (m.one_field === e.field || m.junction_field != null && m.many_collection === e.field)
366
374
  ), d = o ? o.junction_field ? o : (() => {
367
- const u = a.find(
375
+ const m = a.find(
368
376
  (k) => k.many_collection === o.many_collection && k.id !== o.id
369
377
  );
370
- return u ? { ...o, junction_field: u.many_field } : null;
378
+ return m ? { ...o, junction_field: m.many_field } : null;
371
379
  })() : null;
372
380
  if (d) {
373
- const u = oe(e.options);
381
+ const m = oe(e.options);
374
382
  return /* @__PURE__ */ i(
375
383
  je,
376
384
  {
@@ -378,7 +386,7 @@ function Ie({
378
386
  parentId: c,
379
387
  allRelations: a,
380
388
  staging: r,
381
- maxValues: u == null ? void 0 : u.max_values
389
+ maxValues: m == null ? void 0 : m.max_values
382
390
  }
383
391
  );
384
392
  }
@@ -387,8 +395,8 @@ function Ie({
387
395
  if (p && e.type === "boolean")
388
396
  return /* @__PURE__ */ i("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
389
397
  if (p) return /* @__PURE__ */ i("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
390
- if (m === "extension-editorjs" || m === "input-rich-text-html" || m === "rich_text" || m === "wysiwyg" || typeof n == "string") {
391
- const o = He(n, m);
398
+ if (u === "extension-editorjs" || u === "input-rich-text-html" || u === "rich_text" || u === "wysiwyg" || typeof n == "string") {
399
+ const o = He(n, u);
392
400
  if (o !== null)
393
401
  return /* @__PURE__ */ i("span", { className: "truncate text-slate-700 dark:text-slate-200", title: o, children: o || "—" });
394
402
  }
@@ -453,7 +461,7 @@ function ae(e, n) {
453
461
  enabled: c,
454
462
  staleTime: 10 * 6e4,
455
463
  retry: !1
456
- }), { data: m } = $({
464
+ }), { data: u } = $({
457
465
  queryKey: ["rrv-related", e, String(n)],
458
466
  queryFn: () => l(e, n).catch(() => null),
459
467
  enabled: c && !!r,
@@ -461,10 +469,10 @@ function ae(e, n) {
461
469
  retry: !1
462
470
  });
463
471
  if (!c) return null;
464
- if (!m) return "a linked record";
465
- const f = re(r == null ? void 0 : r.display_template, m).trim();
472
+ if (!u) return "a linked record";
473
+ const f = re(r == null ? void 0 : r.display_template, u).trim();
466
474
  if (f) return f;
467
- for (const p of ["name", "title", "label", "number", "email"]) if (m[p]) return String(m[p]);
475
+ for (const p of ["name", "title", "label", "number", "email"]) if (u[p]) return String(u[p]);
468
476
  return "a linked record";
469
477
  }
470
478
  function We({
@@ -474,13 +482,13 @@ function We({
474
482
  detail: l,
475
483
  relations: c,
476
484
  collection: r,
477
- onRevert: m
485
+ onRevert: u
478
486
  }) {
479
487
  var o;
480
488
  const f = ((o = c.find(
481
489
  (d) => d.many_collection === r && d.many_field === e.field && !!d.one_collection
482
490
  )) == null ? void 0 : o.one_collection) ?? null, p = ae(f, n), g = ae(f, a), b = l ? `Unsaved — ${l}` : `Unsaved — was ${p ?? le(n)} → now ${g ?? le(a)}`;
483
- return m ? (
491
+ return u ? (
484
492
  // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
485
493
  /* @__PURE__ */ i(
486
494
  "span",
@@ -491,10 +499,10 @@ function We({
491
499
  "data-tip": `${b} · click to revert`,
492
500
  "aria-label": "Revert this change",
493
501
  onClick: (d) => {
494
- d.stopPropagation(), m();
502
+ d.stopPropagation(), u();
495
503
  },
496
504
  onKeyDown: (d) => {
497
- (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), m());
505
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), u());
498
506
  },
499
507
  className: "group/dot inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-amber-100 dark:hover:bg-amber-500/20",
500
508
  children: /* @__PURE__ */ i("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 ring-2 ring-amber-100 group-hover/dot:ring-amber-200 dark:ring-amber-500/30" })
@@ -516,14 +524,14 @@ function it({
516
524
  sectionGroups: l,
517
525
  draft: c,
518
526
  relations: r,
519
- collection: m,
527
+ collection: u,
520
528
  itemId: f,
521
529
  staging: p,
522
530
  errors: g,
523
531
  staleFields: b,
524
532
  aliasEmptiness: o,
525
533
  layoutFields: d,
526
- changedFields: u,
534
+ changedFields: m,
527
535
  onRevertChange: k,
528
536
  onFieldClick: E,
529
537
  stagedO2MRows: F,
@@ -536,7 +544,7 @@ function it({
536
544
  const s = (t.key === "__general__" ? [...a, ...l.flatMap((x) => n[x.key] ?? [])] : n[t.key] ?? []).filter((x) => !x.hidden && !qe.has(x.field) && !Te.has(x.field));
537
545
  return { step: t, fields: s };
538
546
  }).filter((t) => t.fields.length > 0), K = new Set(q.flatMap((t) => t.fields.map((s) => s.field))), T = f && f !== "new" ? r.filter(
539
- (t) => !t.junction_field && t.many_field && t.many_collection && (t.one_collection === m || t.one_collection == null) && t.one_field != null && !K.has(t.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
547
+ (t) => !t.junction_field && t.many_field && t.many_collection && (t.one_collection === u || t.one_collection == null) && t.one_field != null && !K.has(t.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
540
548
  (!d || d.has(t.one_field))
541
549
  ) : [];
542
550
  return q.length === 0 && T.length === 0 ? null : /* @__PURE__ */ i(ce.Provider, { value: { rows: F, deletes: I }, children: /* @__PURE__ */ h("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
@@ -553,7 +561,7 @@ function it({
553
561
  }
554
562
  ),
555
563
  s.map((y, P) => {
556
- const N = c[y.field], M = y.label ?? ee(y.field), A = !!(g != null && g[y.field]), J = o == null ? void 0 : o[y.field], ue = J !== void 0 ? J === !0 : N == null || typeof N == "string" && N.trim() === "" || Array.isArray(N) && N.length === 0, fe = J === null, W = !!y.required && ue && !A && !fe, Y = (b == null ? void 0 : b.has(y.field)) ?? !1;
564
+ const N = c[y.field], M = y.label ?? ee(y.field), A = !!(g != null && g[y.field]), J = o == null ? void 0 : o[y.field], me = J !== void 0 ? J === !0 : N == null || typeof N == "string" && N.trim() === "" || Array.isArray(N) && N.length === 0, fe = J === null, W = !!y.required && me && !A && !fe, Y = (b == null ? void 0 : b.has(y.field)) ?? !1;
557
565
  return /* @__PURE__ */ h(
558
566
  "div",
559
567
  {
@@ -582,15 +590,15 @@ function it({
582
590
  ),
583
591
  children: [
584
592
  /* @__PURE__ */ i("span", { className: "truncate", children: M }),
585
- (u == null ? void 0 : u[y.field]) && /* @__PURE__ */ i(
593
+ (m == null ? void 0 : m[y.field]) && /* @__PURE__ */ i(
586
594
  We,
587
595
  {
588
596
  field: y,
589
- from: u[y.field].from,
590
- detail: u[y.field].detail,
597
+ from: m[y.field].from,
598
+ detail: m[y.field].detail,
591
599
  to: N,
592
600
  relations: r,
593
- collection: m,
601
+ collection: u,
594
602
  onRevert: k ? () => k(y.field) : void 0
595
603
  }
596
604
  ),
@@ -619,7 +627,7 @@ function it({
619
627
  field: y,
620
628
  val: N,
621
629
  relations: r,
622
- collection: m,
630
+ collection: u,
623
631
  itemId: f,
624
632
  staging: p
625
633
  }
@@ -704,7 +712,7 @@ function it({
704
712
  ee(t.one_field ?? t.many_collection ?? "")
705
713
  ] }),
706
714
  /* @__PURE__ */ i("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ i(
707
- me,
715
+ ue,
708
716
  {
709
717
  relatedCollection: t.many_collection ?? "",
710
718
  manyField: t.many_field,
@@ -1,19 +1,22 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { describeError as d } from "../../lib/error-message.js";
3
- import { cn as r } from "../../lib/utils.js";
4
- function i(e) {
5
- if (e == null)
1
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
2
+ import { useQuery as f } from "@tanstack/react-query";
3
+ import { useOptionalNivaroClient as m } from "../../context.js";
4
+ import { get as g } from "../../lib/commands.js";
5
+ import { describeError as p } from "../../lib/error-message.js";
6
+ import { cn as h } from "../../lib/utils.js";
7
+ function u(t) {
8
+ if (t == null)
6
9
  return {
7
10
  kind: "no-access",
8
11
  text: "Not available to you",
9
12
  tip: "Your access does not include this record."
10
13
  };
11
- const t = d(e).kind;
12
- return t === "forbidden" || t === "signed-out" ? {
14
+ const e = p(t).kind;
15
+ return e === "forbidden" || e === "signed-out" ? {
13
16
  kind: "no-access",
14
17
  text: "Not available to you",
15
18
  tip: "Your access does not include this record."
16
- } : t === "not-found" ? {
19
+ } : e === "not-found" ? {
17
20
  kind: "not-found",
18
21
  text: "Record not found",
19
22
  tip: "It may have been deleted, or it is outside what you can see."
@@ -23,23 +26,76 @@ function i(e) {
23
26
  tip: "The linked record didn’t load. Reload the page to try again."
24
27
  };
25
28
  }
26
- function u(e, t) {
27
- return i(t).kind !== "failed" ? !1 : e < 2;
29
+ function E(t, e) {
30
+ return u(e).kind !== "failed" ? !1 : t < 2;
28
31
  }
29
- function c({ error: e, className: t }) {
30
- const n = i(e);
31
- return /* @__PURE__ */ o(
32
+ function k(t) {
33
+ var o, s, n;
34
+ const e = (t == null ? void 0 : t.reasons) ?? [];
35
+ if (e.length === 0) return null;
36
+ const i = e.find((a) => a.type === "not_found");
37
+ return i ? {
38
+ kind: "not-found",
39
+ text: "Record not found",
40
+ // The server's sentence says when it was deleted, by whom and that it
41
+ // can be restored: more use than a fixed "was removed".
42
+ tip: ((o = i.message) == null ? void 0 : o.trim()) || "This record was removed."
43
+ } : {
44
+ kind: "no-access",
45
+ text: "Not available to you",
46
+ tip: ((n = (s = e.find((a) => {
47
+ var d;
48
+ return (d = a.message) == null ? void 0 : d.trim();
49
+ })) == null ? void 0 : s.message) == null ? void 0 : n.trim()) ?? "Your access does not include this record."
50
+ };
51
+ }
52
+ const x = /^(nivaro|directus)_/i;
53
+ function y(t, e, i) {
54
+ const r = m(), o = u(t), s = !!r && o.kind === "not-found" && !!e && !x.test(e) && i != null && i !== "", { data: n, isLoading: a } = f({
55
+ // Its own key: the denied panel keeps a differently shaped answer for a
56
+ // record page under 'access-explain'.
57
+ queryKey: ["related-missing-explain", e, String(i)],
58
+ queryFn: () => r.request(
59
+ g(`/access-explain/${e}/${encodeURIComponent(String(i))}`)
60
+ ).then((d) => d.data ?? null).catch(() => null),
61
+ enabled: s,
62
+ staleTime: 5 * 6e4,
63
+ retry: !1
64
+ });
65
+ return s ? { missing: k(n) ?? o, settling: a } : { missing: o, settling: !1 };
66
+ }
67
+ const b = "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]";
68
+ function M({
69
+ error: t,
70
+ collection: e,
71
+ id: i,
72
+ className: r,
73
+ settlingClassName: o = b,
74
+ labelId: s
75
+ }) {
76
+ const { missing: n, settling: a } = y(t, e, i);
77
+ return a ? /* @__PURE__ */ c("span", { "aria-hidden": "true", "data-related-unavailable-settling": "", className: o }) : /* @__PURE__ */ l(
32
78
  "span",
33
79
  {
34
- className: r("italic text-muted-foreground", t),
80
+ id: s,
81
+ className: h("italic text-muted-foreground", s && "relative", r),
35
82
  "data-related-unavailable": n.kind,
36
- "data-tip": n.tip,
37
- children: n.text
83
+ "data-tip": `${n.text}. ${n.tip}`,
84
+ children: [
85
+ n.text,
86
+ s && /* @__PURE__ */ l("span", { className: "sr-only", children: [
87
+ ". ",
88
+ n.tip
89
+ ] })
90
+ ]
38
91
  }
39
92
  );
40
93
  }
41
94
  export {
42
- c as RelatedMissingLabel,
43
- i as relatedMissing,
44
- u as retryRelatedRead
95
+ b as RELATED_LOADING_CLASS,
96
+ M as RelatedMissingLabel,
97
+ k as explainedMissing,
98
+ u as relatedMissing,
99
+ E as retryRelatedRead,
100
+ y as useRelatedMissing
45
101
  };