@nivaro/react 0.3.14 → 0.3.16

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 (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +127 -6
  4. package/dist/index.js +736 -734
  5. package/dist/shared/components/CollectionBrowserView.js +2316 -2281
  6. package/dist/shared/components/ItemEditForm.js +3773 -3604
  7. package/dist/shared/components/RecordGridEditor.js +319 -282
  8. package/dist/shared/components/RecordReadView.js +202 -200
  9. package/dist/shared/components/cbv/unknown-fields.js +18 -8
  10. package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
  11. package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
  12. package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
  13. package/dist/shared/components/item-edit/FieldRow.js +198 -184
  14. package/dist/shared/components/item-edit/HeaderTools.js +107 -99
  15. package/dist/shared/components/item-edit/InlineTableField.js +138 -136
  16. package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
  17. package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
  18. package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
  19. package/dist/shared/components/item-edit/column-length.js +12 -0
  20. package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
  21. package/dist/shared/components/panels/ItemLockBanner.js +307 -285
  22. package/dist/shared/components/panels/PipelinePanel.js +486 -465
  23. package/dist/shared/components/panels/RevisionsPanel.js +210 -204
  24. package/dist/shared/components/profile/DelegationCard.js +178 -121
  25. package/dist/shared/components/profile/PersonActivity.js +152 -139
  26. package/dist/shared/components/queue/QueueWorklist.js +668 -659
  27. package/dist/shared/components/queue/transition-note.js +90 -0
  28. package/dist/shared/components/support/SupportRequestDialog.js +100 -89
  29. package/dist/shared/components/support/TicketDetailSheet.js +104 -91
  30. package/dist/shared/lib/autofill-runs.js +33 -26
  31. package/dist/shared/lib/draft-store.js +40 -24
  32. package/dist/shared/lib/live-queries.js +10 -9
  33. package/dist/shared/lib/restore-skipped.js +10 -0
  34. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ function e(t) {
2
+ const n = Number(t.max_length);
3
+ return Number.isInteger(n) && n > 0 ? n : null;
4
+ }
5
+ function l(t, n, o) {
6
+ const r = e(t);
7
+ return r == null || typeof n != "string" || n.length <= r ? null : `${o} is too long — ${r.toLocaleString()} characters at most (it has ${n.length.toLocaleString()})`;
8
+ }
9
+ export {
10
+ l as columnLengthError,
11
+ e as columnMaxLength
12
+ };
@@ -1,41 +1,50 @@
1
- import { jsx as e, jsxs as t, Fragment as c } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as r, Fragment as m } from "react/jsx-runtime";
2
2
  import { useMutation as g, useQuery as f } from "@tanstack/react-query";
3
- import { Lock as k, Check as y, Send as v, ArrowLeft as N } from "lucide-react";
4
- import { toast as p } from "sonner";
3
+ import { Lock as k, Check as y, Send as N, ArrowLeft as v } from "lucide-react";
5
4
  import { useState as w } from "react";
5
+ import { toast as x } from "sonner";
6
6
  import { useNivaroClient as q } from "../../context.js";
7
7
  import { post as C, get as S } from "../../lib/commands.js";
