@nivaro/react 0.3.58 → 0.3.59
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/fields/RelationField.js +110 -80
- package/dist/full.css +1 -1
- package/dist/hooks/useRelationOptions.js +1 -0
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +523 -520
- package/dist/shared/components/CollectionBrowserView.js +2083 -2052
- package/dist/shared/components/DataTable.js +497 -465
- package/dist/shared/components/ItemEditForm.js +4430 -4282
- package/dist/shared/components/PageRenderer.js +537 -508
- package/dist/shared/components/QueryTable.js +74 -74
- package/dist/shared/components/WidgetSlot.js +543 -520
- package/dist/shared/components/alerts/AlertManagerView.js +269 -275
- package/dist/shared/components/alerts/types.js +37 -14
- package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
- package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
- package/dist/shared/components/item-edit/InlineTableField.js +2461 -2421
- package/dist/shared/components/item-edit/M2MCombobox.js +141 -137
- package/dist/shared/components/item-edit/PlanGrid.js +876 -820
- package/dist/shared/components/item-edit/QuickCreateButton.js +323 -130
- package/dist/shared/components/item-edit/RelationCombobox.js +408 -375
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +255 -156
- package/dist/shared/components/item-edit/SummaryPanel.js +356 -343
- package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
- package/dist/shared/components/item-edit/line-midair.js +82 -75
- package/dist/shared/components/item-edit/save-outcome.js +6 -4
- package/dist/shared/components/panels/ItemLockBanner.js +212 -209
- package/dist/shared/components/panels/PipelinePanel.js +775 -737
- package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
- package/dist/shared/components/panels/RevisionsPanel.js +313 -299
- package/dist/shared/components/pipeline/PipelineEditorView.js +26 -16
- package/dist/shared/components/queue/QueueQuickFilters.js +13 -13
- package/dist/shared/components/queue/QueueWorklist.js +978 -953
- package/dist/shared/components/queue/live-state-aspect.js +9 -5
- package/dist/shared/components/widgets/ReviewListWidget.js +152 -149
- package/dist/shared/lib/display-prefs.js +60 -52
- package/dist/shared/lib/draft-store.js +71 -48
- package/dist/shared/lib/expression.js +53 -53
- package/dist/shared/lib/list-page-memory.js +42 -20
- package/dist/shared/lib/money-input.js +45 -0
- package/dist/shared/lib/sanitize-html.js +10 -6
- package/dist/shared/lib/staged-row-labels.js +18 -0
- package/package.json +1 -1
|
@@ -1,279 +1,378 @@
|
|
|
1
|
-
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Loader2 as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { matchesAllTokens as
|
|
8
|
-
import { applyDisplayTemplate as
|
|
9
|
-
import { NAMELESS_LABEL as
|
|
10
|
-
import { useStaleTip as
|
|
11
|
-
function
|
|
12
|
-
collection:
|
|
13
|
-
value:
|
|
14
|
-
onChange:
|
|
15
|
-
groupField:
|
|
16
|
-
optionField:
|
|
17
|
-
disabled:
|
|
18
|
-
placeholder:
|
|
1
|
+
import { jsxs as d, jsx as s, Fragment as Le } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as N } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as he, AlertTriangle as Te, ChevronDown as ye, Search as Ee, X as _e, Check as be, ChevronRight as Ie } from "lucide-react";
|
|
4
|
+
import { useState as Q, useRef as ae, useId as Ke, useEffect as T, useMemo as z } from "react";
|
|
5
|
+
import { useNivaroClient as Ce } from "../../context.js";
|
|
6
|
+
import { get as S } from "../../lib/commands.js";
|
|
7
|
+
import { matchesAllTokens as ge, cn as E } from "../../lib/utils.js";
|
|
8
|
+
import { applyDisplayTemplate as q } from "./helpers.js";
|
|
9
|
+
import { NAMELESS_LABEL as Ae } from "./option-disambiguate.js";
|
|
10
|
+
import { useStaleTip as je } from "./RelationCombobox.js";
|
|
11
|
+
function Xe({
|
|
12
|
+
collection: p,
|
|
13
|
+
value: i,
|
|
14
|
+
onChange: oe,
|
|
15
|
+
groupField: f,
|
|
16
|
+
optionField: m,
|
|
17
|
+
disabled: V,
|
|
18
|
+
placeholder: xe,
|
|
19
19
|
extraFilter: _,
|
|
20
|
-
pinned: c
|
|
20
|
+
pinned: c,
|
|
21
|
+
narrowedBy: J
|
|
21
22
|
}) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (!
|
|
25
|
-
const e = (
|
|
26
|
-
var
|
|
27
|
-
if (
|
|
23
|
+
const g = Ce(), [a, y] = Q(!1), [u, P] = Q(""), [X, H] = Q(/* @__PURE__ */ new Set()), ie = ae(null), $ = ae(null), I = ae(null), W = Ke(), [le, K] = Q(-1);
|
|
24
|
+
T(() => {
|
|
25
|
+
if (!a) return;
|
|
26
|
+
const e = (n) => {
|
|
27
|
+
var o, w;
|
|
28
|
+
if (n.key !== "Escape") return;
|
|
28
29
|
const r = document.activeElement;
|
|
29
|
-
r !== document.body && !(r && ((
|
|
30
|
-
},
|
|
31
|
-
var
|
|
32
|
-
const r =
|
|
33
|
-
r && r !== document.body && !((
|
|
30
|
+
r !== document.body && !(r && ((o = $.current) != null && o.contains(r))) || (n.preventDefault(), n.stopPropagation(), y(!1), (w = I.current) == null || w.focus());
|
|
31
|
+
}, t = (n) => {
|
|
32
|
+
var o;
|
|
33
|
+
const r = n.target;
|
|
34
|
+
r && r !== document.body && !((o = $.current) != null && o.contains(r)) && y(!1);
|
|
34
35
|
};
|
|
35
|
-
return window.addEventListener("keydown", e, !0), document.addEventListener("focusin",
|
|
36
|
-
window.removeEventListener("keydown", e, !0), document.removeEventListener("focusin",
|
|
36
|
+
return window.addEventListener("keydown", e, !0), document.addEventListener("focusin", t), () => {
|
|
37
|
+
window.removeEventListener("keydown", e, !0), document.removeEventListener("focusin", t);
|
|
37
38
|
};
|
|
38
|
-
}, [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
}, [a]);
|
|
40
|
+
const C = () => {
|
|
41
|
+
var n;
|
|
42
|
+
const e = ie.current;
|
|
43
|
+
if (!e || document.activeElement === e) return;
|
|
44
|
+
e.focus({ preventScroll: !0 });
|
|
45
|
+
const t = e.value.length;
|
|
46
|
+
(n = e.setSelectionRange) == null || n.call(e, t, t);
|
|
47
|
+
};
|
|
48
|
+
T(() => {
|
|
49
|
+
if (a) {
|
|
50
|
+
document.activeElement === I.current && C();
|
|
51
|
+
const e = setTimeout(C, 30);
|
|
52
|
+
return () => clearTimeout(e);
|
|
53
|
+
} else
|
|
54
|
+
P(""), H(/* @__PURE__ */ new Set());
|
|
55
|
+
}, [a]), T(() => {
|
|
56
|
+
if (!a) return;
|
|
57
|
+
const e = (t) => {
|
|
58
|
+
$.current && !$.current.contains(t.target) && y(!1);
|
|
47
59
|
};
|
|
48
60
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
49
|
-
}, [
|
|
50
|
-
const { data:
|
|
51
|
-
queryKey: ["col-meta",
|
|
52
|
-
queryFn: () =>
|
|
61
|
+
}, [a]);
|
|
62
|
+
const { data: b } = N({
|
|
63
|
+
queryKey: ["col-meta", p],
|
|
64
|
+
queryFn: () => g.request(S(`/collections/${p}`)).then((e) => e.data),
|
|
53
65
|
staleTime: 3e5,
|
|
54
66
|
retry: !1
|
|
55
|
-
}),
|
|
67
|
+
}), Y = z(
|
|
56
68
|
() => {
|
|
57
69
|
var e;
|
|
58
|
-
return ((e = ((
|
|
70
|
+
return ((e = ((b == null ? void 0 : b.relations) ?? []).find((t) => t.many_field === f && !t.junction_field)) == null ? void 0 : e.one_collection) ?? null;
|
|
59
71
|
},
|
|
60
|
-
[
|
|
61
|
-
),
|
|
72
|
+
[b, f]
|
|
73
|
+
), Z = z(
|
|
62
74
|
() => {
|
|
63
75
|
var e;
|
|
64
|
-
return ((e = ((
|
|
76
|
+
return ((e = ((b == null ? void 0 : b.relations) ?? []).find((t) => t.many_field === m && !t.junction_field)) == null ? void 0 : e.one_collection) ?? null;
|
|
65
77
|
},
|
|
66
|
-
[
|
|
67
|
-
), { data:
|
|
68
|
-
queryKey: ["col-meta",
|
|
69
|
-
queryFn: () =>
|
|
70
|
-
|
|
78
|
+
[b, m]
|
|
79
|
+
), { data: B } = N({
|
|
80
|
+
queryKey: ["col-meta", Y],
|
|
81
|
+
queryFn: () => g.request(
|
|
82
|
+
S(`/collections/${Y}`)
|
|
71
83
|
).then((e) => e.data),
|
|
72
|
-
enabled: !!
|
|
84
|
+
enabled: !!Y,
|
|
73
85
|
staleTime: 3e5,
|
|
74
86
|
retry: !1
|
|
75
|
-
}), { data:
|
|
76
|
-
queryKey: ["col-meta",
|
|
77
|
-
queryFn: () =>
|
|
78
|
-
|
|
87
|
+
}), { data: F } = N({
|
|
88
|
+
queryKey: ["col-meta", Z],
|
|
89
|
+
queryFn: () => g.request(
|
|
90
|
+
S(`/collections/${Z}`)
|
|
79
91
|
).then((e) => e.data),
|
|
80
|
-
enabled: !!
|
|
92
|
+
enabled: !!Z,
|
|
81
93
|
staleTime: 3e5,
|
|
82
94
|
retry: !1
|
|
83
|
-
}),
|
|
84
|
-
queryKey: ["relation-grouped-opts",
|
|
85
|
-
queryFn: () =>
|
|
86
|
-
|
|
95
|
+
}), ce = `id,${f}.*,${m}.*`, A = _ ? JSON.stringify(_) : void 0, { data: j, isFetching: ve } = N({
|
|
96
|
+
queryKey: ["relation-grouped-opts", p, f, m, A],
|
|
97
|
+
queryFn: () => g.request(
|
|
98
|
+
S(`/items/${p}`, {
|
|
87
99
|
limit: 1e3,
|
|
88
100
|
picker: "1",
|
|
89
|
-
fields:
|
|
90
|
-
...
|
|
101
|
+
fields: ce,
|
|
102
|
+
...A ? { filter: A } : {}
|
|
91
103
|
})
|
|
92
104
|
).then((e) => e.data ?? []),
|
|
93
|
-
enabled:
|
|
94
|
-
staleTime:
|
|
95
|
-
}), { data:
|
|
96
|
-
queryKey: ["relation-grouped-single",
|
|
97
|
-
queryFn: () =>
|
|
98
|
-
enabled: !!
|
|
105
|
+
enabled: a,
|
|
106
|
+
staleTime: A ? 0 : 3e4
|
|
107
|
+
}), { data: R, isLoading: we } = N({
|
|
108
|
+
queryKey: ["relation-grouped-single", p, String(i), f, m],
|
|
109
|
+
queryFn: () => g.request(S(`/items/${p}/${i}`, { fields: ce })).then((e) => e.data),
|
|
110
|
+
enabled: !!i,
|
|
99
111
|
staleTime: 6e4
|
|
100
|
-
}),
|
|
101
|
-
queryKey: ["relation-avail",
|
|
102
|
-
queryFn: () =>
|
|
103
|
-
|
|
104
|
-
filter:
|
|
112
|
+
}), ke = JSON.stringify(_ ? { _and: [{ id: { _eq: i } }, _] } : { id: { _eq: i } }), { data: de } = N({
|
|
113
|
+
queryKey: ["relation-avail", p, String(i), A],
|
|
114
|
+
queryFn: () => g.request(
|
|
115
|
+
S(`/items/${p}`, {
|
|
116
|
+
filter: ke,
|
|
105
117
|
picker: "1",
|
|
106
118
|
limit: 1,
|
|
107
119
|
fields: "id"
|
|
108
120
|
})
|
|
109
121
|
).then((e) => e.data ?? []),
|
|
110
|
-
enabled: !!
|
|
122
|
+
enabled: !!i && !!R,
|
|
111
123
|
staleTime: 3e4
|
|
112
|
-
}),
|
|
113
|
-
const e =
|
|
124
|
+
}), ee = !!i && de !== void 0 && de.length === 0, U = B == null ? void 0 : B.display_template, O = F == null ? void 0 : F.display_template, D = z(() => {
|
|
125
|
+
const e = j ?? [], t = u.toLowerCase(), n = /* @__PURE__ */ new Map();
|
|
114
126
|
for (const r of e) {
|
|
115
|
-
const
|
|
116
|
-
|
|
127
|
+
const o = r[f], w = r[m], k = o ? String(o.id ?? "") : "__none__", pe = o ? q(U, o) : "—", De = w ? q(O, w) : String(r.id ?? "");
|
|
128
|
+
t && !ge(`${pe} ${De}`, t) || (n.has(k) || n.set(k, { label: pe, items: [] }), n.get(k).items.push(r));
|
|
117
129
|
}
|
|
118
|
-
return [...
|
|
119
|
-
}, [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, [
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
return
|
|
130
|
+
return [...n.entries()].map(([r, o]) => ({ id: r, label: o.label, items: o.items }));
|
|
131
|
+
}, [j, u, f, m, U, O]);
|
|
132
|
+
T(() => {
|
|
133
|
+
u && H(new Set(D.map((e) => e.id)));
|
|
134
|
+
}, [u, D]);
|
|
135
|
+
function Ne(e) {
|
|
136
|
+
H((t) => {
|
|
137
|
+
const n = new Set(t);
|
|
138
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
127
139
|
});
|
|
128
140
|
}
|
|
129
|
-
const
|
|
130
|
-
queryKey: ["relation-grouped-single",
|
|
131
|
-
queryFn: () =>
|
|
132
|
-
|
|
141
|
+
const h = (c == null ? void 0 : c.id) != null && c.id !== "" ? String(c.id) : null, { data: Se } = N({
|
|
142
|
+
queryKey: ["relation-grouped-single", p, h ?? "", f, m],
|
|
143
|
+
queryFn: () => g.request(
|
|
144
|
+
S(`/items/${p}/${h}`, { fields: `id,${f}.*,${m}.*` })
|
|
133
145
|
).then((e) => e.data).catch(() => null),
|
|
134
|
-
enabled: !!
|
|
146
|
+
enabled: !!h && a && !(j ?? []).some((e) => String(e.id) === h),
|
|
135
147
|
staleTime: 6e4
|
|
136
|
-
}),
|
|
137
|
-
const
|
|
138
|
-
return [r,
|
|
148
|
+
}), x = h ? (j ?? []).find((e) => String(e.id) === h) ?? Se ?? null : null, ue = (e) => {
|
|
149
|
+
const t = e[f], n = e[m], r = t ? q(U, t) : null, o = n ? q(O, n) : null;
|
|
150
|
+
return [r, o].filter(Boolean).join(" — ") || Ae;
|
|
151
|
+
}, M = !!h && (!u.trim() || ge(
|
|
152
|
+
`${x ? ue(x) : ""} ${(c == null ? void 0 : c.tag) ?? "Default"}`,
|
|
153
|
+
u.replace(/[-_/]+/g, " ")
|
|
154
|
+
)), L = M ? 1 : 0, G = z(
|
|
155
|
+
() => D.filter((e) => X.has(e.id)).flatMap((e) => e.items),
|
|
156
|
+
[D, X]
|
|
157
|
+
), v = L + G.length, l = le >= v ? v - 1 : le;
|
|
158
|
+
T(() => {
|
|
159
|
+
K(a && u.trim() ? G.length ? L : M ? 0 : -1 : -1);
|
|
160
|
+
}, [a, u, L, G.length, M]);
|
|
161
|
+
const te = (e) => `${W}-opt-${e}`, ne = (e) => {
|
|
162
|
+
var t;
|
|
163
|
+
String(e) !== String(i) && oe(e), y(!1), (t = I.current) == null || t.focus();
|
|
164
|
+
}, re = (e) => {
|
|
165
|
+
e < 0 || e >= v || (e < L ? ne((x == null ? void 0 : x.id) ?? (c == null ? void 0 : c.id)) : ne(G[e - L].id));
|
|
139
166
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
167
|
+
T(() => {
|
|
168
|
+
var t, n;
|
|
169
|
+
if (!a || l < 0) return;
|
|
170
|
+
const e = (t = $.current) == null ? void 0 : t.querySelector(`[data-nav-index="${l}"]`);
|
|
171
|
+
(n = e == null ? void 0 : e.scrollIntoView) == null || n.call(e, { block: "nearest" });
|
|
172
|
+
}, [a, l]);
|
|
173
|
+
const me = (e) => {
|
|
174
|
+
var t;
|
|
175
|
+
if (e.key === "ArrowDown")
|
|
176
|
+
e.preventDefault(), v > 0 && K(l < 0 ? 0 : Math.min(l + 1, v - 1));
|
|
177
|
+
else if (e.key === "ArrowUp")
|
|
178
|
+
e.preventDefault(), v > 0 && K(l <= 0 ? 0 : l - 1);
|
|
179
|
+
else if (e.key === "Enter") {
|
|
180
|
+
if (e.preventDefault(), j === void 0) return;
|
|
181
|
+
l >= 0 ? re(l) : u.trim() && v === 1 && re(0);
|
|
182
|
+
} else e.key === "Tab" && (y(!1), (t = I.current) == null || t.focus());
|
|
183
|
+
}, qe = (e) => {
|
|
184
|
+
if (V) return;
|
|
185
|
+
const t = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (a || e.key !== " ");
|
|
186
|
+
if (!a && (e.key === "ArrowDown" || e.key === "ArrowUp"))
|
|
187
|
+
e.preventDefault(), y(!0);
|
|
188
|
+
else if (t) {
|
|
189
|
+
e.preventDefault();
|
|
190
|
+
const n = e.key;
|
|
191
|
+
P((r) => r + n), a ? C() : y(!0);
|
|
192
|
+
} else a && e.key === "Backspace" ? (e.preventDefault(), P((n) => n.slice(0, -1)), C()) : a && (e.key === "Enter" || e.key === "ArrowDown" || e.key === "ArrowUp") && (me(e), C());
|
|
193
|
+
};
|
|
194
|
+
let se = null;
|
|
195
|
+
if (R) {
|
|
196
|
+
const e = R[f], t = R[m], n = e ? q(U, e) : null, r = t ? q(O, t) : null;
|
|
197
|
+
se = [n, r].filter(Boolean).join(" — ") || null;
|
|
144
198
|
}
|
|
145
|
-
const
|
|
146
|
-
return /* @__PURE__ */ d("div", { ref:
|
|
199
|
+
const $e = !!i && we && !R, fe = je(ee);
|
|
200
|
+
return /* @__PURE__ */ d("div", { ref: $, className: "relative", ...fe.bind, children: [
|
|
147
201
|
/* @__PURE__ */ d(
|
|
148
202
|
"button",
|
|
149
203
|
{
|
|
150
|
-
ref:
|
|
204
|
+
ref: I,
|
|
151
205
|
type: "button",
|
|
152
|
-
disabled:
|
|
206
|
+
disabled: V,
|
|
153
207
|
"aria-haspopup": "listbox",
|
|
154
|
-
"aria-expanded":
|
|
208
|
+
"aria-expanded": a,
|
|
155
209
|
onClick: () => y((e) => !e),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
210
|
+
onKeyDown: qe,
|
|
211
|
+
className: E(
|
|
212
|
+
"flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-background px-3 text-sm text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 disabled:pointer-events-none disabled:opacity-50",
|
|
213
|
+
ee ? "border-amber-300 dark:border-amber-600" : "border-input"
|
|
159
214
|
),
|
|
160
215
|
children: [
|
|
161
|
-
|
|
216
|
+
$e ? /* @__PURE__ */ s(he, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ d(
|
|
162
217
|
"span",
|
|
163
218
|
{
|
|
164
|
-
className:
|
|
219
|
+
className: E(
|
|
165
220
|
"flex items-center gap-1.5 truncate min-w-0",
|
|
166
|
-
!
|
|
221
|
+
!se && "text-muted-foreground"
|
|
167
222
|
),
|
|
168
223
|
children: [
|
|
169
|
-
|
|
170
|
-
/* @__PURE__ */ s("span", { className: "truncate", children:
|
|
224
|
+
ee && /* @__PURE__ */ s(Te, { className: "h-3.5 w-3.5 shrink-0 text-amber-500" }),
|
|
225
|
+
/* @__PURE__ */ s("span", { className: "truncate", children: se ?? xe ?? "Select…" })
|
|
171
226
|
]
|
|
172
227
|
}
|
|
173
228
|
),
|
|
174
|
-
/* @__PURE__ */ s(
|
|
229
|
+
/* @__PURE__ */ s(ye, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
175
230
|
]
|
|
176
231
|
}
|
|
177
232
|
),
|
|
178
|
-
|
|
179
|
-
|
|
233
|
+
fe.tip,
|
|
234
|
+
a && /* @__PURE__ */ d("div", { className: "absolute z-50 mt-1 min-w-[280px] w-max max-w-[420px] rounded-md border border-border bg-popover shadow-md", children: [
|
|
180
235
|
/* @__PURE__ */ d("div", { className: "flex items-center border-b px-3", children: [
|
|
181
|
-
/* @__PURE__ */ s(
|
|
236
|
+
/* @__PURE__ */ s(Ee, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
182
237
|
/* @__PURE__ */ s(
|
|
183
238
|
"input",
|
|
184
239
|
{
|
|
185
|
-
ref:
|
|
186
|
-
value:
|
|
187
|
-
onChange: (e) =>
|
|
188
|
-
onKeyDown:
|
|
189
|
-
|
|
190
|
-
|
|
240
|
+
ref: ie,
|
|
241
|
+
value: u,
|
|
242
|
+
onChange: (e) => P(e.target.value),
|
|
243
|
+
onKeyDown: me,
|
|
244
|
+
role: "combobox",
|
|
245
|
+
"aria-expanded": !0,
|
|
246
|
+
"aria-autocomplete": "list",
|
|
247
|
+
"aria-controls": `${W}-list`,
|
|
248
|
+
"aria-activedescendant": l >= 0 ? te(l) : void 0,
|
|
191
249
|
placeholder: "Search…",
|
|
192
250
|
className: "flex h-9 w-full bg-transparent py-3 text-[13px] outline-none placeholder:text-muted-foreground"
|
|
193
251
|
}
|
|
194
252
|
)
|
|
195
253
|
] }),
|
|
196
|
-
/* @__PURE__ */ d("div", { className: "max-h-64 overflow-y-auto py-1", children: [
|
|
197
|
-
!!
|
|
254
|
+
/* @__PURE__ */ d("div", { id: `${W}-list`, role: "listbox", className: "max-h-64 overflow-y-auto py-1", children: [
|
|
255
|
+
!!i && !V && /* @__PURE__ */ d(
|
|
198
256
|
"button",
|
|
199
257
|
{
|
|
200
258
|
type: "button",
|
|
259
|
+
tabIndex: -1,
|
|
201
260
|
onClick: () => {
|
|
202
|
-
|
|
261
|
+
oe(null), y(!1);
|
|
203
262
|
},
|
|
204
263
|
className: "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-slate-500 hover:bg-muted border-b border-slate-100 dark:text-slate-400 dark:border-border",
|
|
205
264
|
children: [
|
|
206
|
-
/* @__PURE__ */ s(
|
|
265
|
+
/* @__PURE__ */ s(_e, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
207
266
|
"Clear selection"
|
|
208
267
|
]
|
|
209
268
|
}
|
|
210
269
|
),
|
|
211
|
-
|
|
270
|
+
M && /* @__PURE__ */ d(
|
|
212
271
|
"button",
|
|
213
272
|
{
|
|
214
273
|
type: "button",
|
|
274
|
+
tabIndex: -1,
|
|
275
|
+
id: te(0),
|
|
276
|
+
role: "option",
|
|
277
|
+
"aria-selected": String(i) === h,
|
|
278
|
+
"data-nav-index": 0,
|
|
215
279
|
"data-nvr-pinned-option": !0,
|
|
216
|
-
onClick: () =>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
280
|
+
onClick: () => re(0),
|
|
281
|
+
onMouseMove: () => l !== 0 && K(0),
|
|
282
|
+
className: E(
|
|
283
|
+
"flex w-full items-center gap-2 border-b border-slate-100 px-3 py-1.5 text-left text-[13px] hover:bg-nvr-cyan/10 dark:border-border",
|
|
284
|
+
l === 0 ? "bg-nvr-cyan/10" : "bg-nvr-cyan/5"
|
|
285
|
+
),
|
|
220
286
|
children: [
|
|
221
287
|
/* @__PURE__ */ s(
|
|
222
288
|
"div",
|
|
223
289
|
{
|
|
224
|
-
className:
|
|
290
|
+
className: E(
|
|
225
291
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
226
|
-
String(
|
|
292
|
+
String(i) === h ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
227
293
|
),
|
|
228
|
-
children: String(
|
|
294
|
+
children: String(i) === h && /* @__PURE__ */ s(be, { className: "h-2.5 w-2.5 text-white" })
|
|
229
295
|
}
|
|
230
296
|
),
|
|
231
|
-
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children:
|
|
297
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: x ? ue(x) : "Loading…" }),
|
|
232
298
|
/* @__PURE__ */ s("span", { className: "shrink-0 rounded bg-nvr-cyan/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-slate-700 dark:text-foreground", children: (c == null ? void 0 : c.tag) ?? "Default" })
|
|
233
299
|
]
|
|
234
300
|
}
|
|
235
301
|
),
|
|
236
|
-
|
|
237
|
-
|
|
302
|
+
ve ? /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ s(he, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : D.length === 0 ? u.trim() && M ? null : u.trim() ? /* @__PURE__ */ d("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: [
|
|
303
|
+
"No results for “",
|
|
304
|
+
u.trim(),
|
|
305
|
+
"”"
|
|
306
|
+
] }) : _ ? (
|
|
307
|
+
// Nothing at all fits this record: say what narrows the list
|
|
308
|
+
// (a project with no line categories set up — army9 b01) so
|
|
309
|
+
// the person knows who can fix it, instead of a bare "No results".
|
|
310
|
+
/* @__PURE__ */ d(
|
|
311
|
+
"p",
|
|
312
|
+
{
|
|
313
|
+
className: "px-3 py-2 text-[12px] leading-5 text-muted-foreground",
|
|
314
|
+
"data-nvr-empty-narrowed": !0,
|
|
315
|
+
children: [
|
|
316
|
+
J != null && J.labels.length ? /* @__PURE__ */ d(Le, { children: [
|
|
317
|
+
"Nothing set up for this",
|
|
318
|
+
" ",
|
|
319
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: J.labels.join(" · ") }),
|
|
320
|
+
" ",
|
|
321
|
+
"yet."
|
|
322
|
+
] }) : "Nothing set up for this record yet.",
|
|
323
|
+
" ",
|
|
324
|
+
"Pick a different one, or ask an administrator to add options for it."
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
) : /* @__PURE__ */ s("p", { className: "px-3 py-2 text-[13px] text-muted-foreground", children: "No results" }) : D.map((e) => {
|
|
329
|
+
const t = X.has(e.id);
|
|
238
330
|
return /* @__PURE__ */ d("div", { children: [
|
|
239
331
|
/* @__PURE__ */ d(
|
|
240
332
|
"button",
|
|
241
333
|
{
|
|
242
334
|
type: "button",
|
|
243
|
-
onClick: () =>
|
|
335
|
+
onClick: () => Ne(e.id),
|
|
244
336
|
className: "flex w-full items-center gap-1.5 px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400 hover:bg-muted",
|
|
245
337
|
children: [
|
|
246
|
-
|
|
338
|
+
t ? /* @__PURE__ */ s(ye, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ s(Ie, { className: "h-3 w-3 shrink-0" }),
|
|
247
339
|
e.label,
|
|
248
340
|
/* @__PURE__ */ s("span", { className: "ml-auto font-normal normal-case tracking-normal text-slate-400", children: e.items.length })
|
|
249
341
|
]
|
|
250
342
|
}
|
|
251
343
|
),
|
|
252
|
-
|
|
253
|
-
const r =
|
|
344
|
+
t && e.items.map((n) => {
|
|
345
|
+
const r = L + G.indexOf(n), o = n[m], w = o ? q(O, o) : String(n.id ?? ""), k = String(n.id) === String(i);
|
|
254
346
|
return /* @__PURE__ */ d(
|
|
255
347
|
"button",
|
|
256
348
|
{
|
|
257
349
|
type: "button",
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
350
|
+
tabIndex: -1,
|
|
351
|
+
id: te(r),
|
|
352
|
+
role: "option",
|
|
353
|
+
"aria-selected": k,
|
|
354
|
+
"data-nav-index": r,
|
|
355
|
+
onClick: () => ne(n.id),
|
|
356
|
+
onMouseMove: () => l !== r && K(r),
|
|
357
|
+
className: E(
|
|
358
|
+
"flex w-full items-center gap-2 pl-8 pr-3 py-1.5 text-[13px] text-left hover:bg-muted",
|
|
359
|
+
l === r && "bg-muted"
|
|
360
|
+
),
|
|
262
361
|
children: [
|
|
263
362
|
/* @__PURE__ */ s(
|
|
264
363
|
"div",
|
|
265
364
|
{
|
|
266
|
-
className:
|
|
365
|
+
className: E(
|
|
267
366
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
268
|
-
|
|
367
|
+
k ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
269
368
|
),
|
|
270
|
-
children:
|
|
369
|
+
children: k && /* @__PURE__ */ s(be, { className: "h-2.5 w-2.5 text-white" })
|
|
271
370
|
}
|
|
272
371
|
),
|
|
273
|
-
|
|
372
|
+
w
|
|
274
373
|
]
|
|
275
374
|
},
|
|
276
|
-
String(
|
|
375
|
+
String(n.id)
|
|
277
376
|
);
|
|
278
377
|
})
|
|
279
378
|
] }, e.id);
|
|
@@ -283,5 +382,5 @@ function Ee({
|
|
|
283
382
|
] });
|
|
284
383
|
}
|
|
285
384
|
export {
|
|
286
|
-
|
|
385
|
+
Xe as RelationGroupedCombobox
|
|
287
386
|
};
|