@nivaro/react 0.3.140 → 0.3.141
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/index.d.ts +3 -0
- package/dist/shared/components/CollectionBrowserView.js +842 -830
- package/dist/shared/components/ItemEditForm.js +825 -819
- package/dist/shared/components/RowPresence.js +83 -76
- package/dist/shared/components/UnseenDot.js +183 -22
- package/dist/shared/components/delivery-analytics/drill.js +32 -32
- package/dist/shared/components/item-edit/InlineTableField.js +338 -338
- package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
- package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
- package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
- package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
- package/dist/shared/components/layout-editor/settings/controls.js +98 -90
- package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
- package/dist/shared/components/queue/QueueWorklist.js +556 -545
- package/dist/shared/components/support/RequestList.js +2 -2
- package/dist/shared/lib/layout-resolve.js +64 -48
- package/package.json +1 -1
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { ChevronRight as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { compareValueText as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
1
|
+
import { jsxs as o, jsx as t, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as N } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronRight as g, ArrowRight as k } from "lucide-react";
|
|
4
|
+
import { useState as w, useId as R } from "react";
|
|
5
|
+
import { useNivaroClient as C } from "../../context.js";
|
|
6
|
+
import { get as T } from "../../lib/commands.js";
|
|
7
|
+
import { compareValueText as _ } from "../../lib/compare-value.js";
|
|
8
|
+
import { useRelativeText as S } from "../../lib/relative-ticker.js";
|
|
9
|
+
import { formatDateTime as p, cn as h } from "../../lib/utils.js";
|
|
10
|
+
import { ErrorNotice as $ } from "../ErrorNotice.js";
|
|
11
|
+
import { RelativeTime as j } from "../RelativeTime.js";
|
|
12
|
+
import { UserAvatar as A } from "../UserAvatar.js";
|
|
13
|
+
import { Skeleton as u } from "../ui/skeleton.js";
|
|
14
|
+
function x(e, a, r) {
|
|
14
15
|
if (a !== void 0) return a;
|
|
15
16
|
if (e == null || e === "" || Array.isArray(e) && e.length === 0) return null;
|
|
16
|
-
const
|
|
17
|
+
const l = r ? {
|
|
17
18
|
type: r.type,
|
|
18
19
|
interface: r.interface,
|
|
19
20
|
options: r.options,
|
|
20
21
|
display_options: r.options
|
|
21
|
-
} : void 0, n =
|
|
22
|
+
} : void 0, n = _(e, l);
|
|
22
23
|
return n === "—" ? null : n;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function q(e, a) {
|
|
25
26
|
var n;
|
|
26
|
-
const r = [],
|
|
27
|
-
for (const
|
|
28
|
-
return { main: r, system:
|
|
27
|
+
const r = [], l = [];
|
|
28
|
+
for (const i of e) ((n = a[i.field]) != null && n.system ? l : r).push(i);
|
|
29
|
+
return { main: r, system: l };
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function I(e) {
|
|
31
32
|
return e.split(/\s+/).map((a) => a[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "·";
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function y({ text: e, strong: a }) {
|
|
34
35
|
return e == null ? /* @__PURE__ */ t("span", { className: "italic text-slate-400 dark:text-slate-500", children: "Empty" }) : /* @__PURE__ */ t(
|
|
35
36
|
"span",
|
|
36
37
|
{
|
|
37
|
-
className:
|
|
38
|
+
className: h(
|
|
38
39
|
"break-words [overflow-wrap:anywhere]",
|
|
39
40
|
a ? "font-medium text-slate-900 dark:text-slate-100" : "text-slate-500 dark:text-slate-400"
|
|
40
41
|
),
|
|
@@ -42,19 +43,19 @@ function h({ text: e, strong: a }) {
|
|
|
42
43
|
}
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function v({
|
|
46
47
|
change: e,
|
|
47
48
|
meta: a,
|
|
48
49
|
muted: r
|
|
49
50
|
}) {
|
|
50
|
-
const
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */ t("div", { className: "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children:
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
e.has_before ? /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */ t(
|
|
51
|
+
const l = (a == null ? void 0 : a.label) ?? e.field, n = x(e.before, e.before_text, a), i = x(e.after, e.after_text, a);
|
|
52
|
+
return /* @__PURE__ */ o("li", { className: h("relative py-1.5", r && "opacity-75"), "data-recap-change": e.field, children: [
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children: l }),
|
|
54
|
+
/* @__PURE__ */ o("div", { className: "mt-0.5 flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5 text-[12.5px] leading-snug", children: [
|
|
55
|
+
e.has_before ? /* @__PURE__ */ o(b, { children: [
|
|
56
|
+
/* @__PURE__ */ t(y, { text: n }),
|
|
56
57
|
/* @__PURE__ */ t(
|
|
57
|
-
|
|
58
|
+
k,
|
|
58
59
|
{
|
|
59
60
|
"aria-hidden": !0,
|
|
60
61
|
className: "h-3 w-3 shrink-0 self-center text-slate-400 dark:text-slate-500"
|
|
@@ -62,51 +63,51 @@ function u({
|
|
|
62
63
|
),
|
|
63
64
|
/* @__PURE__ */ t("span", { className: "sr-only", children: "changed to" })
|
|
64
65
|
] }) : /* @__PURE__ */ t("span", { className: "sr-only", children: "now" }),
|
|
65
|
-
/* @__PURE__ */ t(
|
|
66
|
+
/* @__PURE__ */ t(y, { text: i, strong: !r })
|
|
66
67
|
] })
|
|
67
68
|
] });
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
const [r,
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
70
|
+
function E({ group: e, fields: a }) {
|
|
71
|
+
const [r, l] = w(!1), n = R(), { main: i, system: d } = q(e.changes, a), c = e.last_at;
|
|
72
|
+
return /* @__PURE__ */ o("section", { className: "py-2.5 first:pt-1", "aria-label": `Changed by ${e.name}`, children: [
|
|
73
|
+
/* @__PURE__ */ o("header", { className: "flex items-center gap-2", children: [
|
|
73
74
|
/* @__PURE__ */ t(
|
|
74
|
-
|
|
75
|
+
A,
|
|
75
76
|
{
|
|
76
77
|
userId: e.user_id,
|
|
77
78
|
className: "h-5 w-5 rounded-full",
|
|
78
|
-
fallback: /* @__PURE__ */ t("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[9px] font-semibold text-nvr-navy dark:text-nvr-cyan", children:
|
|
79
|
+
fallback: /* @__PURE__ */ t("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[9px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: I(e.name) })
|
|
79
80
|
}
|
|
80
81
|
),
|
|
81
82
|
/* @__PURE__ */ t("span", { className: "min-w-0 truncate text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: e.name }),
|
|
82
|
-
|
|
83
|
+
c && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11.5px] text-slate-400 dark:text-slate-500", children: /* @__PURE__ */ t(j, { value: c, title: p(c) }) })
|
|
83
84
|
] }),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/* @__PURE__ */
|
|
85
|
+
i.length > 0 && /* @__PURE__ */ t("ul", { className: "mt-1 divide-y divide-slate-100 pl-7 dark:divide-border/60", children: i.map((s) => /* @__PURE__ */ t(v, { change: s, meta: a[s.field] }, s.field)) }),
|
|
86
|
+
d.length > 0 && /* @__PURE__ */ o("div", { className: "pl-7", children: [
|
|
87
|
+
/* @__PURE__ */ o(
|
|
87
88
|
"button",
|
|
88
89
|
{
|
|
89
90
|
type: "button",
|
|
90
91
|
"aria-expanded": r,
|
|
91
92
|
"aria-controls": n,
|
|
92
|
-
onClick: () =>
|
|
93
|
+
onClick: () => l((s) => !s),
|
|
93
94
|
className: "mt-1 inline-flex items-center gap-1 rounded text-[11.5px] text-slate-400 hover:text-slate-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-slate-500 dark:hover:text-slate-300",
|
|
94
95
|
"data-recap-system-toggle": !0,
|
|
95
96
|
children: [
|
|
96
97
|
/* @__PURE__ */ t(
|
|
97
|
-
|
|
98
|
+
g,
|
|
98
99
|
{
|
|
99
100
|
"aria-hidden": !0,
|
|
100
|
-
className:
|
|
101
|
+
className: h(
|
|
101
102
|
"h-3 w-3 transition-transform duration-150 motion-reduce:transition-none",
|
|
102
103
|
r && "rotate-90"
|
|
103
104
|
)
|
|
104
105
|
}
|
|
105
106
|
),
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
i.length > 0 ? "and " : "",
|
|
108
|
+
d.length,
|
|
108
109
|
" system field",
|
|
109
|
-
|
|
110
|
+
d.length === 1 ? "" : "s"
|
|
110
111
|
]
|
|
111
112
|
}
|
|
112
113
|
),
|
|
@@ -116,51 +117,92 @@ function q({ group: e, fields: a }) {
|
|
|
116
117
|
id: n,
|
|
117
118
|
hidden: !r,
|
|
118
119
|
className: "divide-y divide-slate-100 dark:divide-border/60",
|
|
119
|
-
children:
|
|
120
|
+
children: d.map((s) => /* @__PURE__ */ t(v, { change: s, meta: a[s.field], muted: !0 }, s.field))
|
|
120
121
|
}
|
|
121
122
|
)
|
|
122
123
|
] })
|
|
123
124
|
] });
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function U({
|
|
126
127
|
collection: e,
|
|
127
128
|
itemId: a,
|
|
128
129
|
since: r,
|
|
129
|
-
everyone:
|
|
130
|
+
everyone: l,
|
|
131
|
+
emptyText: n
|
|
130
132
|
}) {
|
|
131
|
-
const
|
|
132
|
-
queryKey: ["record-recap-changes", e, a, r, !!
|
|
133
|
-
queryFn: () =>
|
|
134
|
-
|
|
133
|
+
const i = C(), d = N({
|
|
134
|
+
queryKey: ["record-recap-changes", e, a, r, !!l],
|
|
135
|
+
queryFn: () => i.request(
|
|
136
|
+
T(`/record-views/${e}/${encodeURIComponent(a)}/changes`, {
|
|
135
137
|
since: r,
|
|
136
|
-
...
|
|
138
|
+
...l ? { everyone: "1" } : {}
|
|
137
139
|
})
|
|
138
|
-
).then((
|
|
140
|
+
).then((s) => s.data),
|
|
139
141
|
staleTime: 3e4,
|
|
140
142
|
retry: !1
|
|
141
143
|
});
|
|
142
|
-
if (
|
|
143
|
-
return /* @__PURE__ */ t("div", { className: "space-y-3 py-2", "aria-busy": "true", children: [0, 1, 2].map((
|
|
144
|
-
/* @__PURE__ */ t(
|
|
145
|
-
/* @__PURE__ */ t(
|
|
146
|
-
] },
|
|
147
|
-
if (
|
|
148
|
-
return /* @__PURE__ */ t("div", { className: "py-2", children: /* @__PURE__ */ t(
|
|
149
|
-
const
|
|
150
|
-
return !
|
|
151
|
-
/* @__PURE__ */ t("div", { className: "divide-y divide-slate-200/70 dark:divide-border", children:
|
|
152
|
-
|
|
144
|
+
if (d.isLoading)
|
|
145
|
+
return /* @__PURE__ */ t("div", { className: "space-y-3 py-2", "aria-busy": "true", children: [0, 1, 2].map((s) => /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
|
|
146
|
+
/* @__PURE__ */ t(u, { className: "h-3 w-24" }),
|
|
147
|
+
/* @__PURE__ */ t(u, { className: "h-4 w-56 max-w-full" })
|
|
148
|
+
] }, s)) });
|
|
149
|
+
if (d.isError)
|
|
150
|
+
return /* @__PURE__ */ t("div", { className: "py-2", children: /* @__PURE__ */ t($, { error: d.error, what: "the changes", onRetry: () => void d.refetch() }) });
|
|
151
|
+
const c = d.data;
|
|
152
|
+
return !c || c.groups.length === 0 ? /* @__PURE__ */ t("p", { className: "py-3 text-[12.5px] text-slate-500 dark:text-slate-400", children: n ?? "No field changes to show — the values are back to what you last saw." }) : /* @__PURE__ */ o("div", { "data-recap-changes": !0, children: [
|
|
153
|
+
/* @__PURE__ */ t("div", { className: "divide-y divide-slate-200/70 dark:divide-border", children: c.groups.map((s) => /* @__PURE__ */ t(
|
|
154
|
+
E,
|
|
153
155
|
{
|
|
154
|
-
group:
|
|
155
|
-
fields:
|
|
156
|
+
group: s,
|
|
157
|
+
fields: c.fields
|
|
156
158
|
},
|
|
157
|
-
`${
|
|
159
|
+
`${s.user_id ?? "system"}|${s.first_at}`
|
|
158
160
|
)) }),
|
|
159
|
-
|
|
161
|
+
c.truncated && /* @__PURE__ */ t("p", { className: "pt-2 text-[11.5px] text-slate-400 dark:text-slate-500", children: "Showing the first 300 saves — the full history has the rest." })
|
|
162
|
+
] });
|
|
163
|
+
}
|
|
164
|
+
function O({
|
|
165
|
+
collection: e,
|
|
166
|
+
itemId: a,
|
|
167
|
+
since: r,
|
|
168
|
+
everyone: l,
|
|
169
|
+
title: n,
|
|
170
|
+
extras: i,
|
|
171
|
+
emptyText: d,
|
|
172
|
+
footer: c,
|
|
173
|
+
bodyRef: s,
|
|
174
|
+
sinceLabel: f
|
|
175
|
+
}) {
|
|
176
|
+
const m = S(r);
|
|
177
|
+
return /* @__PURE__ */ o("div", { ref: s, tabIndex: -1, className: "outline-none", children: [
|
|
178
|
+
/* @__PURE__ */ o("div", { className: "border-b border-slate-200/80 px-4 pb-2 pt-3 dark:border-border", children: [
|
|
179
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-900 dark:text-slate-100", children: n }),
|
|
180
|
+
/* @__PURE__ */ o("p", { className: "mt-0.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
181
|
+
f ? `${f} ` : "",
|
|
182
|
+
/* @__PURE__ */ t("time", { dateTime: r, children: p(r) }),
|
|
183
|
+
m && m !== p(r) ? ` · ${m}` : null
|
|
184
|
+
] })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ t("div", { className: "max-h-[min(60vh,420px)] overflow-y-auto overscroll-contain px-4 py-1", children: /* @__PURE__ */ t(
|
|
187
|
+
U,
|
|
188
|
+
{
|
|
189
|
+
collection: e,
|
|
190
|
+
itemId: a,
|
|
191
|
+
since: r,
|
|
192
|
+
everyone: l,
|
|
193
|
+
emptyText: d
|
|
194
|
+
}
|
|
195
|
+
) }),
|
|
196
|
+
i && /* @__PURE__ */ o("p", { className: "border-t border-slate-200/80 px-4 py-2 text-[11.5px] text-slate-500 dark:border-border dark:text-slate-400", children: [
|
|
197
|
+
"Also ",
|
|
198
|
+
i
|
|
199
|
+
] }),
|
|
200
|
+
c && /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-2 border-t border-slate-200/80 px-4 py-2 dark:border-border", children: c })
|
|
160
201
|
] });
|
|
161
202
|
}
|
|
162
203
|
export {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
204
|
+
O as RecapChangesPanel,
|
|
205
|
+
U as RecordRecapChangesList,
|
|
206
|
+
x as recapValueText,
|
|
207
|
+
q as splitSystem
|
|
166
208
|
};
|