@nivaro/react 0.3.28 → 0.3.30
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/components/slots/pipeline/OwnersSection.js +59 -47
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/ItemEditForm.js +11 -10
- package/dist/shared/components/item-edit/CatalogPickerField.js +816 -776
- package/dist/shared/components/item-edit/HeaderFreshness.js +58 -57
- package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +56 -46
- package/dist/shared/components/panels/PipelinePanel.js +313 -282
- package/dist/shared/lib/worker-socket.js +112 -104
- package/package.json +1 -1
|
@@ -1,67 +1,68 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as b } from "@tanstack/react-query";
|
|
3
|
+
import { Info as f } from "lucide-react";
|
|
4
|
+
import { useNivaroClient as v } from "../../context.js";
|
|
5
|
+
import { get as x } from "../../lib/commands.js";
|
|
6
|
+
import { useAfterIdle as $ } from "../../lib/defer.js";
|
|
7
|
+
import { cn as p, formatDateTime as d, formatRelative as h } from "../../lib/utils.js";
|
|
8
|
+
import { InboundRequestPopover as g } from "../integrations/InboundRequest.js";
|
|
9
|
+
function k(a, t, i) {
|
|
10
|
+
const s = v(), n = [...i].sort().join(","), r = $(1500);
|
|
11
|
+
return b({
|
|
12
|
+
queryKey: ["field-touch", a, t, n],
|
|
13
|
+
queryFn: () => s.request(
|
|
14
|
+
x("/revisions/field-touch", { collection: a, item: t, fields: n })
|
|
15
|
+
).then((e) => e.data ?? {}),
|
|
16
|
+
enabled: r && !!t && t !== "new" && i.length > 0,
|
|
16
17
|
staleTime: 6e4
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
collection:
|
|
20
|
+
function _({
|
|
21
|
+
collection: a,
|
|
21
22
|
itemId: t,
|
|
22
|
-
field:
|
|
23
|
-
fields:
|
|
23
|
+
field: i,
|
|
24
|
+
fields: s,
|
|
25
|
+
className: n
|
|
24
26
|
}) {
|
|
25
|
-
const { data:
|
|
27
|
+
const { data: r } = k(a, t, s), e = r == null ? void 0 : r[i];
|
|
26
28
|
if (!e) return null;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
29
|
+
const c = e.via !== "user", l = p(
|
|
30
|
+
"h-3 w-3",
|
|
31
|
+
c ? "text-amber-600/80 dark:text-amber-300/80" : "text-slate-400 dark:text-slate-500"
|
|
32
|
+
), u = p(
|
|
33
|
+
"flex h-3 w-3 items-center justify-center rounded-sm opacity-70 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
34
|
+
n
|
|
35
|
+
);
|
|
36
|
+
if (e.caller && e.activity_id)
|
|
37
|
+
return /* @__PURE__ */ o(
|
|
38
|
+
g,
|
|
39
|
+
{
|
|
40
|
+
activityId: e.activity_id,
|
|
41
|
+
callerName: e.caller.name,
|
|
42
|
+
collection: a,
|
|
43
|
+
itemId: t,
|
|
44
|
+
children: /* @__PURE__ */ o(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
"data-copy-skip": !0,
|
|
49
|
+
"data-field-touch-caller": e.caller.key,
|
|
50
|
+
"aria-label": `Changed by ${e.caller.name} ${h(e.at)} — open the request`,
|
|
51
|
+
className: u,
|
|
52
|
+
"data-tip": `${e.caller.name} · ${d(e.at)} — click for the request`,
|
|
53
|
+
onClick: (y) => y.stopPropagation(),
|
|
54
|
+
children: /* @__PURE__ */ o(f, { className: l })
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
const m = `Changed by ${c && e.via !== "import" ? `${e.who} (${e.via})` : e.who} · ${d(e.at)} (${h(e.at)})`;
|
|
60
|
+
return (
|
|
61
|
+
// biome-ignore lint/a11y/noNoninteractiveTabindex: focusable so keyboard users get the tip
|
|
62
|
+
/* @__PURE__ */ o("span", { "data-copy-skip": !0, tabIndex: 0, role: "img", "aria-label": m, "data-tip": m, className: u, children: /* @__PURE__ */ o(f, { className: l }) })
|
|
62
63
|
);
|
|
63
64
|
}
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
_ as HeaderFreshness,
|
|
67
|
+
k as useFieldTouches
|
|
67
68
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { X as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { X as x } from "lucide-react";
|
|
3
|
+
import { useState as O, useEffect as w } from "react";
|
|
4
4
|
import { cn as v } from "../../../lib/utils.js";
|
|
5
|
-
import { effectText as
|
|
6
|
-
import { useInspectorEnv as A, Setting as c, TextInput as N, Choice as
|
|
7
|
-
import { bindingValue as h, withStaticBinding as
|
|
8
|
-
const
|
|
5
|
+
import { effectText as _, inputBase as L, tintCard as T } from "../panel-style.js";
|
|
6
|
+
import { useInspectorEnv as A, Setting as c, TextInput as N, Choice as b, Segmented as k, AddButton as R, Section as E, JsonInput as J } from "./kit.js";
|
|
7
|
+
import { bindingValue as h, withStaticBinding as $ } from "./model.js";
|
|
8
|
+
const H = [
|
|
9
9
|
{ value: "text", label: "Text" },
|
|
10
10
|
{ value: "currency", label: "Currency ($)" },
|
|
11
11
|
{ value: "integer", label: "Whole number" },
|
|
@@ -21,7 +21,7 @@ const P = [
|
|
|
21
21
|
{ value: "amber", label: "Amber" },
|
|
22
22
|
{ value: "red", label: "Red" },
|
|
23
23
|
{ value: "purple", label: "Purple" }
|
|
24
|
-
],
|
|
24
|
+
], P = [
|
|
25
25
|
{ value: "", label: "Normal" },
|
|
26
26
|
{ value: "medium", label: "Medium" },
|
|
27
27
|
{ value: "semibold", label: "Semibold" },
|
|
@@ -34,8 +34,8 @@ const P = [
|
|
|
34
34
|
function I(t) {
|
|
35
35
|
if (!Array.isArray(t)) return 'Needs a list like [{ "op": "gt", "value": 0, "color": "red" }]';
|
|
36
36
|
for (const l of t) {
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const r = l;
|
|
38
|
+
if (!r || !S.has(r.op ?? "") || r.value == null || !r.color)
|
|
39
39
|
return "Each needs op (lt, lte, gt, gte, eq), value and color";
|
|
40
40
|
}
|
|
41
41
|
return null;
|
|
@@ -47,11 +47,11 @@ const d = (t) => typeof t == "string" ? t : "", B = [
|
|
|
47
47
|
{ value: "gte", label: "is at least" },
|
|
48
48
|
{ value: "eq", label: "equals" }
|
|
49
49
|
], g = (t) => Array.isArray(t) ? t.map((l) => {
|
|
50
|
-
const
|
|
50
|
+
const r = l ?? {};
|
|
51
51
|
return {
|
|
52
|
-
op:
|
|
53
|
-
value:
|
|
54
|
-
color:
|
|
52
|
+
op: r.op ?? "gt",
|
|
53
|
+
value: r.value == null ? "" : String(r.value),
|
|
54
|
+
color: r.color ?? ""
|
|
55
55
|
};
|
|
56
56
|
}) : [], y = (t) => t.filter((l) => S.has(l.op) && l.value.trim() !== "" && l.color).map((l) => ({
|
|
57
57
|
op: l.op,
|
|
@@ -62,28 +62,28 @@ function q({
|
|
|
62
62
|
value: t,
|
|
63
63
|
onChange: l
|
|
64
64
|
}) {
|
|
65
|
-
const
|
|
65
|
+
const r = JSON.stringify(y(g(t))), [u, s] = O(() => g(t));
|
|
66
66
|
w(() => {
|
|
67
67
|
s(
|
|
68
|
-
(
|
|
68
|
+
(o) => JSON.stringify(y(o)) === r ? o : g(JSON.parse(r))
|
|
69
69
|
);
|
|
70
|
-
}, [
|
|
71
|
-
const m = (
|
|
72
|
-
s(
|
|
73
|
-
const n = y(
|
|
74
|
-
JSON.stringify(n) !==
|
|
75
|
-
}, a = (
|
|
70
|
+
}, [r]);
|
|
71
|
+
const m = (o) => {
|
|
72
|
+
s(o);
|
|
73
|
+
const n = y(o);
|
|
74
|
+
JSON.stringify(n) !== r && l(n.length ? n : null);
|
|
75
|
+
}, a = (o, n) => m(u.map((i, f) => f === o ? { ...i, ...n } : i));
|
|
76
76
|
return /* @__PURE__ */ p("div", { className: "space-y-2", children: [
|
|
77
|
-
u.length === 0 ? /* @__PURE__ */ e("p", { className:
|
|
77
|
+
u.length === 0 ? /* @__PURE__ */ e("p", { className: _, children: "No rules: the value keeps the colour above." }) : /* @__PURE__ */ e("ul", { className: "space-y-2", children: u.map((o, n) => (
|
|
78
78
|
// biome-ignore lint/suspicious/noArrayIndexKey: rules are positional
|
|
79
79
|
/* @__PURE__ */ p("li", { className: v(T, "space-y-1.5 p-2.5"), "data-threshold-row": "", children: [
|
|
80
80
|
/* @__PURE__ */ p("div", { className: "flex items-center gap-1.5", children: [
|
|
81
|
-
/* @__PURE__ */ e("span", { className: v(
|
|
81
|
+
/* @__PURE__ */ e("span", { className: v(_, "shrink-0"), children: "When it" }),
|
|
82
82
|
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(
|
|
83
|
-
|
|
83
|
+
b,
|
|
84
84
|
{
|
|
85
85
|
ariaLabel: "Comparison",
|
|
86
|
-
value:
|
|
86
|
+
value: o.op,
|
|
87
87
|
options: B,
|
|
88
88
|
onChange: (i) => a(n, { op: i })
|
|
89
89
|
}
|
|
@@ -94,9 +94,9 @@ function q({
|
|
|
94
94
|
type: "button",
|
|
95
95
|
"aria-label": "Remove rule",
|
|
96
96
|
"data-tip": "Remove rule",
|
|
97
|
-
onClick: () => m(u.filter((i,
|
|
97
|
+
onClick: () => m(u.filter((i, f) => f !== n)),
|
|
98
98
|
className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-100 hover:text-red-600 dark:hover:bg-muted dark:hover:text-red-400",
|
|
99
|
-
children: /* @__PURE__ */ e(
|
|
99
|
+
children: /* @__PURE__ */ e(x, { className: "h-3.5 w-3.5" })
|
|
100
100
|
}
|
|
101
101
|
)
|
|
102
102
|
] }),
|
|
@@ -105,18 +105,18 @@ function q({
|
|
|
105
105
|
"input",
|
|
106
106
|
{
|
|
107
107
|
"aria-label": "Value",
|
|
108
|
-
value:
|
|
108
|
+
value: o.value,
|
|
109
109
|
placeholder: "0",
|
|
110
110
|
onChange: (i) => a(n, { value: i.target.value }),
|
|
111
111
|
className: v(L, "w-24 shrink-0")
|
|
112
112
|
}
|
|
113
113
|
),
|
|
114
|
-
/* @__PURE__ */ e("span", { className: v(
|
|
114
|
+
/* @__PURE__ */ e("span", { className: v(_, "shrink-0"), children: "show it" }),
|
|
115
115
|
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(
|
|
116
|
-
|
|
116
|
+
b,
|
|
117
117
|
{
|
|
118
118
|
ariaLabel: "Colour",
|
|
119
|
-
value:
|
|
119
|
+
value: o.color,
|
|
120
120
|
options: [{ value: "", label: "Pick a colour…" }, ...C.slice(1)],
|
|
121
121
|
onChange: (i) => a(n, { color: i })
|
|
122
122
|
}
|
|
@@ -124,27 +124,27 @@ function q({
|
|
|
124
124
|
] })
|
|
125
125
|
] }, n)
|
|
126
126
|
)) }),
|
|
127
|
-
/* @__PURE__ */ e(
|
|
128
|
-
/* @__PURE__ */ e(
|
|
129
|
-
|
|
127
|
+
/* @__PURE__ */ e(R, { onClick: () => s([...u, { op: "gt", value: "", color: "" }]), children: "+ Add a colour rule" }),
|
|
128
|
+
/* @__PURE__ */ e(E, { title: "Edit as JSON", collapsible: !0, className: "border-t-0 pt-1", children: /* @__PURE__ */ e(
|
|
129
|
+
J,
|
|
130
130
|
{
|
|
131
131
|
ariaLabel: "Colour by value as JSON",
|
|
132
132
|
rows: 3,
|
|
133
|
-
value:
|
|
133
|
+
value: r === "[]" ? null : JSON.parse(r),
|
|
134
134
|
placeholder: '[{ "op": "gt", "value": 0, "color": "red" }]',
|
|
135
135
|
validate: I,
|
|
136
|
-
onCommit: (
|
|
136
|
+
onCommit: (o) => l(Array.isArray(o) && o.length ? o : null)
|
|
137
137
|
}
|
|
138
138
|
) })
|
|
139
139
|
] });
|
|
140
140
|
}
|
|
141
141
|
function Y({ row: t, label: l }) {
|
|
142
|
-
const
|
|
142
|
+
const r = A(), u = { field: t.field, group_key: t.group_key }, s = (a, o, n, i) => r.apply(
|
|
143
143
|
[
|
|
144
144
|
{
|
|
145
145
|
op: "update_placement",
|
|
146
146
|
at: u,
|
|
147
|
-
patch: { input_bindings:
|
|
147
|
+
patch: { input_bindings: $(t, a, o) }
|
|
148
148
|
}
|
|
149
149
|
],
|
|
150
150
|
{ label: n, text: i }
|
|
@@ -164,7 +164,7 @@ function Y({ row: t, label: l }) {
|
|
|
164
164
|
ariaLabel: "Label",
|
|
165
165
|
value: t.label_override ?? "",
|
|
166
166
|
placeholder: l,
|
|
167
|
-
onChange: (a) =>
|
|
167
|
+
onChange: (a) => r.apply([{ op: "update_placement", at: u, patch: { label_override: a || null } }], {
|
|
168
168
|
label: `Rename ${l} in the header`,
|
|
169
169
|
text: !0
|
|
170
170
|
})
|
|
@@ -177,18 +177,18 @@ function Y({ row: t, label: l }) {
|
|
|
177
177
|
label: "Format",
|
|
178
178
|
effect: "How the value is written in the header.",
|
|
179
179
|
children: /* @__PURE__ */ e(
|
|
180
|
-
|
|
180
|
+
b,
|
|
181
181
|
{
|
|
182
182
|
ariaLabel: "Format",
|
|
183
183
|
value: d(h(t, "__display_format__")) || "text",
|
|
184
|
-
options:
|
|
184
|
+
options: H,
|
|
185
185
|
onChange: (a) => s("__display_format__", a === "text" ? null : a, `Change the format of ${l}`)
|
|
186
186
|
}
|
|
187
187
|
)
|
|
188
188
|
}
|
|
189
189
|
),
|
|
190
190
|
/* @__PURE__ */ e(c, { k: "header.color", label: "Colour", effect: "The colour of the value in the header.", children: /* @__PURE__ */ e(
|
|
191
|
-
|
|
191
|
+
b,
|
|
192
192
|
{
|
|
193
193
|
ariaLabel: "Colour",
|
|
194
194
|
value: d(h(t, "__color__")),
|
|
@@ -200,7 +200,7 @@ function Y({ row: t, label: l }) {
|
|
|
200
200
|
k,
|
|
201
201
|
{
|
|
202
202
|
value: d(h(t, "__weight__")),
|
|
203
|
-
options:
|
|
203
|
+
options: P,
|
|
204
204
|
onChange: (a) => s("__weight__", a || null, `Change the weight of ${l}`)
|
|
205
205
|
}
|
|
206
206
|
) }),
|
|
@@ -256,13 +256,23 @@ function Y({ row: t, label: l }) {
|
|
|
256
256
|
}
|
|
257
257
|
)
|
|
258
258
|
}
|
|
259
|
-
)
|
|
259
|
+
),
|
|
260
|
+
/* @__PURE__ */ e("div", { className: "border-t border-slate-200 pt-3 dark:border-border", children: /* @__PURE__ */ e(
|
|
261
|
+
"button",
|
|
262
|
+
{
|
|
263
|
+
type: "button",
|
|
264
|
+
"data-header-remove": !0,
|
|
265
|
+
onClick: () => r.apply([{ op: "remove", at: u }], { label: `Remove ${l} from the header` }),
|
|
266
|
+
className: "text-[12px] text-red-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-red-400",
|
|
267
|
+
children: "Remove from header"
|
|
268
|
+
}
|
|
269
|
+
) })
|
|
260
270
|
] });
|
|
261
271
|
}
|
|
262
272
|
export {
|
|
263
273
|
C as COLORS,
|
|
264
274
|
D as DISPLAY_AS,
|
|
265
|
-
|
|
275
|
+
H as HEADER_FORMATS,
|
|
266
276
|
Y as HeaderItemInspector,
|
|
267
|
-
|
|
277
|
+
P as WEIGHTS
|
|
268
278
|
};
|