@nivaro/react 0.3.57 → 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 +37 -2
- package/dist/index.js +523 -520
- package/dist/shared/components/CollectionBrowserView.js +2693 -2619
- package/dist/shared/components/DataTable.js +538 -495
- package/dist/shared/components/ItemEditForm.js +4559 -4386
- package/dist/shared/components/PageRenderer.js +537 -508
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/QueryTable.js +74 -74
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/WidgetSlot.js +543 -520
- package/dist/shared/components/alerts/AlertManagerView.js +324 -317
- package/dist/shared/components/alerts/types.js +37 -14
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
- package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
- package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +973 -894
- package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
- package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
- 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/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +9 -7
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +213 -211
- package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
- package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
- package/dist/shared/components/panels/RevisionsPanel.js +316 -299
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
- package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/queue/live-state-aspect.js +9 -5
- package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
- package/dist/shared/lib/back-closes.js +25 -0
- 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/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +63 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/money-input.js +45 -0
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/sanitize-html.js +10 -6
- package/dist/shared/lib/staged-row-labels.js +18 -0
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -1,254 +1,375 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
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 {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
extraFilter: _,
|
|
20
|
+
pinned: c,
|
|
21
|
+
narrowedBy: J
|
|
20
22
|
}) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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;
|
|
29
|
+
const r = document.activeElement;
|
|
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);
|
|
35
|
+
};
|
|
36
|
+
return window.addEventListener("keydown", e, !0), document.addEventListener("focusin", t), () => {
|
|
37
|
+
window.removeEventListener("keydown", e, !0), document.removeEventListener("focusin", t);
|
|
38
|
+
};
|
|
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;
|
|
29
57
|
const e = (t) => {
|
|
30
|
-
|
|
58
|
+
$.current && !$.current.contains(t.target) && y(!1);
|
|
31
59
|
};
|
|
32
60
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
33
|
-
}, [
|
|
34
|
-
const { data:
|
|
35
|
-
queryKey: ["col-meta",
|
|
36
|
-
queryFn: () =>
|
|
61
|
+
}, [a]);
|
|
62
|
+
const { data: b } = N({
|
|
63
|
+
queryKey: ["col-meta", p],
|
|
64
|
+
queryFn: () => g.request(S(`/collections/${p}`)).then((e) => e.data),
|
|
37
65
|
staleTime: 3e5,
|
|
38
66
|
retry: !1
|
|
39
|
-
}),
|
|
67
|
+
}), Y = z(
|
|
40
68
|
() => {
|
|
41
69
|
var e;
|
|
42
|
-
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;
|
|
43
71
|
},
|
|
44
|
-
[
|
|
45
|
-
),
|
|
72
|
+
[b, f]
|
|
73
|
+
), Z = z(
|
|
46
74
|
() => {
|
|
47
75
|
var e;
|
|
48
|
-
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;
|
|
49
77
|
},
|
|
50
|
-
[
|
|
51
|
-
), { data:
|
|
52
|
-
queryKey: ["col-meta",
|
|
53
|
-
queryFn: () =>
|
|
54
|
-
|
|
78
|
+
[b, m]
|
|
79
|
+
), { data: B } = N({
|
|
80
|
+
queryKey: ["col-meta", Y],
|
|
81
|
+
queryFn: () => g.request(
|
|
82
|
+
S(`/collections/${Y}`)
|
|
55
83
|
).then((e) => e.data),
|
|
56
|
-
enabled: !!
|
|
84
|
+
enabled: !!Y,
|
|
57
85
|
staleTime: 3e5,
|
|
58
86
|
retry: !1
|
|
59
|
-
}), { data:
|
|
60
|
-
queryKey: ["col-meta",
|
|
61
|
-
queryFn: () =>
|
|
62
|
-
|
|
87
|
+
}), { data: F } = N({
|
|
88
|
+
queryKey: ["col-meta", Z],
|
|
89
|
+
queryFn: () => g.request(
|
|
90
|
+
S(`/collections/${Z}`)
|
|
63
91
|
).then((e) => e.data),
|
|
64
|
-
enabled: !!
|
|
92
|
+
enabled: !!Z,
|
|
65
93
|
staleTime: 3e5,
|
|
66
94
|
retry: !1
|
|
67
|
-
}),
|
|
68
|
-
queryKey: ["relation-grouped-opts",
|
|
69
|
-
queryFn: () =>
|
|
70
|
-
|
|
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}`, {
|
|
71
99
|
limit: 1e3,
|
|
72
100
|
picker: "1",
|
|
73
|
-
fields:
|
|
74
|
-
...
|
|
101
|
+
fields: ce,
|
|
102
|
+
...A ? { filter: A } : {}
|
|
75
103
|
})
|
|
76
104
|
).then((e) => e.data ?? []),
|
|
77
|
-
enabled:
|
|
78
|
-
staleTime:
|
|
79
|
-
}), { data:
|
|
80
|
-
queryKey: ["relation-grouped-single",
|
|
81
|
-
queryFn: () =>
|
|
82
|
-
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,
|
|
83
111
|
staleTime: 6e4
|
|
84
|
-
}),
|
|
85
|
-
queryKey: ["relation-avail",
|
|
86
|
-
queryFn: () =>
|
|
87
|
-
|
|
88
|
-
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,
|
|
89
117
|
picker: "1",
|
|
90
118
|
limit: 1,
|
|
91
119
|
fields: "id"
|
|
92
120
|
})
|
|
93
121
|
).then((e) => e.data ?? []),
|
|
94
|
-
enabled: !!
|
|
122
|
+
enabled: !!i && !!R,
|
|
95
123
|
staleTime: 3e4
|
|
96
|
-
}),
|
|
97
|
-
const e =
|
|
98
|
-
for (const
|
|
99
|
-
const
|
|
100
|
-
t && !
|
|
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();
|
|
126
|
+
for (const r of e) {
|
|
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));
|
|
101
129
|
}
|
|
102
|
-
return [...n.entries()].map(([
|
|
103
|
-
}, [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}, [
|
|
107
|
-
function
|
|
108
|
-
|
|
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) => {
|
|
109
137
|
const n = new Set(t);
|
|
110
138
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
111
139
|
});
|
|
112
140
|
}
|
|
113
|
-
const
|
|
114
|
-
queryKey: ["relation-grouped-single",
|
|
115
|
-
queryFn: () =>
|
|
116
|
-
|
|
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}.*` })
|
|
117
145
|
).then((e) => e.data).catch(() => null),
|
|
118
|
-
enabled: !!
|
|
146
|
+
enabled: !!h && a && !(j ?? []).some((e) => String(e.id) === h),
|
|
119
147
|
staleTime: 6e4
|
|
120
|
-
}),
|
|
121
|
-
const t = e[
|
|
122
|
-
return [
|
|
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));
|
|
123
166
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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;
|
|
128
198
|
}
|
|
129
|
-
const
|
|
130
|
-
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: [
|
|
131
201
|
/* @__PURE__ */ d(
|
|
132
202
|
"button",
|
|
133
203
|
{
|
|
204
|
+
ref: I,
|
|
134
205
|
type: "button",
|
|
135
|
-
disabled:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
206
|
+
disabled: V,
|
|
207
|
+
"aria-haspopup": "listbox",
|
|
208
|
+
"aria-expanded": a,
|
|
209
|
+
onClick: () => y((e) => !e),
|
|
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"
|
|
140
214
|
),
|
|
141
215
|
children: [
|
|
142
|
-
|
|
216
|
+
$e ? /* @__PURE__ */ s(he, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ d(
|
|
143
217
|
"span",
|
|
144
218
|
{
|
|
145
|
-
className:
|
|
219
|
+
className: E(
|
|
146
220
|
"flex items-center gap-1.5 truncate min-w-0",
|
|
147
|
-
!
|
|
221
|
+
!se && "text-muted-foreground"
|
|
148
222
|
),
|
|
149
223
|
children: [
|
|
150
|
-
|
|
151
|
-
/* @__PURE__ */
|
|
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…" })
|
|
152
226
|
]
|
|
153
227
|
}
|
|
154
228
|
),
|
|
155
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ s(ye, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
156
230
|
]
|
|
157
231
|
}
|
|
158
232
|
),
|
|
159
|
-
|
|
160
|
-
|
|
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: [
|
|
161
235
|
/* @__PURE__ */ d("div", { className: "flex items-center border-b px-3", children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ s(Ee, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
237
|
+
/* @__PURE__ */ s(
|
|
164
238
|
"input",
|
|
165
239
|
{
|
|
166
|
-
ref:
|
|
167
|
-
value:
|
|
168
|
-
onChange: (e) =>
|
|
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,
|
|
169
249
|
placeholder: "Search…",
|
|
170
250
|
className: "flex h-9 w-full bg-transparent py-3 text-[13px] outline-none placeholder:text-muted-foreground"
|
|
171
251
|
}
|
|
172
252
|
)
|
|
173
253
|
] }),
|
|
174
|
-
/* @__PURE__ */ d("div", { className: "max-h-64 overflow-y-auto py-1", children: [
|
|
175
|
-
!!
|
|
254
|
+
/* @__PURE__ */ d("div", { id: `${W}-list`, role: "listbox", className: "max-h-64 overflow-y-auto py-1", children: [
|
|
255
|
+
!!i && !V && /* @__PURE__ */ d(
|
|
176
256
|
"button",
|
|
177
257
|
{
|
|
178
258
|
type: "button",
|
|
259
|
+
tabIndex: -1,
|
|
179
260
|
onClick: () => {
|
|
180
|
-
|
|
261
|
+
oe(null), y(!1);
|
|
181
262
|
},
|
|
182
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",
|
|
183
264
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ s(_e, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
185
266
|
"Clear selection"
|
|
186
267
|
]
|
|
187
268
|
}
|
|
188
269
|
),
|
|
189
|
-
|
|
270
|
+
M && /* @__PURE__ */ d(
|
|
190
271
|
"button",
|
|
191
272
|
{
|
|
192
273
|
type: "button",
|
|
274
|
+
tabIndex: -1,
|
|
275
|
+
id: te(0),
|
|
276
|
+
role: "option",
|
|
277
|
+
"aria-selected": String(i) === h,
|
|
278
|
+
"data-nav-index": 0,
|
|
193
279
|
"data-nvr-pinned-option": !0,
|
|
194
|
-
onClick: () =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
+
),
|
|
198
286
|
children: [
|
|
199
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ s(
|
|
200
288
|
"div",
|
|
201
289
|
{
|
|
202
|
-
className:
|
|
290
|
+
className: E(
|
|
203
291
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
204
|
-
String(
|
|
292
|
+
String(i) === h ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
205
293
|
),
|
|
206
|
-
children: String(
|
|
294
|
+
children: String(i) === h && /* @__PURE__ */ s(be, { className: "h-2.5 w-2.5 text-white" })
|
|
207
295
|
}
|
|
208
296
|
),
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: x ? ue(x) : "Loading…" }),
|
|
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" })
|
|
211
299
|
]
|
|
212
300
|
}
|
|
213
301
|
),
|
|
214
|
-
|
|
215
|
-
|
|
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);
|
|
216
330
|
return /* @__PURE__ */ d("div", { children: [
|
|
217
331
|
/* @__PURE__ */ d(
|
|
218
332
|
"button",
|
|
219
333
|
{
|
|
220
334
|
type: "button",
|
|
221
|
-
onClick: () =>
|
|
335
|
+
onClick: () => Ne(e.id),
|
|
222
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",
|
|
223
337
|
children: [
|
|
224
|
-
t ? /* @__PURE__ */
|
|
338
|
+
t ? /* @__PURE__ */ s(ye, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ s(Ie, { className: "h-3 w-3 shrink-0" }),
|
|
225
339
|
e.label,
|
|
226
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ s("span", { className: "ml-auto font-normal normal-case tracking-normal text-slate-400", children: e.items.length })
|
|
227
341
|
]
|
|
228
342
|
}
|
|
229
343
|
),
|
|
230
344
|
t && e.items.map((n) => {
|
|
231
|
-
const
|
|
345
|
+
const r = L + G.indexOf(n), o = n[m], w = o ? q(O, o) : String(n.id ?? ""), k = String(n.id) === String(i);
|
|
232
346
|
return /* @__PURE__ */ d(
|
|
233
347
|
"button",
|
|
234
348
|
{
|
|
235
349
|
type: "button",
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
+
),
|
|
240
361
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ s(
|
|
242
363
|
"div",
|
|
243
364
|
{
|
|
244
|
-
className:
|
|
365
|
+
className: E(
|
|
245
366
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
246
|
-
|
|
367
|
+
k ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300"
|
|
247
368
|
),
|
|
248
|
-
children:
|
|
369
|
+
children: k && /* @__PURE__ */ s(be, { className: "h-2.5 w-2.5 text-white" })
|
|
249
370
|
}
|
|
250
371
|
),
|
|
251
|
-
|
|
372
|
+
w
|
|
252
373
|
]
|
|
253
374
|
},
|
|
254
375
|
String(n.id)
|
|
@@ -261,5 +382,5 @@ function Te({
|
|
|
261
382
|
] });
|
|
262
383
|
}
|
|
263
384
|
export {
|
|
264
|
-
|
|
385
|
+
Xe as RelationGroupedCombobox
|
|
265
386
|
};
|