@nivaro/react 0.3.103 → 0.3.105

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.
Files changed (28) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +15 -3
  4. package/dist/shared/components/CollectionBrowserView.js +1694 -1639
  5. package/dist/shared/components/ItemEditForm.js +2867 -2845
  6. package/dist/shared/components/imports/CollectionImportPanel.js +483 -459
  7. package/dist/shared/components/integrations/IntegrationStatusLines.js +71 -68
  8. package/dist/shared/components/item-edit/InlineTableField.js +88 -88
  9. package/dist/shared/components/item-edit/UserChip.js +38 -38
  10. package/dist/shared/components/layout-editor/DesignNode.js +16 -14
  11. package/dist/shared/components/layout-editor/LayoutEditor.js +445 -441
  12. package/dist/shared/components/layout-editor/inspector/Inspector.js +18 -18
  13. package/dist/shared/components/layout-editor/inspector/SlotInspector.js +80 -52
  14. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  15. package/dist/shared/components/layout-editor/settings/ButtonsSection.js +54 -26
  16. package/dist/shared/components/layout-editor/settings/settings-registry.js +23 -15
  17. package/dist/shared/components/layout-editor/useLayoutDraft.js +211 -196
  18. package/dist/shared/components/panels/ExternalRequestsChip.js +141 -122
  19. package/dist/shared/components/quick-filters/QuickFilterBarEditor.js +334 -0
  20. package/dist/shared/components/quick-filters/QuickFilterFieldPicker.js +151 -0
  21. package/dist/shared/components/quick-filters/QuickFilterForm.js +371 -0
  22. package/dist/shared/components/quick-filters/config.js +63 -0
  23. package/dist/shared/components/quick-filters/facets.js +55 -0
  24. package/dist/shared/components/quick-filters/useQuickFilterEditing.js +95 -0
  25. package/dist/shared/lib/entry-config.js +7 -7
  26. package/dist/shared/lib/integration-chip.js +10 -6
  27. package/dist/shared/lib/owners-header-tile.js +63 -0
  28. package/package.json +1 -1
