@nivaro/react 0.3.64 → 0.3.66

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 (74) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +62 -8
  4. package/dist/shared/components/CollectionBrowserView.js +3127 -3204
  5. package/dist/shared/components/ConformanceView.js +235 -221
  6. package/dist/shared/components/DataTable.js +478 -459
  7. package/dist/shared/components/ItemEditForm.js +4842 -4500
  8. package/dist/shared/components/MyWorkView.js +124 -113
  9. package/dist/shared/components/PageRenderer.js +146 -138
  10. package/dist/shared/components/ProfileView.js +483 -472
  11. package/dist/shared/components/RecordDrilldownSheet.js +73 -65
  12. package/dist/shared/components/ReportView.js +1100 -1094
  13. package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
  14. package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
  15. package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
  16. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
  17. package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
  18. package/dist/shared/components/bulk/bulk-field-options.js +29 -23
  19. package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
  20. package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
  21. package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
  22. package/dist/shared/components/integrations/SendCurrentData.js +126 -0
  23. package/dist/shared/components/item-edit/CatalogPickerField.js +1535 -1440
  24. package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
  25. package/dist/shared/components/item-edit/FieldRow.js +413 -403
  26. package/dist/shared/components/item-edit/GroupSection.js +555 -538
  27. package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
  28. package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
  29. package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
  30. package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
  31. package/dist/shared/components/item-edit/PlanGrid.js +783 -724
  32. package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
  33. package/dist/shared/components/item-edit/RecordInsights.js +113 -111
  34. package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
  35. package/dist/shared/components/item-edit/RelationCombobox.js +398 -364
  36. package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
  37. package/dist/shared/components/item-edit/UserChip.js +264 -229
  38. package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -0
  39. package/dist/shared/components/item-edit/collision-format.js +37 -0
  40. package/dist/shared/components/item-edit/field-a11y.js +25 -0
  41. package/dist/shared/components/item-edit/header-path-preview.js +52 -0
  42. package/dist/shared/components/item-edit/line-merge.js +84 -0
  43. package/dist/shared/components/item-edit/line-midair.js +94 -87
  44. package/dist/shared/components/item-edit/move-guard.js +17 -0
  45. package/dist/shared/components/item-edit/picker-search.js +27 -16
  46. package/dist/shared/components/item-edit/rail-width.js +8 -0
  47. package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
  48. package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
  49. package/dist/shared/components/panels/CommentPanel.js +142 -136
  50. package/dist/shared/components/panels/ItemLockBanner.js +246 -240
  51. package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
  52. package/dist/shared/components/panels/RevisionsPanel.js +106 -102
  53. package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
  54. package/dist/shared/components/panels/SlaClock.js +90 -68
  55. package/dist/shared/components/queue/QueueItemSheet.js +94 -87
  56. package/dist/shared/components/queue/QueueWorklist.js +1522 -1347
  57. package/dist/shared/components/queue/worklist-csv.js +75 -0
  58. package/dist/shared/components/queue/worklist-helpers.js +20 -0
  59. package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
  60. package/dist/shared/lib/bulk-copy.js +17 -0
  61. package/dist/shared/lib/cbv-export.js +122 -0
  62. package/dist/shared/lib/delete-offer.js +13 -0
  63. package/dist/shared/lib/error-hints.js +1 -0
  64. package/dist/shared/lib/leave-guard.js +41 -26
  65. package/dist/shared/lib/list-link.js +72 -56
  66. package/dist/shared/lib/live-queries.js +32 -30
  67. package/dist/shared/lib/moved-notice.js +25 -0
  68. package/dist/shared/lib/notification-target.js +56 -54
  69. package/dist/shared/lib/obligation-banner.js +11 -8
  70. package/dist/shared/lib/obligation-reason-text.js +6 -6
  71. package/dist/shared/lib/quick-filter-cascade.js +29 -19
  72. package/dist/shared/lib/sort-cycle.js +6 -0
  73. package/dist/shared/lib/summary-mode.js +59 -41
  74. package/package.json +1 -1
