@photon-ai/pho-ui 4.13.0 → 4.14.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.
@@ -1,272 +1,310 @@
1
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({
2
+ import { t as d } from "../chunks/cn-ChIgwEl3.js";
3
+ import { revealIn as st } from "../motion.js";
4
+ import { u as at } from "../chunks/button-C9VqBBIr.js";
5
+ import { t as ye } from "../chunks/IconCheck-D2WuculQ.js";
6
+ import { t as it } from "../chunks/IconChevronDown-CZilB71T.js";
7
+ import { t as ct } from "../chunks/close-button-GvqWbLl0.js";
8
+ import { r as ce } from "../chunks/checkbox-CwvoEJhd.js";
9
+ import { t as I } from "../chunks/skeleton-DwjSl4vC.js";
10
+ import { t as dt } from "../chunks/ghost-search-8PzP73zS.js";
11
+ import { t as A } from "../chunks/tooltip-BTF7GChl.js";
12
+ import { t as p } from "../chunks/select-COFV0NLb.js";
13
+ import { useEffect as Ne, useId as ut, useLayoutEffect as pt, useMemo as G, useRef as S, useState as X } from "react";
14
+ import { jsx as n, jsxs as l } from "react/jsx-runtime";
15
+ import { AnimatePresence as H, motion as y, useReducedMotion as ht } from "motion/react";
16
+ import { Field as ft } from "@base-ui/react/field";
17
+ import { Tooltip as mt } from "@base-ui/react/tooltip";
18
+ var vt = "group/scope relative w-full min-w-0 overflow-clip rounded-base border border-pho-secondary bg-pho-primary [--scope-inset:var(--choice-card-inset,0.75rem)]", Se = "px-[var(--scope-inset)]", gt = "flex min-h-11 items-center gap-3 border-b border-pho-secondary px-[var(--scope-inset)]", bt = "text-pho-secondary hover:bg-pho-ghost-hover hover:text-pho-secondary-hover data-[popup-open]:bg-pho-ghost-hover outline-pho-brand shrink-0 gap-1.5 rounded-full py-1.5 pr-2 pl-3 font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid", de = "custom", Ce = "grid grid-cols-1 group-data-[wide]/scope:grid-cols-[fit-content(45%)_minmax(0,1fr)] group-data-[wide]/scope:gap-x-4", Oe = "col-span-full grid grid-cols-subgrid border-t border-pho-secondary first:border-t-0", Ee = "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", wt = "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", ke = "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", Ie = "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", Re = "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", xt = 34, yt = 18;
19
+ function Nt(r) {
20
+ const [s, m] = X({
17
21
  wide: !0,
18
22
  roomy: !0
23
+ }), i = S({
24
+ face: 0,
25
+ list: 0,
26
+ bones: 0
19
27
  });
20
- return en(() => {
28
+ return pt(() => {
21
29
  const o = r.current;
22
30
  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
31
+ const c = () => {
32
+ i.current.face = o.clientHeight;
33
+ const C = o.querySelector("[data-scope-list]");
34
+ C != null && (i.current.list = C.offsetHeight);
35
+ const z = o.querySelector("[data-scope-bones]");
36
+ z != null && (i.current.bones = z.offsetHeight);
37
+ const L = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16, W = o.getBoundingClientRect().width, u = {
38
+ wide: W >= xt * L,
39
+ roomy: W >= yt * L
27
40
  };
28
- p((I) => I.wide === _.wide && I.roomy === _.roomy ? I : _);
41
+ m((g) => g.wide === u.wide && g.roomy === u.roomy ? g : u);
29
42
  };
30
- s();
31
- const u = new ResizeObserver(s);
32
- return u.observe(o), () => u.disconnect();
33
- }, [r]), a;
43
+ c();
44
+ const _ = new ResizeObserver(c);
45
+ return _.observe(o), () => _.disconnect();
46
+ }, [r]), {
47
+ ...s,
48
+ heights: i
49
+ };
34
50
  }
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,
51
+ function St(r) {
52
+ const s = [], m = /* @__PURE__ */ new Map();
53
+ for (const i of r) {
54
+ const o = i.group ?? null;
55
+ let c = m.get(o);
56
+ c || (c = {
57
+ label: o,
42
58
  items: []
43
- }, p.set(s, u), a.push(u)), u.items.push(o);
59
+ }, m.set(o, c), s.push(c)), c.items.push(i);
44
60
  }
45
- return [...a.filter((o) => o.label === null), ...a.filter((o) => o.label !== null)];
61
+ return [...s.filter((i) => i.label === null), ...s.filter((i) => i.label !== null)];
46
62
  }