@@ -0,0 +1,334 @@
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { useSensors as E, useSensor as q, PointerSensor as Q, KeyboardSensor as R, DndContext as j, closestCenter as K } from "@dnd-kit/core";
3
+ import { sortableKeyboardCoordinates as L, SortableContext as B, rectSortingStrategy as I, useSortable as M } from "@dnd-kit/sortable";
4
+ import { CSS as z } from "@dnd-kit/utilities";
5
+ import { useQueryClient as G } from "@tanstack/react-query";
6
+ import { Plus as H, AlertTriangle as U, Loader2 as V, Check as W, SlidersHorizontal as X, GripVertical as J, X as P, ArrowLeft as Y, ArrowRight as Z, Trash2 as ee } from "lucide-react";
7
+ import { useState as D, forwardRef as te } from "react";
8
+ import { useNivaroClient as re } from "../../context.js";
9
+ import { describeError as ae } from "../../lib/error-message.js";
10
+ import { titleCase as ne, cn as w } from "../../lib/utils.js";
11
+ import { ErrorDetails as se } from "../ErrorNotice.js";
12
+ import { Popover as F, PopoverTrigger as _, PopoverContent as $ } from "../ui/popover.js";
13
+ import { quickFilterProblems as O, slugKey as ie, uniqueKey as oe } from "./config.js";
14
+ import { pathLabel as le } from "./facets.js";
15
+ import { QuickFilterFieldPicker as de, usedPathLabels as ce } from "./QuickFilterFieldPicker.js";
16
+ import { facetDefaults as ue, QuickFilterForm as he } from "./QuickFilterForm.js";
17
+ const T = "w-[min(22rem,calc(100vw-2rem))] rounded-lg border-slate-200 bg-white p-0 shadow-[0_10px_30px_-8px_rgba(15,23,42,0.25),0_2px_6px_rgba(15,23,42,0.08)] dark:border-slate-700 dark:bg-slate-900", A = "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11.5px] font-medium text-slate-600 hover:bg-slate-100 hover:text-slate-900 disabled:pointer-events-none disabled:opacity-40 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-white", Fe = te(function({ ctl: i, label: c = "Edit filters", className: s }, h) {
18
+ return /* @__PURE__ */ a("span", { className: w("inline-flex items-center gap-1.5", s), children: [
19
+ i.status === "saving" && /* @__PURE__ */ a(
20
+ "span",
21
+ {
22
+ role: "status",
23
+ className: "inline-flex items-center gap-1 text-[11px] text-slate-500 dark:text-slate-400",
24
+ children: [
25
+ /* @__PURE__ */ t(V, { "aria-hidden": !0, className: "h-3 w-3 animate-spin" }),
26
+ "Saving…"
27
+ ]
28
+ }
29
+ ),
30
+ i.status === "saved" && /* @__PURE__ */ a(
31
+ "span",
32
+ {
33
+ role: "status",
34
+ className: "nvr-fade-in inline-flex items-center gap-1 text-[11px] font-medium text-emerald-700 dark:text-emerald-400",
35
+ children: [
36
+ /* @__PURE__ */ t(W, { "aria-hidden": !0, className: "h-3 w-3", strokeWidth: 3 }),
37
+ "Saved"
38
+ ]
39
+ }
40
+ ),
41
+ /* @__PURE__ */ a(
42
+ "button",
43
+ {
44
+ ref: h,
45
+ type: "button",
46
+ onClick: () => i.start(),
47
+ "data-tip": "Choose the filters everyone sees above this list. Only administrators can change them.",
48
+ "data-qf-edit": "",
49
+ className: "inline-flex h-6 items-center gap-1 rounded px-1.5 text-[11px] font-medium text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-100",
50
+ children: [
51
+ /* @__PURE__ */ t(X, { "aria-hidden": !0, className: "h-3 w-3" }),
52
+ c
53
+ ]
54
+ }
55
+ )
56
+ ] });
57
+ });
58
+ function fe({
59
+ item: e,
60
+ index: i,
61
+ count: c,
62
+ ctl: s,
63
+ collection: h,
64
+ onMoved: b
65
+ }) {
66
+ var N, C;
67
+ const { attributes: g, listeners: k, setNodeRef: f, transform: m, transition: y, isDragging: p } = M({
68
+ id: e.id
69
+ }), [l, r] = D(!1), o = ((N = e.def.label) == null ? void 0 : N.trim()) || "Untitled filter", d = O(e.def, s.defs), v = s.openId === e.id, x = (n) => {
70
+ const u = i + n;
71
+ u < 0 || u >= c || (s.move(e.id, n), b(o, u + 1));
72
+ };
73
+ return /* @__PURE__ */ a(
74
+ "div",
75
+ {
76
+ ref: f,
77
+ style: { transform: z.Translate.toString(m), transition: y },
78
+ "data-qf-token": e.def.key || e.id,
79
+ className: w(
80
+ "inline-flex h-6 max-w-[15rem] items-center rounded border bg-white text-[11.5px] shadow-[0_1px_1px_rgba(15,23,42,0.04)] dark:bg-slate-900",
81
+ d.length > 0 ? "border-amber-400 dark:border-amber-500/70" : v ? "border-nvr-cyan/70 ring-2 ring-nvr-cyan/20" : "border-slate-300 dark:border-slate-600",
82
+ p && "z-10 opacity-80 shadow-lg"
83
+ ),
84
+ children: [
85
+ /* @__PURE__ */ t(
86
+ "button",
87
+ {
88
+ type: "button",
89
+ ...g,
90
+ ...k,
91
+ "aria-label": `Drag ${o} to reorder`,
92
+ className: "flex h-full w-5 shrink-0 cursor-grab touch-none items-center justify-center rounded-l text-slate-400 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/60 active:cursor-grabbing dark:text-slate-500 dark:hover:text-slate-200",
93
+ children: /* @__PURE__ */ t(J, { className: "h-3 w-3" })
94
+ }
95
+ ),
96
+ /* @__PURE__ */ a(F, { open: v, onOpenChange: (n) => s.setOpenId(n ? e.id : null), children: [
97
+ /* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ a(
98
+ "button",
99
+ {
100
+ type: "button",
101
+ onKeyDown: (n) => {
102
+ n.altKey && (n.key === "ArrowLeft" ? (n.preventDefault(), x(-1)) : n.key === "ArrowRight" && (n.preventDefault(), x(1)));
103
+ },
104
+ "aria-label": `${o}: settings${d.length ? ` (${d[0]})` : ""}. Alt+Left or Alt+Right moves it.`,
105
+ className: "flex h-full min-w-0 items-center gap-1.5 px-1 text-slate-800 hover:text-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/60 dark:text-slate-100 dark:hover:text-white",
106
+ children: [
107
+ /* @__PURE__ */ t("span", { className: w("truncate", !((C = e.def.label) != null && C.trim()) && "italic text-slate-500"), children: o }),
108
+ d.length > 0 && /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500" })
109
+ ]
110
+ }
111
+ ) }),
112
+ /* @__PURE__ */ a(
113
+ $,
114
+ {
115
+ align: "start",
116
+ sideOffset: 6,
117
+ collisionPadding: 16,
118
+ className: T,
119
+ onOpenAutoFocus: (n) => {
120
+ var u, S;
121
+ n.preventDefault(), e.isNew && ((S = (u = n.currentTarget) == null ? void 0 : u.querySelector("[data-qf-name]")) == null || S.select());
122
+ },
123
+ children: [
124
+ !l && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-2 border-b border-slate-100 px-3 py-2 dark:border-slate-800", children: [
125
+ /* @__PURE__ */ t("p", { className: "min-w-0 truncate text-[12.5px] font-semibold text-slate-900 dark:text-slate-50", children: o }),
126
+ /* @__PURE__ */ t(
127
+ "button",
128
+ {
129
+ type: "button",
130
+ onClick: () => s.setOpenId(null),
131
+ "aria-label": "Close",
132
+ className: "flex h-6 w-6 shrink-0 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200",
133
+ children: /* @__PURE__ */ t(P, { className: "h-3.5 w-3.5" })
134
+ }
135
+ )
136
+ ] }),
137
+ /* @__PURE__ */ t(
138
+ he,
139
+ {
140
+ collection: h,
141
+ value: e.def,
142
+ all: s.defs,
143
+ isNew: e.isNew,
144
+ onChange: (n) => s.update(e.id, n),
145
+ onPickingChange: r,
146
+ className: "max-h-[min(30rem,65vh)] overflow-y-auto px-3 py-3"
147
+ }
148
+ ),
149
+ !l && /* @__PURE__ */ a("div", { className: "flex items-center gap-1 border-t border-slate-100 px-2 py-1.5 dark:border-slate-800", children: [
150
+ /* @__PURE__ */ a(
151
+ "button",
152
+ {
153
+ type: "button",
154
+ disabled: i === 0,
155
+ onClick: () => x(-1),
156
+ className: A,
157
+ children: [
158
+ /* @__PURE__ */ t(Y, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
159
+ "Move left"
160
+ ]
161
+ }
162
+ ),
163
+ /* @__PURE__ */ a(
164
+ "button",
165
+ {
166
+ type: "button",
167
+ disabled: i === c - 1,
168
+ onClick: () => x(1),
169
+ className: A,
170
+ children: [
171
+ "Move right",
172
+ /* @__PURE__ */ t(Z, { "aria-hidden": !0, className: "h-3.5 w-3.5" })
173
+ ]
174
+ }
175
+ ),
176
+ /* @__PURE__ */ a(
177
+ "button",
178
+ {
179
+ type: "button",
180
+ onClick: () => s.remove(e.id),
181
+ className: "ml-auto inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11.5px] font-medium text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-500/10",
182
+ children: [
183
+ /* @__PURE__ */ t(ee, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
184
+ "Remove"
185
+ ]
186
+ }
187
+ )
188
+ ] })
189
+ ]
190
+ }
191
+ )
192
+ ] }),
193
+ /* @__PURE__ */ t(
194
+ "button",
195
+ {
196
+ type: "button",
197
+ onClick: () => s.remove(e.id),
198
+ "aria-label": `Remove ${o}`,
199
+ className: "flex h-full w-5 shrink-0 items-center justify-center rounded-r text-slate-400 hover:bg-red-50 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/60 dark:hover:bg-red-500/10 dark:hover:text-red-400",
200
+ children: /* @__PURE__ */ t(P, { className: "h-3 w-3" })
201
+ }
202
+ )
203
+ ]
204
+ }
205
+ );
206
+ }
207
+ function _e({
208
+ ctl: e,
209
+ collection: i
210
+ }) {
211
+ const c = G(), s = re(), [h, b] = D(""), g = E(
212
+ q(Q, { activationConstraint: { distance: 4 } }),
213
+ q(R, { coordinateGetter: L })
214
+ ), k = (r) => {
215
+ r.over && r.active.id !== r.over.id && e.reorder(String(r.active.id), String(r.over.id));
216
+ }, f = e.draft.length, m = e.status === "error" && e.error != null, y = (e.dirty || m) && e.problemCount === 0, p = e.draft.find((r) => O(r.def, e.defs).length > 0), l = m ? ae(e.error, "The quick filters were not saved") : null;
217
+ return /* @__PURE__ */ a(
218
+ "div",
219
+ {
220
+ "data-qf-editor": "",
221
+ className: "relative flex shrink-0 flex-wrap items-center gap-1.5 border-b border-nvr-cyan/25 bg-[#f4fbfd] px-4 py-1.5 dark:border-nvr-cyan/20 dark:bg-[#0f1d26]",
222
+ children: [
223
+ /* @__PURE__ */ t("span", { className: "sr-only", "aria-live": "polite", children: h }),
224
+ /* @__PURE__ */ t("span", { className: "mr-0.5 text-[11px] font-semibold text-slate-700 dark:text-slate-200", children: "Quick filters" }),
225
+ /* @__PURE__ */ t(j, { sensors: g, collisionDetection: K, onDragEnd: k, children: /* @__PURE__ */ t(B, { items: e.draft.map((r) => r.id), strategy: I, children: e.draft.map((r, o) => /* @__PURE__ */ t(
226
+ fe,
227
+ {
228
+ item: r,
229
+ index: o,
230
+ count: f,
231
+ ctl: e,
232
+ collection: i,
233
+ onMoved: (d, v) => b(`${d} moved to position ${v} of ${f}`)
234
+ },
235
+ r.id
236
+ )) }) }),
237
+ /* @__PURE__ */ a(F, { open: e.adding, onOpenChange: e.setAdding, children: [
238
+ /* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ a(
239
+ "button",
240
+ {
241
+ type: "button",
242
+ "data-qf-add": "",
243
+ className: "inline-flex h-6 items-center gap-1 rounded border border-dashed border-slate-300 px-1.5 text-[11.5px] font-medium text-slate-600 hover:border-nvr-cyan/70 hover:bg-white hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 data-[state=open]:border-nvr-cyan/70 data-[state=open]:bg-white dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-900 dark:hover:text-white dark:data-[state=open]:bg-slate-900",
244
+ children: [
245
+ /* @__PURE__ */ t(H, { "aria-hidden": !0, className: "h-3 w-3" }),
246
+ "Add quick filter"
247
+ ]
248
+ }
249
+ ) }),
250
+ /* @__PURE__ */ t(
251
+ $,
252
+ {
253
+ align: "start",
254
+ sideOffset: 6,
255
+ collisionPadding: 16,
256
+ className: T,
257
+ onCloseAutoFocus: (r) => r.preventDefault(),
258
+ children: /* @__PURE__ */ t(
259
+ de,
260
+ {
261
+ rootCollection: i,
262
+ used: ce(e.defs),
263
+ onPick: (r) => {
264
+ ue(c, s, r).then((o) => {
265
+ const d = ie(r.path[r.path.length - 1] ?? "");
266
+ e.add({
267
+ key: oe(d, e.defs),
268
+ label: ne(r.path[r.path.length - 1] ?? ""),
269
+ path: r.path,
270
+ ...o
271
+ }), b(`Added ${le(r.path)}`);
272
+ });
273
+ }
274
+ }
275
+ )
276
+ }
277
+ )
278
+ ] }),
279
+ f === 0 && !e.adding && /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: "No quick filters yet." }),
280
+ l && /* @__PURE__ */ a(
281
+ "span",
282
+ {
283
+ role: "alert",
284
+ className: "order-last flex min-w-0 basis-full items-center gap-1.5 text-[11.5px] text-red-700 sm:order-none sm:ml-auto sm:basis-auto dark:text-red-300",
285
+ children: [
286
+ /* @__PURE__ */ t(U, { "aria-hidden": !0, className: "h-3.5 w-3.5 shrink-0" }),
287
+ /* @__PURE__ */ t("span", { className: "min-w-0 sm:truncate", "data-tip": l.hint, children: l.title }),
288
+ /* @__PURE__ */ t(se, { description: l, action: "Save quick filters", className: "shrink-0" })
289
+ ]
290
+ }
291
+ ),
292
+ /* @__PURE__ */ a("div", { className: "ml-auto flex min-w-0 items-center gap-1.5", children: [
293
+ l ? null : p ? /* @__PURE__ */ a(
294
+ "button",
295
+ {
296
+ type: "button",
297
+ onClick: () => e.setOpenId(p.id),
298
+ className: "rounded text-[11.5px] font-medium text-amber-800 underline decoration-amber-400 underline-offset-2 hover:text-amber-950 dark:text-amber-300 dark:hover:text-amber-200",
299
+ children: [
300
+ e.problemCount === 1 ? "1 filter needs" : `${e.problemCount} filters need`,
301
+ " ",
302
+ "finishing"
303
+ ]
304
+ }
305
+ ) : /* @__PURE__ */ t("span", { className: "hidden text-[11.5px] text-slate-500 lg:inline dark:text-slate-400", children: "Saved for everyone who opens this list" }),
306
+ /* @__PURE__ */ t(
307
+ "button",
308
+ {
309
+ type: "button",
310
+ onClick: e.cancel,
311
+ className: "h-6 rounded px-2 text-[11.5px] font-medium text-slate-600 hover:bg-white hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-slate-300 dark:hover:bg-slate-900 dark:hover:text-white",
312
+ children: "Cancel"
313
+ }
314
+ ),
315
+ /* @__PURE__ */ t(
316
+ "button",
317
+ {
318
+ type: "button",
319
+ disabled: !y,
320
+ onClick: () => void e.save(),
321
+ "data-qf-save": "",
322
+ className: "h-6 whitespace-nowrap rounded bg-nvr-cyan px-2.5 text-[11.5px] font-semibold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 focus-visible:ring-offset-1 hover:brightness-95 disabled:cursor-not-allowed disabled:opacity-45",
323
+ children: m ? "Try again" : "Save"
324
+ }
325
+ )
326
+ ] })
327
+ ]
328
+ }
329
+ );
330
+ }
331
+ export {
332
+ _e as QuickFilterBarEditor,
333
+ Fe as QuickFilterEditButton
334
+ };
@@ -0,0 +1,151 @@
1
+ import { jsxs as a, jsx as t, Fragment as j } from "react/jsx-runtime";
2
+ import { useQueryClient as T } from "@tanstack/react-query";
3
+ import { ChevronLeft as M, Search as P, Loader2 as S, Check as _, ChevronRight as B } from "lucide-react";
4
+ import { useState as $, useEffect as H, useMemo as K } from "react";
5
+ import { useNivaroClient as R } from "../../context.js";
6
+ import { get as W } from "../../lib/commands.js";
7
+ import { describeError as z } from "../../lib/error-message.js";
8
+ import { titleCase as r, cn as D } from "../../lib/utils.js";
9
+ import { useFacetMeta as G, facetHops as L } from "./facets.js";
10
+ function te({
11
+ rootCollection: s,
12
+ initialPath: m,
13
+ used: u = {},
14
+ currentPath: h,
15
+ onPick: n,
16
+ onCancel: c,
17
+ className: q
18
+ }) {
19
+ const [l, g] = $([]), [d, v] = $(""), b = l.length > 0 ? l[l.length - 1].collection : s, w = l.map((e) => e.field), f = G(b), Q = T(), A = R(), k = (m ?? []).slice(0, -1).join(".");
20
+ H(() => {
21
+ if (!k) return;
22
+ let e = !0;
23
+ return (async () => {
24
+ const o = [];
25
+ let i = s;
26
+ for (const x of k.split(".")) {
27
+ const y = await Q.fetchQuery({
28
+ queryKey: ["cbv-collection-meta", i],
29
+ queryFn: () => A.request(W(`/collections/${i}`)).then((N) => N.data),
30
+ staleTime: 6e5
31
+ }).catch(() => null), p = L(y, i).find((N) => N.field === x);
32
+ if (!p) break;
33
+ o.push({ field: p.field, collection: p.target }), i = p.target;
34
+ }
35
+ e && o.length > 0 && g(o);
36
+ })(), () => {
37
+ e = !1;
38
+ };
39
+ }, [k, s]);
40
+ const F = K(() => L(f.data, b), [f.data, b]), C = d.trim() ? F.filter(
41
+ (e) => `${e.field} ${r(e.field)} ${e.target}`.toLowerCase().includes(d.trim().toLowerCase())
42
+ ) : F, E = (h ?? []).join(".");
43
+ return /* @__PURE__ */ a("div", { className: D("flex max-h-[min(24rem,70vh)] flex-col", q), children: [
44
+ /* @__PURE__ */ a("div", { className: "flex min-h-8 items-center gap-1 px-2 pt-2", children: [
45
+ l.length > 0 && /* @__PURE__ */ t(
46
+ "button",
47
+ {
48
+ type: "button",
49
+ onClick: () => {
50
+ g((e) => e.slice(0, -1)), v("");
51
+ },
52
+ "aria-label": "Back",
53
+ className: "flex h-6 w-6 shrink-0 items-center justify-center rounded text-slate-500 hover:bg-slate-100 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-100",
54
+ children: /* @__PURE__ */ t(M, { className: "h-3.5 w-3.5" })
55
+ }
56
+ ),
57
+ /* @__PURE__ */ t("p", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-500 dark:text-slate-400", children: l.length === 0 ? /* @__PURE__ */ a(j, { children: [
58
+ "Filter",
59
+ " ",
60
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: r(s) }),
61
+ " ",
62
+ "by…"
63
+ ] }) : /* @__PURE__ */ a(j, { children: [
64
+ r(s),
65
+ " ›",
66
+ " ",
67
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: l.map((e) => r(e.field)).join(" › ") })
68
+ ] }) }),
69
+ c && /* @__PURE__ */ t(
70
+ "button",
71
+ {
72
+ type: "button",
73
+ onClick: c,
74
+ className: "h-6 shrink-0 rounded px-1.5 text-[11.5px] font-medium text-slate-600 hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-white",
75
+ children: "Cancel"
76
+ }
77
+ )
78
+ ] }),
79
+ /* @__PURE__ */ a("div", { className: "relative mx-2 mt-1.5", children: [
80
+ /* @__PURE__ */ t(
81
+ P,
82
+ {
83
+ "aria-hidden": !0,
84
+ className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400"
85
+ }
86
+ ),
87
+ /* @__PURE__ */ t(
88
+ "input",
89
+ {
90
+ autoFocus: !0,
91
+ value: d,
92
+ onChange: (e) => v(e.target.value),
93
+ placeholder: "Find a field…",
94
+ "aria-label": "Find a field",
95
+ className: "h-7 w-full rounded-md border border-slate-200 bg-slate-50 pl-7 pr-2 text-[12px] text-slate-800 placeholder:text-slate-400 focus:border-nvr-cyan/60 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/25 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100 dark:placeholder:text-slate-500"
96
+ }
97
+ )
98
+ ] }),
99
+ /* @__PURE__ */ t("div", { className: "mt-1 min-h-0 flex-1 overflow-y-auto px-1 pb-1", children: f.isLoading ? /* @__PURE__ */ a("p", { className: "flex items-center gap-2 px-2 py-3 text-[12px] text-slate-500 dark:text-slate-400", children: [
100
+ /* @__PURE__ */ t(S, { "aria-hidden": !0, className: "h-3.5 w-3.5 animate-spin" }),
101
+ "Loading fields…"
102
+ ] }) : f.isError ? /* @__PURE__ */ t("p", { className: "px-2 py-3 text-[12px] text-red-700 dark:text-red-300", children: z(f.error, "The fields could not be loaded").title }) : C.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2 py-3 text-[12px] leading-snug text-slate-500 dark:text-slate-400", children: d.trim() ? `Nothing here matches “${d.trim()}”.` : "No related records here. A quick filter offers the records a field links to." }) : /* @__PURE__ */ t("ul", { children: C.map((e) => {
103
+ const o = [...w, e.field].join("."), i = o === E, x = u[o];
104
+ return /* @__PURE__ */ a("li", { className: "group flex items-center rounded-md", children: [
105
+ /* @__PURE__ */ a(
106
+ "button",
107
+ {
108
+ type: "button",
109
+ onClick: () => n({ path: [...w, e.field], target: e.target, kind: e.kind }),
110
+ className: "flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50 dark:hover:bg-slate-800",
111
+ children: [
112
+ /* @__PURE__ */ t("span", { className: "min-w-0 truncate text-[12.5px] text-slate-800 dark:text-slate-100", children: r(e.field) }),
113
+ i || x ? /* @__PURE__ */ a("span", { className: "inline-flex shrink-0 items-center gap-0.5 rounded bg-nvr-cyan/[0.12] px-1.5 py-px text-[10.5px] font-medium text-[#0284a8] dark:text-nvr-cyan", children: [
114
+ /* @__PURE__ */ t(_, { "aria-hidden": !0, className: "h-2.5 w-2.5", strokeWidth: 3 }),
115
+ i ? "this filter" : `on the bar as ${x}`
116
+ ] }) : /* @__PURE__ */ a("span", { className: "min-w-0 truncate text-[11px] text-slate-500 dark:text-slate-400", children: [
117
+ e.kind === "many" ? "list of " : "links to ",
118
+ r(e.target)
119
+ ] })
120
+ ]
121
+ }
122
+ ),
123
+ /* @__PURE__ */ t(
124
+ "button",
125
+ {
126
+ type: "button",
127
+ onClick: () => {
128
+ g((y) => [...y, { field: e.field, collection: e.target }]), v("");
129
+ },
130
+ "aria-label": `Fields of ${r(e.field)}`,
131
+ "data-tip": `Filter by something on ${r(e.field)}`,
132
+ className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-400 hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-slate-800 dark:hover:text-slate-200",
133
+ children: /* @__PURE__ */ t(B, { className: "h-3.5 w-3.5" })
134
+ }
135
+ )
136
+ ] }, e.field);
137
+ }) }) })
138
+ ] });
139
+ }
140
+ function ae(s) {
141
+ var u, h;
142
+ const m = {};
143
+ for (const n of s)
144
+ for (const c of (u = n.or_paths) != null && u.length ? n.or_paths : [n.path ?? []])
145
+ c.length && (m[c.join(".")] = ((h = n.label) == null ? void 0 : h.trim()) || "a filter");
146
+ return m;
147
+ }
148
+ export {
149
+ te as QuickFilterFieldPicker,
150
+ ae as usedPathLabels
151
+ };