@nivaro/react 0.3.41 → 0.3.42

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 (96) hide show
  1. package/dist/components/LayoutForm.js +100 -98
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +644 -15
  5. package/dist/index.js +814 -775
  6. package/dist/shared/components/ActivityEntry.js +154 -0
  7. package/dist/shared/components/AudienceConfirmPanel.js +98 -0
  8. package/dist/shared/components/BackgroundRunOffer.js +43 -31
  9. package/dist/shared/components/BroadcastView.js +225 -204
  10. package/dist/shared/components/CollectionBrowserView.js +3924 -3584
  11. package/dist/shared/components/ConfigHistory.js +153 -0
  12. package/dist/shared/components/ConfigReadBack.js +65 -0
  13. package/dist/shared/components/DataTable.js +379 -346
  14. package/dist/shared/components/ForceReloadBanner.js +47 -40
  15. package/dist/shared/components/IdleReloadWatcher.js +69 -0
  16. package/dist/shared/components/ItemEditForm.js +4041 -3853
  17. package/dist/shared/components/MyWorkView.js +278 -213
  18. package/dist/shared/components/NotificationBell.js +130 -121
  19. package/dist/shared/components/ProfileView.js +776 -1003
  20. package/dist/shared/components/RecentRecordsRail.js +34 -16
  21. package/dist/shared/components/RecordReadView.js +500 -477
  22. package/dist/shared/components/Skeletons.js +199 -0
  23. package/dist/shared/components/SlowNotice.js +63 -0
  24. package/dist/shared/components/Term.js +23 -0
  25. package/dist/shared/components/WidgetSlot.js +350 -353
  26. package/dist/shared/components/access/PermissionSummary.js +106 -0
  27. package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
  28. package/dist/shared/components/chat/ChatPanel.js +902 -886
  29. package/dist/shared/components/chat/MemberPaging.js +70 -0
  30. package/dist/shared/components/chat/RoomParts.js +147 -117
  31. package/dist/shared/components/chat/ScreenClip.js +73 -69
  32. package/dist/shared/components/chat/chat-core.js +449 -396
  33. package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
  34. package/dist/shared/components/help-videos/api.js +2 -5
  35. package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
  36. package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
  37. package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
  38. package/dist/shared/components/imports/RunDetailSheet.js +222 -227
  39. package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
  40. package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
  41. package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
  42. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
  43. package/dist/shared/components/item-edit/FieldComments.js +212 -0
  44. package/dist/shared/components/item-edit/FieldRow.js +340 -336
  45. package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
  46. package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
  47. package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
  48. package/dist/shared/components/item-edit/field-comments-context.js +6 -0
  49. package/dist/shared/components/item-edit/field-sources.js +33 -0
  50. package/dist/shared/components/item-edit/rule-hidden.js +30 -0
  51. package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
  52. package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
  53. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
  54. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
  55. package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
  56. package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
  57. package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
  58. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  59. package/dist/shared/components/list/CopyListLinkButton.js +41 -0
  60. package/dist/shared/components/list/InlineEdit.js +363 -0
  61. package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
  62. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
  63. package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
  64. package/dist/shared/components/notifications/TestMyRules.js +137 -0
  65. package/dist/shared/components/notifications/changes-lines.js +24 -0
  66. package/dist/shared/components/notifications/why-lines.js +64 -0
  67. package/dist/shared/components/panels/CommentPanel.js +316 -281
  68. package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
  69. package/dist/shared/components/panels/PipelinePanel.js +201 -196
  70. package/dist/shared/components/panels/RevisionsPanel.js +496 -479
  71. package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
  72. package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
  73. package/dist/shared/components/profile/PersonDidPanel.js +188 -0
  74. package/dist/shared/components/profile/PersonProfile.js +57 -52
  75. package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
  76. package/dist/shared/hooks/useSlowReason.js +39 -0
  77. package/dist/shared/lib/activity-sentence.js +670 -0
  78. package/dist/shared/lib/config-sentences.js +418 -0
  79. package/dist/shared/lib/core-glossary.js +229 -0
  80. package/dist/shared/lib/error-hints.js +159 -0
  81. package/dist/shared/lib/error-message.js +105 -0
  82. package/dist/shared/lib/error-toast.js +22 -0
  83. package/dist/shared/lib/field-comments.js +25 -0
  84. package/dist/shared/lib/filter-sentence.js +261 -0
  85. package/dist/shared/lib/glossary.js +55 -48
  86. package/dist/shared/lib/idle-reload.js +138 -0
  87. package/dist/shared/lib/layout-resolve.js +42 -29
  88. package/dist/shared/lib/list-inline-edit.js +190 -0
  89. package/dist/shared/lib/list-link.js +147 -0
  90. package/dist/shared/lib/prefetch.js +259 -106
  91. package/dist/shared/lib/record-ref.js +72 -0
  92. package/dist/shared/lib/reload-holds.js +25 -0
  93. package/dist/shared/lib/safe-error.js +52 -24
  94. package/dist/shared/lib/skeleton-shapes.js +72 -0
  95. package/dist/shared/lib/slow-reason.js +63 -0
  96. package/package.json +1 -1
