@photon-ai/pho-ui 4.12.0 → 4.13.0
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/chunks/{basic-page-CJ11ekjH.js → basic-page-6dDfY33L.js} +717 -737
- package/dist/chunks/basic-page-6dDfY33L.js.map +1 -0
- package/dist/chunks/box-search-C9EVZgcb.js +56 -0
- package/dist/chunks/box-search-C9EVZgcb.js.map +1 -0
- package/dist/chunks/{chat-CU3XVm99.js → chat-Bu8UyIbT.js} +206 -204
- package/dist/chunks/chat-Bu8UyIbT.js.map +1 -0
- package/dist/chunks/chrome-Ds7WykBJ.js +14 -0
- package/dist/chunks/chrome-Ds7WykBJ.js.map +1 -0
- package/dist/chunks/{data-table-Ce_c6T73.js → data-table-hzZb7Otx.js} +56 -54
- package/dist/chunks/{data-table-Ce_c6T73.js.map → data-table-hzZb7Otx.js.map} +1 -1
- package/dist/chunks/{filter-bar-CMkvhvgL.js → filter-bar-C4sPEjw1.js} +62 -65
- package/dist/chunks/filter-bar-C4sPEjw1.js.map +1 -0
- package/dist/chunks/ghost-search-8PzP73zS.js +50 -0
- package/dist/chunks/ghost-search-8PzP73zS.js.map +1 -0
- package/dist/chunks/{trace-D1fOFzJt.js → trace-DyjsBY-S.js} +15 -13
- package/dist/chunks/{trace-D1fOFzJt.js.map → trace-DyjsBY-S.js.map} +1 -1
- package/dist/components/chat.js +1 -1
- package/dist/components/data-table.js +4 -3
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/scope.js +418 -0
- package/dist/components/scope.js.map +1 -0
- package/dist/components/trace.js +1 -1
- package/dist/index.js +176 -175
- package/dist/motion.js +61 -36
- package/dist/motion.js.map +1 -1
- package/dist/sections/basic-page.js +2 -2
- package/dist/src/components/chat/chat.d.ts +7 -4
- package/dist/src/components/input-group/box-search.d.ts +29 -0
- package/dist/src/components/scope/index.d.ts +1 -0
- package/dist/src/components/scope/scope.d.ts +98 -0
- package/dist/src/motion/index.d.ts +52 -0
- package/dist/src/utils/ghost-search.d.ts +19 -3
- package/package.json +5 -1
- package/dist/chunks/basic-page-CJ11ekjH.js.map +0 -1
- package/dist/chunks/chat-CU3XVm99.js.map +0 -1
- package/dist/chunks/filter-bar-CMkvhvgL.js.map +0 -1
- package/dist/chunks/ghost-search-CNVs9k1o.js +0 -34
- package/dist/chunks/ghost-search-CNVs9k1o.js.map +0 -1
package/dist/components/chat.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as e, i as t, n as r, r as o, t as s } from "../chunks/data-table-
|
|
3
|
-
import {
|
|
2
|
+
import { a as e, i as t, n as r, r as o, t as s } from "../chunks/data-table-hzZb7Otx.js";
|
|
3
|
+
import { r as c } from "../chunks/chrome-Ds7WykBJ.js";
|
|
4
|
+
import { t as T } from "../chunks/ghost-search-8PzP73zS.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
c as DATA_TABLE_SURFACE,
|
|
6
7
|
s as DataTable,
|
|
7
8
|
T as GhostSearch,
|
|
8
9
|
r as TableHostContext,
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as c } from "../chunks/cn-ChIgwEl3.js";
|
|
3
|
+
import { revealIn as Ye } from "../motion.js";
|
|
4
|
+
import { u as Qe } from "../chunks/button-C9VqBBIr.js";
|
|
5
|
+
import { t as Je } from "../chunks/close-button-GvqWbLl0.js";
|
|
6
|
+
import { r as ne } from "../chunks/checkbox-CwvoEJhd.js";
|
|
7
|
+
import { t as y } from "../chunks/skeleton-DwjSl4vC.js";
|
|
8
|
+
import { t as Xe } from "../chunks/ghost-search-8PzP73zS.js";
|
|
9
|
+
import { t as z } from "../chunks/tooltip-BTF7GChl.js";
|
|
10
|
+
import { useEffect as fe, useId as Ze, useLayoutEffect as en, useMemo as M, useRef as C, useState as U } from "react";
|
|
11
|
+
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
12
|
+
import { AnimatePresence as A, motion as g, useReducedMotion as nn } from "motion/react";
|
|
13
|
+
import { Tooltip as tn } from "@base-ui/react/tooltip";
|
|
14
|
+
var rn = "group/scope w-full min-w-0 overflow-clip rounded-base border border-pho-secondary bg-pho-primary [--scope-inset:var(--choice-card-inset,0.75rem)]", me = "px-[var(--scope-inset)]", sn = "flex min-h-11 items-center gap-3 border-b border-pho-secondary px-[var(--scope-inset)]", ve = "grid grid-cols-1 group-data-[wide]/scope:grid-cols-[fit-content(45%)_minmax(0,1fr)] group-data-[wide]/scope:gap-x-4", ge = "col-span-full grid grid-cols-subgrid border-t border-pho-secondary first:border-t-0", be = "group col-span-full flex min-w-0 cursor-pointer flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 transition-colors select-none hover:bg-pho-primary-hover group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center data-[disabled]:cursor-not-allowed data-[disabled]:hover:bg-transparent", an = "col-span-full flex min-w-0 flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center", we = "group col-span-full flex h-8 min-w-0 cursor-pointer items-center gap-2 border-b border-pho-secondary bg-pho-page px-[var(--scope-inset)] text-xs font-medium text-pho-secondary select-none data-[disabled]:cursor-not-allowed", xe = "line-clamp-2 min-w-0 pl-6 text-xs text-pho-description group-data-[wide]/scope:block group-data-[wide]/scope:truncate group-data-[wide]/scope:pl-0", Ne = "flex w-full min-w-0 items-center gap-3 py-2.5 pr-2 pl-[var(--scope-inset)] text-left outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-2", ln = 34, on = 18;
|
|
15
|
+
function cn(r) {
|
|
16
|
+
const [a, p] = U({
|
|
17
|
+
wide: !0,
|
|
18
|
+
roomy: !0
|
|
19
|
+
});
|
|
20
|
+
return en(() => {
|
|
21
|
+
const o = r.current;
|
|
22
|
+
if (o == null) return;
|
|
23
|
+
const s = () => {
|
|
24
|
+
const S = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16, $ = o.getBoundingClientRect().width, _ = {
|
|
25
|
+
wide: $ >= ln * S,
|
|
26
|
+
roomy: $ >= on * S
|
|
27
|
+
};
|
|
28
|
+
p((I) => I.wide === _.wide && I.roomy === _.roomy ? I : _);
|
|
29
|
+
};
|
|
30
|
+
s();
|
|
31
|
+
const u = new ResizeObserver(s);
|
|
32
|
+
return u.observe(o), () => u.disconnect();
|
|
33
|
+
}, [r]), a;
|
|
34
|
+
}
|
|
35
|
+
function dn(r) {
|
|
36
|
+
const a = [], p = /* @__PURE__ */ new Map();
|
|
37
|
+
for (const o of r) {
|
|
38
|
+
const s = o.group ?? null;
|
|
39
|
+
let u = p.get(s);
|
|
40
|
+
u || (u = {
|
|
41
|
+
label: s,
|
|
42
|
+
items: []
|
|
43
|
+
}, p.set(s, u), a.push(u)), u.items.push(o);
|
|
44
|
+
}
|
|
45
|
+
return [...a.filter((o) => o.label === null), ...a.filter((o) => o.label !== null)];
|
|
46
|
+
}
|
|
47
|
+
function Se(r) {
|
|
48
|
+
return r.toLowerCase().replace(/[.:\-_/]/g, " ");
|
|
49
|
+
}
|
|
50
|
+
function un(r) {
|
|
51
|
+
return Se(r).split(/\s+/).filter(Boolean);
|
|
52
|
+
}
|
|
53
|
+
function ye(r, ...a) {
|
|
54
|
+
const p = Se(a.filter(Boolean).join(" "));
|
|
55
|
+
return r.every((o) => p.includes(o));
|
|
56
|
+
}
|
|
57
|
+
function Ce(r) {
|
|
58
|
+
return r.label ?? r.value;
|
|
59
|
+
}
|
|
60
|
+
function pn(r, a) {
|
|
61
|
+
if (r.length !== a.length) return !1;
|
|
62
|
+
const p = new Set(r);
|
|
63
|
+
return a.every((o) => p.has(o));
|
|
64
|
+
}
|
|
65
|
+
function hn(r) {
|
|
66
|
+
if (!(r instanceof Element)) return !1;
|
|
67
|
+
const a = r.closest("[data-scope-description]");
|
|
68
|
+
return a == null ? !1 : a.scrollWidth > a.clientWidth + 1 || a.scrollHeight > a.clientHeight + 1;
|
|
69
|
+
}
|
|
70
|
+
function fn({ items: r, value: a, defaultValue: p, onValueChange: o, all: s, placeholder: u = "Search", collapsible: S = !1, open: $, defaultOpen: _ = !1, onOpenChange: I, loading: b = !1, disabled: D = !1, className: Oe, ref: W, ...Ee }) {
|
|
71
|
+
const [ke, Re] = U(p ?? []), O = a ?? ke, [$e, _e] = U(_), N = S ? $ ?? $e : !0, [T, P] = U(""), Ie = nn(), te = C(null), { wide: Pe, roomy: ze } = cn(te), h = Ze(), re = `${h}-list`, se = C(null), ae = C(null), B = C(null), le = M(() => tn.createHandle(), []), G = M(() => dn(r), [r]), V = M(() => new Set(r.map((e) => e.value)), [r]), Me = M(() => new Map(r.map((e, n) => [e.value, n])), [r]), Ae = M(() => new Map(G.map((e, n) => [e.label, n])), [G]), q = C([]);
|
|
72
|
+
for (const e of O) e !== s?.value && !V.has(e) && !q.current.includes(e) && q.current.push(e);
|
|
73
|
+
const E = q.current.filter((e) => !V.has(e)), w = s?.value, F = new Set(O), x = w !== void 0 && F.has(w), j = (e) => x ? V.has(e) : F.has(e), k = r.filter((e) => j(e.value)).length, oe = E.filter((e) => F.has(e)).length, K = (e) => {
|
|
74
|
+
a === void 0 && Re(e), o?.(e);
|
|
75
|
+
}, ie = (e) => K([...r.filter((n) => e.has(n.value)).map((n) => n.value), ...E.filter((n) => e.has(n))]), De = () => x ? new Set(r.map((e) => e.value)) : new Set(O.filter((e) => e !== w)), Y = (e, n) => {
|
|
76
|
+
const i = De();
|
|
77
|
+
for (const d of e) n ? i.add(d) : i.delete(d);
|
|
78
|
+
ie(i);
|
|
79
|
+
}, We = (e) => {
|
|
80
|
+
w === void 0 ? Y(r.map((n) => n.value), e) : e ? K([w]) : ie(new Set(r.map((n) => n.value)));
|
|
81
|
+
}, ce = (e) => {
|
|
82
|
+
$ === void 0 && _e(e), I?.(e);
|
|
83
|
+
}, Te = () => {
|
|
84
|
+
B.current = "search", ce(!0);
|
|
85
|
+
}, Be = () => {
|
|
86
|
+
B.current = "summary", P(""), ce(!1);
|
|
87
|
+
}, Q = C(O);
|
|
88
|
+
Q.current = O;
|
|
89
|
+
const de = C(N ? O : null);
|
|
90
|
+
fe(() => {
|
|
91
|
+
de.current = N ? Q.current : null, N || P("");
|
|
92
|
+
}, [N]);
|
|
93
|
+
const ue = () => {
|
|
94
|
+
const e = de.current;
|
|
95
|
+
e != null && !pn(e, Q.current) && K([...e]), Be();
|
|
96
|
+
};
|
|
97
|
+
fe(() => {
|
|
98
|
+
const e = B.current;
|
|
99
|
+
if (e == null) return;
|
|
100
|
+
B.current = null;
|
|
101
|
+
let n = 0, i = 0;
|
|
102
|
+
const d = () => {
|
|
103
|
+
const m = e === "search" ? se.current : ae.current;
|
|
104
|
+
m != null && (m.focus(), document.activeElement !== m && i++ < 5 && (n = requestAnimationFrame(d)));
|
|
105
|
+
};
|
|
106
|
+
return n = requestAnimationFrame(d), () => cancelAnimationFrame(n);
|
|
107
|
+
}, [N]);
|
|
108
|
+
const Ge = (e) => {
|
|
109
|
+
e.key === "Enter" && e.preventDefault(), e.key === "Escape" && (T !== "" ? (e.preventDefault(), P("")) : S && !D && (e.preventDefault(), ue()));
|
|
110
|
+
}, J = un(T), H = J.length > 0, pe = G.map((e) => ({
|
|
111
|
+
...e,
|
|
112
|
+
items: H ? e.items.filter((n) => ye(J, e.label, n.value, n.label, n.description)) : e.items
|
|
113
|
+
})).filter((e) => e.items.length > 0), X = H ? E.filter((e) => ye(J, e)) : E, L = x || r.length === 0 ? null : `${k} of ${r.length}`, Z = (() => {
|
|
114
|
+
if (x && s) return {
|
|
115
|
+
title: s.label,
|
|
116
|
+
detail: s.description ?? ""
|
|
117
|
+
};
|
|
118
|
+
if (s && w === void 0 && r.length > 0 && k === r.length && oe === 0) return {
|
|
119
|
+
title: s.label,
|
|
120
|
+
detail: s.description ?? L ?? ""
|
|
121
|
+
};
|
|
122
|
+
const e = [];
|
|
123
|
+
for (const n of G) {
|
|
124
|
+
const i = n.items.filter((d) => j(d.value));
|
|
125
|
+
n.label !== null && n.items.length > 1 && i.length === n.items.length ? e.push(n.label) : e.push(...i.map(Ce));
|
|
126
|
+
}
|
|
127
|
+
return e.push(...E.filter((n) => F.has(n))), {
|
|
128
|
+
title: e.length > 0 ? e.join(", ") : "None",
|
|
129
|
+
detail: L ?? ""
|
|
130
|
+
};
|
|
131
|
+
})(), R = D || b, f = Ye(Ie), ee = (e, n = !1) => {
|
|
132
|
+
const i = n ? `${h}-r${E.indexOf(e.value)}` : `${h}-i${Me.get(e.value)}`, d = `${i}-name`, m = `${i}-description`;
|
|
133
|
+
return /* @__PURE__ */ l(g.label, {
|
|
134
|
+
...f,
|
|
135
|
+
className: c(be, "overflow-hidden"),
|
|
136
|
+
"data-scope-row": "",
|
|
137
|
+
"data-disabled": R || void 0,
|
|
138
|
+
children: [/* @__PURE__ */ l("span", {
|
|
139
|
+
className: "flex min-w-0 items-center gap-2",
|
|
140
|
+
children: [/* @__PURE__ */ t(ne, {
|
|
141
|
+
size: "sm",
|
|
142
|
+
checked: j(e.value),
|
|
143
|
+
disabled: R,
|
|
144
|
+
"aria-labelledby": d,
|
|
145
|
+
"aria-describedby": e.description ? m : void 0,
|
|
146
|
+
onCheckedChange: (v) => Y([e.value], v)
|
|
147
|
+
}), /* @__PURE__ */ t("span", {
|
|
148
|
+
id: d,
|
|
149
|
+
className: c("truncate text-base", n ? "text-pho-description" : "text-pho-secondary"),
|
|
150
|
+
children: Ce(e)
|
|
151
|
+
})]
|
|
152
|
+
}), e.description ? /* @__PURE__ */ t(z.Trigger, {
|
|
153
|
+
handle: le,
|
|
154
|
+
payload: e.description,
|
|
155
|
+
render: /* @__PURE__ */ t("span", {
|
|
156
|
+
id: m,
|
|
157
|
+
"data-scope-description": "",
|
|
158
|
+
className: xe
|
|
159
|
+
}),
|
|
160
|
+
children: e.description
|
|
161
|
+
}) : null]
|
|
162
|
+
}, e.value);
|
|
163
|
+
}, Fe = (e) => {
|
|
164
|
+
if (e.label === null) return e.items.map((v) => ee(v));
|
|
165
|
+
const n = `${h}-g${Ae.get(e.label)}`, i = e.items.map((v) => v.value), d = i.filter(j).length, m = d === i.length;
|
|
166
|
+
return /* @__PURE__ */ l(g.div, {
|
|
167
|
+
...f,
|
|
168
|
+
role: "group",
|
|
169
|
+
"aria-labelledby": n,
|
|
170
|
+
className: c(ge, "overflow-hidden"),
|
|
171
|
+
children: [/* @__PURE__ */ l("label", {
|
|
172
|
+
className: we,
|
|
173
|
+
"data-disabled": R || void 0,
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ t(ne, {
|
|
176
|
+
size: "sm",
|
|
177
|
+
checked: m,
|
|
178
|
+
indeterminate: d > 0 && !m,
|
|
179
|
+
disabled: R,
|
|
180
|
+
"aria-labelledby": n,
|
|
181
|
+
onCheckedChange: (v) => Y(i, v)
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ t("span", {
|
|
184
|
+
id: n,
|
|
185
|
+
className: "truncate",
|
|
186
|
+
children: e.label
|
|
187
|
+
}),
|
|
188
|
+
/* @__PURE__ */ t("span", {
|
|
189
|
+
className: "text-pho-description tabular-nums",
|
|
190
|
+
children: i.length
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
}), /* @__PURE__ */ t(A, {
|
|
194
|
+
initial: !1,
|
|
195
|
+
children: e.items.map((v) => ee(v))
|
|
196
|
+
})]
|
|
197
|
+
}, `group:${e.label}`);
|
|
198
|
+
}, je = X.length > 0 ? /* @__PURE__ */ l(g.div, {
|
|
199
|
+
...f,
|
|
200
|
+
role: "group",
|
|
201
|
+
"aria-labelledby": `${h}-retired`,
|
|
202
|
+
className: c(ge, "overflow-hidden"),
|
|
203
|
+
children: [/* @__PURE__ */ l("div", {
|
|
204
|
+
className: c(we, "cursor-default"),
|
|
205
|
+
children: [/* @__PURE__ */ t("span", {
|
|
206
|
+
"aria-hidden": !0,
|
|
207
|
+
className: "size-4 shrink-0"
|
|
208
|
+
}), /* @__PURE__ */ t("span", {
|
|
209
|
+
id: `${h}-retired`,
|
|
210
|
+
className: "truncate",
|
|
211
|
+
children: "No longer offered"
|
|
212
|
+
})]
|
|
213
|
+
}), /* @__PURE__ */ t(A, {
|
|
214
|
+
initial: !1,
|
|
215
|
+
children: X.map((e) => ee({ value: e }, !0))
|
|
216
|
+
})]
|
|
217
|
+
}, "retired") : null, He = s ? /* @__PURE__ */ l(g.label, {
|
|
218
|
+
...f,
|
|
219
|
+
className: c(be, "overflow-hidden"),
|
|
220
|
+
"data-scope-row": "",
|
|
221
|
+
"data-disabled": R || x && r.length === 0 || void 0,
|
|
222
|
+
children: [/* @__PURE__ */ l("span", {
|
|
223
|
+
className: "flex min-w-0 items-center gap-2",
|
|
224
|
+
children: [/* @__PURE__ */ t(ne, {
|
|
225
|
+
size: "sm",
|
|
226
|
+
checked: w === void 0 ? r.length > 0 && k === r.length : x,
|
|
227
|
+
indeterminate: w === void 0 ? k > 0 && k < r.length : !x && k + oe > 0,
|
|
228
|
+
disabled: R || x && r.length === 0,
|
|
229
|
+
"aria-labelledby": `${h}-all`,
|
|
230
|
+
"aria-describedby": s.description ? `${h}-all-description` : void 0,
|
|
231
|
+
onCheckedChange: (e) => We(e)
|
|
232
|
+
}), /* @__PURE__ */ t("span", {
|
|
233
|
+
id: `${h}-all`,
|
|
234
|
+
className: "text-pho-primary truncate text-base font-medium",
|
|
235
|
+
children: s.label
|
|
236
|
+
})]
|
|
237
|
+
}), s.description ? /* @__PURE__ */ t("span", {
|
|
238
|
+
id: `${h}-all-description`,
|
|
239
|
+
className: xe,
|
|
240
|
+
children: s.description
|
|
241
|
+
}) : null]
|
|
242
|
+
}, "all") : null, Le = H && pe.length === 0 && X.length === 0 ? /* @__PURE__ */ t(g.p, {
|
|
243
|
+
...f,
|
|
244
|
+
className: c("text-pho-description col-span-full overflow-hidden text-center text-base", me),
|
|
245
|
+
children: /* @__PURE__ */ l("span", {
|
|
246
|
+
className: "block py-6",
|
|
247
|
+
children: [
|
|
248
|
+
"Nothing matches “",
|
|
249
|
+
T,
|
|
250
|
+
"”."
|
|
251
|
+
]
|
|
252
|
+
})
|
|
253
|
+
}, "nothing") : null, Ue = /* @__PURE__ */ t(g.div, {
|
|
254
|
+
...f,
|
|
255
|
+
id: re,
|
|
256
|
+
className: c(ve, "overflow-hidden"),
|
|
257
|
+
children: /* @__PURE__ */ l(A, {
|
|
258
|
+
initial: !1,
|
|
259
|
+
children: [
|
|
260
|
+
H ? null : He,
|
|
261
|
+
pe.map(Fe),
|
|
262
|
+
je,
|
|
263
|
+
Le
|
|
264
|
+
]
|
|
265
|
+
})
|
|
266
|
+
}, "list"), Ve = /* @__PURE__ */ t(g.div, {
|
|
267
|
+
...f,
|
|
268
|
+
"aria-hidden": !0,
|
|
269
|
+
className: c(ve, "overflow-hidden"),
|
|
270
|
+
children: [
|
|
271
|
+
{
|
|
272
|
+
band: !1,
|
|
273
|
+
name: "w-20",
|
|
274
|
+
text: "w-44"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
band: !0,
|
|
278
|
+
name: "w-12",
|
|
279
|
+
text: ""
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
band: !1,
|
|
283
|
+
name: "w-28",
|
|
284
|
+
text: "w-56"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
band: !1,
|
|
288
|
+
name: "w-32",
|
|
289
|
+
text: "w-48"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
band: !1,
|
|
293
|
+
name: "w-24",
|
|
294
|
+
text: "w-60"
|
|
295
|
+
}
|
|
296
|
+
].map((e, n) => e.band ? /* @__PURE__ */ l("div", {
|
|
297
|
+
className: c("border-pho-secondary bg-pho-page col-span-full flex h-8 items-center gap-2 border-y", me),
|
|
298
|
+
children: [/* @__PURE__ */ t(y, { className: "size-4 rounded-sm" }), /* @__PURE__ */ t(y, { className: c("h-3", e.name) })]
|
|
299
|
+
}, n) : /* @__PURE__ */ l("div", {
|
|
300
|
+
className: an,
|
|
301
|
+
children: [/* @__PURE__ */ l("span", {
|
|
302
|
+
className: "flex h-5 min-w-0 items-center gap-2",
|
|
303
|
+
children: [/* @__PURE__ */ t(y, { className: "size-4 shrink-0 rounded-sm" }), /* @__PURE__ */ t(y, { className: c("h-3.5 max-w-full", e.name) })]
|
|
304
|
+
}), /* @__PURE__ */ t("span", {
|
|
305
|
+
className: "flex h-4.5 items-center pl-6 group-data-[wide]/scope:pl-0",
|
|
306
|
+
children: /* @__PURE__ */ t(y, { className: c("h-3 max-w-full", e.text) })
|
|
307
|
+
})]
|
|
308
|
+
}, n))
|
|
309
|
+
}, "bones"), qe = /* @__PURE__ */ l(g.div, {
|
|
310
|
+
...f,
|
|
311
|
+
className: "overflow-hidden",
|
|
312
|
+
children: [/* @__PURE__ */ l("div", {
|
|
313
|
+
className: sn,
|
|
314
|
+
children: [/* @__PURE__ */ t(Xe, {
|
|
315
|
+
ref: se,
|
|
316
|
+
value: T,
|
|
317
|
+
onChange: P,
|
|
318
|
+
onClear: () => P(""),
|
|
319
|
+
onKeyDown: Ge,
|
|
320
|
+
placeholder: u,
|
|
321
|
+
"aria-label": u,
|
|
322
|
+
"aria-controls": b ? void 0 : re,
|
|
323
|
+
disabled: b,
|
|
324
|
+
trailing: L != null && !b ? /* @__PURE__ */ t("span", {
|
|
325
|
+
className: "hidden group-data-[roomy]/scope:inline",
|
|
326
|
+
children: L
|
|
327
|
+
}) : void 0,
|
|
328
|
+
autoComplete: "off",
|
|
329
|
+
spellCheck: !1
|
|
330
|
+
}), S ? /* @__PURE__ */ t(Je, {
|
|
331
|
+
size: "sm",
|
|
332
|
+
label: "Cancel",
|
|
333
|
+
disabled: D,
|
|
334
|
+
onClick: ue,
|
|
335
|
+
className: "-mr-2 shrink-0 focus-visible:-outline-offset-2"
|
|
336
|
+
}) : null]
|
|
337
|
+
}), /* @__PURE__ */ t(A, {
|
|
338
|
+
initial: !1,
|
|
339
|
+
children: b ? Ve : Ue
|
|
340
|
+
})]
|
|
341
|
+
}, "picker"), he = b ? /* @__PURE__ */ l("span", {
|
|
342
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
343
|
+
children: [/* @__PURE__ */ t("span", {
|
|
344
|
+
className: "flex h-5 items-center",
|
|
345
|
+
children: /* @__PURE__ */ t(y, { className: "h-3.5 w-48 max-w-full" })
|
|
346
|
+
}), /* @__PURE__ */ t("span", {
|
|
347
|
+
className: "flex h-4.5 items-center",
|
|
348
|
+
children: /* @__PURE__ */ t(y, { className: "h-3 w-16" })
|
|
349
|
+
})]
|
|
350
|
+
}) : /* @__PURE__ */ l("span", {
|
|
351
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
352
|
+
children: [/* @__PURE__ */ t("span", {
|
|
353
|
+
className: "text-pho-primary truncate text-base",
|
|
354
|
+
children: Z.title
|
|
355
|
+
}), Z.detail ? /* @__PURE__ */ t("span", {
|
|
356
|
+
className: "text-pho-description truncate text-xs tabular-nums",
|
|
357
|
+
children: Z.detail
|
|
358
|
+
}) : null]
|
|
359
|
+
}), Ke = /* @__PURE__ */ t(g.div, {
|
|
360
|
+
...f,
|
|
361
|
+
className: "overflow-hidden",
|
|
362
|
+
children: D || b ? /* @__PURE__ */ t("div", {
|
|
363
|
+
className: Ne,
|
|
364
|
+
children: he
|
|
365
|
+
}) : /* @__PURE__ */ l("button", {
|
|
366
|
+
ref: ae,
|
|
367
|
+
type: "button",
|
|
368
|
+
"aria-expanded": !1,
|
|
369
|
+
className: c(Ne, "group hover:bg-pho-primary-hover cursor-pointer transition-colors"),
|
|
370
|
+
onClick: Te,
|
|
371
|
+
children: [he, /* @__PURE__ */ t("span", {
|
|
372
|
+
"aria-hidden": !0,
|
|
373
|
+
className: Qe({
|
|
374
|
+
variant: "ghost",
|
|
375
|
+
size: "sm",
|
|
376
|
+
className: "group-hover:bg-pho-ghost-hover group-hover:text-pho-secondary-hover pointer-events-none shrink-0"
|
|
377
|
+
}),
|
|
378
|
+
children: "Edit"
|
|
379
|
+
})]
|
|
380
|
+
})
|
|
381
|
+
}, "folded");
|
|
382
|
+
return /* @__PURE__ */ l("div", {
|
|
383
|
+
role: "group",
|
|
384
|
+
"aria-busy": b || void 0,
|
|
385
|
+
"data-scope": "",
|
|
386
|
+
"data-open": N ? "" : void 0,
|
|
387
|
+
"data-wide": Pe ? "" : void 0,
|
|
388
|
+
"data-roomy": ze ? "" : void 0,
|
|
389
|
+
className: c(rn, Oe),
|
|
390
|
+
...Ee,
|
|
391
|
+
ref: (e) => {
|
|
392
|
+
te.current = e, typeof W == "function" ? W(e) : W != null && (W.current = e);
|
|
393
|
+
},
|
|
394
|
+
children: [/* @__PURE__ */ t(A, {
|
|
395
|
+
initial: !1,
|
|
396
|
+
children: N ? qe : Ke
|
|
397
|
+
}), /* @__PURE__ */ t(z.Root, {
|
|
398
|
+
handle: le,
|
|
399
|
+
onOpenChange: (e, n) => {
|
|
400
|
+
e && !hn(n.event?.target) && n.cancel();
|
|
401
|
+
},
|
|
402
|
+
children: ({ payload: e }) => /* @__PURE__ */ t(z.Portal, { children: /* @__PURE__ */ t(z.Positioner, {
|
|
403
|
+
side: "top",
|
|
404
|
+
align: "start",
|
|
405
|
+
children: /* @__PURE__ */ t(z.Popup, {
|
|
406
|
+
className: "max-w-80 font-normal",
|
|
407
|
+
children: e
|
|
408
|
+
})
|
|
409
|
+
}) })
|
|
410
|
+
})]
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
fn.displayName = "Scope";
|
|
414
|
+
export {
|
|
415
|
+
fn as Scope
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
//# sourceMappingURL=scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","names":[],"sources":["../../src/components/scope/scope.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ComponentProps,\n type KeyboardEvent,\n type Ref,\n type RefObject,\n} from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { Tooltip as BaseTooltip } from \"@base-ui/react/tooltip\";\nimport { CloseButton, buttonVariants } from \"../button\";\nimport { Checkbox } from \"../checkbox\";\nimport { Skeleton } from \"../skeleton\";\nimport { Tooltip } from \"../tooltip\";\nimport { revealIn } from \"../../motion\";\nimport { cn } from \"../../utils/cn\";\nimport { GhostSearch } from \"../../utils/ghost-search\";\n\n/**\n * Scope — pick what something covers out of a catalog: the events a webhook\n * destination receives, the permissions an app or key holds. A searchable,\n * grouped checklist with a catch-all row; `collapsible` folds it to a\n * two-line summary for a resource that already exists, opening on click.\n */\n\nexport interface ScopeItem {\n /**\n * What the selection holds — an event type, a permission id. It is also\n * the row's name unless `label` says otherwise.\n */\n value: string;\n /** The row's name, when it shouldn't be the value itself. */\n label?: string;\n /** One line on what it covers. Searched along with the name. */\n description?: string;\n /**\n * The group it files under — the resource, the namespace. Groups keep\n * the order they first appear in; items without one come first.\n */\n group?: string;\n}\n\nexport interface ScopeAll {\n /** The row's name — `All events`. */\n label: string;\n /** What choosing it means — `Every current and future event.` */\n description?: string;\n /**\n * A wildcard the selection holds in place of the items — `*`. With it,\n * the row stands for every item, now and later: choosing it sets the\n * selection to `[value]`, and leaving it spells every item out by name so\n * the reader prunes from there, never from nothing. Without it, the row\n * selects every item listed.\n */\n value?: string;\n}\n\nexport interface ScopeProps extends Omit<\n ComponentProps<\"div\">,\n \"defaultValue\" | \"onChange\" | \"children\"\n> {\n /** The catalog — everything that can be picked, in display order. */\n items: readonly ScopeItem[];\n /** The selected values, controlled. */\n value?: readonly string[];\n /** The selected values at first, uncontrolled. */\n defaultValue?: readonly string[];\n /**\n * Called with the next selection, in catalog order (values no longer in\n * the catalog follow in the order they were held).\n */\n onValueChange?: (value: string[]) => void;\n /** The catch-all row at the top. Leave it out for no such row. */\n all?: ScopeAll;\n /** The search field's placeholder, which also names it. @default \"Search\" */\n placeholder?: string;\n /**\n * Fold to a two-line summary of the selection, opening to the full list\n * on click — for a resource that already exists, where the scope is read\n * far more often than it changes. The page saves the change (its \"Save\n * changes\" below the card) and folds the list through `open`; the ✕ in\n * the search row, or `Escape` on an empty search, drops the edit: the\n * selection goes back to what it was when the list opened, and folds.\n */\n collapsible?: boolean;\n /** Whether the collapsible list is open, controlled. */\n open?: boolean;\n /** Whether the collapsible list starts open. @default false */\n defaultOpen?: boolean;\n /** Called when the collapsible list opens or folds. */\n onOpenChange?: (open: boolean) => void;\n /** The catalog is on its way: bones in place of rows. */\n loading?: boolean;\n /**\n * Read-only: the list can be searched but not changed, and a folded one\n * stays folded. Held open by `open` (a save in flight), nothing in it\n * changes the selection, the ✕ and Escape included.\n */\n disabled?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\n/* ------------------------------- class map ------------------------------- */\n\n/**\n * The card: the BasicPage card's stroke, corner, and fill. `overflow-clip`\n * rounds a hovered edge row into the corners without making the card a\n * scroll container. The rows lay out by the card's width, not the\n * viewport's: it is measured (`data-wide`, `data-roomy`) rather than made a\n * CSS query container, because Chromium drops a query container's\n * children from layout when a `Reveal` mounts beside it in a Base UI form\n * (a BasicPage `Footer` appearing under the card left it 2px tall).\n *\n * Its words stand `--scope-inset` in from its edges, which is the page's\n * choice inset (the one `RadioCard` and `CheckboxCard` pad by): 20px when\n * the card stands on a `BasicPage.Stack`, on the headings' line like any\n * card's rows; 12px inside a sheet, a card, or a dialog, where it is a\n * field among fields and its words line up with theirs.\n */\nconst SCOPE_SURFACE =\n \"group/scope w-full min-w-0 overflow-clip rounded-base border border-pho-secondary bg-pho-primary [--scope-inset:var(--choice-card-inset,0.75rem)]\";\n\n/** The side padding every row of the card shares. */\nconst SCOPE_INSET = \"px-[var(--scope-inset)]\";\n\n/**\n * The search, the card's first row: no box of its own. The magnifier stands\n * on the checkbox column and the query on the names' line, the count at the\n * row's end and, on a collapsible list, the ✕ that drops the edit after it,\n * its glyph as far in from the right edge as the magnifier's from the left.\n * 44px with the hairline below, the DataTable toolbar band's height.\n */\nconst SCOPE_SEARCH_ROW =\n \"flex min-h-11 items-center gap-3 border-b border-pho-secondary px-[var(--scope-inset)]\";\n\n/**\n * Two columns once the card is wide enough: the names, as wide as the\n * longest (never past 45%), then the descriptions on one shared edge.\n * Narrower, each row stacks its description under its name.\n */\nconst SCOPE_LIST =\n \"grid grid-cols-1 group-data-[wide]/scope:grid-cols-[fit-content(45%)_minmax(0,1fr)] group-data-[wide]/scope:gap-x-4\";\n\n/** A group: its band and its rows, on the list's columns. */\nconst SCOPE_GROUP =\n \"col-span-full grid grid-cols-subgrid border-t border-pho-secondary first:border-t-0\";\n\n/**\n * One row: 36px on the wide layout — a 20px line and 8px either side. Only\n * the stacked layout's row gap is set: the columns' gap is the list's, and\n * a subgrid that set its own would let a long name run into its\n * description.\n */\nconst SCOPE_ROW =\n \"group col-span-full flex min-w-0 cursor-pointer flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 transition-colors select-none hover:bg-pho-primary-hover group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center data-[disabled]:cursor-not-allowed data-[disabled]:hover:bg-transparent\";\n\n/** A bone row: a row's layout, nothing to hover or click. */\nconst SCOPE_BONE_ROW =\n \"col-span-full flex min-w-0 flex-col gap-y-0.5 px-[var(--scope-inset)] py-2 group-data-[wide]/scope:grid group-data-[wide]/scope:grid-cols-subgrid group-data-[wide]/scope:items-center\";\n\n/**\n * A group's band — DataTable's section wash, thinner than the rows it\n * heads, with the group's own checkbox on the rows' checkbox column.\n */\nconst SCOPE_GROUP_BAND =\n \"group col-span-full flex h-8 min-w-0 cursor-pointer items-center gap-2 border-b border-pho-secondary bg-pho-page px-[var(--scope-inset)] text-xs font-medium text-pho-secondary select-none data-[disabled]:cursor-not-allowed\";\n\n/**\n * A description: under the name (two lines at most) on the narrow layout,\n * one line in its own column on the wide one — the rest opens on hover.\n */\nconst SCOPE_DESCRIPTION =\n \"line-clamp-2 min-w-0 pl-6 text-xs text-pho-description group-data-[wide]/scope:block group-data-[wide]/scope:truncate group-data-[wide]/scope:pl-0\";\n\n/** The folded summary: two lines, the whole card its hit target. */\nconst SCOPE_SUMMARY =\n \"flex w-full min-w-0 items-center gap-3 py-2.5 pr-2 pl-[var(--scope-inset)] text-left outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-2\";\n\n/** Two columns (names, then descriptions) from this card width up. */\nconst WIDE_REM = 34;\n/** The count stands in the search row from this card width up. */\nconst ROOMY_REM = 18;\n\n/**\n * The card's width against the two breakpoints, measured before paint and\n * followed as it changes. Desktop-first until measured, so a server render\n * shows the common layout.\n */\nfunction useCardWidth(ref: RefObject<HTMLElement | null>) {\n const [size, setSize] = useState({ wide: true, roomy: true });\n useLayoutEffect(() => {\n const node = ref.current;\n if (node == null) return;\n const measure = () => {\n const rem =\n parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n const width = node.getBoundingClientRect().width;\n const next = {\n wide: width >= WIDE_REM * rem,\n roomy: width >= ROOMY_REM * rem,\n };\n setSize((current) =>\n current.wide === next.wide && current.roomy === next.roomy\n ? current\n : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n return () => observer.disconnect();\n }, [ref]);\n return size;\n}\n\n/* -------------------------------- model --------------------------------- */\n\ninterface ScopeGroup {\n label: string | null;\n items: ScopeItem[];\n}\n\n/** Items by group, groups in first-appearance order, ungrouped first. */\nfunction groupItems(items: readonly ScopeItem[]): ScopeGroup[] {\n const groups: ScopeGroup[] = [];\n const byLabel = new Map<string | null, ScopeGroup>();\n for (const item of items) {\n const label = item.group ?? null;\n let group = byLabel.get(label);\n if (!group) {\n group = { label, items: [] };\n byLabel.set(label, group);\n groups.push(group);\n }\n group.items.push(item);\n }\n return [\n ...groups.filter((group) => group.label === null),\n ...groups.filter((group) => group.label !== null),\n ];\n}\n\n/**\n * Lowercase, with the separators ids are written in (`.`, `:`, `-`, `_`,\n * `/`) read as spaces — `call ended` finds `call.ended`.\n */\nfunction normalize(text: string): string {\n return text.toLowerCase().replace(/[.:\\-_/]/g, \" \");\n}\n\nfunction tokenize(query: string): string[] {\n return normalize(query).split(/\\s+/).filter(Boolean);\n}\n\n/** Every word of the query somewhere in the group, name, or description. */\nfunction matches(\n tokens: readonly string[],\n ...fields: (string | null | undefined)[]\n) {\n const haystack = normalize(fields.filter(Boolean).join(\" \"));\n return tokens.every((token) => haystack.includes(token));\n}\n\nfunction nameOf(item: ScopeItem): string {\n return item.label ?? item.value;\n}\n\n/** The same values, whatever their order. */\nfunction sameSelection(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false;\n const held = new Set(a);\n return b.every((value) => held.has(value));\n}\n\n/** Whether a description shows whole, measured when the pointer asks. */\nfunction isClipped(target: EventTarget | null | undefined): boolean {\n if (!(target instanceof Element)) return false;\n const text = target.closest<HTMLElement>(\"[data-scope-description]\");\n if (text == null) return false;\n return (\n text.scrollWidth > text.clientWidth + 1 ||\n text.scrollHeight > text.clientHeight + 1\n );\n}\n\n/* ------------------------------- component ------------------------------- */\n\n/**\n * A searchable, grouped checklist for choosing what something covers.\n *\n * Every row is one line on a wide card — the name, then its description in\n * a second column that opens whole on hover when it doesn't fit. Groups are\n * thin tinted bands carrying a checkbox for the whole group (mixed when\n * partly chosen). The search matches names, descriptions, and group names,\n * word by word; while it holds a query the catch-all row steps aside and a\n * group's checkbox covers the rows it shows.\n *\n * With `collapsible`, the card rests as a summary — whole groups by name,\n * the rest by item, over a count — and opens in place, the search taking\n * focus, when clicked; its ✕ drops the edit and folds it back, the page's\n * own save below the card commits it. Values the catalog no longer offers keep a row\n * under \"No longer offered\": they can be removed, never added in bulk.\n */\nexport function Scope({\n items,\n value: valueProp,\n defaultValue,\n onValueChange,\n all,\n placeholder = \"Search\",\n collapsible = false,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n loading = false,\n disabled = false,\n className,\n ref,\n ...props\n}: ScopeProps) {\n const [innerValue, setInnerValue] = useState<readonly string[]>(\n defaultValue ?? [],\n );\n const value = valueProp ?? innerValue;\n const [innerOpen, setInnerOpen] = useState(defaultOpen);\n const open = collapsible ? (openProp ?? innerOpen) : true;\n const [query, setQuery] = useState(\"\");\n\n const reduceMotion = useReducedMotion();\n const cardRef = useRef<HTMLDivElement | null>(null);\n const { wide, roomy } = useCardWidth(cardRef);\n const baseId = useId();\n const listId = `${baseId}-list`;\n const searchRef = useRef<HTMLInputElement | null>(null);\n const summaryRef = useRef<HTMLButtonElement | null>(null);\n // Where focus goes once the next face has mounted — set only by our own\n // controls, so a host flipping `open` doesn't pull focus around.\n const focusNext = useRef<\"search\" | \"summary\" | null>(null);\n const handle = useMemo(() => BaseTooltip.createHandle<string>(), []);\n\n const groups = useMemo(() => groupItems(items), [items]);\n const offered = useMemo(\n () => new Set(items.map((item) => item.value)),\n [items],\n );\n // Ids go by catalog position: values may hold characters an id shouldn't.\n const position = useMemo(\n () => new Map(items.map((item, index) => [item.value, index])),\n [items],\n );\n const groupPosition = useMemo(\n () => new Map(groups.map((group, index) => [group.label, index])),\n [groups],\n );\n\n // Values held that the catalog doesn't offer. Remembered while mounted,\n // so one unticked stays on the list and can be ticked back.\n const retiredSeen = useRef<string[]>([]);\n for (const held of value) {\n if (\n held !== all?.value &&\n !offered.has(held) &&\n !retiredSeen.current.includes(held)\n ) {\n retiredSeen.current.push(held);\n }\n }\n const retired = retiredSeen.current.filter((held) => !offered.has(held));\n\n const wildcard = all?.value;\n const selected = new Set(value);\n const everything = wildcard !== undefined && selected.has(wildcard);\n const isOn = (item: string) =>\n everything ? offered.has(item) : selected.has(item);\n const offeredOn = items.filter((item) => isOn(item.value)).length;\n const retiredOn = retired.filter((held) => selected.has(held)).length;\n\n const setValue = (next: string[]) => {\n if (valueProp === undefined) setInnerValue(next);\n onValueChange?.(next);\n };\n /** Catalog order, then what's no longer offered in the order it was held. */\n const emit = (next: Set<string>) =>\n setValue([\n ...items.filter((item) => next.has(item.value)).map((item) => item.value),\n ...retired.filter((held) => next.has(held)),\n ]);\n /** The selection by name — under the wildcard, every item it stands for. */\n const explicit = () =>\n everything\n ? new Set(items.map((item) => item.value))\n : new Set(value.filter((held) => held !== wildcard));\n const toggle = (values: readonly string[], on: boolean) => {\n const next = explicit();\n for (const item of values) {\n if (on) next.add(item);\n else next.delete(item);\n }\n emit(next);\n };\n const toggleAll = (on: boolean) => {\n if (wildcard === undefined) {\n toggle(\n items.map((item) => item.value),\n on,\n );\n } else if (on) {\n setValue([wildcard]);\n } else {\n emit(new Set(items.map((item) => item.value)));\n }\n };\n\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setInnerOpen(next);\n onOpenChange?.(next);\n };\n const unfold = () => {\n focusNext.current = \"search\";\n setOpen(true);\n };\n const fold = () => {\n focusNext.current = \"summary\";\n setQuery(\"\");\n setOpen(false);\n };\n\n // The selection as it stood when the list opened, whoever opened it:\n // dismissing the edit puts it back.\n const valueRef = useRef(value);\n valueRef.current = value;\n const openedWith = useRef<readonly string[] | null>(open ? value : null);\n useEffect(() => {\n openedWith.current = open ? valueRef.current : null;\n // Folded by the page (after its save) or by the ✕, the next opening\n // starts from the whole list.\n if (!open) setQuery(\"\");\n }, [open]);\n /** The ✕ (or Escape): the edit is dropped and the list folds. */\n const dismiss = () => {\n const before = openedWith.current;\n if (before != null && !sameSelection(before, valueRef.current)) {\n setValue([...before]);\n }\n fold();\n };\n\n // Focus lands once the face can take it: it fades in, and a field asked\n // to focus on its first frame may still refuse. Try a frame at a time.\n useEffect(() => {\n const target = focusNext.current;\n if (target == null) return;\n focusNext.current = null;\n let frame = 0;\n let tries = 0;\n const attempt = () => {\n const node = target === \"search\" ? searchRef.current : summaryRef.current;\n if (node == null) return;\n node.focus();\n if (document.activeElement !== node && tries++ < 5) {\n frame = requestAnimationFrame(attempt);\n }\n };\n frame = requestAnimationFrame(attempt);\n return () => cancelAnimationFrame(frame);\n }, [open]);\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n // A search, not the form's submit.\n if (event.key === \"Enter\") event.preventDefault();\n if (event.key !== \"Escape\") return;\n if (query !== \"\") {\n // Ours — not an enclosing dialog's or aside's close.\n event.preventDefault();\n setQuery(\"\");\n } else if (collapsible && !disabled) {\n event.preventDefault();\n dismiss();\n }\n };\n\n const tokens = tokenize(query);\n const searching = tokens.length > 0;\n const shownGroups = groups\n .map((group) => ({\n ...group,\n items: searching\n ? group.items.filter((item) =>\n matches(\n tokens,\n group.label,\n item.value,\n item.label,\n item.description,\n ),\n )\n : group.items,\n }))\n .filter((group) => group.items.length > 0);\n const shownRetired = searching\n ? retired.filter((held) => matches(tokens, held))\n : retired;\n\n // The count reads the catalog: under the wildcard every item is in and\n // more will be, so it steps aside for the catch-all's own words.\n const count =\n everything || items.length === 0 ? null : `${offeredOn} of ${items.length}`;\n\n const summary = (() => {\n if (everything && all) {\n return { title: all.label, detail: all.description ?? \"\" };\n }\n if (\n all &&\n wildcard === undefined &&\n items.length > 0 &&\n offeredOn === items.length &&\n retiredOn === 0\n ) {\n return { title: all.label, detail: all.description ?? count ?? \"\" };\n }\n // Whole groups by name, the rest item by item. A group of one is just\n // its item: the id says more than the heading over it.\n const names: string[] = [];\n for (const group of groups) {\n const on = group.items.filter((item) => isOn(item.value));\n if (\n group.label !== null &&\n group.items.length > 1 &&\n on.length === group.items.length\n ) {\n names.push(group.label);\n } else {\n names.push(...on.map(nameOf));\n }\n }\n names.push(...retired.filter((held) => selected.has(held)));\n return {\n title: names.length > 0 ? names.join(\", \") : \"None\",\n detail: count ?? \"\",\n };\n })();\n\n const rowDisabled = disabled || loading;\n // Every block that comes and goes (the folded face and the open one,\n // bones and rows, a group or a row a search sets aside) opens and closes\n // on `BasicPage.Reveal`'s motion.\n const reveal = revealIn(reduceMotion);\n\n /**\n * One row. A retired row is a value the catalog no longer offers: its\n * name goes quiet and it has no description to show.\n */\n const renderRow = (item: ScopeItem, retiredRow = false) => {\n const rowId = retiredRow\n ? `${baseId}-r${retired.indexOf(item.value)}`\n : `${baseId}-i${position.get(item.value)}`;\n const nameId = `${rowId}-name`;\n const descriptionId = `${rowId}-description`;\n return (\n <motion.label\n key={item.value}\n {...reveal}\n className={cn(SCOPE_ROW, \"overflow-hidden\")}\n data-scope-row=\"\"\n data-disabled={rowDisabled || undefined}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Checkbox\n size=\"sm\"\n checked={isOn(item.value)}\n disabled={rowDisabled}\n aria-labelledby={nameId}\n aria-describedby={item.description ? descriptionId : undefined}\n onCheckedChange={(on: boolean) => toggle([item.value], on)}\n />\n <span\n id={nameId}\n className={cn(\n \"truncate text-base\",\n retiredRow ? \"text-pho-description\" : \"text-pho-secondary\",\n )}\n >\n {nameOf(item)}\n </span>\n </span>\n {item.description ? (\n <Tooltip.Trigger\n handle={handle}\n payload={item.description}\n render={\n <span\n id={descriptionId}\n data-scope-description=\"\"\n className={SCOPE_DESCRIPTION}\n />\n }\n >\n {item.description}\n </Tooltip.Trigger>\n ) : null}\n </motion.label>\n );\n };\n\n const renderGroup = (group: ScopeGroup) => {\n // Ungrouped items stand on the list's own columns.\n if (group.label === null) {\n return group.items.map((item) => renderRow(item));\n }\n const labelId = `${baseId}-g${groupPosition.get(group.label)}`;\n const members = group.items.map((item) => item.value);\n const on = members.filter(isOn).length;\n const checked = on === members.length;\n return (\n <motion.div\n key={`group:${group.label}`}\n {...reveal}\n // A fieldset's min-content width and legend layout don't sit on the\n // list's grid; the role says the same.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-labelledby={labelId}\n className={cn(SCOPE_GROUP, \"overflow-hidden\")}\n >\n <label\n className={SCOPE_GROUP_BAND}\n data-disabled={rowDisabled || undefined}\n >\n <Checkbox\n size=\"sm\"\n checked={checked}\n indeterminate={on > 0 && !checked}\n disabled={rowDisabled}\n aria-labelledby={labelId}\n onCheckedChange={(next: boolean) => toggle(members, next)}\n />\n <span id={labelId} className=\"truncate\">\n {group.label}\n </span>\n {/* The rows it heads — while searching, the ones that match. */}\n <span className=\"text-pho-description tabular-nums\">\n {members.length}\n </span>\n </label>\n <AnimatePresence initial={false}>\n {group.items.map((item) => renderRow(item))}\n </AnimatePresence>\n </motion.div>\n );\n };\n\n const retiredGroup =\n shownRetired.length > 0 ? (\n <motion.div\n key=\"retired\"\n {...reveal}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-labelledby={`${baseId}-retired`}\n className={cn(SCOPE_GROUP, \"overflow-hidden\")}\n >\n <div className={cn(SCOPE_GROUP_BAND, \"cursor-default\")}>\n {/* The checkbox column stays: nothing here is added in bulk. */}\n <span aria-hidden className=\"size-4 shrink-0\" />\n <span id={`${baseId}-retired`} className=\"truncate\">\n No longer offered\n </span>\n </div>\n <AnimatePresence initial={false}>\n {shownRetired.map((held) => renderRow({ value: held }, true))}\n </AnimatePresence>\n </motion.div>\n ) : null;\n\n const allRow = all ? (\n <motion.label\n key=\"all\"\n {...reveal}\n className={cn(SCOPE_ROW, \"overflow-hidden\")}\n data-scope-row=\"\"\n data-disabled={\n rowDisabled || (everything && items.length === 0) || undefined\n }\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <Checkbox\n size=\"sm\"\n checked={\n wildcard === undefined\n ? items.length > 0 && offeredOn === items.length\n : everything\n }\n indeterminate={\n wildcard === undefined\n ? offeredOn > 0 && offeredOn < items.length\n : !everything && offeredOn + retiredOn > 0\n }\n // With no catalog to spell out, leaving the wildcard could only\n // mean nothing.\n disabled={rowDisabled || (everything && items.length === 0)}\n aria-labelledby={`${baseId}-all`}\n aria-describedby={\n all.description ? `${baseId}-all-description` : undefined\n }\n onCheckedChange={(on: boolean) => toggleAll(on)}\n />\n <span\n id={`${baseId}-all`}\n className=\"text-pho-primary truncate text-base font-medium\"\n >\n {all.label}\n </span>\n </span>\n {all.description ? (\n <span id={`${baseId}-all-description`} className={SCOPE_DESCRIPTION}>\n {all.description}\n </span>\n ) : null}\n </motion.label>\n ) : null;\n\n const nothing =\n searching && shownGroups.length === 0 && shownRetired.length === 0 ? (\n <motion.p\n key=\"nothing\"\n {...reveal}\n className={cn(\n \"text-pho-description col-span-full overflow-hidden text-center text-base\",\n SCOPE_INSET,\n )}\n >\n <span className=\"block py-6\">Nothing matches “{query}”.</span>\n </motion.p>\n ) : null;\n\n const list = (\n <motion.div\n key=\"list\"\n {...reveal}\n id={listId}\n className={cn(SCOPE_LIST, \"overflow-hidden\")}\n >\n <AnimatePresence initial={false}>\n {!searching ? allRow : null}\n {shownGroups.map(renderGroup)}\n {retiredGroup}\n {nothing}\n </AnimatePresence>\n </motion.div>\n );\n\n // The bones are the list's own shape — the catch-all row, a group's\n // band, rows with their descriptions — so the rows open into it.\n const bones = (\n <motion.div\n key=\"bones\"\n {...reveal}\n aria-hidden\n className={cn(SCOPE_LIST, \"overflow-hidden\")}\n >\n {[\n { band: false, name: \"w-20\", text: \"w-44\" },\n { band: true, name: \"w-12\", text: \"\" },\n { band: false, name: \"w-28\", text: \"w-56\" },\n { band: false, name: \"w-32\", text: \"w-48\" },\n { band: false, name: \"w-24\", text: \"w-60\" },\n ].map((bone, index) =>\n bone.band ? (\n <div\n key={index}\n className={cn(\n \"border-pho-secondary bg-pho-page col-span-full flex h-8 items-center gap-2 border-y\",\n SCOPE_INSET,\n )}\n >\n <Skeleton className=\"size-4 rounded-sm\" />\n <Skeleton className={cn(\"h-3\", bone.name)} />\n </div>\n ) : (\n <div key={index} className={SCOPE_BONE_ROW}>\n <span className=\"flex h-5 min-w-0 items-center gap-2\">\n <Skeleton className=\"size-4 shrink-0 rounded-sm\" />\n <Skeleton className={cn(\"h-3.5 max-w-full\", bone.name)} />\n </span>\n <span className=\"flex h-4.5 items-center pl-6 group-data-[wide]/scope:pl-0\">\n <Skeleton className={cn(\"h-3 max-w-full\", bone.text)} />\n </span>\n </div>\n ),\n )}\n </motion.div>\n );\n\n const picker = (\n <motion.div key=\"picker\" {...reveal} className=\"overflow-hidden\">\n <div className={SCOPE_SEARCH_ROW}>\n <GhostSearch\n ref={searchRef}\n value={query}\n onChange={setQuery}\n onClear={() => setQuery(\"\")}\n onKeyDown={onSearchKeyDown}\n placeholder={placeholder}\n aria-label={placeholder}\n aria-controls={loading ? undefined : listId}\n disabled={loading}\n trailing={\n count != null && !loading ? (\n // A card too narrow for both gives the room to the query; the\n // folded summary carries the count there.\n <span className=\"hidden group-data-[roomy]/scope:inline\">\n {count}\n </span>\n ) : undefined\n }\n autoComplete=\"off\"\n spellCheck={false}\n />\n {collapsible ? (\n <CloseButton\n size=\"sm\"\n label=\"Cancel\"\n // Held open while the page saves: dropping the edit now would\n // show the old selection under a save that sends the new one.\n disabled={disabled}\n onClick={dismiss}\n // Out by its own padding: the ✕ stands as far from the right\n // edge as the magnifier from the left. Its ring inside, as a\n // Button's: the blocks around it clip.\n className=\"-mr-2 shrink-0 focus-visible:-outline-offset-2\"\n />\n ) : null}\n </div>\n <AnimatePresence initial={false}>\n {loading ? bones : list}\n </AnimatePresence>\n </motion.div>\n );\n\n // The bones stand in the two lines' own boxes, so the card keeps its\n // height when the words arrive.\n const summaryText = loading ? (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"flex h-5 items-center\">\n <Skeleton className=\"h-3.5 w-48 max-w-full\" />\n </span>\n <span className=\"flex h-4.5 items-center\">\n <Skeleton className=\"h-3 w-16\" />\n </span>\n </span>\n ) : (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"text-pho-primary truncate text-base\">\n {summary.title}\n </span>\n {summary.detail ? (\n <span className=\"text-pho-description truncate text-xs tabular-nums\">\n {summary.detail}\n </span>\n ) : null}\n </span>\n );\n\n const folded = (\n <motion.div key=\"folded\" {...reveal} className=\"overflow-hidden\">\n {disabled || loading ? (\n <div className={SCOPE_SUMMARY}>{summaryText}</div>\n ) : (\n <button\n ref={summaryRef}\n type=\"button\"\n aria-expanded={false}\n className={cn(\n SCOPE_SUMMARY,\n \"group hover:bg-pho-primary-hover cursor-pointer transition-colors\",\n )}\n onClick={unfold}\n >\n {summaryText}\n <span\n aria-hidden\n className={buttonVariants({\n variant: \"ghost\",\n size: \"sm\",\n className:\n \"group-hover:bg-pho-ghost-hover group-hover:text-pho-secondary-hover pointer-events-none shrink-0\",\n })}\n >\n Edit\n </span>\n </button>\n )}\n </motion.div>\n );\n\n return (\n <div\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-busy={loading || undefined}\n data-scope=\"\"\n data-open={open ? \"\" : undefined}\n data-wide={wide ? \"\" : undefined}\n data-roomy={roomy ? \"\" : undefined}\n className={cn(SCOPE_SURFACE, className)}\n {...props}\n ref={(node: HTMLDivElement | null) => {\n cardRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref != null) ref.current = node;\n }}\n >\n {/* Folding and opening, the faces trade places on Reveal's motion:\n the one leaving closes as the one arriving opens, and the card's\n height is theirs. */}\n <AnimatePresence initial={false}>\n {open ? picker : folded}\n </AnimatePresence>\n <Tooltip.Root\n handle={handle}\n onOpenChange={(next, details) => {\n // Only a description the row cuts short opens.\n if (next && !isClipped(details.event?.target)) details.cancel();\n }}\n >\n {({ payload }) => (\n <Tooltip.Portal>\n <Tooltip.Positioner side=\"top\" align=\"start\">\n <Tooltip.Popup className=\"max-w-80 font-normal\">\n {payload}\n </Tooltip.Popup>\n </Tooltip.Positioner>\n </Tooltip.Portal>\n )}\n </Tooltip.Root>\n </div>\n );\n}\n\nScope.displayName = \"Scope\";\n"],"mappings":";;;;;;;;;;;;;AA2HA,IAAM,KACJ,qJAGI,KAAc,2BASd,KACJ,0FAOI,KACJ,uHAGI,KACJ,uFAQI,KACJ,gVAGI,KACJ,0LAMI,KACJ,kOAMI,KACJ,sJAGI,KACJ,kKAGI,KAAW,IAEX,KAAY;AAOlB,SAAS,GAAa,GAAoC;AACxD,QAAM,CAAC,GAAM,CAAA,IAAW,EAAS;AAAA,IAAE,MAAM;AAAA,IAAM,OAAO;AAAA,EAAK,CAAC;AAC5D,SAAA,GAAA,MAAsB;AACpB,UAAM,IAAO,EAAI;AACjB,QAAI,KAAQ,KAAM;AAClB,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AI,UAAU;AAAA,IACtC;AAAA,IAdF,UAAA,CAmBE,gBAAA,EAAC,GAAD;AAAA,MAAiB,SAAS;AAAA,MACvB,UAAA,IAAO,KAAS;AAAA,IACF,CAAA,GACjB,gBAAA,EAAC,EAAQ,MAAT;AAAA,MACU,QAAA;AAAA,MACR,cAAA,CAAe,GAAM,MAAY;AAE/B,QAAI,KAAQ,CAAC,GAAU,EAAQ,OAAO,MAAM,KAAG,EAAQ,OAAO;AAAA,MAChE;AAAA,MAEE,UAAA,CAAA,EAAE,SAAA,EAAA,MACF,gBAAA,EAAC,EAAQ,QAAT,EAAA,UACE,gBAAA,EAAC,EAAQ,YAAT;AAAA,QAAoB,MAAK;AAAA,QAAM,OAAM;AAAA,QACnC,UAAA,gBAAA,EAAC,EAAQ,OAAT;AAAA,UAAe,WAAU;AAAA,UACtB,UAAA;AAAA,QACY,CAAA;AAAA,MACG,CAAA,EACN,CAAA;AAAA,IAEN,CAAA,CACX;AAAA;AAET;AAEA,GAAM,cAAc"}
|
package/dist/components/trace.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as s, B as e, C as i, D as n, E as l, F as r, I as t, L as o, M as p, N as c, O as T, P as u, R as I, S, T as m, V as d, _ as v, a as b, b as V, c as w, d as f, f as D, g as L, h as _, i as k, j as x, k as g, l as A, m as E, n as F, o as N, p as y, r as z, s as B, t as O, u as P, v as R, w as W, x as C, y as G, z as K } from "../chunks/trace-
|
|
2
|
+
import { A as s, B as e, C as i, D as n, E as l, F as r, I as t, L as o, M as p, N as c, O as T, P as u, R as I, S, T as m, V as d, _ as v, a as b, b as V, c as w, d as f, f as D, g as L, h as _, i as k, j as x, k as g, l as A, m as E, n as F, o as N, p as y, r as z, s as B, t as O, u as P, v as R, w as W, x as C, y as G, z as K } from "../chunks/trace-DyjsBY-S.js";
|
|
3
3
|
export {
|
|
4
4
|
i as FULL_VIEW,
|
|
5
5
|
y as GEN_AI_KINDS,
|