47
- function Se(r) {
63
+ function ze(r) {
48
64
  return r.toLowerCase().replace(/[.:\-_/]/g, " ");
49
65
  }
50
- function un(r) {
51
- return Se(r).split(/\s+/).filter(Boolean);
66
+ function Ct(r) {
67
+ return ze(r).split(/\s+/).filter(Boolean);
52
68
  }
53
- function ye(r, ...a) {
54
- const p = Se(a.filter(Boolean).join(" "));
55
- return r.every((o) => p.includes(o));
69
+ function Pe(r, ...s) {
70
+ const m = ze(s.filter(Boolean).join(" "));
71
+ return r.every((i) => m.includes(i));
56
72
  }
57
- function Ce(r) {
73
+ function $e(r) {
58
74
  return r.label ?? r.value;
59
75
  }
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));
76
+ function _e(r, s) {
77
+ if (r.length !== s.length) return !1;
78
+ const m = new Set(r);
79
+ return s.every((i) => m.has(i));
80
+ }
81
+ function J(r, s) {
82
+ return {
83
+ ...r,
84
+ initial: {
85
+ ...r.initial,
86
+ height: s
87
+ },
88
+ exit: { opacity: 0 }
89
+ };
64
90
  }
65
- function hn(r) {
91
+ function Ot(r) {
66
92
  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;
93
+ const s = r.closest("[data-scope-description]");
94
+ return s == null ? !1 : s.scrollWidth > s.clientWidth + 1 || s.scrollHeight > s.clientHeight + 1;
69
95
  }
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
+ function Et({ items: r, value: s, defaultValue: m, onValueChange: i, all: o, presets: c, placeholder: _ = "Search", collapsible: C = !1, open: z, defaultOpen: L = !1, onOpenChange: W, loading: u = !1, disabled: g = !1, className: Te, ref: B, ...Me }) {
97
+ const [De, Ae] = X(m ?? []), O = s ?? De, [Ge, He] = X(L), E = C ? z ?? Ge : !0, [F, T] = X(""), Le = ht(), ue = S(null), { wide: We, roomy: Be, heights: V } = Nt(ue), v = ut(), pe = `${v}-list`, he = S(null), fe = S(null), q = S(null), me = G(() => mt.createHandle(), []), U = G(() => St(r), [r]), j = G(() => new Set(r.map((e) => e.value)), [r]), Fe = G(() => new Map(r.map((e, t) => [e.value, t])), [r]), Ve = G(() => new Map(U.map((e, t) => [e.label, t])), [U]), Z = S([]);
98
+ for (const e of O) e !== o?.value && !j.has(e) && !Z.current.includes(e) && Z.current.push(e);
99
+ const k = Z.current.filter((e) => !j.has(e)), f = o?.value, M = new Set(O), N = f !== void 0 && M.has(f), K = (e) => N ? j.has(e) : M.has(e), R = r.filter((e) => K(e.value)).length, ee = k.filter((e) => M.has(e)).length, Y = (e) => {
100
+ s === void 0 && Ae(e), i?.(e);
101
+ }, te = (e) => Y([...r.filter((t) => e.has(t.value)).map((t) => t.value), ...k.filter((t) => e.has(t))]), qe = () => N ? new Set(r.map((e) => e.value)) : new Set(O.filter((e) => e !== f)), ne = (e, t) => {
102
+ const a = qe();
103
+ for (const h of e) t ? a.add(h) : a.delete(h);
104
+ te(a);
105
+ }, Ue = (e) => {
106
+ f === void 0 ? ne(r.map((t) => t.value), e) : e ? Y([f]) : te(new Set(r.map((t) => t.value)));
107
+ }, re = (e) => e.filter((t) => t === f || j.has(t)), P = u || r.length === 0 ? void 0 : c?.find((e) => {
108
+ const t = re(e.value);
109
+ return t.length > 0 && _e(t, re(O));
110
+ }), je = (e) => {
111
+ const t = re(e.value);
112
+ f !== void 0 && t.includes(f) ? Y([f]) : te(/* @__PURE__ */ new Set([...t, ...k.filter((a) => M.has(a))]));
113
+ }, ve = (e) => {
114
+ z === void 0 && He(e), W?.(e);
115
+ }, Ke = () => {
116
+ q.current = "search", ve(!0);
117
+ }, Ye = () => {
118
+ q.current = "summary", T(""), ve(!1);
119
+ }, oe = S(O);
120
+ oe.current = O;
121
+ const ge = S(E ? O : null);
122
+ Ne(() => {
123
+ ge.current = E ? oe.current : null, E || T("");
124
+ }, [E]);
125
+ const be = () => {
126
+ const e = ge.current;
127
+ e != null && !_e(e, oe.current) && Y([...e]), Ye();
96
128
  };
97
- fe(() => {
98
- const e = B.current;
129
+ Ne(() => {
130
+ const e = q.current;
99
131
  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)));
132
+ q.current = null;
133
+ let t = 0, a = 0;
134
+ const h = () => {
135
+ const w = e === "search" ? he.current : fe.current;
136
+ w != null && (w.focus({ preventScroll: !0 }), document.activeElement !== w && a++ < 5 && (t = requestAnimationFrame(h)));
105
137
  };
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) => ({
138
+ return t = requestAnimationFrame(h), () => cancelAnimationFrame(t);
139
+ }, [E]);
140
+ const Qe = (e) => {
141
+ e.key === "Enter" && e.preventDefault(), e.key === "Escape" && (F !== "" ? (e.preventDefault(), T("")) : C && !g && (e.preventDefault(), be()));
142
+ }, le = Ct(F), Q = le.length > 0, we = U.map((e) => ({
111
143
  ...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 ?? ""
144
+ items: Q ? e.items.filter((t) => Pe(le, e.label, t.value, t.label, t.description)) : e.items
145
+ })).filter((e) => e.items.length > 0), se = Q ? k.filter((e) => Pe(le, e)) : k, D = N || r.length === 0 ? null : `${R} of ${r.length}`, ae = (() => {
146
+ if (N && o) return {
147
+ title: o.label,
148
+ detail: o.description ?? ""
117
149
  };
118
- if (s && w === void 0 && r.length > 0 && k === r.length && oe === 0) return {
119
- title: s.label,
120
- detail: s.description ?? L ?? ""
150
+ if (P && ee === 0) return {
151
+ title: P.label,
152
+ detail: P.description ?? D ?? ""
153
+ };
154
+ if (o && f === void 0 && r.length > 0 && R === r.length && ee === 0) return {
155
+ title: o.label,
156
+ detail: o.description ?? D ?? ""
121
157
  };
122
158
  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));
159
+ for (const t of U) {
160
+ const a = t.items.filter((h) => K(h.value));
161
+ t.label !== null && t.items.length > 1 && a.length === t.items.length ? e.push(t.label) : e.push(...a.map($e));
126
162
  }
127
- return e.push(...E.filter((n) => F.has(n))), {
163
+ return e.push(...k.filter((t) => M.has(t))), {
128
164
  title: e.length > 0 ? e.join(", ") : "None",
129
- detail: L ?? ""
165
+ detail: D ?? ""
130
166
  };
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"),
167
+ })(), $ = g || u, b = st(Le), ie = (e, t = !1) => {
168
+ const a = t ? `${v}-r${k.indexOf(e.value)}` : `${v}-i${Fe.get(e.value)}`, h = `${a}-name`, w = `${a}-description`;
169
+ return /* @__PURE__ */ l(y.label, {
170
+ ...b,
171
+ className: d(Ee, "overflow-hidden"),
136
172
  "data-scope-row": "",
137
- "data-disabled": R || void 0,
173
+ "data-disabled": $ || void 0,
138
174
  children: [/* @__PURE__ */ l("span", {
139
175
  className: "flex min-w-0 items-center gap-2",
140
- children: [/* @__PURE__ */ t(ne, {
176
+ children: [/* @__PURE__ */ n(ce, {
141
177
  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)
178
+ checked: K(e.value),
179
+ disabled: $,
180
+ "aria-labelledby": h,
181
+ "aria-describedby": e.description ? w : void 0,
182
+ onCheckedChange: (x) => ne([e.value], x)
183
+ }), /* @__PURE__ */ n("span", {
184
+ id: h,
185
+ className: d("truncate text-base", t ? "text-pho-description" : "text-pho-secondary"),
186
+ children: $e(e)
151
187
  })]
152
- }), e.description ? /* @__PURE__ */ t(z.Trigger, {
153
- handle: le,
188
+ }), e.description ? /* @__PURE__ */ n(A.Trigger, {
189
+ handle: me,
154
190
  payload: e.description,
155
- render: /* @__PURE__ */ t("span", {
156
- id: m,
191
+ render: /* @__PURE__ */ n("span", {
192
+ id: w,
157
193
  "data-scope-description": "",
158
- className: xe
194
+ className: Ie
159
195
  }),
160
196
  children: e.description
161
197
  }) : null]
162
198
  }, 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,
199
+ }, Je = (e) => {
200
+ if (e.label === null) return e.items.map((x) => ie(x));
201
+ const t = `${v}-g${Ve.get(e.label)}`, a = e.items.map((x) => x.value), h = a.filter(K).length, w = h === a.length;
202
+ return /* @__PURE__ */ l(y.div, {
203
+ ...b,
168
204
  role: "group",
169
- "aria-labelledby": n,
170
- className: c(ge, "overflow-hidden"),
205
+ "aria-labelledby": t,
206
+ className: d(Oe, "overflow-hidden"),
171
207
  children: [/* @__PURE__ */ l("label", {
172
- className: we,
173
- "data-disabled": R || void 0,
208
+ className: ke,
209
+ "data-disabled": $ || void 0,
174
210
  children: [
175
- /* @__PURE__ */ t(ne, {
211
+ /* @__PURE__ */ n(ce, {
176
212
  size: "sm",
177
- checked: m,
178
- indeterminate: d > 0 && !m,
179
- disabled: R,
180
- "aria-labelledby": n,
181
- onCheckedChange: (v) => Y(i, v)
213
+ checked: w,
214
+ indeterminate: h > 0 && !w,
215
+ disabled: $,
216
+ "aria-labelledby": t,
217
+ onCheckedChange: (x) => ne(a, x)
182
218
  }),
183
- /* @__PURE__ */ t("span", {
184
- id: n,
219
+ /* @__PURE__ */ n("span", {
220
+ id: t,
185
221
  className: "truncate",
186
222
  children: e.label
187
223
  }),
188
- /* @__PURE__ */ t("span", {
224
+ /* @__PURE__ */ n("span", {
189
225
  className: "text-pho-description tabular-nums",
190
- children: i.length
226
+ children: a.length
191
227
  })
192
228
  ]
193
- }), /* @__PURE__ */ t(A, {
229
+ }), /* @__PURE__ */ n(H, {
194
230
  initial: !1,
195
- children: e.items.map((v) => ee(v))
231
+ children: e.items.map((x) => ie(x))
196
232
  })]
197
233
  }, `group:${e.label}`);
198
- }, je = X.length > 0 ? /* @__PURE__ */ l(g.div, {
199
- ...f,
234
+ }, Xe = se.length > 0 ? /* @__PURE__ */ l(y.div, {
235
+ ...b,
200
236
  role: "group",
201
- "aria-labelledby": `${h}-retired`,
202
- className: c(ge, "overflow-hidden"),
237
+ "aria-labelledby": `${v}-retired`,
238
+ className: d(Oe, "overflow-hidden"),
203
239
  children: [/* @__PURE__ */ l("div", {
204
- className: c(we, "cursor-default"),
205
- children: [/* @__PURE__ */ t("span", {
240
+ className: d(ke, "cursor-default"),
241
+ children: [/* @__PURE__ */ n("span", {
206
242
  "aria-hidden": !0,
207
243
  className: "size-4 shrink-0"
208
- }), /* @__PURE__ */ t("span", {
209
- id: `${h}-retired`,
244
+ }), /* @__PURE__ */ n("span", {
245
+ id: `${v}-retired`,
210
246
  className: "truncate",
211
247
  children: "No longer offered"
212
248
  })]
213
- }), /* @__PURE__ */ t(A, {
249
+ }), /* @__PURE__ */ n(H, {
214
250
  initial: !1,
215
- children: X.map((e) => ee({ value: e }, !0))
251
+ children: se.map((e) => ie({ value: e }, !0))
216
252
  })]
217
- }, "retired") : null, He = s ? /* @__PURE__ */ l(g.label, {
218
- ...f,
219
- className: c(be, "overflow-hidden"),
253
+ }, "retired") : null, Ze = o ? /* @__PURE__ */ l(y.label, {
254
+ ...b,
255
+ className: d(Ee, "overflow-hidden"),
220
256
  "data-scope-row": "",
221
- "data-disabled": R || x && r.length === 0 || void 0,
257
+ "data-disabled": $ || N && r.length === 0 || void 0,
222
258
  children: [/* @__PURE__ */ l("span", {
223
259
  className: "flex min-w-0 items-center gap-2",
224
- children: [/* @__PURE__ */ t(ne, {
260
+ children: [/* @__PURE__ */ n(ce, {
225
261
  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`,
262
+ checked: f === void 0 ? r.length > 0 && R === r.length : N,
263
+ indeterminate: f === void 0 ? R > 0 && R < r.length : !N && R + ee > 0,
264
+ disabled: $ || N && r.length === 0,
265
+ "aria-labelledby": `${v}-all`,
266
+ "aria-describedby": o.description ? `${v}-all-description` : void 0,
267
+ onCheckedChange: (e) => Ue(e)
268
+ }), /* @__PURE__ */ n("span", {
269
+ id: `${v}-all`,
234
270
  className: "text-pho-primary truncate text-base font-medium",
235
- children: s.label
271
+ children: o.label
236
272
  })]
237
- }), s.description ? /* @__PURE__ */ t("span", {
238
- id: `${h}-all-description`,
239
- className: xe,
240
- children: s.description
273
+ }), o.description ? /* @__PURE__ */ n("span", {
274
+ id: `${v}-all-description`,
275
+ className: Ie,
276
+ children: o.description
241
277
  }) : 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),
278
+ }, "all") : null, et = Q && we.length === 0 && se.length === 0 ? /* @__PURE__ */ n(y.p, {
279
+ ...b,
280
+ className: d("text-pho-description col-span-full overflow-hidden text-center text-base", Se),
245
281
  children: /* @__PURE__ */ l("span", {
246
282
  className: "block py-6",
247
283
  children: [
248
284
  "Nothing matches “",
249
- T,
285
+ F,
250
286
  "”."
251
287
  ]
252
288
  })
253
- }, "nothing") : null, Ue = /* @__PURE__ */ t(g.div, {
254
- ...f,
255
- id: re,
256
- className: c(ve, "overflow-hidden"),
257
- children: /* @__PURE__ */ l(A, {
289
+ }, "nothing") : null, tt = /* @__PURE__ */ n(y.div, {
290
+ ...J(b, V.current.bones),
291
+ id: pe,
292
+ "data-scope-list": "",
293
+ className: d(Ce, "overflow-hidden"),
294
+ children: /* @__PURE__ */ l(H, {
258
295
  initial: !1,
259
296
  children: [
260
- H ? null : He,
261
- pe.map(Fe),
262
- je,
263
- Le
297
+ Q ? null : Ze,
298
+ we.map(Je),
299
+ Xe,
300
+ et
264
301
  ]
265
302
  })
266
- }, "list"), Ve = /* @__PURE__ */ t(g.div, {
267
- ...f,
303
+ }, "list"), nt = /* @__PURE__ */ n(y.div, {
304
+ ...J(b, V.current.list),
305
+ "data-scope-bones": "",
268
306
  "aria-hidden": !0,
269
- className: c(ve, "overflow-hidden"),
307
+ className: d(Ce, "overflow-hidden"),
270
308
  children: [
271
309
  {
272
310
  band: !1,
@@ -293,84 +331,129 @@ function fn({ items: r, value: a, defaultValue: p, onValueChange: o, all: s, pla
293
331
  name: "w-24",
294
332
  text: "w-60"
295
333
  }
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,
334
+ ].map((e, t) => e.band ? /* @__PURE__ */ l("div", {
335
+ className: d("border-pho-secondary bg-pho-page col-span-full flex h-8 items-center gap-2 border-y", Se),
336
+ children: [/* @__PURE__ */ n(I, { className: "size-4 rounded-sm" }), /* @__PURE__ */ n(I, { className: d("h-3", e.name) })]
337
+ }, t) : /* @__PURE__ */ l("div", {
338
+ className: wt,
301
339
  children: [/* @__PURE__ */ l("span", {
302
340
  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", {
341
+ children: [/* @__PURE__ */ n(I, { className: "size-4 shrink-0 rounded-sm" }), /* @__PURE__ */ n(I, { className: d("h-3.5 max-w-full", e.name) })]
342
+ }), /* @__PURE__ */ n("span", {
305
343
  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) })
344
+ children: /* @__PURE__ */ n(I, { className: d("h-3 max-w-full", e.text) })
307
345
  })]
308
- }, n))
309
- }, "bones"), qe = /* @__PURE__ */ l(g.div, {
310
- ...f,
346
+ }, t))
347
+ }, "bones"), rt = c != null && c.length > 0 ? /* @__PURE__ */ n(ft.Root, {
348
+ className: "contents",
349
+ children: /* @__PURE__ */ l(p.Root, {
350
+ items: [...c.map((e, t) => ({
351
+ value: `preset:${t}`,
352
+ label: e.label
353
+ })), {
354
+ value: de,
355
+ label: "Custom"
356
+ }],
357
+ value: P ? `preset:${c.indexOf(P)}` : de,
358
+ onValueChange: (e) => {
359
+ const t = c[Number(String(e).slice(7))];
360
+ t != null && t !== P && je(t);
361
+ },
362
+ disabled: g || u,
363
+ children: [/* @__PURE__ */ l(p.Trigger, {
364
+ variant: "inline",
365
+ "aria-label": "Preset",
366
+ className: d(bt, C ? "-mr-1" : "-mr-2"),
367
+ children: [/* @__PURE__ */ n(p.Value, {}), /* @__PURE__ */ n(p.Icon, { children: /* @__PURE__ */ n(it, {}) })]
368
+ }), /* @__PURE__ */ n(p.Portal, { children: /* @__PURE__ */ n(p.Positioner, {
369
+ align: "end",
370
+ children: /* @__PURE__ */ n(p.Popup, { children: /* @__PURE__ */ l(p.List, { children: [c.map((e, t) => /* @__PURE__ */ l(p.Item, {
371
+ value: `preset:${t}`,
372
+ children: [
373
+ /* @__PURE__ */ n(p.ItemIndicator, { children: /* @__PURE__ */ n(ye, {}) }),
374
+ /* @__PURE__ */ n(p.ItemText, { children: e.label }),
375
+ e.description ? /* @__PURE__ */ n("span", {
376
+ className: "text-pho-description col-start-2 text-xs",
377
+ children: e.description
378
+ }) : null
379
+ ]
380
+ }, t)), /* @__PURE__ */ l(p.Item, {
381
+ value: de,
382
+ disabled: !0,
383
+ children: [/* @__PURE__ */ n(p.ItemIndicator, { children: /* @__PURE__ */ n(ye, {}) }), /* @__PURE__ */ n(p.ItemText, { children: "Custom" })]
384
+ })] }) })
385
+ }) })]
386
+ })
387
+ }) : null, ot = /* @__PURE__ */ l(y.div, {
388
+ ...J(b, V.current.face),
311
389
  className: "overflow-hidden",
312
390
  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, {
391
+ className: gt,
392
+ children: [
393
+ /* @__PURE__ */ n(dt, {
394
+ ref: he,
395
+ value: F,
396
+ onChange: T,
397
+ onClear: () => T(""),
398
+ onKeyDown: Qe,
399
+ placeholder: _,
400
+ "aria-label": _,
401
+ "aria-controls": u ? void 0 : pe,
402
+ disabled: u,
403
+ trailing: D != null && !u ? /* @__PURE__ */ n("span", {
404
+ className: "hidden group-data-[roomy]/scope:inline",
405
+ children: D
406
+ }) : void 0,
407
+ autoComplete: "off",
408
+ spellCheck: !1
409
+ }),
410
+ rt,
411
+ C ? /* @__PURE__ */ n(ct, {
412
+ size: "sm",
413
+ label: "Cancel",
414
+ disabled: g,
415
+ onClick: be,
416
+ className: "-mr-2 shrink-0 focus-visible:-outline-offset-2"
417
+ }) : null
418
+ ]
419
+ }), /* @__PURE__ */ n(H, {
338
420
  initial: !1,
339
- children: b ? Ve : Ue
421
+ mode: "popLayout",
422
+ children: u ? nt : tt
340
423
  })]
341
- }, "picker"), he = b ? /* @__PURE__ */ l("span", {
424
+ }, "picker"), xe = u ? /* @__PURE__ */ l("span", {
342
425
  className: "flex min-w-0 flex-1 flex-col",
343
- children: [/* @__PURE__ */ t("span", {
426
+ children: [/* @__PURE__ */ n("span", {
344
427
  className: "flex h-5 items-center",
345
- children: /* @__PURE__ */ t(y, { className: "h-3.5 w-48 max-w-full" })
346
- }), /* @__PURE__ */ t("span", {
428
+ children: /* @__PURE__ */ n(I, { className: "h-3.5 w-48 max-w-full" })
429
+ }), /* @__PURE__ */ n("span", {
347
430
  className: "flex h-4.5 items-center",
348
- children: /* @__PURE__ */ t(y, { className: "h-3 w-16" })
431
+ children: /* @__PURE__ */ n(I, { className: "h-3 w-16" })
349
432
  })]
350
433
  }) : /* @__PURE__ */ l("span", {
351
434
  className: "flex min-w-0 flex-1 flex-col",
352
- children: [/* @__PURE__ */ t("span", {
435
+ children: [/* @__PURE__ */ n("span", {
353
436
  className: "text-pho-primary truncate text-base",
354
- children: Z.title
355
- }), Z.detail ? /* @__PURE__ */ t("span", {
437
+ children: ae.title
438
+ }), ae.detail ? /* @__PURE__ */ n("span", {
356
439
  className: "text-pho-description truncate text-xs tabular-nums",
357
- children: Z.detail
440
+ children: ae.detail
358
441
  }) : null]
359
- }), Ke = /* @__PURE__ */ t(g.div, {
360
- ...f,
442
+ }), lt = /* @__PURE__ */ n(y.div, {
443
+ ...J(b, V.current.face),
361
444
  className: "overflow-hidden",
362
- children: D || b ? /* @__PURE__ */ t("div", {
363
- className: Ne,
364
- children: he
445
+ children: g || u ? /* @__PURE__ */ n("div", {
446
+ className: Re,
447
+ children: xe
365
448
  }) : /* @__PURE__ */ l("button", {
366
- ref: ae,
449
+ ref: fe,
367
450
  type: "button",
368
451
  "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", {
452
+ className: d(Re, "group hover:bg-pho-primary-hover cursor-pointer transition-colors"),
453
+ onClick: Ke,
454
+ children: [xe, /* @__PURE__ */ n("span", {
372
455
  "aria-hidden": !0,
373
- className: Qe({
456
+ className: at({
374
457
  variant: "ghost",
375
458
  size: "sm",
376
459
  className: "group-hover:bg-pho-ghost-hover group-hover:text-pho-secondary-hover pointer-events-none shrink-0"
@@ -381,28 +464,29 @@ function fn({ items: r, value: a, defaultValue: p, onValueChange: o, all: s, pla
381
464
  }, "folded");
382
465
  return /* @__PURE__ */ l("div", {
383
466
  role: "group",
384
- "aria-busy": b || void 0,
467
+ "aria-busy": u || void 0,
385
468
  "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,
469
+ "data-open": E ? "" : void 0,
470
+ "data-wide": We ? "" : void 0,
471
+ "data-roomy": Be ? "" : void 0,
472
+ className: d(vt, Te),
473
+ ...Me,
391
474
  ref: (e) => {
392
- te.current = e, typeof W == "function" ? W(e) : W != null && (W.current = e);
475
+ ue.current = e, typeof B == "function" ? B(e) : B != null && (B.current = e);
393
476
  },
394
- children: [/* @__PURE__ */ t(A, {
477
+ children: [/* @__PURE__ */ n(H, {
395
478
  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();
479
+ mode: "popLayout",
480
+ children: E ? ot : lt
481
+ }), /* @__PURE__ */ n(A.Root, {
482
+ handle: me,
483
+ onOpenChange: (e, t) => {
484
+ e && !Ot(t.event?.target) && t.cancel();
401
485
  },
402
- children: ({ payload: e }) => /* @__PURE__ */ t(z.Portal, { children: /* @__PURE__ */ t(z.Positioner, {
486
+ children: ({ payload: e }) => /* @__PURE__ */ n(A.Portal, { children: /* @__PURE__ */ n(A.Positioner, {
403
487
  side: "top",
404
488
  align: "start",
405
- children: /* @__PURE__ */ t(z.Popup, {
489
+ children: /* @__PURE__ */ n(A.Popup, {
406
490
  className: "max-w-80 font-normal",
407
491
  children: e
408
492
  })
@@ -410,9 +494,9 @@ function fn({ items: r, value: a, defaultValue: p, onValueChange: o, all: s, pla
410
494
  })]
411
495
  });
412
496
  }
413
- fn.displayName = "Scope";
497
+ Et.displayName = "Scope";
414
498
  export {
415
- fn as Scope
499
+ Et as Scope
416
500
  };
417
501
 
418
502
  //# sourceMappingURL=scope.js.map