8
- function T({
9
- collection: r,
10
- itemId: a,
11
- onBack: m
8
+ const j = {
9
+ access: !1,
10
+ reasons: [{ type: "not_found", message: "There is no record with this id." }]
11
+ };
12
+ function A(a) {
13
+ var n;
14
+ const t = a;
15
+ return ((t == null ? void 0 : t.status) ?? ((n = t == null ? void 0 : t.response) == null ? void 0 : n.status)) === 404;
16
+ }
17
+ function D({
18
+ collection: a,
19
+ itemId: t,
20
+ onBack: o
12
21
  }) {
13
- const u = q(), [x, h] = w(!1), n = g({
14
- mutationFn: () => u.request(C("/access-requests", { collection: r, item: String(a) })),
22
+ const n = q(), [p, h] = w(!1), l = g({
23
+ mutationFn: () => n.request(C("/access-requests", { collection: a, item: String(t) })),
15
24
  onSuccess: () => {
16
- h(!0), p.success("Access request sent — an administrator has been notified");
25
+ h(!0), x.success("Access request sent — an administrator has been notified");
17
26
  },
18
- onError: () => p.error("Could not send the request")
19
- }), { data: l, isLoading: o } = f({
20
- queryKey: ["access-explain", r, String(a)],
21
- queryFn: () => u.request(
22
- S(`/access-explain/${r}/${encodeURIComponent(a)}`)
23
- ).then((s) => s.data ?? null).catch(() => null),
27
+ onError: () => x.error("Could not send the request")
28
+ }), { data: i, isLoading: c } = f({
29
+ queryKey: ["access-explain", a, String(t)],
30
+ queryFn: () => n.request(
31
+ S(`/access-explain/${a}/${encodeURIComponent(t)}`)
32
+ ).then((s) => s.data ?? null).catch((s) => A(s) ? j : null),
24
33
  staleTime: 3e4
25
- }), d = (l == null ? void 0 : l.reasons) ?? [], i = d.some((s) => s.type === "not_found");
26
- return /* @__PURE__ */ e("div", { className: "flex flex-1 items-start justify-center px-6 py-16", children: /* @__PURE__ */ t("div", { className: "w-full max-w-[560px] rounded-xl border border-slate-200 bg-white p-8 dark:border-border dark:bg-card", children: [
27
- /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
34
+ }), d = (i == null ? void 0 : i.reasons) ?? [], u = d.some((s) => s.type === "not_found");
35
+ return /* @__PURE__ */ e("div", { className: "flex flex-1 items-start justify-center px-6 py-16", children: /* @__PURE__ */ r("div", { className: "w-full max-w-[560px] rounded-xl border border-slate-200 bg-white p-8 dark:border-border dark:bg-card", children: [
36
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
28
37
  /* @__PURE__ */ e("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(k, { className: "h-[18px] w-[18px] text-slate-500 dark:text-slate-400" }) }),
29
- /* @__PURE__ */ t("div", { children: [
30
- /* @__PURE__ */ e("h2", { className: "text-[15px] font-semibold text-slate-800 dark:text-slate-100", children: i ? "Record not found" : "You can't view this record" }),
31
- /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: [
32
- r.replace(/_/g, " "),
38
+ /* @__PURE__ */ r("div", { children: [
39
+ /* @__PURE__ */ e("h2", { className: "text-[15px] font-semibold text-slate-800 dark:text-slate-100", children: u ? "Record not found" : "You can't view this record" }),
40
+ /* @__PURE__ */ r("p", { className: "break-all text-[12px] text-slate-500 dark:text-slate-400", children: [
41
+ a.replace(/_/g, " "),
33
42
  " · #",
34
- a
43
+ t
35
44
  ] })
36
45
  ] })
37
46
  ] }),
38
- /* @__PURE__ */ e("div", { className: "mt-5 space-y-2.5", children: o ? /* @__PURE__ */ t(c, { children: [
47
+ /* @__PURE__ */ e("div", { className: "mt-5 space-y-2.5", children: c ? /* @__PURE__ */ r(m, { children: [
39
48
  /* @__PURE__ */ e("div", { className: "animate-pulse h-4 w-3/4 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
40
49
  /* @__PURE__ */ e("div", { className: "animate-pulse h-4 w-1/2 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
41
50
  ] }) : d.length > 0 ? d.map((s, b) => /* @__PURE__ */ e(
@@ -46,32 +55,32 @@ function T({
46
55
  },
47
56
  `${s.type}-${s.dimension ?? b}`
48
57
  )) : /* @__PURE__ */ e("div", { className: "rounded-lg border border-slate-200 bg-slate-50 px-3.5 py-2.5 text-[13px] leading-relaxed text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-300", children: "This record could not be loaded. It may have been deleted, or an access rule may be hiding it." }) }),
49
- !i && !o && d.length > 0 && /* @__PURE__ */ e("p", { className: "mt-4 text-[12px] text-slate-500 dark:text-slate-400", children: "If you need access, request it below — an administrator gets the record and the reason attached, and can adjust your role's permissions or access filters." }),
50
- !i && !o && /* @__PURE__ */ e(
58
+ !u && !c && d.length > 0 && /* @__PURE__ */ e("p", { className: "mt-4 text-[12px] text-slate-500 dark:text-slate-400", children: "If you need access, request it below — an administrator gets the record and the reason attached, and can adjust your role's permissions or access filters." }),
59
+ !u && !c && /* @__PURE__ */ e(
51
60
  "button",
52
61
  {
53
62
  type: "button",
54
- disabled: x || n.isPending,
55
- onClick: () => n.mutate(),
63
+ disabled: p || l.isPending,
64
+ onClick: () => l.mutate(),
56
65
  className: "mt-3 inline-flex items-center gap-1.5 rounded-md bg-nvr-cyan px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",
57
66
  "data-request-access": !0,
58
- children: x ? /* @__PURE__ */ t(c, { children: [
67
+ children: p ? /* @__PURE__ */ r(m, { children: [
59
68
  /* @__PURE__ */ e(y, { className: "h-3.5 w-3.5" }),
60
69
  " Request sent"
61
- ] }) : /* @__PURE__ */ t(c, { children: [
62
- /* @__PURE__ */ e(v, { className: "h-3.5 w-3.5" }),
63
- n.isPending ? "Sending…" : "Request access"
70
+ ] }) : /* @__PURE__ */ r(m, { children: [
71
+ /* @__PURE__ */ e(N, { className: "h-3.5 w-3.5" }),
72
+ l.isPending ? "Sending…" : "Request access"
64
73
  ] })
65
74
  }
66
75
  ),
67
- m && /* @__PURE__ */ t(
76
+ o && /* @__PURE__ */ r(
68
77
  "button",
69
78
  {
70
79
  type: "button",
71
- onClick: m,
80
+ onClick: o,
72
81
  className: "mt-5 inline-flex items-center gap-1.5 rounded-md border border-slate-200 px-3 py-1.5 text-[12px] font-medium text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-white/[0.03]",
73
82
  children: [
74
- /* @__PURE__ */ e(N, { className: "h-3.5 w-3.5" }),
83
+ /* @__PURE__ */ e(v, { className: "h-3.5 w-3.5" }),
75
84
  "Go back"
76
85
  ]
77
86
  }
@@ -79,5 +88,6 @@ function T({
79
88
  ] }) });
80
89
  }
81
90
  export {
82
- T as AccessDeniedPanel
91
+ D as AccessDeniedPanel,
92
+ A as explainMissing
83
93
  };