@nivaro/react 0.3.107 → 0.3.108
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 +146 -0
- package/dist/index.js +742 -738
- package/dist/shared/components/CollectionBrowserView.js +410 -416
- package/dist/shared/components/ItemEditForm.js +1927 -1915
- 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/lib/template-paths.js +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowRight as k, ArrowLeft as g, Workflow as w, LayoutTemplate as y } from "lucide-react";
|
|
3
|
+
import { useState as b, useRef as v, useCallback as d, useEffect as u } from "react";
|
|
4
|
+
import { titleCase as f, formatRelative as C, formatDateTime as _ } from "../../lib/utils.js";
|
|
5
|
+
import { Popover as P, PopoverAnchor as $, PopoverContent as L } from "../ui/popover.js";
|
|
6
|
+
import { Skeleton as c } from "../ui/skeleton.js";
|
|
7
|
+
import { useCollectionSummary as S } from "./directory-data.js";
|
|
8
|
+
const A = 400, E = 150, h = 6;
|
|
9
|
+
function I(s, t = A) {
|
|
10
|
+
const [n, i] = b(!1), r = v(null), e = d(() => {
|
|
11
|
+
r.current && clearTimeout(r.current), r.current = null;
|
|
12
|
+
}, []), m = d(() => {
|
|
13
|
+
s && (e(), r.current = setTimeout(() => i(!0), t));
|
|
14
|
+
}, [s, e, t]), o = d(() => {
|
|
15
|
+
e(), r.current = setTimeout(() => i(!1), E);
|
|
16
|
+
}, [e]), p = d(() => {
|
|
17
|
+
e(), i(!1);
|
|
18
|
+
}, [e]);
|
|
19
|
+
return u(() => e, [e]), u(() => {
|
|
20
|
+
s || p();
|
|
21
|
+
}, [s, p]), { open: n, show: m, hide: o, cancel: e, close: p };
|
|
22
|
+
}
|
|
23
|
+
function N({ items: s }) {
|
|
24
|
+
if (s.length === 0)
|
|
25
|
+
return /* @__PURE__ */ a("p", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: "None" });
|
|
26
|
+
const t = s.slice(0, h), n = s.slice(h);
|
|
27
|
+
return /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: [
|
|
28
|
+
t.map((i) => /* @__PURE__ */ a(
|
|
29
|
+
"span",
|
|
30
|
+
{
|
|
31
|
+
"data-tip": i.tip,
|
|
32
|
+
className: "inline-flex max-w-[140px] items-center truncate rounded bg-slate-100 px-1.5 py-px text-[10px] font-medium text-slate-600 dark:bg-white/10 dark:text-slate-300",
|
|
33
|
+
children: /* @__PURE__ */ a("span", { className: "truncate", children: i.label })
|
|
34
|
+
},
|
|
35
|
+
i.key
|
|
36
|
+
)),
|
|
37
|
+
n.length > 0 && /* @__PURE__ */ l(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
"data-tip": n.map((i) => i.label).join(", "),
|
|
41
|
+
className: "inline-flex items-center rounded px-1 py-px text-[10px] font-medium text-slate-500 dark:text-slate-400",
|
|
42
|
+
children: [
|
|
43
|
+
"+",
|
|
44
|
+
n.length
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
function x({ icon: s, children: t }) {
|
|
51
|
+
return /* @__PURE__ */ l("p", { className: "mb-1 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: [
|
|
52
|
+
s,
|
|
53
|
+
t
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function O({ collection: s }) {
|
|
57
|
+
const { data: t, isLoading: n, isError: i } = S(s, !0);
|
|
58
|
+
if (n)
|
|
59
|
+
return /* @__PURE__ */ l("div", { className: "space-y-2", role: "status", "aria-busy": "true", "aria-label": "Loading summary", children: [
|
|
60
|
+
/* @__PURE__ */ a(c, { className: "h-3 w-24" }),
|
|
61
|
+
[0, 1, 2, 3, 4].map((e) => /* @__PURE__ */ l("div", { className: "flex justify-between gap-4", children: [
|
|
62
|
+
/* @__PURE__ */ a(c, { className: "h-3 w-32" }),
|
|
63
|
+
/* @__PURE__ */ a(c, { className: "h-3 w-12" })
|
|
64
|
+
] }, e)),
|
|
65
|
+
/* @__PURE__ */ a(c, { className: "h-3 w-20" }),
|
|
66
|
+
/* @__PURE__ */ a(c, { className: "h-4 w-full" })
|
|
67
|
+
] });
|
|
68
|
+
if (i || !t)
|
|
69
|
+
return /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "Couldn't load this collection's summary." });
|
|
70
|
+
const r = Math.max(0, t.field_count - t.fields.length);
|
|
71
|
+
return /* @__PURE__ */ l("div", { className: "space-y-3", children: [
|
|
72
|
+
/* @__PURE__ */ l("div", { children: [
|
|
73
|
+
/* @__PURE__ */ l(x, { children: [
|
|
74
|
+
t.field_count,
|
|
75
|
+
" field",
|
|
76
|
+
t.field_count === 1 ? "" : "s"
|
|
77
|
+
] }),
|
|
78
|
+
t.fields.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: "No fields yet" }) : /* @__PURE__ */ a("ul", { className: "space-y-0.5", children: t.fields.slice(0, 8).map((e) => /* @__PURE__ */ l("li", { className: "flex items-baseline justify-between gap-3 text-[12px]", children: [
|
|
79
|
+
/* @__PURE__ */ a(
|
|
80
|
+
"span",
|
|
81
|
+
{
|
|
82
|
+
className: "truncate text-slate-700 dark:text-slate-200",
|
|
83
|
+
"data-tip": e.label !== e.field ? e.field : void 0,
|
|
84
|
+
children: e.label || e.field
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ a("span", { className: "shrink-0 font-mono text-[10px] text-slate-400 dark:text-slate-500", children: e.type })
|
|
88
|
+
] }, e.field)) }),
|
|
89
|
+
r > 0 && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-400 dark:text-slate-500", children: [
|
|
90
|
+
"and ",
|
|
91
|
+
r,
|
|
92
|
+
" more"
|
|
93
|
+
] })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ l("div", { children: [
|
|
96
|
+
/* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(k, { className: "h-2.5 w-2.5" }), children: "Points to" }),
|
|
97
|
+
/* @__PURE__ */ a(
|
|
98
|
+
N,
|
|
99
|
+
{
|
|
100
|
+
items: t.relations_out.map((e) => ({
|
|
101
|
+
key: `${e.field}:${e.collection}`,
|
|
102
|
+
label: f(e.collection),
|
|
103
|
+
tip: `${e.field} → ${e.collection}`
|
|
104
|
+
}))
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ l("div", { children: [
|
|
109
|
+
/* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(g, { className: "h-2.5 w-2.5" }), children: "Used by" }),
|
|
110
|
+
/* @__PURE__ */ a(
|
|
111
|
+
N,
|
|
112
|
+
{
|
|
113
|
+
items: t.relations_in.map((e) => ({
|
|
114
|
+
key: `${e.collection}:${e.field}`,
|
|
115
|
+
label: f(e.collection),
|
|
116
|
+
tip: `${e.collection}.${e.field}`
|
|
117
|
+
}))
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] }),
|
|
121
|
+
(t.pipeline || t.forms > 0) && /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-slate-600 dark:text-slate-300", children: [
|
|
122
|
+
t.pipeline && /* @__PURE__ */ l("span", { className: "inline-flex min-w-0 items-center gap-1", children: [
|
|
123
|
+
/* @__PURE__ */ a(w, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
|
|
124
|
+
/* @__PURE__ */ a("span", { className: "truncate", children: t.pipeline })
|
|
125
|
+
] }),
|
|
126
|
+
t.forms > 0 && /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", children: [
|
|
127
|
+
/* @__PURE__ */ a(y, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
|
|
128
|
+
t.forms,
|
|
129
|
+
" form",
|
|
130
|
+
t.forms === 1 ? "" : "s"
|
|
131
|
+
] })
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ a("p", { className: "border-t border-slate-100 pt-2 text-[11px] text-slate-500 dark:border-white/[0.06] dark:text-slate-400", children: t.last_edit ? /* @__PURE__ */ l("span", { "data-tip": _(t.last_edit.at), children: [
|
|
134
|
+
"Edited ",
|
|
135
|
+
C(t.last_edit.at),
|
|
136
|
+
t.last_edit.user ? ` by ${t.last_edit.user}` : ""
|
|
137
|
+
] }) : "No edits in the last 90 days" })
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
function Y({
|
|
141
|
+
collection: s,
|
|
142
|
+
title: t,
|
|
143
|
+
open: n,
|
|
144
|
+
onClose: i,
|
|
145
|
+
onCardEnter: r,
|
|
146
|
+
onCardLeave: e,
|
|
147
|
+
children: m
|
|
148
|
+
}) {
|
|
149
|
+
return /* @__PURE__ */ l(P, { open: n, onOpenChange: (o) => !o && i(), children: [
|
|
150
|
+
/* @__PURE__ */ a($, { asChild: !0, children: m }),
|
|
151
|
+
n && /* @__PURE__ */ l(
|
|
152
|
+
L,
|
|
153
|
+
{
|
|
154
|
+
side: "right",
|
|
155
|
+
align: "start",
|
|
156
|
+
sideOffset: 12,
|
|
157
|
+
collisionPadding: 12,
|
|
158
|
+
avoidCollisions: !0,
|
|
159
|
+
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
160
|
+
onCloseAutoFocus: (o) => o.preventDefault(),
|
|
161
|
+
onPointerEnter: r,
|
|
162
|
+
onPointerLeave: e,
|
|
163
|
+
onClick: (o) => o.stopPropagation(),
|
|
164
|
+
"aria-label": `${t} summary`,
|
|
165
|
+
className: "w-[320px] p-3 motion-reduce:animate-none",
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ a("p", { className: "mb-2 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: t }),
|
|
168
|
+
/* @__PURE__ */ a(O, { collection: s })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
Y as CollectionHoverCard,
|
|
176
|
+
I as useHoverIntent
|
|
177
|
+
};
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { jsx as r, jsxs as p, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { Pencil as O, Pin as V, Star as Y, EyeOff as q, Code2 as W, Link2 as G, Workflow as Q, LayoutTemplate as X, Download as z, Square as J } from "lucide-react";
|
|
3
|
+
import { forwardRef as Z, useState as A } from "react";
|
|
4
|
+
import { useNavigation as ee } from "../../context.js";
|
|
5
|
+
import { titleCase as te, cn as l, resolveCollectionIcon as ne, formatNumber as re, formatDateTime as ae } from "../../lib/utils.js";
|
|
6
|
+
import { Checkbox as oe } from "../ui/checkbox.js";
|
|
7
|
+
import { useHoverIntent as se, CollectionHoverCard as ie } from "./CollectionHoverCard.js";
|
|
8
|
+
import { CollectionRowMenu as ce } from "./CollectionRowMenu.js";
|
|
9
|
+
import { recordCollectionOpen as le } from "./directory-data.js";
|
|
10
|
+
const de = (t) => `/collections/${encodeURIComponent(t)}`, D = Z(function({ to: e, onClick: n, ...a }, i) {
|
|
11
|
+
const { navigate: c } = ee();
|
|
12
|
+
return /* @__PURE__ */ r(
|
|
13
|
+
"a",
|
|
14
|
+
{
|
|
15
|
+
ref: i,
|
|
16
|
+
href: e,
|
|
17
|
+
...a,
|
|
18
|
+
onClick: (s) => {
|
|
19
|
+
n == null || n(s), !s.defaultPrevented && (s.button !== 0 || s.metaKey || s.ctrlKey || s.shiftKey || s.altKey || (s.preventDefault(), c(e)));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}), E = 3;
|
|
24
|
+
function ue({
|
|
25
|
+
color: t,
|
|
26
|
+
name: e,
|
|
27
|
+
icon: n,
|
|
28
|
+
size: a = "md"
|
|
29
|
+
}) {
|
|
30
|
+
const i = ne(n);
|
|
31
|
+
return /* @__PURE__ */ r(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: l(
|
|
35
|
+
"flex shrink-0 items-center justify-center rounded font-bold text-white select-none",
|
|
36
|
+
a === "sm" ? "h-5 w-5 text-[10px]" : "h-6 w-6 text-[11px]"
|
|
37
|
+
),
|
|
38
|
+
style: { backgroundColor: t ?? "#94a3b8" },
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
children: i ? /* @__PURE__ */ r(i, { className: a === "sm" ? "h-3 w-3" : "h-3.5 w-3.5" }) : e.charAt(0).toUpperCase()
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function pe(t, e) {
|
|
45
|
+
const n = [];
|
|
46
|
+
return t.hidden && !(e != null && e.link) && n.push({ key: "hidden", label: "Hidden", icon: q, tip: "Hidden from navigation" }), e != null && e.virtual && n.push({
|
|
47
|
+
key: "virtual",
|
|
48
|
+
label: "Virtual",
|
|
49
|
+
icon: W,
|
|
50
|
+
tip: "Backed by SQL — read-only"
|
|
51
|
+
}), e != null && e.link && n.push({ key: "link", label: "Link table", icon: G, tip: "Links two collections" }), e != null && e.pipeline && n.push({ key: "pipeline", label: "Pipeline", icon: Q, tip: e.pipeline }), e && e.forms > 0 && n.push({
|
|
52
|
+
key: "forms",
|
|
53
|
+
label: e.forms > 1 ? `Form ×${e.forms}` : "Form",
|
|
54
|
+
icon: X,
|
|
55
|
+
tip: `${e.forms} form layout${e.forms === 1 ? "" : "s"}`
|
|
56
|
+
}), e && e.imports > 0 && n.push({
|
|
57
|
+
key: "imports",
|
|
58
|
+
label: "Imports",
|
|
59
|
+
icon: z,
|
|
60
|
+
tip: `${e.imports} import${e.imports === 1 ? "" : "s"} feed this collection`
|
|
61
|
+
}), t.singleton && n.push({ key: "singleton", label: "Singleton", icon: J, tip: "Holds a single record" }), n;
|
|
62
|
+
}
|
|
63
|
+
function me({ spec: t }) {
|
|
64
|
+
const e = t.icon;
|
|
65
|
+
return /* @__PURE__ */ p(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
"data-tip": t.tip,
|
|
69
|
+
className: "inline-flex items-center gap-1 whitespace-nowrap rounded px-1.5 py-px text-[10px] font-medium bg-slate-100 text-slate-500 dark:bg-white/10 dark:text-slate-400",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ r(e, { className: "h-[11px] w-[11px] shrink-0", "aria-hidden": "true" }),
|
|
72
|
+
t.label
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function fe({ items: t }) {
|
|
78
|
+
if (t.length === 0) return null;
|
|
79
|
+
const e = t.slice(0, E), n = t.slice(E);
|
|
80
|
+
return /* @__PURE__ */ p("span", { "data-cdr": "", className: "hidden shrink-0 items-center gap-1 sm:[&[data-cdr]]:flex", children: [
|
|
81
|
+
e.map((a) => /* @__PURE__ */ r(me, { spec: a }, a.key)),
|
|
82
|
+
n.length > 0 && /* @__PURE__ */ p(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
"data-tip": n.map((a) => a.label).join(" · "),
|
|
86
|
+
className: "inline-flex items-center rounded px-1 py-px text-[10px] font-medium tabular-nums text-slate-500 dark:text-slate-400",
|
|
87
|
+
children: [
|
|
88
|
+
"+",
|
|
89
|
+
n.length
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
function he(t, e) {
|
|
96
|
+
const n = e == null ? void 0 : e.trim().toLowerCase();
|
|
97
|
+
return n ? t.toLowerCase().indexOf(n) : -1;
|
|
98
|
+
}
|
|
99
|
+
function xe({ text: t, at: e, len: n }) {
|
|
100
|
+
let a = t;
|
|
101
|
+
return e >= 0 && n > 0 && (a = /* @__PURE__ */ p(F, { children: [
|
|
102
|
+
t.slice(0, e),
|
|
103
|
+
/* @__PURE__ */ r("mark", { className: "rounded-sm bg-nvr-cyan/15 text-slate-700 dark:bg-nvr-cyan/25 dark:text-slate-200", children: t.slice(e, e + n) }),
|
|
104
|
+
t.slice(e + n)
|
|
105
|
+
] })), /* @__PURE__ */ r(
|
|
106
|
+
"span",
|
|
107
|
+
{
|
|
108
|
+
"data-key-text": "",
|
|
109
|
+
className: "min-w-0 max-w-[50%] shrink truncate font-mono text-[11px] font-normal text-slate-400 dark:text-slate-500",
|
|
110
|
+
children: a
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function ve(t, e = Date.now()) {
|
|
115
|
+
const n = new Date(t), a = n.getTime();
|
|
116
|
+
if (Number.isNaN(a)) return "—";
|
|
117
|
+
const i = Math.floor((e - a) / 6e4);
|
|
118
|
+
if (i < 1) return "just now";
|
|
119
|
+
if (i < 60) return `${i}m ago`;
|
|
120
|
+
const c = Math.floor(i / 60);
|
|
121
|
+
if (c < 24) return `${c}h ago`;
|
|
122
|
+
const s = Math.floor(c / 24);
|
|
123
|
+
if (s < 7) return `${s}d ago`;
|
|
124
|
+
const y = n.getFullYear() === new Date(e).getFullYear();
|
|
125
|
+
return n.toLocaleDateString("en-US", {
|
|
126
|
+
month: "short",
|
|
127
|
+
day: "numeric",
|
|
128
|
+
...y ? {} : { year: "numeric" }
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function be({ stat: t }) {
|
|
132
|
+
const e = t.rows == null ? /* @__PURE__ */ r("span", { "data-tip": "Record count unknown", className: "text-slate-400 dark:text-slate-500", children: "—" }) : t.rows === 0 ? /* @__PURE__ */ r("span", { className: "text-slate-400 dark:text-slate-500", children: "Empty" }) : /* @__PURE__ */ r("span", { "data-tip": "Approximate record count", children: re(t.rows) });
|
|
133
|
+
return /* @__PURE__ */ p("span", { className: "flex shrink-0 items-center gap-3 text-[11px] tabular-nums text-slate-500 dark:text-slate-400", children: [
|
|
134
|
+
/* @__PURE__ */ r("span", { className: "w-16 text-right", children: e }),
|
|
135
|
+
/* @__PURE__ */ r("span", { "data-cdr": "", className: "hidden w-16 whitespace-nowrap text-right md:[&[data-cdr]]:block", children: t.changed_at ? /* @__PURE__ */ r("span", { "data-tip": `Last change ${ae(t.changed_at)}`, children: ve(t.changed_at) }) : /* @__PURE__ */ r(
|
|
136
|
+
"span",
|
|
137
|
+
{
|
|
138
|
+
"data-tip": "No change seen since the database last started",
|
|
139
|
+
className: "text-slate-400 dark:text-slate-500",
|
|
140
|
+
children: "—"
|
|
141
|
+
}
|
|
142
|
+
) })
|
|
143
|
+
] });
|
|
144
|
+
}
|
|
145
|
+
const b = "opacity-0 transition-opacity duration-150 group-hover/row:opacity-100 group-focus-within/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 motion-reduce:transition-none";
|
|
146
|
+
function ye(t) {
|
|
147
|
+
try {
|
|
148
|
+
return t.matches(":focus-visible");
|
|
149
|
+
} catch {
|
|
150
|
+
return !1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function Ee({
|
|
154
|
+
col: t,
|
|
155
|
+
stat: e,
|
|
156
|
+
density: n,
|
|
157
|
+
favorite: a,
|
|
158
|
+
onToggleFavorite: i,
|
|
159
|
+
pinnedForAll: c = !1,
|
|
160
|
+
onTogglePinned: s,
|
|
161
|
+
onMoveUp: y,
|
|
162
|
+
onMoveDown: j,
|
|
163
|
+
quietPin: S = !1,
|
|
164
|
+
folders: R,
|
|
165
|
+
onMove: H,
|
|
166
|
+
recordsPath: I,
|
|
167
|
+
editPath: k,
|
|
168
|
+
menuExtra: M,
|
|
169
|
+
selecting: w,
|
|
170
|
+
selected: g,
|
|
171
|
+
onSelect: N,
|
|
172
|
+
dragHandle: C,
|
|
173
|
+
highlight: x,
|
|
174
|
+
isAdmin: f,
|
|
175
|
+
indent: _
|
|
176
|
+
}) {
|
|
177
|
+
const m = t.collection, d = t.display_name ?? te(m), h = n === "compact", [B, v] = A(!1), u = se(f), $ = I ?? de(m), L = he(m, x), K = B || L >= 0, U = pe(t, e), T = (o) => {
|
|
178
|
+
o.currentTarget.contains(o.relatedTarget) || v(!1);
|
|
179
|
+
}, P = /* @__PURE__ */ r(
|
|
180
|
+
"span",
|
|
181
|
+
{
|
|
182
|
+
className: "min-w-0 truncate text-[13px] font-semibold tracking-[-0.003em] text-slate-800 group-hover/row:text-slate-900 dark:text-slate-200 dark:group-hover/row:text-slate-100",
|
|
183
|
+
onPointerEnter: u.show,
|
|
184
|
+
onPointerLeave: u.hide,
|
|
185
|
+
children: d
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
return (
|
|
189
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: hover/focus only reveal the key; the link, star and menu are the controls
|
|
190
|
+
/* @__PURE__ */ p(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
"data-collection": m,
|
|
194
|
+
className: l(
|
|
195
|
+
"group/row relative flex w-full items-center gap-2 transition-colors duration-150 hover:bg-nvr-cyan/[0.04] focus-within:bg-nvr-cyan/[0.04] motion-reduce:transition-none dark:hover:bg-nvr-cyan/[0.06] dark:focus-within:bg-nvr-cyan/[0.06]",
|
|
196
|
+
g && "bg-nvr-cyan/[0.07] dark:bg-nvr-cyan/[0.1]",
|
|
197
|
+
h ? "h-7" : "min-h-10 py-1",
|
|
198
|
+
_ ? "pl-2 pr-2" : C ? "pr-2" : "pl-4 pr-2"
|
|
199
|
+
),
|
|
200
|
+
onMouseEnter: () => v(!0),
|
|
201
|
+
onMouseLeave: () => v(!1),
|
|
202
|
+
onFocus: () => v(!0),
|
|
203
|
+
onBlur: T,
|
|
204
|
+
children: [
|
|
205
|
+
C,
|
|
206
|
+
w && /* @__PURE__ */ r(
|
|
207
|
+
oe,
|
|
208
|
+
{
|
|
209
|
+
checked: g,
|
|
210
|
+
onCheckedChange: () => N(),
|
|
211
|
+
onClick: (o) => o.stopPropagation(),
|
|
212
|
+
"aria-label": `Select ${d}`,
|
|
213
|
+
className: "h-3.5 w-3.5 border-slate-300 data-[state=checked]:border-nvr-cyan data-[state=checked]:bg-nvr-cyan data-[state=checked]:text-white dark:border-slate-600 [&_svg]:h-3 [&_svg]:w-3"
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ p(
|
|
217
|
+
D,
|
|
218
|
+
{
|
|
219
|
+
to: $,
|
|
220
|
+
onClick: (o) => {
|
|
221
|
+
if (u.close(), w) {
|
|
222
|
+
o.preventDefault(), N();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
le(m);
|
|
226
|
+
},
|
|
227
|
+
onFocus: (o) => {
|
|
228
|
+
ye(o.currentTarget) && u.show();
|
|
229
|
+
},
|
|
230
|
+
onBlur: u.hide,
|
|
231
|
+
className: l(
|
|
232
|
+
"flex min-w-0 flex-1 items-center gap-2.5 self-stretch rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50",
|
|
233
|
+
h ? "" : "py-0.5"
|
|
234
|
+
),
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ r(
|
|
237
|
+
ue,
|
|
238
|
+
{
|
|
239
|
+
color: t.color,
|
|
240
|
+
name: d,
|
|
241
|
+
icon: t.icon,
|
|
242
|
+
size: h ? "sm" : "md"
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ p("span", { className: "flex min-w-0 flex-1 flex-col justify-center", children: [
|
|
246
|
+
/* @__PURE__ */ p("span", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
247
|
+
f ? /* @__PURE__ */ r(
|
|
248
|
+
ie,
|
|
249
|
+
{
|
|
250
|
+
collection: m,
|
|
251
|
+
title: d,
|
|
252
|
+
open: u.open,
|
|
253
|
+
onClose: u.close,
|
|
254
|
+
onCardEnter: u.cancel,
|
|
255
|
+
onCardLeave: u.hide,
|
|
256
|
+
children: P
|
|
257
|
+
}
|
|
258
|
+
) : P,
|
|
259
|
+
K && /* @__PURE__ */ r(xe, { text: m, at: L, len: (x == null ? void 0 : x.trim().length) ?? 0 }),
|
|
260
|
+
h && t.note && /* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-500 dark:text-slate-400", children: t.note })
|
|
261
|
+
] }),
|
|
262
|
+
!h && t.note && /* @__PURE__ */ r("span", { className: "truncate text-[12px] leading-4 text-slate-500 dark:text-slate-400", children: t.note })
|
|
263
|
+
] }),
|
|
264
|
+
/* @__PURE__ */ r(fe, { items: U }),
|
|
265
|
+
e && /* @__PURE__ */ r(be, { stat: e })
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
f && k && /* @__PURE__ */ r(
|
|
270
|
+
D,
|
|
271
|
+
{
|
|
272
|
+
to: k,
|
|
273
|
+
"aria-label": `Edit ${d}`,
|
|
274
|
+
"data-tip": "Edit fields, forms and settings",
|
|
275
|
+
"data-collection-edit": !0,
|
|
276
|
+
"data-cdr": "",
|
|
277
|
+
onClick: (o) => o.stopPropagation(),
|
|
278
|
+
className: l(
|
|
279
|
+
// Phones: the ⋯ menu carries editing; the row keeps its width for the name.
|
|
280
|
+
"hidden h-6 w-6 shrink-0 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 sm:[&[data-cdr]]:flex dark:text-slate-500 dark:hover:bg-white/10 dark:hover:text-slate-300",
|
|
281
|
+
b
|
|
282
|
+
),
|
|
283
|
+
children: /* @__PURE__ */ r(O, { className: "h-3.5 w-3.5" })
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
f && s && /* @__PURE__ */ r(
|
|
287
|
+
"button",
|
|
288
|
+
{
|
|
289
|
+
type: "button",
|
|
290
|
+
"aria-label": c ? `Unpin ${d} for everyone` : `Pin ${d} for everyone`,
|
|
291
|
+
"aria-pressed": c,
|
|
292
|
+
"data-tip": c ? "Unpin for everyone" : "Pin to the top for everyone",
|
|
293
|
+
"data-collection-pin": !0,
|
|
294
|
+
"data-cdr": "",
|
|
295
|
+
onClick: (o) => {
|
|
296
|
+
o.preventDefault(), o.stopPropagation(), s();
|
|
297
|
+
},
|
|
298
|
+
className: l(
|
|
299
|
+
// Phones: Pin for everyone stays in the ⋯ menu.
|
|
300
|
+
"hidden sm:[&[data-cdr]]:flex h-6 w-6 shrink-0 items-center justify-center rounded hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-white/10",
|
|
301
|
+
c && !S ? "text-slate-600 hover:text-slate-800 dark:text-slate-300 dark:hover:text-slate-100" : l(
|
|
302
|
+
b,
|
|
303
|
+
"text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
|
|
304
|
+
)
|
|
305
|
+
),
|
|
306
|
+
children: /* @__PURE__ */ r(V, { className: l("h-3.5 w-3.5", c && "fill-current") })
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
/* @__PURE__ */ r(
|
|
310
|
+
"button",
|
|
311
|
+
{
|
|
312
|
+
type: "button",
|
|
313
|
+
"aria-label": a ? `Remove ${d} from my favorites` : `Add ${d} to my favorites`,
|
|
314
|
+
"aria-pressed": a,
|
|
315
|
+
"data-tip": a ? "Remove from my favorites" : "Add to my favorites",
|
|
316
|
+
onClick: (o) => {
|
|
317
|
+
o.preventDefault(), o.stopPropagation(), i();
|
|
318
|
+
},
|
|
319
|
+
className: l(
|
|
320
|
+
"flex h-6 w-6 shrink-0 items-center justify-center rounded hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-white/10",
|
|
321
|
+
a ? "text-nvr-cyan" : l(
|
|
322
|
+
b,
|
|
323
|
+
"text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
|
|
324
|
+
)
|
|
325
|
+
),
|
|
326
|
+
children: /* @__PURE__ */ r(Y, { className: l("h-3.5 w-3.5", a && "fill-current") })
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ r(
|
|
330
|
+
ce,
|
|
331
|
+
{
|
|
332
|
+
col: t,
|
|
333
|
+
displayName: d,
|
|
334
|
+
isAdmin: f,
|
|
335
|
+
recordsPath: $,
|
|
336
|
+
extra: f ? M : void 0,
|
|
337
|
+
favorite: a,
|
|
338
|
+
onToggleFavorite: i,
|
|
339
|
+
pinnedForAll: c,
|
|
340
|
+
onTogglePinned: s,
|
|
341
|
+
onMoveUp: y,
|
|
342
|
+
onMoveDown: j,
|
|
343
|
+
folders: R,
|
|
344
|
+
onMove: H,
|
|
345
|
+
className: l(b, "[@media(hover:none)]:[&[data-cdr]]:opacity-100")
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
)
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
export {
|
|
354
|
+
ue as CollectionAvatar,
|
|
355
|
+
Ee as CollectionRow,
|
|
356
|
+
D as HostLink,
|
|
357
|
+
de as defaultCollectionPath,
|
|
358
|
+
ve as shortWhen
|
|
359
|
+
};
|