@nivaro/react 0.3.118 → 0.3.119
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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/ItemEditForm.js +2047 -2026
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +6 -4
- package/dist/shared/components/item-edit/FieldComments.js +45 -43
- package/dist/shared/components/item-edit/HeaderTools.js +237 -142
- package/dist/shared/components/item-edit/RecordHelpChip.js +10 -10
- package/dist/shared/components/item-edit/addendum-view.js +6 -0
- package/dist/shared/components/layout-editor/pickers/field-picker.js +118 -105
- package/package.json +1 -1
|
@@ -63,7 +63,9 @@ function ne({
|
|
|
63
63
|
"aria-label": `${x} — show what changed`,
|
|
64
64
|
"data-tip": x,
|
|
65
65
|
className: v(
|
|
66
|
-
|
|
66
|
+
// max-w-full: on a row narrower than the chip the label truncates; the record id
|
|
67
|
+
// beside it never gives way.
|
|
68
|
+
"inline-flex min-w-0 max-w-full shrink-0 items-center gap-1 rounded-full border px-2 py-px text-[10.5px] font-semibold",
|
|
67
69
|
// Violet, the approval hue — never the amber of the required-fields warning beside it.
|
|
68
70
|
"border-violet-300 bg-violet-50 text-violet-800 hover:bg-violet-100",
|
|
69
71
|
"dark:border-violet-400/40 dark:bg-violet-400/10 dark:text-violet-200 dark:hover:bg-violet-400/20",
|
|
@@ -71,9 +73,9 @@ function ne({
|
|
|
71
73
|
n.normal && "nvr-fade-in"
|
|
72
74
|
),
|
|
73
75
|
children: [
|
|
74
|
-
/* @__PURE__ */ i(A, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
75
|
-
"Changed after approval",
|
|
76
|
-
t.total > 1 && /* @__PURE__ */ o("span", { className: "tabular-nums font-medium text-violet-700/80 dark:text-violet-200/70", children: [
|
|
76
|
+
/* @__PURE__ */ i(A, { className: "h-3 w-3 shrink-0", "aria-hidden": !0 }),
|
|
77
|
+
/* @__PURE__ */ i("span", { className: "truncate", children: "Changed after approval" }),
|
|
78
|
+
t.total > 1 && /* @__PURE__ */ o("span", { className: "shrink-0 tabular-nums font-medium text-violet-700/80 dark:text-violet-200/70", children: [
|
|
77
79
|
"· ",
|
|
78
80
|
t.total
|
|
79
81
|
] })
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as E, useQueryClient as U, useMutation as q } from "@tanstack/react-query";
|
|
3
3
|
import { MessageSquare as W, Link2 as A, RotateCcw as H, Check as z } from "lucide-react";
|
|
4
4
|
import { useState as k, useMemo as v } from "react";
|
|
5
|
-
import { toast as
|
|
5
|
+
import { toast as y } from "sonner";
|
|
6
6
|
import { useNivaroClient as L } from "../../context.js";
|
|
7
7
|
import { get as G, post as D } from "../../lib/commands.js";
|
|
8
8
|
import { useRepliesWhileTyping as J } from "../../lib/comment-awareness.js";
|
|
9
9
|
import { openFieldCommentCounts as V, fieldThread as X, fieldDeepLinkQuery as Y } from "../../lib/field-comments.js";
|
|
10
10
|
import { useDraftTypingSignal as Z, useRecordSignalPeers as ee, useMyUserId as te, signalSentence as oe } from "../../lib/presence-signals.js";
|
|
11
11
|
import { cn as M, formatRelative as I } from "../../lib/utils.js";
|
|
12
|
-
import { RepliesWhileTyping as ne, SeenByLine as re, MentionDeliveryButton as
|
|
13
|
-
import { useCommentImages as
|
|
12
|
+
import { RepliesWhileTyping as ne, SeenByLine as re, MentionDeliveryButton as ae } from "../panels/CommentAwareness.js";
|
|
13
|
+
import { useCommentImages as ie, CommentImageStrip as se, CommentBody as le } from "../panels/CommentImages.js";
|
|
14
14
|
import { notePreviewText as de, MentionTextarea as me } from "../panels/CommentPanel.js";
|
|
15
15
|
import { Popover as ce, PopoverTrigger as pe, PopoverContent as ue } from "../ui/popover.js";
|
|
16
16
|
import { useFieldComments as he } from "./field-comments-context.js";
|
|
17
17
|
const K = (t, o) => ["comments", t, o];
|
|
18
18
|
function O(t, o, r) {
|
|
19
|
-
const
|
|
19
|
+
const a = L();
|
|
20
20
|
return E({
|
|
21
21
|
queryKey: K(t, o),
|
|
22
|
-
queryFn: () =>
|
|
22
|
+
queryFn: () => a.request(G("/comments", { collection: t, item: o })).then((m) => m.data),
|
|
23
23
|
enabled: r
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
function De(t) {
|
|
27
|
-
const o = t.itemId == null ? "" : String(t.itemId), r = t.enabled && o !== "" && o !== "new", { data:
|
|
27
|
+
const o = t.itemId == null ? "" : String(t.itemId), r = t.enabled && o !== "" && o !== "new", { data: a } = O(t.collection, o, r), [m, s] = k(null), c = v(() => V(a ?? []), [a]), { labelOf: l, jump: u, collection: f } = t;
|
|
28
28
|
return v(
|
|
29
29
|
() => r ? { collection: f, item: o, counts: c, openField: m, setOpenField: s, labelOf: l, jump: u } : null,
|
|
30
30
|
[r, f, o, c, m, l, u]
|
|
@@ -42,23 +42,25 @@ function xe({
|
|
|
42
42
|
field: o,
|
|
43
43
|
label: r
|
|
44
44
|
}) {
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */ n(pe, { asChild: !0, children: /* @__PURE__ */
|
|
45
|
+
const a = t.counts[o] ?? 0, m = t.openField === o;
|
|
46
|
+
return /* @__PURE__ */ i(ce, { open: m, onOpenChange: (s) => t.setOpenField(s ? o : null), children: [
|
|
47
|
+
/* @__PURE__ */ n(pe, { asChild: !0, children: /* @__PURE__ */ i(
|
|
48
48
|
"button",
|
|
49
49
|
{
|
|
50
50
|
type: "button",
|
|
51
51
|
"data-field-comment": o,
|
|
52
|
-
"data-field-comment-count":
|
|
53
|
-
"aria-label":
|
|
54
|
-
"data-tip":
|
|
52
|
+
"data-field-comment-count": a || void 0,
|
|
53
|
+
"aria-label": a ? `${a} open ${a === 1 ? "comment" : "comments"} on ${r}` : `Comment on ${r}`,
|
|
54
|
+
"data-tip": a ? void 0 : `Comment on ${r}`,
|
|
55
55
|
className: M(
|
|
56
56
|
"inline-flex items-center gap-0.5 rounded px-0.5 py-0.5 text-[10px] font-semibold transition-[opacity,color]",
|
|
57
|
-
|
|
57
|
+
// Always shown where comments are on (Rob 2026-11-16: a hover-only icon was easy to
|
|
58
|
+
// miss and jumped in beside the lock); quiet grey until a thread exists.
|
|
59
|
+
a || m ? "text-[#0e7490] dark:text-nvr-cyan" : "text-slate-400 hover:text-[#0e7490] dark:text-slate-500 dark:hover:text-nvr-cyan"
|
|
58
60
|
),
|
|
59
61
|
children: [
|
|
60
62
|
/* @__PURE__ */ n(W, { "aria-hidden": !0, className: "h-3 w-3" }),
|
|
61
|
-
|
|
63
|
+
a > 0 && /* @__PURE__ */ n("span", { className: "tabular-nums", children: a })
|
|
62
64
|
]
|
|
63
65
|
}
|
|
64
66
|
) }),
|
|
@@ -82,16 +84,16 @@ function fe({
|
|
|
82
84
|
field: o,
|
|
83
85
|
label: r
|
|
84
86
|
}) {
|
|
85
|
-
const
|
|
87
|
+
const a = L(), m = U(), { data: s, isLoading: c } = O(t.collection, t.item, !0), l = v(() => X(s ?? [], o), [s, o]), [u, f] = k(!1), [h, C] = k(""), p = ie();
|
|
86
88
|
Z(t.collection, t.item, h, o);
|
|
87
|
-
const
|
|
89
|
+
const w = ee(t.collection, t.item, "note", { field: o }), j = te(), B = v(
|
|
88
90
|
() => (s ?? []).filter((e) => e.field === o && !e.resolved_at),
|
|
89
91
|
[s, o]
|
|
90
92
|
), N = J(h, s ? B : void 0, j), $ = () => m.invalidateQueries({ queryKey: K(t.collection, t.item) }), F = (e, d) => {
|
|
91
93
|
var x, _, P;
|
|
92
94
|
return ((_ = (x = e == null ? void 0 : e.response) == null ? void 0 : x.data) == null ? void 0 : _.error) ?? ((P = e == null ? void 0 : e.data) == null ? void 0 : P.error) ?? d;
|
|
93
|
-
},
|
|
94
|
-
mutationFn: (e) =>
|
|
95
|
+
}, g = q({
|
|
96
|
+
mutationFn: (e) => a.request(
|
|
95
97
|
D("/comments", {
|
|
96
98
|
collection: t.collection,
|
|
97
99
|
item: t.item,
|
|
@@ -101,31 +103,31 @@ function fe({
|
|
|
101
103
|
})
|
|
102
104
|
),
|
|
103
105
|
onSuccess: () => {
|
|
104
|
-
|
|
106
|
+
C(""), p.reset(), $();
|
|
105
107
|
},
|
|
106
|
-
onError: (e) =>
|
|
108
|
+
onError: (e) => y.error(F(e, "Could not post the comment"))
|
|
107
109
|
}), R = q({
|
|
108
|
-
mutationFn: ({ id: e, resolved: d }) =>
|
|
110
|
+
mutationFn: ({ id: e, resolved: d }) => a.request(D(`/comments/${e}/resolve`, { resolved: d })),
|
|
109
111
|
onSuccess: () => void $(),
|
|
110
|
-
onError: (e) =>
|
|
112
|
+
onError: (e) => y.error(F(e, "Could not update the comment"))
|
|
111
113
|
}), S = () => {
|
|
112
114
|
const e = p.compose(h);
|
|
113
|
-
e && !p.uploading && !
|
|
115
|
+
e && !p.uploading && !g.isPending && g.mutate(e);
|
|
114
116
|
}, Q = () => {
|
|
115
117
|
const e = new URL(window.location.href);
|
|
116
118
|
e.searchParams.delete("field");
|
|
117
119
|
const d = e.search ? "&" : "?";
|
|
118
120
|
navigator.clipboard.writeText(`${e.origin}${e.pathname}${e.search}${d}${Y(o)}`).then(
|
|
119
|
-
() =>
|
|
120
|
-
() =>
|
|
121
|
+
() => y.success("Link to this field copied"),
|
|
122
|
+
() => y.error("Could not copy")
|
|
121
123
|
);
|
|
122
124
|
}, T = (e, d) => {
|
|
123
125
|
var x;
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ i("li", { "data-field-comment-row": e.id, className: "px-3 py-2", children: [
|
|
127
|
+
/* @__PURE__ */ i("div", { className: "flex items-baseline gap-1.5", children: [
|
|
126
128
|
/* @__PURE__ */ n("span", { className: "truncate text-[12px] font-medium text-slate-800 dark:text-foreground", children: b(e.user) }),
|
|
127
129
|
/* @__PURE__ */ n("span", { className: "shrink-0 text-[11px] text-slate-400 dark:text-muted-foreground", children: I(e.created_at) }),
|
|
128
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ i(
|
|
129
131
|
"button",
|
|
130
132
|
{
|
|
131
133
|
type: "button",
|
|
@@ -151,15 +153,15 @@ function fe({
|
|
|
151
153
|
)
|
|
152
154
|
}
|
|
153
155
|
),
|
|
154
|
-
!d && ((((x = e.seen_by) == null ? void 0 : x.length) ?? 0) > 0 || e.delivery_visible) && /* @__PURE__ */
|
|
156
|
+
!d && ((((x = e.seen_by) == null ? void 0 : x.length) ?? 0) > 0 || e.delivery_visible) && /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-x-2", children: [
|
|
155
157
|
/* @__PURE__ */ n(re, { people: e.seen_by }),
|
|
156
|
-
e.delivery_visible && /* @__PURE__ */ n(
|
|
158
|
+
e.delivery_visible && /* @__PURE__ */ n(ae, { collection: t.collection, item: t.item, commentId: e.id })
|
|
157
159
|
] })
|
|
158
160
|
] }, e.id);
|
|
159
161
|
};
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ i("div", { "data-field-comments": o, children: [
|
|
163
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
164
|
+
/* @__PURE__ */ i("p", { className: "m-0 min-w-0 flex-1 truncate text-[12px] font-semibold text-slate-700 dark:text-foreground", children: [
|
|
163
165
|
"Comments on ",
|
|
164
166
|
r
|
|
165
167
|
] }),
|
|
@@ -175,8 +177,8 @@ function fe({
|
|
|
175
177
|
}
|
|
176
178
|
)
|
|
177
179
|
] }),
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
c ? /* @__PURE__ */ n("p", { className: "m-0 px-3 py-3 text-[12px] text-slate-400 dark:text-muted-foreground", children: "Loading…" }) : l.open.length === 0 && l.resolved.length === 0 ? /* @__PURE__ */ n("p", { className: "m-0 px-3 py-3 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No comments on this field yet. They also show in the record’s Comments." }) : /* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ i("div", { className: "max-h-[260px] overflow-y-auto overscroll-contain", children: [
|
|
181
|
+
c ? /* @__PURE__ */ n("p", { className: "m-0 px-3 py-3 text-[12px] text-slate-400 dark:text-muted-foreground", children: "Loading…" }) : l.open.length === 0 && l.resolved.length === 0 ? /* @__PURE__ */ n("p", { className: "m-0 px-3 py-3 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No comments on this field yet. They also show in the record’s Comments." }) : /* @__PURE__ */ i("ul", { className: "m-0 list-none divide-y divide-slate-100 p-0 dark:divide-border", children: [
|
|
180
182
|
l.open.map((e) => T(e, !1)),
|
|
181
183
|
u && l.resolved.map((e) => T(e, !0))
|
|
182
184
|
] }),
|
|
@@ -191,7 +193,7 @@ function fe({
|
|
|
191
193
|
}
|
|
192
194
|
)
|
|
193
195
|
] }),
|
|
194
|
-
|
|
196
|
+
w.length > 0 && /* @__PURE__ */ i(
|
|
195
197
|
"p",
|
|
196
198
|
{
|
|
197
199
|
"data-field-comment-typing": o,
|
|
@@ -199,12 +201,12 @@ function fe({
|
|
|
199
201
|
className: "m-0 flex items-center gap-1.5 border-t border-slate-100 px-3 py-1.5 text-[11.5px] italic text-slate-400 dark:border-border dark:text-slate-500",
|
|
200
202
|
children: [
|
|
201
203
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan motion-reduce:animate-none" }),
|
|
202
|
-
oe(
|
|
204
|
+
oe(w, "replying"),
|
|
203
205
|
"…"
|
|
204
206
|
]
|
|
205
207
|
}
|
|
206
208
|
),
|
|
207
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ i("div", { className: "space-y-1.5 border-t border-slate-200 p-2 dark:border-border", children: [
|
|
208
210
|
/* @__PURE__ */ n(
|
|
209
211
|
ne,
|
|
210
212
|
{
|
|
@@ -222,7 +224,7 @@ function fe({
|
|
|
222
224
|
me,
|
|
223
225
|
{
|
|
224
226
|
value: h,
|
|
225
|
-
onChange:
|
|
227
|
+
onChange: C,
|
|
226
228
|
onImages: p.addFiles,
|
|
227
229
|
rows: 2,
|
|
228
230
|
"aria-label": `Comment on ${r}`,
|
|
@@ -234,16 +236,16 @@ function fe({
|
|
|
234
236
|
}
|
|
235
237
|
),
|
|
236
238
|
/* @__PURE__ */ n(se, { images: p }),
|
|
237
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
|
|
238
240
|
/* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 dark:text-muted-foreground", children: "Only people who can open this record are notified." }),
|
|
239
241
|
/* @__PURE__ */ n(
|
|
240
242
|
"button",
|
|
241
243
|
{
|
|
242
244
|
type: "button",
|
|
243
245
|
onClick: S,
|
|
244
|
-
disabled: !h.trim() && !p.hasReady || p.uploading ||
|
|
246
|
+
disabled: !h.trim() && !p.hasReady || p.uploading || g.isPending,
|
|
245
247
|
className: "inline-flex h-7 shrink-0 items-center rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white transition-colors hover:bg-nvr-cyan-dark disabled:opacity-50",
|
|
246
|
-
children:
|
|
248
|
+
children: g.isPending ? "Posting…" : p.uploading ? "Uploading…" : "Comment"
|
|
247
249
|
}
|
|
248
250
|
)
|
|
249
251
|
] })
|