@@ -1,39 +1,67 @@
1
- import { reportClientCrash as a } from "./client-crash.js";
2
- const u = "Something went wrong — it’s been reported", c = /failed to fetch|load failed|networkerror|network request failed|network error/i;
3
- function l(t) {
1
+ import { reportClientCrash as c } from "./client-crash.js";
2
+ const d = "Something went wrong — it’s been reported", g = /failed to fetch|load failed|networkerror|network request failed|network error/i;
3
+ function u(e) {
4
4
  var s;
5
- const r = t, e = (r == null ? void 0 : r.status) ?? ((s = r == null ? void 0 : r.response) == null ? void 0 : s.status);
6
- return typeof e == "number" ? e : null;
5
+ const t = e, o = (t == null ? void 0 : t.status) ?? ((s = t == null ? void 0 : t.response) == null ? void 0 : s.status);
6
+ return typeof o == "number" ? o : null;
7
7
  }
8
- function f(t) {
9
- return !(t instanceof Error) || l(t) != null || t.response != null || c.test(t.message) ? !1 : t instanceof TypeError || t instanceof ReferenceError || t instanceof RangeError;
8
+ function f(e) {
9
+ return !(e instanceof Error) || u(e) != null || e.response != null || g.test(e.message) ? !1 : e instanceof TypeError || e instanceof ReferenceError || e instanceof RangeError;
10
10
  }
11
- const d = /^(bad request|unauthorized|forbidden|not found|conflict|unprocessable entity|too many requests|internal server error|bad gateway|service unavailable|gateway timeout)$/i;
12
- function m(t) {
11
+ const l = /^(bad request|unauthorized|forbidden|not found|conflict|unprocessable entity|too many requests|internal server error|bad gateway|service unavailable|gateway timeout)$/i;
12
+ function h(e) {
13
13
  var s;
14
- const r = t, e = [(s = r == null ? void 0 : r.response) == null ? void 0 : s.data, r == null ? void 0 : r.response];
15
- for (const o of e) {
16
- const n = o == null ? void 0 : o.error;
17
- if (typeof n == "string" && n.trim() && !d.test(n.trim())) return n.trim();
14
+ const t = e, o = [(s = t == null ? void 0 : t.response) == null ? void 0 : s.data, t == null ? void 0 : t.response];
15
+ for (const r of o) {
16
+ const n = r == null ? void 0 : r.error;
17
+ if (typeof n == "string" && n.trim() && !l.test(n.trim())) return n.trim();
18
18
  }
19
- for (const o of e) {
20
- const n = o == null ? void 0 : o.message;
19
+ for (const r of o) {
20
+ const n = r == null ? void 0 : r.message;
21
21
  if (typeof n == "string" && n.trim()) return n.trim();
22
22
  }
23
23
  return null;
24
24
  }
25
- function g(t, r = "Failed") {
26
- const e = m(t);
27
- return e || (f(t) ? u : t instanceof Error ? t.message || r : typeof t == "string" && t.trim() ? t : r);
25
+ function p(e, t = "Failed") {
26
+ const o = h(e);
27
+ return o || (f(e) ? d : e instanceof Error ? w(e.message) ? m(u(e)) ?? t : e.message || t : typeof e == "string" && e.trim() ? e : t);
28
28
  }
29
- const i = /* @__PURE__ */ new WeakSet();
30
- function E(t, r) {
31
- !t || !f(r) || i.has(r) || (i.add(r), a(t, r, null).catch(() => {
29
+ const i = {
30
+ 400: "That request could not be completed",
31
+ 401: "You are signed out",
32
+ 403: "You do not have access to do this",
33
+ 404: "That could not be found",
34
+ 408: "The server took too long to answer",
35
+ 409: "This changed while you were working on it",
36
+ 413: "That is too large to send",
37
+ 422: "Some values need fixing",
38
+ 423: "Someone else is working on this",
39
+ 429: "Too many requests in a short time",
40
+ 500: "Something went wrong on the server",
41
+ 502: "The server is not answering right now",
42
+ 503: "The server is not answering right now",
43
+ 504: "The server took too long to answer"
44
+ };
45
+ function m(e) {
46
+ return e == null ? null : i[e] ?? (e >= 500 ? i[500] : e >= 400 ? i[400] : null);
47
+ }
48
+ function w(e) {
49
+ if (typeof e != "string") return !1;
50
+ const t = e.trim();
51
+ return /^request failed with status( code)? \d{3}$/i.test(t) || l.test(t) || /^(payload too large|request entity too large|locked|request timeout)$/i.test(t);
52
+ }
53
+ const a = /* @__PURE__ */ new WeakSet();
54
+ function S(e, t) {
55
+ !e || !f(t) || a.has(t) || (a.add(t), c(e, t, null).catch(() => {
32
56
  }));
33
57
  }
34
58
  export {
35
- u as SOMETHING_WENT_WRONG,
59
+ d as SOMETHING_WENT_WRONG,
60
+ i as STATUS_TITLES,
61
+ u as errorStatusOf,
62
+ w as isBareStatusText,
36
63
  f as isCodeError,
37
- E as reportCodeError,
38
- g as userErrorMessage
64
+ S as reportCodeError,
65
+ m as statusTitle,
66
+ p as userErrorMessage
39
67
  };
@@ -0,0 +1,72 @@
1
+ function b(s, i) {
2
+ const r = String(s ?? "").toLowerCase(), n = String(i ?? "").toLowerCase();
3
+ return n.includes("user") || n.includes("avatar") || n.includes("owner") ? "avatar" : n.includes("status") || n.includes("badge") || n.includes("select-dropdown") ? "badge" : r === "boolean" || n.includes("toggle") || n.includes("checkbox") ? "bool" : r === "date" || r === "datetime" || r === "timestamp" || r === "time" ? "date" : r === "integer" || r === "biginteger" || r === "float" || r === "decimal" ? "number" : r === "text" || n.includes("textarea") || n.includes("rich") ? "long" : r === "uuid" ? "short" : "text";
4
+ }
5
+ function g(s, i) {
6
+ const r = Math.sin((s + 1) * 12.9898 + (i + 1) * 78.233) * 43758.5453;
7
+ return r - Math.floor(r);
8
+ }
9
+ function h(s, i, r) {
10
+ const n = g(i, r);
11
+ switch (s) {
12
+ case "number":
13
+ return `${Math.round(36 + n * 28)}px`;
14
+ case "date":
15
+ return `${Math.round(72 + n * 10)}px`;
16
+ case "badge":
17
+ return `${Math.round(52 + n * 26)}px`;
18
+ case "avatar":
19
+ return "20px";
20
+ case "bool":
21
+ return "14px";
22
+ case "short":
23
+ return `${Math.round(30 + n * 30)}%`;
24
+ case "long":
25
+ return `${Math.round(60 + n * 35)}%`;
26
+ default:
27
+ return `${Math.round(45 + n * 45)}%`;
28
+ }
29
+ }
30
+ function _(s, i, r = {}) {
31
+ const n = new Map(i.map((o) => [o.field, o]));
32
+ return s.map((o) => {
33
+ const l = n.get(o.split(".")[0]);
34
+ return { key: o, shape: b(l == null ? void 0 : l.type, l == null ? void 0 : l.interface), width: r[o] ?? null };
35
+ });
36
+ }
37
+ const m = [3, 4, 6, 12];
38
+ function y(s, i = {}) {
39
+ if (!s || !Array.isArray(s.groups) || !Array.isArray(s.assignments)) return null;
40
+ const r = i.maxSections ?? 6, n = i.maxFields ?? 16, o = [...s.groups].filter((t) => t.visibility_mode === "new_only" ? !!i.isNew : t.visibility_mode === "existing_only" ? !i.isNew : !0).sort((t, e) => (t.sort ?? 0) - (e.sort ?? 0)), l = o.filter((t) => t.type === "tab" && t.container_id == null), d = l[0] ?? null, f = (t) => s.assignments.filter(
41
+ (e) => (e.group_key ?? null) === t && e.is_visible !== !1 && e.is_visible !== 0 && !!e.field
42
+ ).sort((e, u) => (e.sort ?? 0) - (u.sort ?? 0)).slice(0, n).map((e) => {
43
+ const u = e.widget_id != null || /^__.*__$/.test(e.field), a = m.includes(Number(e.col_span)) ? Number(e.col_span) : 12;
44
+ return { key: e.field, span: u ? Math.max(a, 6) : a, ...u ? { tall: u } : {} };
45
+ }), c = [], p = (t) => {
46
+ const e = f(t.key);
47
+ e.length && c.push({ key: t.key, label: t.label ?? null, fields: e });
48
+ };
49
+ if (d) {
50
+ const t = f(d.key);
51
+ t.length && c.push({ key: d.key, label: null, fields: t });
52
+ for (const e of o)
53
+ e.type === "section" && e.container_id != null && e.container_id === d.id && p(e);
54
+ } else {
55
+ const t = f(null), e = s.ungrouped_sort ?? -1;
56
+ let u = t.length === 0;
57
+ for (const a of o)
58
+ a.type !== "section" && a.type !== "metadata" || (!u && (a.sort ?? 0) > e && (c.push({ key: "__ungrouped__", label: null, fields: t }), u = !0), p(a));
59
+ u || c.push({ key: "__ungrouped__", label: null, fields: t });
60
+ }
61
+ return {
62
+ tabs: l.map((t) => t.label || t.key).slice(0, 8),
63
+ sections: c.slice(0, r)
64
+ };
65
+ }
66
+ export {
67
+ h as cellWidth,
68
+ y as formSkeletonFromLayout,
69
+ g as jitter,
70
+ b as shapeForField,
71
+ _ as skeletonColumnsFrom
72
+ };
@@ -0,0 +1,63 @@
1
+ const f = 3e3, l = 3e3, c = 40;
2
+ function u(t) {
3
+ if (!Number.isFinite(t) || t < 0) return "0";
4
+ if (t >= 1e6) {
5
+ const o = Math.round(t / 1e5) / 10;
6
+ return `${o % 1 === 0 ? o.toFixed(0) : o.toFixed(1)} million`;
7
+ }
8
+ return Math.round(t).toLocaleString("en-US");
9
+ }
10
+ function s(t) {
11
+ const o = t.replace(/[_-]+/g, " ").trim();
12
+ return o ? o.split(/\s+/).map((e) => e === e.toUpperCase() ? e : e[0].toUpperCase() + e.slice(1)).join(" ") : t;
13
+ }
14
+ function a(t, o) {
15
+ return t.noun ? t.noun : o.collection ? o.collection.replace(/_/g, " ") : null;
16
+ }
17
+ function d(t, o = {}) {
18
+ var r;
19
+ if (!(t != null && t.found) || !t.kind) return null;
20
+ const e = a(o, t);
21
+ switch (t.kind) {
22
+ case "slot": {
23
+ const n = t.position ?? null;
24
+ return n && n > 1 ? `Waiting for a free slot — busy right now (${n - 1} ahead of you)` : n === 1 ? "Waiting for a free slot — busy right now (you are next)" : "Waiting for a free slot — busy right now";
25
+ }
26
+ case "external":
27
+ return t.subject ? `Waiting for ${s(t.subject)}` : "Waiting for a partner system";
28
+ case "query":
29
+ case "widget": {
30
+ const n = ((r = o.label) == null ? void 0 : r.trim()) || (t.subject ? s(t.subject) : t.kind === "widget" ? "this widget" : "the query");
31
+ return t.shared ? `Someone else is running ${n} too — sharing their answer` : t.kind === "widget" ? `Working out ${n} — not cached yet` : `Running ${n} — not cached yet`;
32
+ }
33
+ case "database": {
34
+ const n = o.knownRows ?? t.table_rows ?? null, i = t.rows_so_far && t.rows_so_far > 0 ? ` — ${u(t.rows_so_far)} so far` : "";
35
+ return n && n > 0 ? `Reading ${u(n)} ${e ?? "records"}${i}` : e ? `Reading ${e} from the database${i}` : `Reading from the database${i}`;
36
+ }
37
+ case "auth":
38
+ return "Checking your sign-in";
39
+ default:
40
+ return e ? `Preparing ${e}` : null;
41
+ }
42
+ }
43
+ function g(t) {
44
+ const o = Math.max(0, Math.floor(t / 1e3));
45
+ return o < 60 ? `${o}s` : `${Math.floor(o / 60)}m ${String(o % 60).padStart(2, "0")}s`;
46
+ }
47
+ function h(t) {
48
+ let o = null;
49
+ for (const [, e] of t) {
50
+ const r = e == null ? void 0 : e.total;
51
+ typeof r == "number" && Number.isFinite(r) && r > 0 && (o = Math.max(o ?? 0, r));
52
+ }
53
+ return o;
54
+ }
55
+ export {
56
+ f as SLOW_REASON_AFTER_MS,
57
+ c as SLOW_REASON_MAX_POLLS,
58
+ l as SLOW_REASON_POLL_MS,
59
+ g as elapsedLabel,
60
+ u as formatCount,
61
+ h as knownTotalFrom,
62
+ d as slowReasonText
63
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.41",
3
+ "version": "0.3.42",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",