@@ -0,0 +1,235 @@
1
+ import { jsx as r, jsxs as l } from "react/jsx-runtime";
2
+ import { useQuery as L } from "@tanstack/react-query";
3
+ import { useState as n } from "react";
4
+ import { toast as Q } from "sonner";
5
+ import { useNivaroClient as R } from "../../context.js";
6
+ import { post as $ } from "../../lib/commands.js";
7
+ import { userErrorMessage as X } from "../../lib/safe-error.js";
8
+ import { cn as a } from "../../lib/utils.js";
9
+ import { Popover as J, PopoverTrigger as U, PopoverContent as V } from "../ui/popover.js";
10
+ const w = 200;
11
+ function W({
12
+ collection: o,
13
+ selectedIds: p,
14
+ onDone: x,
15
+ onCancel: m,
16
+ layout: i = "inline"
17
+ }) {
18
+ var q;
19
+ const h = R(), [s, A] = n(""), [g, C] = n(""), [c, F] = n(!0), [d, P] = n(!0), [N, B] = n(!1), [M, D] = n(!1), [S, j] = n(!1), [E, O] = n(null), v = p.slice(0, w), K = p.length > w, { data: u } = L({
20
+ queryKey: ["cbv-msg-preview", o, v.join(","), c, d],
21
+ queryFn: () => h.request(
22
+ $("/notifications/message-stakeholders", {
23
+ collection: o,
24
+ ids: v,
25
+ include: { owners: c, creators: d },
26
+ preview: !0
27
+ })
28
+ ),
29
+ enabled: c || d
30
+ }), f = c || d ? (u == null ? void 0 : u.count) ?? null : 0, T = async () => {
31
+ if (!(!s.trim() || !g.trim())) {
32
+ j(!0), O(null);
33
+ try {
34
+ const e = await h.request(
35
+ $("/notifications/message-stakeholders", {
36
+ collection: o,
37
+ ids: v,
38
+ subject: M ? `Critical: ${s.trim()}` : s.trim(),
39
+ message: g.trim(),
40
+ include: { owners: c, creators: d },
41
+ email: N
42
+ })
43
+ );
44
+ x(`Messaged ${e.sent} stakeholder(s) across ${e.records} record(s)`);
45
+ } catch (e) {
46
+ O(X(e, "Failed to send")), j(!1);
47
+ }
48
+ }
49
+ }, t = i === "stacked", _ = t ? "flex cursor-pointer items-center gap-1.5 text-[12px] text-foreground" : "flex cursor-pointer items-center gap-1 text-[12px] text-slate-300 dark:text-muted-foreground", y = t ? "h-8 w-full rounded-md border border-input bg-background px-2 text-[12.5px] text-foreground placeholder:text-muted-foreground focus-visible:border-nvr-cyan focus-visible:outline-none" : "h-8 rounded-md border border-white/20 dark:border-border bg-white/10 dark:bg-background px-2 text-[12.5px] text-white dark:text-foreground placeholder:text-slate-400 dark:placeholder:text-muted-foreground", b = (e, z, G, k = {}) => /* @__PURE__ */ l("label", { className: _, ..."tip" in k ? { "data-tip": k.tip } : {}, children: [
50
+ /* @__PURE__ */ r(
51
+ "input",
52
+ {
53
+ type: "checkbox",
54
+ checked: e,
55
+ onChange: (H) => z(H.target.checked),
56
+ className: "h-3.5 w-3.5",
57
+ ..."data" in k ? { [k.data]: "" } : {}
58
+ }
59
+ ),
60
+ G
61
+ ] });
62
+ return /* @__PURE__ */ l(
63
+ "form",
64
+ {
65
+ className: a(t ? "flex flex-col gap-2" : "flex flex-wrap items-center gap-1.5"),
66
+ "data-message-stakeholders": i,
67
+ onSubmit: (e) => {
68
+ e.preventDefault(), T();
69
+ },
70
+ children: [
71
+ /* @__PURE__ */ l("div", { className: a("flex flex-wrap items-center", t ? "gap-x-3 gap-y-1" : "gap-1.5"), children: [
72
+ b(c, F, "Owners"),
73
+ b(d, P, "Creators"),
74
+ b(N, B, "Also email"),
75
+ b(M, D, "Critical", {
76
+ tip: "Marks the message critical: it lands in the Critical lane, gets past mutes and quiet hours, and you can see who has read it under Notifications → Sent.",
77
+ data: "data-msg-critical"
78
+ }),
79
+ /* @__PURE__ */ r(
80
+ "span",
81
+ {
82
+ className: a("text-[11.5px]", t ? "text-muted-foreground" : "text-nvr-cyan"),
83
+ "data-tip": (q = u == null ? void 0 : u.users) == null ? void 0 : q.map((e) => e.name).join(", "),
84
+ children: f == null ? "…" : `${f} recipient${f === 1 ? "" : "s"}`
85
+ }
86
+ )
87
+ ] }),
88
+ K && /* @__PURE__ */ l(
89
+ "p",
90
+ {
91
+ className: a(
92
+ "text-[11px]",
93
+ t ? "text-amber-700 dark:text-amber-300" : "text-amber-200"
94
+ ),
95
+ children: [
96
+ "Messages the people on the first ",
97
+ w,
98
+ " of ",
99
+ p.length,
100
+ " ",
101
+ "records."
102
+ ]
103
+ }
104
+ ),
105
+ /* @__PURE__ */ r(
106
+ "input",
107
+ {
108
+ autoFocus: !0,
109
+ value: s,
110
+ onChange: (e) => A(e.target.value),
111
+ placeholder: "Subject",
112
+ "aria-label": "Subject",
113
+ className: a(y, !t && "w-44")
114
+ }
115
+ ),
116
+ t ? /* @__PURE__ */ r(
117
+ "textarea",
118
+ {
119
+ value: g,
120
+ onChange: (e) => C(e.target.value),
121
+ placeholder: "Message",
122
+ "aria-label": "Message",
123
+ rows: 3,
124
+ className: a(y, "h-auto resize-none py-1.5")
125
+ }
126
+ ) : /* @__PURE__ */ r(
127
+ "input",
128
+ {
129
+ value: g,
130
+ onChange: (e) => C(e.target.value),
131
+ placeholder: "Message",
132
+ "aria-label": "Message",
133
+ className: a(y, "w-64")
134
+ }
135
+ ),
136
+ E && /* @__PURE__ */ r("span", { className: a("text-[11.5px]", t ? "text-destructive" : "text-red-300"), children: E }),
137
+ /* @__PURE__ */ l("div", { className: a("flex items-center gap-1.5", t && "justify-end"), children: [
138
+ t && /* @__PURE__ */ r(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ onClick: m,
143
+ className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground",
144
+ children: "Cancel"
145
+ }
146
+ ),
147
+ /* @__PURE__ */ r(
148
+ "button",
149
+ {
150
+ type: "submit",
151
+ disabled: S || !s.trim() || !g.trim() || f === 0,
152
+ className: a(
153
+ "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold disabled:opacity-50",
154
+ t ? "text-white" : "text-[#0f1e2d]"
155
+ ),
156
+ children: S ? "Sending…" : "Send"
157
+ }
158
+ ),
159
+ !t && /* @__PURE__ */ r(
160
+ "button",
161
+ {
162
+ type: "button",
163
+ onClick: m,
164
+ className: "h-8 px-2 text-[12.5px] text-slate-300 dark:text-muted-foreground hover:text-white dark:hover:text-foreground",
165
+ children: "Cancel"
166
+ }
167
+ )
168
+ ] })
169
+ ]
170
+ }
171
+ );
172
+ }
173
+ function ne({
174
+ targets: o,
175
+ disabled: p,
176
+ className: x
177
+ }) {
178
+ const [m, i] = n(!1), h = [...new Set(o.map((s) => s.collection))];
179
+ return o.length === 0 ? null : h.length !== 1 ? /* @__PURE__ */ r(
180
+ "button",
181
+ {
182
+ type: "button",
183
+ disabled: !0,
184
+ "data-tip": "Pick records of one kind to message their people together",
185
+ className: x,
186
+ children: "Message…"
187
+ }
188
+ ) : /* @__PURE__ */ l(J, { open: m, onOpenChange: i, children: [
189
+ /* @__PURE__ */ r(U, { asChild: !0, children: /* @__PURE__ */ r(
190
+ "button",
191
+ {
192
+ type: "button",
193
+ disabled: p,
194
+ className: x,
195
+ "data-bulk-message": !0,
196
+ "aria-haspopup": "dialog",
197
+ children: "Message…"
198
+ }
199
+ ) }),
200
+ /* @__PURE__ */ l(
201
+ V,
202
+ {
203
+ side: "top",
204
+ align: "center",
205
+ sideOffset: 8,
206
+ className: "w-[360px] max-w-[calc(100vw-24px)] p-3",
207
+ children: [
208
+ /* @__PURE__ */ l("p", { className: "mb-2 text-[13px] font-semibold text-foreground", children: [
209
+ "Message the people on ",
210
+ o.length,
211
+ " record",
212
+ o.length === 1 ? "" : "s"
213
+ ] }),
214
+ m && /* @__PURE__ */ r(
215
+ W,
216
+ {
217
+ collection: h[0],
218
+ selectedIds: o.map((s) => s.id),
219
+ layout: "stacked",
220
+ onCancel: () => i(!1),
221
+ onDone: (s) => {
222
+ i(!1), Q.success(s);
223
+ }
224
+ }
225
+ )
226
+ ]
227
+ }
228
+ )
229
+ ] });
230
+ }
231
+ export {
232
+ ne as BulkMessageButton,
233
+ w as MESSAGE_STAKEHOLDERS_MAX,
234
+ W as MessageStakeholdersForm
235
+ };
@@ -1,45 +1,51 @@
1
- import { formSections as i, mergeFormSections as a } from "../../lib/form-sections.js";
2
- import { titleCase as d } from "../../lib/utils.js";
3
- function u(e, f = {}) {
1
+ import { formSections as s, mergeFormSections as a, HEADER_SECTION_KEY as d } from "../../lib/form-sections.js";
2
+ import { titleCase as c } from "../../lib/utils.js";
3
+ function b(e, n = {}) {
4
4
  const t = e.forms.map(
5
- (r) => i(r.groups, r.placements, { ungroupedSort: r.ungrouped_sort })
5
+ (f) => s(f.groups, f.placements, { ungroupedSort: f.ungrouped_sort })
6
6
  );
7
7
  if (e.no_form > 0) {
8
- const r = new Set(t.flat().flatMap((o) => o.fields.map((l) => l.field))), n = Object.keys(e.fields).filter((o) => !r.has(o)).sort((o, l) => (f[o] || o).localeCompare(f[l] || l));
9
- n.length && t.push([
8
+ const f = new Set(t.flat().flatMap((o) => o.fields.map((r) => r.field))), i = Object.keys(e.fields).filter((o) => !f.has(o)).sort((o, r) => (n[o] || o).localeCompare(n[r] || r));
9
+ i.length && t.push([
10
10
  {
11
11
  key: "__no_form__",
12
12
  label: e.forms.length ? "Other fields" : "Fields",
13
- fields: n.map((o) => ({ field: o, label: null }))
13
+ fields: i.map((o) => ({ field: o, label: null }))
14
14
  }
15
15
  ]);
16
16
  }
17
- const s = [];
18
- for (const r of a(t)) {
19
- const n = r.fields.flatMap((o) => {
20
- const l = e.fields[o.field];
21
- return l ? [
17
+ const l = [];
18
+ for (const f of a(t)) {
19
+ const i = f.fields.flatMap((o) => {
20
+ const r = e.fields[o.field];
21
+ return r ? [
22
22
  {
23
23
  field: o.field,
24
- label: o.label || f[o.field] || d(o.field),
25
- writable: Math.max(0, l.records - l.locked),
26
- offForm: Math.max(0, e.readable - l.records),
27
- locked: l.locked,
28
- reason: l.reason
24
+ label: o.label || n[o.field] || c(o.field),
25
+ writable: Math.max(0, r.records - r.locked),
26
+ offForm: Math.max(0, e.readable - r.records),
27
+ locked: r.locked,
28
+ reason: r.reason,
29
+ required: r.required === !0
29
30
  }
30
31
  ] : [];
31
32
  });
32
- n.length && s.push({ key: r.key, label: r.label, options: n });
33
+ i.length && l.push({ key: f.key, label: f.label, options: i });
33
34
  }
34
- return s;
35
+ return u(l);
35
36
  }
36
- function p(e, f) {
37
+ function u(e) {
38
+ const n = (l) => l.key === d ? "Record header" : l.label.split(" › ").pop() ?? l.label, t = /* @__PURE__ */ new Map();
39
+ for (const l of e) t.set(n(l), (t.get(n(l)) ?? 0) + 1);
40
+ return e.map((l) => ({ ...l, label: (t.get(n(l)) ?? 0) > 1 ? l.label : n(l) }));
41
+ }
42
+ function h(e, n) {
37
43
  const t = [];
38
44
  return e.locked > 0 && t.push(
39
45
  e.writable === 0 && e.offForm === 0 ? e.reason ?? "Locked" : `locked on ${e.locked}`
40
- ), e.offForm > 0 && t.push(`not on the form of ${e.offForm}`), t.length === 0 ? null : e.writable === 0 && e.offForm === 0 ? t[0] : `${e.writable} of ${f} — ${t.join(", ")}`;
46
+ ), e.offForm > 0 && t.push(`not on the form of ${e.offForm}`), t.length === 0 ? null : e.writable === 0 && e.offForm === 0 ? t[0] : `${e.writable} of ${n} — ${t.join(", ")}`;
41
47
  }
42
48
  export {
43
- p as bulkFieldNote,
44
- u as bulkFieldSections
49
+ h as bulkFieldNote,
50
+ b as bulkFieldSections
45
51
  };