@nivaro/react 0.3.107 → 0.3.109
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 +149 -0
- package/dist/index.js +742 -738
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/CollectionBrowserView.js +410 -416
- package/dist/shared/components/ItemEditForm.js +2413 -2384
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +177 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +359 -0
- package/dist/shared/components/collections-directory/CollectionRowMenu.js +213 -0
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +543 -0
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +287 -0
- package/dist/shared/components/collections-directory/PinnedSection.js +97 -0
- package/dist/shared/components/collections-directory/directory-data.js +159 -0
- package/dist/shared/components/collections-directory/page-model.js +122 -0
- package/dist/shared/components/collections-directory/sections.js +108 -0
- package/dist/shared/components/collections-directory/shared-pins.js +70 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +631 -595
- package/dist/shared/components/imports/import-picker-options.js +44 -0
- package/dist/shared/components/item-edit/InlineTableField.js +441 -438
- package/dist/shared/components/item-edit/NestedRelationEditor.js +36 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +1 -1
- package/dist/shared/components/item-edit/StepsBar.js +24 -23
- package/dist/shared/components/item-edit/form-density.js +1 -0
- package/dist/shared/components/item-edit/section-rows.js +39 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +88 -66
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/lib/activity-sentence.js +4 -4
- package/dist/shared/lib/layout-ops.js +24 -22
- package/dist/shared/lib/template-paths.js +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import { jsxs as a, jsx as n, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { useSensors as tt, useSensor as ke, PointerSensor as nt, KeyboardSensor as ot, DndContext as we, closestCenter as xe } from "@dnd-kit/core";
|
|
3
|
+
import { sortableKeyboardCoordinates as rt, SortableContext as Ce, verticalListSortingStrategy as Ne, arrayMove as lt } from "@dnd-kit/sortable";
|
|
4
|
+
import { useQueryClient as it } from "@tanstack/react-query";
|
|
5
|
+
import { Star as at, Clock as st, Link2 as ct, Database as dt, SearchX as ht } from "lucide-react";
|
|
6
|
+
import { useRef as Y, useState as v, useEffect as Se, useMemo as oe } from "react";
|
|
7
|
+
import { toast as re } from "sonner";
|
|
8
|
+
import { ErrorNotice as mt } from "../ErrorNotice.js";
|
|
9
|
+
import { Skeleton as le } from "../ui/skeleton.js";
|
|
10
|
+
import { defaultCollectionPath as pt, HostLink as Re, CollectionRow as ft, CollectionAvatar as ut } from "./CollectionRow.js";
|
|
11
|
+
import { CollectionsToolbar as gt } from "./CollectionsToolbar.js";
|
|
12
|
+
import { readLocal as _e, useDirectoryCollections as bt, useOverviewStats as vt, useCollectionUsage as yt, useNavFavoriteCollections as kt, writeLocal as Me, recordCollectionOpen as Pe, DIRECTORY_KEYS as ie } from "./directory-data.js";
|
|
13
|
+
import { PINNED_KEY as q, PinnedSection as wt } from "./PinnedSection.js";
|
|
14
|
+
import { buildPageModel as xt, nearSpellings as Ct, label as y } from "./page-model.js";
|
|
15
|
+
import { SortableRow as Ee, Section as M, FolderHeader as O } from "./sections.js";
|
|
16
|
+
import { useSharedPins as Nt } from "./shared-pins.js";
|
|
17
|
+
const Le = "nivaro_col_collapsed", Te = "nvr_collections_prefs", E = "__loose__", N = "__links__", St = {
|
|
18
|
+
view: "folders",
|
|
19
|
+
density: "compact",
|
|
20
|
+
showHidden: !1,
|
|
21
|
+
showLinks: !1
|
|
22
|
+
}, w = (s) => `cl-section-${s.replace(/[^A-Za-z0-9_-]/g, "_")}`;
|
|
23
|
+
function _t() {
|
|
24
|
+
return /* @__PURE__ */ n(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-white/[0.08] dark:bg-white/[0.03]",
|
|
28
|
+
role: "status",
|
|
29
|
+
"aria-busy": "true",
|
|
30
|
+
"aria-label": "Loading collections",
|
|
31
|
+
children: ["a", "b", "c", "d", "e", "f", "g", "h"].map((s) => /* @__PURE__ */ a(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: "flex items-center gap-2.5 border-b border-slate-100 px-4 py-2 last:border-0 dark:border-white/[0.05]",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ n(le, { className: "h-6 w-6 rounded" }),
|
|
37
|
+
/* @__PURE__ */ n(le, { className: "h-3.5 w-48" }),
|
|
38
|
+
/* @__PURE__ */ n(le, { className: "ml-auto h-3 w-16" })
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
s
|
|
42
|
+
))
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function Mt() {
|
|
47
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col items-center py-24 text-center", children: [
|
|
48
|
+
/* @__PURE__ */ n("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-xl border border-slate-200 bg-slate-50 dark:border-white/[0.08] dark:bg-white/[0.03]", children: /* @__PURE__ */ n(dt, { className: "h-5 w-5 text-slate-400" }) }),
|
|
49
|
+
/* @__PURE__ */ n("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-300", children: "No collections registered yet" }),
|
|
50
|
+
/* @__PURE__ */ n("p", { className: "mt-1.5 text-[12px] text-slate-500 dark:text-slate-400", children: "Register collections in the Data Model to browse them here." })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
function Et({
|
|
54
|
+
filter: s,
|
|
55
|
+
near: x,
|
|
56
|
+
pathFor: m,
|
|
57
|
+
hiddenMatches: u,
|
|
58
|
+
linkMatches: g,
|
|
59
|
+
chipsOn: L,
|
|
60
|
+
onShowHidden: h,
|
|
61
|
+
onShowLinks: U,
|
|
62
|
+
onClearChips: F,
|
|
63
|
+
onCreate: T
|
|
64
|
+
}) {
|
|
65
|
+
const t = "rounded-md border border-slate-200 px-2.5 py-1 text-[12px] font-medium text-slate-700 hover:border-slate-300 hover:bg-slate-50 dark:border-white/[0.1] dark:text-slate-200 dark:hover:bg-white/[0.05]";
|
|
66
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col items-center py-16 text-center", "data-collections-empty-search": !0, children: [
|
|
67
|
+
/* @__PURE__ */ n(ht, { className: "mb-3 h-6 w-6 text-slate-400" }),
|
|
68
|
+
/* @__PURE__ */ n("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: s ? /* @__PURE__ */ a(Q, { children: [
|
|
69
|
+
"No collection matches ",
|
|
70
|
+
/* @__PURE__ */ a("span", { className: "font-mono", children: [
|
|
71
|
+
"“",
|
|
72
|
+
s,
|
|
73
|
+
"”"
|
|
74
|
+
] })
|
|
75
|
+
] }) : "No collection matches these filters" }),
|
|
76
|
+
x.length > 0 && /* @__PURE__ */ a("p", { className: "mt-3 text-[12px] text-slate-600 dark:text-slate-300", children: [
|
|
77
|
+
"Did you mean",
|
|
78
|
+
" ",
|
|
79
|
+
x.map((C, S) => /* @__PURE__ */ a("span", { children: [
|
|
80
|
+
S > 0 && (S === x.length - 1 ? " or " : ", "),
|
|
81
|
+
/* @__PURE__ */ n(
|
|
82
|
+
Re,
|
|
83
|
+
{
|
|
84
|
+
to: m(C.collection),
|
|
85
|
+
onClick: () => Pe(C.collection),
|
|
86
|
+
className: "font-medium text-cyan-700 underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
87
|
+
children: y(C)
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] }, C.collection)),
|
|
91
|
+
"?"
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ a("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
|
|
94
|
+
u > 0 && /* @__PURE__ */ a("button", { type: "button", className: t, onClick: h, children: [
|
|
95
|
+
u,
|
|
96
|
+
" hidden",
|
|
97
|
+
" ",
|
|
98
|
+
u === 1 ? "collection matches" : "collections match",
|
|
99
|
+
" — show hidden"
|
|
100
|
+
] }),
|
|
101
|
+
g > 0 && /* @__PURE__ */ a("button", { type: "button", className: t, onClick: U, children: [
|
|
102
|
+
g,
|
|
103
|
+
" link ",
|
|
104
|
+
g === 1 ? "table matches" : "tables match",
|
|
105
|
+
" — show link tables"
|
|
106
|
+
] }),
|
|
107
|
+
L && /* @__PURE__ */ n("button", { type: "button", className: t, onClick: F, children: "Clear filters" }),
|
|
108
|
+
T && /* @__PURE__ */ n("button", { type: "button", className: t, onClick: T, children: "Create a table" })
|
|
109
|
+
] })
|
|
110
|
+
] });
|
|
111
|
+
}
|
|
112
|
+
function De({
|
|
113
|
+
title: s,
|
|
114
|
+
icon: x,
|
|
115
|
+
cols: m,
|
|
116
|
+
empty: u,
|
|
117
|
+
pathFor: g,
|
|
118
|
+
...L
|
|
119
|
+
}) {
|
|
120
|
+
return !m.length && !u ? null : /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", ...L, children: [
|
|
121
|
+
/* @__PURE__ */ a("span", { className: "mr-1 inline-flex items-center gap-1 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: [
|
|
122
|
+
x,
|
|
123
|
+
s
|
|
124
|
+
] }),
|
|
125
|
+
m.map((h) => /* @__PURE__ */ a(
|
|
126
|
+
Re,
|
|
127
|
+
{
|
|
128
|
+
to: g(h.collection),
|
|
129
|
+
onClick: () => Pe(h.collection),
|
|
130
|
+
className: "inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-slate-200 bg-white py-0.5 pl-1 pr-2 text-[12px] font-medium text-slate-700 transition-colors hover:border-nvr-cyan/50 hover:bg-nvr-cyan/[0.05] dark:border-white/[0.08] dark:bg-white/[0.03] dark:text-slate-200 dark:hover:bg-nvr-cyan/[0.08]",
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ n(ut, { color: h.color, name: y(h), icon: h.icon }),
|
|
133
|
+
/* @__PURE__ */ n("span", { className: "truncate", children: y(h) })
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
h.collection
|
|
137
|
+
)),
|
|
138
|
+
!m.length && u
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
function $t({
|
|
142
|
+
isAdmin: s,
|
|
143
|
+
title: x,
|
|
144
|
+
collectionPath: m = pt,
|
|
145
|
+
include: u,
|
|
146
|
+
favorites: g,
|
|
147
|
+
admin: L
|
|
148
|
+
}) {
|
|
149
|
+
var be, ve, ye;
|
|
150
|
+
const h = it(), U = Y(null), F = Y(null), T = Y(null), t = s ? L : void 0, C = !!(t != null && t.reorder), S = !!(t != null && t.moveCollections && t.renderMoveDialog), [p, Oe] = v(""), [K, Fe] = v(() => ({
|
|
151
|
+
...St,
|
|
152
|
+
..._e(Te, {})
|
|
153
|
+
})), [H, ae] = v([]), [Ke, He] = v(!1), [Ie, ze] = v(!1), [j, I] = v(/* @__PURE__ */ new Set()), [Ye, se] = v(!1), [$, qe] = v(() => ({
|
|
154
|
+
[N]: !0,
|
|
155
|
+
__unregistered__: !0,
|
|
156
|
+
__system__: !0,
|
|
157
|
+
..._e(Le, {})
|
|
158
|
+
})), c = {
|
|
159
|
+
...K,
|
|
160
|
+
// Admin-only views fall back to Folders for everyone else.
|
|
161
|
+
view: !s && (K.view === "records" || K.view === "recent") ? "folders" : K.view,
|
|
162
|
+
chips: H,
|
|
163
|
+
arranging: C && Ke,
|
|
164
|
+
selecting: S && Ie
|
|
165
|
+
}, { data: D, isLoading: Qe, isError: Ue, error: je, refetch: $e } = bt(), ce = Y(u);
|
|
166
|
+
ce.current = u;
|
|
167
|
+
const de = (e) => {
|
|
168
|
+
const o = ce.current;
|
|
169
|
+
return o ? e.filter(o) : e;
|
|
170
|
+
}, [A, J] = v([]);
|
|
171
|
+
Se(() => {
|
|
172
|
+
D && J(de(D));
|
|
173
|
+
}, [D]);
|
|
174
|
+
const { data: R } = vt(s), V = yt(), Ae = kt(!g), { favorite: B, toggle: Je } = g ?? Ae, b = Nt(), G = oe(() => new Set(b.pins), [b.pins]), l = oe(
|
|
175
|
+
() => xt(A, R, c, p, V),
|
|
176
|
+
[A, R, p, V, c.view, c.chips, c.showHidden, c.showLinks]
|
|
177
|
+
), X = oe(() => new Map(l.real.map((e) => [e.collection, e])), [l.real]);
|
|
178
|
+
Se(() => {
|
|
179
|
+
const e = F.current, o = T.current;
|
|
180
|
+
if (!e || !o) return;
|
|
181
|
+
const i = () => o.style.setProperty(
|
|
182
|
+
"--cl-toolbar-h",
|
|
183
|
+
`${getComputedStyle(e).position === "sticky" ? e.offsetHeight : 0}px`
|
|
184
|
+
);
|
|
185
|
+
i(), window.addEventListener("resize", i);
|
|
186
|
+
const r = typeof ResizeObserver > "u" ? null : new ResizeObserver(i);
|
|
187
|
+
return r == null || r.observe(e), () => {
|
|
188
|
+
window.removeEventListener("resize", i), r == null || r.disconnect();
|
|
189
|
+
};
|
|
190
|
+
}, []);
|
|
191
|
+
const Z = (e) => {
|
|
192
|
+
const o = {
|
|
193
|
+
view: e.view,
|
|
194
|
+
density: e.density,
|
|
195
|
+
showHidden: e.showHidden,
|
|
196
|
+
showLinks: e.showLinks
|
|
197
|
+
};
|
|
198
|
+
Fe(o), Me(Te, o), ae(e.chips), He(e.arranging), ze(e.selecting), e.selecting || I(/* @__PURE__ */ new Set());
|
|
199
|
+
}, _ = (e) => qe((o) => {
|
|
200
|
+
const i = { ...o, [e]: !o[e] };
|
|
201
|
+
return Me(Le, i), i;
|
|
202
|
+
}), W = () => {
|
|
203
|
+
h.invalidateQueries({ queryKey: ie.collections }), h.invalidateQueries({ queryKey: ie.stats });
|
|
204
|
+
}, he = t == null ? void 0 : t.moveCollections, me = he ? async (e, o) => {
|
|
205
|
+
var i;
|
|
206
|
+
try {
|
|
207
|
+
await he([e.collection], o);
|
|
208
|
+
const r = o ? ((i = l.folders.find((d) => d.key === o)) == null ? void 0 : i.label) ?? o : "no folder";
|
|
209
|
+
re.success(`Moved ${y(e)} to ${r}`), W();
|
|
210
|
+
} catch {
|
|
211
|
+
re.error(`Could not move ${y(e)}`);
|
|
212
|
+
}
|
|
213
|
+
} : void 0, pe = tt(
|
|
214
|
+
ke(nt, { activationConstraint: { distance: 8 } }),
|
|
215
|
+
ke(ot, { coordinateGetter: rt })
|
|
216
|
+
), Ve = (e) => {
|
|
217
|
+
const o = t == null ? void 0 : t.reorder;
|
|
218
|
+
if (!o) return;
|
|
219
|
+
const i = new Map(e.map((r) => [r.collection, r.sort]));
|
|
220
|
+
J(
|
|
221
|
+
(r) => r.map((d) => {
|
|
222
|
+
const f = i.get(d.collection);
|
|
223
|
+
return f === void 0 ? d : { ...d, sort: f };
|
|
224
|
+
})
|
|
225
|
+
), o(e).catch(() => {
|
|
226
|
+
re.error("Could not save the new order"), D && J(de(D)), h.invalidateQueries({ queryKey: ie.collections });
|
|
227
|
+
});
|
|
228
|
+
}, fe = (e, o) => {
|
|
229
|
+
const { active: i, over: r } = o;
|
|
230
|
+
if (!r || i.id === r.id) return;
|
|
231
|
+
const d = e.indexOf(String(i.id)), f = e.indexOf(String(r.id));
|
|
232
|
+
d === -1 || f === -1 || Ve(
|
|
233
|
+
lt(e, d, f).map((We, et) => ({ collection: We, sort: (et + 1) * 10 }))
|
|
234
|
+
);
|
|
235
|
+
}, ee = (e, o, i) => {
|
|
236
|
+
var r;
|
|
237
|
+
return /* @__PURE__ */ n(
|
|
238
|
+
ft,
|
|
239
|
+
{
|
|
240
|
+
col: e,
|
|
241
|
+
stat: R == null ? void 0 : R[e.collection],
|
|
242
|
+
density: c.density,
|
|
243
|
+
favorite: B.has(e.collection),
|
|
244
|
+
onToggleFavorite: () => void Je(e.collection, y(e)),
|
|
245
|
+
pinnedForAll: G.has(e.collection),
|
|
246
|
+
onTogglePinned: s ? () => void (G.has(e.collection) ? b.unpin(e.collection, y(e)) : b.pin(e.collection, y(e))) : void 0,
|
|
247
|
+
onMoveUp: i == null ? void 0 : i.onMoveUp,
|
|
248
|
+
onMoveDown: i == null ? void 0 : i.onMoveDown,
|
|
249
|
+
quietPin: i == null ? void 0 : i.inPinned,
|
|
250
|
+
folders: l.folders,
|
|
251
|
+
onMove: me ? (d) => void me(e, d) : void 0,
|
|
252
|
+
recordsPath: m(e.collection),
|
|
253
|
+
editPath: (r = t == null ? void 0 : t.editPath) == null ? void 0 : r.call(t, e.collection),
|
|
254
|
+
menuExtra: t != null && t.rowMenu ? { heading: t.rowMenu.heading, items: t.rowMenu.items(e.collection) } : void 0,
|
|
255
|
+
selecting: c.selecting,
|
|
256
|
+
selected: j.has(e.collection),
|
|
257
|
+
onSelect: () => I((d) => {
|
|
258
|
+
const f = new Set(d);
|
|
259
|
+
return f.has(e.collection) ? f.delete(e.collection) : f.add(e.collection), f;
|
|
260
|
+
}),
|
|
261
|
+
dragHandle: o,
|
|
262
|
+
highlight: p,
|
|
263
|
+
isAdmin: s
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
}, P = (e, o) => {
|
|
267
|
+
if (!o)
|
|
268
|
+
return /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-white/[0.05]", children: e.map((r) => /* @__PURE__ */ n("div", { children: ee(r) }, r.collection)) });
|
|
269
|
+
const i = e.map((r) => r.collection);
|
|
270
|
+
return /* @__PURE__ */ n(
|
|
271
|
+
we,
|
|
272
|
+
{
|
|
273
|
+
sensors: pe,
|
|
274
|
+
collisionDetection: xe,
|
|
275
|
+
onDragEnd: (r) => fe(i, r),
|
|
276
|
+
children: /* @__PURE__ */ n(Ce, { items: i, strategy: Ne, children: /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-white/[0.05]", children: e.map((r) => /* @__PURE__ */ n(Ee, { id: r.collection, label: y(r), children: (d) => ee(r, d) }, r.collection)) }) })
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
}, ue = !!p.trim() || H.length > 0, k = (e) => ue || !$[e], z = c.view === "folders", te = !ue && !c.arranging && !c.selecting, Be = z && te, ne = b.pins.map((e) => X.get(e)).filter((e) => !!e), Ge = [...B].map((e) => X.get(e)).filter((e) => !!e), Xe = V.recent.filter((e) => !B.has(e) && !G.has(e)).map((e) => X.get(e)).filter((e) => !!e).slice(0, 6), Ze = !!(t != null && t.renderSuggestions) && z && !p && !H.length && !c.arranging, ge = z ? [
|
|
280
|
+
...te && ne.length > 0 ? [{ key: q, label: "Pinned", count: ne.length }] : [],
|
|
281
|
+
...l.sections.map((e) => ({
|
|
282
|
+
key: e.folder.key,
|
|
283
|
+
label: e.folder.label,
|
|
284
|
+
count: e.cols.length
|
|
285
|
+
})),
|
|
286
|
+
...l.loose.length ? [{ key: E, label: "Not in a folder", count: l.loose.length }] : [],
|
|
287
|
+
...l.linkTables.length ? [{ key: N, label: "Link tables", count: l.linkTables.length }] : []
|
|
288
|
+
] : [];
|
|
289
|
+
return (
|
|
290
|
+
// Grows with its content (shrink-0): the sticky toolbar only sticks inside this
|
|
291
|
+
// box, so a viewport-tall box let it scroll away and left the folder headers
|
|
292
|
+
// stuck below an empty gap.
|
|
293
|
+
/* @__PURE__ */ a("div", { ref: T, className: "flex min-h-full shrink-0 flex-col", "data-collections-directory": !0, children: [
|
|
294
|
+
/* @__PURE__ */ n(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
ref: F,
|
|
298
|
+
"data-cdr": "",
|
|
299
|
+
className: "z-10 md:[&[data-cdr]]:sticky md:[&[data-cdr]]:top-0",
|
|
300
|
+
children: /* @__PURE__ */ n(
|
|
301
|
+
gt,
|
|
302
|
+
{
|
|
303
|
+
state: c,
|
|
304
|
+
onChange: Z,
|
|
305
|
+
filter: p,
|
|
306
|
+
onFilterChange: Oe,
|
|
307
|
+
filterRef: U,
|
|
308
|
+
counts: l.counts,
|
|
309
|
+
isAdmin: s,
|
|
310
|
+
title: x,
|
|
311
|
+
canArrange: C,
|
|
312
|
+
canSelect: S,
|
|
313
|
+
selectedCount: j.size,
|
|
314
|
+
onMoveSelected: () => se(!0),
|
|
315
|
+
onClearSelection: () => I(/* @__PURE__ */ new Set()),
|
|
316
|
+
adminActions: (t == null ? void 0 : t.toolbarActions) ?? null
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ a("div", { "data-cdr": "", className: "flex gap-6 px-4 py-6 sm:[&[data-cdr]]:px-8", children: [
|
|
322
|
+
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1 space-y-4", children: [
|
|
323
|
+
t == null ? void 0 : t.panels,
|
|
324
|
+
Qe ? /* @__PURE__ */ n(_t, {}) : Ue && A.length === 0 ? /* @__PURE__ */ n(mt, { error: je, what: "the collections", onRetry: () => void $e() }) : l.real.length === 0 ? /* @__PURE__ */ n(Mt, {}) : l.shownCount === 0 && l.linkTables.length === 0 ? /* @__PURE__ */ n(
|
|
325
|
+
Et,
|
|
326
|
+
{
|
|
327
|
+
filter: p.trim(),
|
|
328
|
+
near: p.trim() ? Ct(p, l.real) : [],
|
|
329
|
+
pathFor: m,
|
|
330
|
+
hiddenMatches: l.foldedMatches.hidden.length,
|
|
331
|
+
linkMatches: l.foldedMatches.links.length,
|
|
332
|
+
chipsOn: H.length > 0,
|
|
333
|
+
onShowHidden: () => Z({ ...c, showHidden: !0 }),
|
|
334
|
+
onShowLinks: () => Z({ ...c, showLinks: !0 }),
|
|
335
|
+
onClearChips: () => ae([]),
|
|
336
|
+
onCreate: t == null ? void 0 : t.onCreate
|
|
337
|
+
}
|
|
338
|
+
) : /* @__PURE__ */ a(Q, { children: [
|
|
339
|
+
te && /* @__PURE__ */ n(
|
|
340
|
+
wt,
|
|
341
|
+
{
|
|
342
|
+
sectionId: w(q),
|
|
343
|
+
cols: ne,
|
|
344
|
+
isAdmin: s,
|
|
345
|
+
status: b.status,
|
|
346
|
+
error: b.error,
|
|
347
|
+
onRetry: () => void b.refetch(),
|
|
348
|
+
onReorder: (e) => void b.reorder(e),
|
|
349
|
+
collapsed: !!$[q],
|
|
350
|
+
onToggle: () => _(q),
|
|
351
|
+
renderRow: (e, o) => ee(e, o.handle, {
|
|
352
|
+
onMoveUp: o.onMoveUp,
|
|
353
|
+
onMoveDown: o.onMoveDown,
|
|
354
|
+
inPinned: !0
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
Be && /* @__PURE__ */ a("div", { className: "space-y-2", "data-collections-quick": !0, children: [
|
|
359
|
+
/* @__PURE__ */ n(
|
|
360
|
+
De,
|
|
361
|
+
{
|
|
362
|
+
"data-collections-favorites": !0,
|
|
363
|
+
title: "My favorites",
|
|
364
|
+
icon: /* @__PURE__ */ n(at, { className: "h-3 w-3 fill-current" }),
|
|
365
|
+
cols: Ge,
|
|
366
|
+
pathFor: m,
|
|
367
|
+
empty: /* @__PURE__ */ n("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: g ? "Star a collection to keep it here and in your sidebar." : "Star a collection to keep it here." })
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ n(
|
|
371
|
+
De,
|
|
372
|
+
{
|
|
373
|
+
"data-collections-recent": !0,
|
|
374
|
+
title: "Recent",
|
|
375
|
+
icon: /* @__PURE__ */ n(st, { className: "h-3 w-3" }),
|
|
376
|
+
cols: Xe,
|
|
377
|
+
pathFor: m
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
] }),
|
|
381
|
+
Ze && ((be = t == null ? void 0 : t.renderSuggestions) == null ? void 0 : be.call(t, {
|
|
382
|
+
real: l.real,
|
|
383
|
+
folders: l.folders,
|
|
384
|
+
refresh: W
|
|
385
|
+
})),
|
|
386
|
+
z ? /* @__PURE__ */ a(Q, { children: [
|
|
387
|
+
c.arranging ? /* @__PURE__ */ n(
|
|
388
|
+
we,
|
|
389
|
+
{
|
|
390
|
+
sensors: pe,
|
|
391
|
+
collisionDetection: xe,
|
|
392
|
+
onDragEnd: (e) => fe(
|
|
393
|
+
l.sections.map((o) => o.folder.key),
|
|
394
|
+
e
|
|
395
|
+
),
|
|
396
|
+
children: /* @__PURE__ */ n(
|
|
397
|
+
Ce,
|
|
398
|
+
{
|
|
399
|
+
items: l.sections.map((e) => e.folder.key),
|
|
400
|
+
strategy: Ne,
|
|
401
|
+
children: /* @__PURE__ */ n("div", { className: "space-y-4", children: l.sections.map((e) => /* @__PURE__ */ n(
|
|
402
|
+
Ee,
|
|
403
|
+
{
|
|
404
|
+
id: e.folder.key,
|
|
405
|
+
label: e.folder.label,
|
|
406
|
+
children: (o) => /* @__PURE__ */ a(M, { id: w(e.folder.key), children: [
|
|
407
|
+
/* @__PURE__ */ n(
|
|
408
|
+
O,
|
|
409
|
+
{
|
|
410
|
+
folder: e.folder,
|
|
411
|
+
count: e.cols.length,
|
|
412
|
+
hiddenCount: e.hiddenCount,
|
|
413
|
+
collapsed: !k(e.folder.key),
|
|
414
|
+
onToggle: () => _(e.folder.key),
|
|
415
|
+
dragHandle: o
|
|
416
|
+
}
|
|
417
|
+
),
|
|
418
|
+
k(e.folder.key) && P(e.cols, !0)
|
|
419
|
+
] })
|
|
420
|
+
},
|
|
421
|
+
e.folder.key
|
|
422
|
+
)) })
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
}
|
|
426
|
+
) : l.sections.map((e) => /* @__PURE__ */ a(M, { id: w(e.folder.key), children: [
|
|
427
|
+
/* @__PURE__ */ n(
|
|
428
|
+
O,
|
|
429
|
+
{
|
|
430
|
+
folder: e.folder,
|
|
431
|
+
count: e.cols.length,
|
|
432
|
+
hiddenCount: e.hiddenCount,
|
|
433
|
+
collapsed: !k(e.folder.key),
|
|
434
|
+
onToggle: () => _(e.folder.key)
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
k(e.folder.key) && P(e.cols, !1)
|
|
438
|
+
] }, e.folder.key)),
|
|
439
|
+
l.loose.length > 0 && /* @__PURE__ */ a(M, { id: w(E), children: [
|
|
440
|
+
/* @__PURE__ */ n(
|
|
441
|
+
O,
|
|
442
|
+
{
|
|
443
|
+
folder: { key: E, label: "Not in a folder", color: "#94a3b8" },
|
|
444
|
+
count: l.loose.length,
|
|
445
|
+
hiddenCount: 0,
|
|
446
|
+
collapsed: !k(E),
|
|
447
|
+
onToggle: () => _(E)
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
k(E) && P(l.loose, !1)
|
|
451
|
+
] })
|
|
452
|
+
] }) : /* @__PURE__ */ n(M, { id: w("flat"), children: P(l.flat, !1) }),
|
|
453
|
+
l.linkTables.length > 0 && /* @__PURE__ */ a(M, { id: w(N), children: [
|
|
454
|
+
/* @__PURE__ */ n(
|
|
455
|
+
O,
|
|
456
|
+
{
|
|
457
|
+
folder: { key: N, label: "Link tables", color: "#64748b" },
|
|
458
|
+
icon: /* @__PURE__ */ n(ct, { className: "h-3 w-3 text-slate-500 dark:text-slate-400" }),
|
|
459
|
+
count: l.linkTables.length,
|
|
460
|
+
hiddenCount: 0,
|
|
461
|
+
collapsed: !k(N),
|
|
462
|
+
onToggle: () => _(N)
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
k(N) && /* @__PURE__ */ a(Q, { children: [
|
|
466
|
+
/* @__PURE__ */ n("p", { className: "border-b border-slate-100 px-4 py-1.5 text-[11.5px] text-slate-500 dark:border-white/[0.05] dark:text-slate-400", children: "Tables that only connect two collections (many-to-many). Turn on “Show link tables” to list them in their folders." }),
|
|
467
|
+
P(l.linkTables, !1)
|
|
468
|
+
] })
|
|
469
|
+
] }),
|
|
470
|
+
(ve = t == null ? void 0 : t.renderExtraSections) == null ? void 0 : ve.call(t, {
|
|
471
|
+
filter: p,
|
|
472
|
+
collapsed: $,
|
|
473
|
+
onToggle: _,
|
|
474
|
+
renderSection: (e) => /* @__PURE__ */ a(M, { id: w(e.key), children: [
|
|
475
|
+
/* @__PURE__ */ n(
|
|
476
|
+
O,
|
|
477
|
+
{
|
|
478
|
+
folder: { key: e.key, label: e.label, color: "#94a3b8" },
|
|
479
|
+
icon: e.icon,
|
|
480
|
+
count: e.count,
|
|
481
|
+
hiddenCount: 0,
|
|
482
|
+
collapsed: !e.open,
|
|
483
|
+
onToggle: e.onToggle
|
|
484
|
+
}
|
|
485
|
+
),
|
|
486
|
+
e.open && e.body
|
|
487
|
+
] }, e.key)
|
|
488
|
+
})
|
|
489
|
+
] })
|
|
490
|
+
] }),
|
|
491
|
+
ge.length > 2 && /* @__PURE__ */ n(
|
|
492
|
+
"nav",
|
|
493
|
+
{
|
|
494
|
+
"aria-label": "Jump to folder",
|
|
495
|
+
"data-cdr": "",
|
|
496
|
+
className: "hidden w-44 shrink-0 xl:[&[data-cdr]]:block",
|
|
497
|
+
children: /* @__PURE__ */ a(
|
|
498
|
+
"div",
|
|
499
|
+
{
|
|
500
|
+
className: "sticky space-y-0.5",
|
|
501
|
+
style: { top: "calc(var(--cl-toolbar-h, 0px) + 24px)" },
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ n("p", { className: "px-2 pb-1 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Jump to" }),
|
|
504
|
+
ge.map((e) => /* @__PURE__ */ a(
|
|
505
|
+
"button",
|
|
506
|
+
{
|
|
507
|
+
type: "button",
|
|
508
|
+
onClick: () => {
|
|
509
|
+
var o;
|
|
510
|
+
return (o = document.getElementById(w(e.key))) == null ? void 0 : o.scrollIntoView({
|
|
511
|
+
behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth",
|
|
512
|
+
block: "start"
|
|
513
|
+
});
|
|
514
|
+
},
|
|
515
|
+
className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] text-slate-600 transition-colors hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-white/[0.05] dark:hover:text-slate-100",
|
|
516
|
+
children: [
|
|
517
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: e.label }),
|
|
518
|
+
/* @__PURE__ */ n("span", { className: "text-[11px] tabular-nums text-slate-500 dark:text-slate-400", children: e.count })
|
|
519
|
+
]
|
|
520
|
+
},
|
|
521
|
+
e.key
|
|
522
|
+
))
|
|
523
|
+
]
|
|
524
|
+
}
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
] }),
|
|
529
|
+
S && ((ye = t == null ? void 0 : t.renderMoveDialog) == null ? void 0 : ye.call(t, {
|
|
530
|
+
open: Ye,
|
|
531
|
+
onOpenChange: se,
|
|
532
|
+
names: [...j],
|
|
533
|
+
folders: l.folders,
|
|
534
|
+
onMoved: () => {
|
|
535
|
+
I(/* @__PURE__ */ new Set()), W();
|
|
536
|
+
}
|
|
537
|
+
}))
|
|
538
|
+
] })
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
export {
|
|
542
|
+
$t as CollectionsDirectory
|
|
543
|
+
};
|