@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.
Files changed (38) hide show
  1. package/dist/chunks/{basic-page-CJ11ekjH.js → basic-page-6dDfY33L.js} +717 -737
  2. package/dist/chunks/basic-page-6dDfY33L.js.map +1 -0
  3. package/dist/chunks/box-search-C9EVZgcb.js +56 -0
  4. package/dist/chunks/box-search-C9EVZgcb.js.map +1 -0
  5. package/dist/chunks/{chat-CU3XVm99.js → chat-Bu8UyIbT.js} +206 -204
  6. package/dist/chunks/chat-Bu8UyIbT.js.map +1 -0
  7. package/dist/chunks/chrome-Ds7WykBJ.js +14 -0
  8. package/dist/chunks/chrome-Ds7WykBJ.js.map +1 -0
  9. package/dist/chunks/{data-table-Ce_c6T73.js → data-table-hzZb7Otx.js} +56 -54
  10. package/dist/chunks/{data-table-Ce_c6T73.js.map → data-table-hzZb7Otx.js.map} +1 -1
  11. package/dist/chunks/{filter-bar-CMkvhvgL.js → filter-bar-C4sPEjw1.js} +62 -65
  12. package/dist/chunks/filter-bar-C4sPEjw1.js.map +1 -0
  13. package/dist/chunks/ghost-search-8PzP73zS.js +50 -0
  14. package/dist/chunks/ghost-search-8PzP73zS.js.map +1 -0
  15. package/dist/chunks/{trace-D1fOFzJt.js → trace-DyjsBY-S.js} +15 -13
  16. package/dist/chunks/{trace-D1fOFzJt.js.map → trace-DyjsBY-S.js.map} +1 -1
  17. package/dist/components/chat.js +1 -1
  18. package/dist/components/data-table.js +4 -3
  19. package/dist/components/filter-bar.js +1 -1
  20. package/dist/components/scope.js +418 -0
  21. package/dist/components/scope.js.map +1 -0
  22. package/dist/components/trace.js +1 -1
  23. package/dist/index.js +176 -175
  24. package/dist/motion.js +61 -36
  25. package/dist/motion.js.map +1 -1
  26. package/dist/sections/basic-page.js +2 -2
  27. package/dist/src/components/chat/chat.d.ts +7 -4
  28. package/dist/src/components/input-group/box-search.d.ts +29 -0
  29. package/dist/src/components/scope/index.d.ts +1 -0
  30. package/dist/src/components/scope/scope.d.ts +98 -0
  31. package/dist/src/motion/index.d.ts +52 -0
  32. package/dist/src/utils/ghost-search.d.ts +19 -3
  33. package/package.json +5 -1
  34. package/dist/chunks/basic-page-CJ11ekjH.js.map +0 -1
  35. package/dist/chunks/chat-CU3XVm99.js.map +0 -1
  36. package/dist/chunks/filter-bar-CMkvhvgL.js.map +0 -1
  37. package/dist/chunks/ghost-search-CNVs9k1o.js +0 -34
  38. package/dist/chunks/ghost-search-CNVs9k1o.js.map +0 -1
@@ -1,19 +1,20 @@
1
1
  "use client";
2
- import { t as x } from "./cn-ChIgwEl3.js";
3
- import { n as oe } from "./link-provider-DXzDQ08N.js";
4
- import { FADE_SWAP as K, PRESS_SCALE_ROW as se, SPRING_PRESS as le, TRAVEL_LINEAR as ce } from "../motion.js";
2
+ import { t as f } from "./cn-ChIgwEl3.js";
3
+ import { n as se } from "./link-provider-DXzDQ08N.js";
4
+ import { FADE_SWAP as K, PRESS_SCALE_ROW as oe, SPRING_PRESS as le, TRAVEL_LINEAR as ce } from "../motion.js";
5
5
  import { a as z } from "./button-C9VqBBIr.js";
6
- import { t as I } from "./createReactComponent-BqCmnqfX.js";
6
+ import { t as M } from "./createReactComponent-BqCmnqfX.js";
7
7
  import { t as de } from "./input-fFWvPJOf.js";
8
8
  import { n as B } from "./avatar-BkmGDIqf.js";
9
9
  import { t as ue } from "./IconSearch-BKAHkLyX.js";
10
10
  import { t as C } from "./scroll-area-DSwD9th7.js";
11
11
  import { i as pe } from "./status-view-C8tabjDu.js";
12
- import { t as S } from "./skeleton-DwjSl4vC.js";
13
- import { createContext as he, useCallback as G, useContext as fe, useEffect as me, useId as xe, useLayoutEffect as ve, useMemo as Q, useRef as k, useState as R } from "react";
12
+ import { t as _ } from "./skeleton-DwjSl4vC.js";
13
+ import { n as he } from "./box-search-C9EVZgcb.js";
14
+ import { createContext as fe, useCallback as G, useContext as me, useEffect as ve, useId as xe, useLayoutEffect as we, useMemo as J, useRef as S, useState as P } from "react";
14
15
  import { Fragment as Y, jsx as e, jsxs as y } from "react/jsx-runtime";
15
- import { AnimatePresence as be, motion as M, useReducedMotion as Z } from "motion/react";
16
- var we = [
16
+ import { AnimatePresence as ge, motion as I, useReducedMotion as Z } from "motion/react";
17
+ var be = [
17
18
  ["path", {
18
19
  d: "M5 12l14 0",
19
20
  key: "svg-0"
@@ -26,7 +27,7 @@ var we = [
26
27
  d: "M5 12l6 -6",
27
28
  key: "svg-2"
28
29
  }]
29
- ], ge = I("outline", "arrow-left", "ArrowLeft", we), ye = [
30
+ ], ye = M("outline", "arrow-left", "ArrowLeft", be), Ne = [
30
31
  ["path", {
31
32
  d: "M12 5l0 14",
32
33
  key: "svg-0"
@@ -39,13 +40,13 @@ var we = [
39
40
  d: "M6 11l6 -6",
40
41
  key: "svg-2"
41
42
  }]
42
- ], Ne = I("outline", "arrow-up", "ArrowUp", ye), Ce = [["path", {
43
+ ], Ce = M("outline", "arrow-up", "ArrowUp", Ne), Se = [["path", {
43
44
  d: "M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",
44
45
  key: "svg-0"
45
46
  }], ["path", {
46
47
  d: "M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",
47
48
  key: "svg-1"
48
- }]], ke = I("outline", "user", "User", Ce), Se = [
49
+ }]], _e = M("outline", "user", "User", Se), ke = [
49
50
  ["path", {
50
51
  d: "M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",
51
52
  key: "svg-0"
@@ -62,23 +63,23 @@ var we = [
62
63
  d: "M21 21v-2a4 4 0 0 0 -3 -3.85",
63
64
  key: "svg-3"
64
65
  }]
65
- ], _e = I("outline", "users", "Users", Se), Pe = "rounded-base border border-pho-secondary bg-pho-primary", Re = 672, Ae = 24, Ee = 8, ee = "min-h-[61px]", Me = 273, _ = 256, O = 320, Ie = 16;
66
- function q(t, r) {
67
- const a = Math.max(_, t);
68
- return r <= 0 ? Number.isFinite(a) ? a : _ : Math.min(a, Math.max(_, r - O));
66
+ ], Re = M("outline", "users", "Users", ke), Pe = "rounded-base border border-pho-secondary bg-pho-primary", Ae = 672, Ee = 24, Ie = 8, ee = "min-h-[61px]", Me = 273, k = 256, O = 320, Le = 16;
67
+ function Q(t, r) {
68
+ const a = Math.max(k, t);
69
+ return r <= 0 ? Number.isFinite(a) ? a : k : Math.min(a, Math.max(k, r - O));
69
70
  }
70
- var te = he(null);
71
+ var te = fe(null);
71
72
  function A(t) {
72
- const r = fe(te);
73
+ const r = me(te);
73
74
  if (r == null) throw new Error(`Chat.${t} must be used inside Chat.Root`);
74
75
  return r;
75
76
  }
76
- var D = typeof window > "u" ? me : ve;
77
+ var D = typeof window > "u" ? ve : we;
77
78
  function T(t) {
78
79
  return t === "thread" ? 1 : -1;
79
80
  }
80
- function Le(t, r) {
81
- return t === "compact" || t === "auto" && r > 0 && r < Re;
81
+ function Te(t, r) {
82
+ return t === "compact" || t === "auto" && r > 0 && r < Ae;
82
83
  }
83
84
  function E(t, r) {
84
85
  return r ? {
@@ -88,7 +89,7 @@ function E(t, r) {
88
89
  transition: { duration: 0 }
89
90
  } : {
90
91
  initial: {
91
- x: t * Ae,
92
+ x: t * Ee,
92
93
  opacity: 0,
93
94
  filter: "blur(1px)"
94
95
  },
@@ -98,7 +99,7 @@ function E(t, r) {
98
99
  filter: "blur(0px)"
99
100
  },
100
101
  exit: {
101
- x: -t * Ee,
102
+ x: -t * Ie,
102
103
  opacity: 0,
103
104
  filter: "blur(1px)"
104
105
  },
@@ -109,84 +110,84 @@ function E(t, r) {
109
110
  }
110
111
  };
111
112
  }
112
- function Te(t) {
113
+ function Oe(t) {
113
114
  return {
114
115
  enter: (r) => E(r, t).initial,
115
116
  rest: (r) => E(r, t).animate,
116
117
  leave: (r) => E(r, t).exit
117
118
  };
118
119
  }
119
- function re({ as: t, show: r, swapped: a, direction: l, reduceMotion: o, children: c, ...s }) {
120
- const u = E(l, o), f = {
121
- custom: l,
122
- variants: Te(o),
120
+ function re({ as: t, show: r, swapped: a, direction: o, reduceMotion: s, children: c, ...l }) {
121
+ const u = E(o, s), m = {
122
+ custom: o,
123
+ variants: Oe(s),
123
124
  initial: "enter",
124
125
  animate: "rest",
125
126
  exit: "leave",
126
127
  transition: u.transition
127
128
  };
128
- return /* @__PURE__ */ e(be, {
129
+ return /* @__PURE__ */ e(ge, {
129
130
  initial: !a && r ? !1 : void 0,
130
131
  mode: "popLayout",
131
- custom: l,
132
- children: r ? t === "aside" ? /* @__PURE__ */ e(M.aside, {
133
- ...s,
134
- ...f,
132
+ custom: o,
133
+ children: r ? t === "aside" ? /* @__PURE__ */ e(I.aside, {
134
+ ...l,
135
+ ...m,
135
136
  children: c
136
- }, "list") : /* @__PURE__ */ e(M.section, {
137
- ...s,
138
- ...f,
137
+ }, "list") : /* @__PURE__ */ e(I.section, {
138
+ ...l,
139
+ ...m,
139
140
  children: c
140
141
  }, "thread") : null
141
142
  });
142
143
  }
143
- function Oe({ layout: t = "default", pane: r, defaultPane: a = "list", onPaneChange: l, className: o, style: c, ref: s, ...u }) {
144
- const [f, m] = R(a), [g, w] = R(Me), [i, n] = R(0), p = k(null), v = r !== void 0, h = v ? r : f, [b, d] = R(() => T(h)), [W, ae] = R(!1), H = k(h);
145
- let P = b, L = W;
146
- H.current !== h && (P = T(h), L = !0, H.current = h, P !== b && d(P), W || ae(!0));
147
- const V = G((N) => {
148
- d(T(N)), v || m(N), l?.(N);
149
- }, [v, l]), X = G((N) => {
150
- w(q(N, p.current?.clientWidth ?? 0));
151
- }, []), U = Le(t, i);
144
+ function ze({ layout: t = "default", pane: r, defaultPane: a = "list", onPaneChange: o, className: s, style: c, ref: l, ...u }) {
145
+ const [m, v] = P(a), [b, g] = P(Me), [i, n] = P(0), p = S(null), x = r !== void 0, h = x ? r : m, [w, d] = P(() => T(h)), [W, ae] = P(!1), H = S(h);
146
+ let R = w, L = W;
147
+ H.current !== h && (R = T(h), L = !0, H.current = h, R !== w && d(R), W || ae(!0));
148
+ const U = G((N) => {
149
+ d(T(N)), x || v(N), o?.(N);
150
+ }, [x, o]), V = G((N) => {
151
+ g(Q(N, p.current?.clientWidth ?? 0));
152
+ }, []), X = Te(t, i);
152
153
  D(() => {
153
154
  const N = p.current;
154
155
  if (!N || typeof ResizeObserver > "u") return;
155
- const $ = () => {
156
+ const F = () => {
156
157
  const j = N.clientWidth;
157
- n(j), w((ie) => q(ie, j));
158
+ n(j), g((ie) => Q(ie, j));
158
159
  };
159
- $();
160
- const F = new ResizeObserver($);
161
- return F.observe(N), () => F.disconnect();
160
+ F();
161
+ const $ = new ResizeObserver(F);
162
+ return $.observe(N), () => $.disconnect();
162
163
  }, []);
163
- const ne = Q(() => ({
164
+ const ne = J(() => ({
164
165
  layout: t,
165
166
  pane: h,
166
- setPane: V,
167
- direction: P,
168
- swap: U,
167
+ setPane: U,
168
+ direction: R,
169
+ swap: X,
169
170
  swapped: L,
170
- listWidth: g,
171
+ listWidth: b,
171
172
  frameWidth: i,
172
- resizeList: X,
173
+ resizeList: V,
173
174
  rootRef: p
174
175
  }), [
175
176
  t,
176
177
  h,
177
- V,
178
- P,
179
178
  U,
179
+ R,
180
+ X,
180
181
  L,
181
- g,
182
+ b,
182
183
  i,
183
- X
184
+ V
184
185
  ]);
185
186
  return /* @__PURE__ */ e(te.Provider, {
186
187
  value: ne,
187
188
  children: /* @__PURE__ */ e("div", {
188
189
  ref: (N) => {
189
- p.current = N, typeof s == "function" ? s(N) : s && (s.current = N);
190
+ p.current = N, typeof l == "function" ? l(N) : l && (l.current = N);
190
191
  },
191
192
  "data-chat": "",
192
193
  "data-basic-page-card": "",
@@ -194,27 +195,27 @@ function Oe({ layout: t = "default", pane: r, defaultPane: a = "list", onPaneCha
194
195
  "data-pane": h,
195
196
  style: {
196
197
  ...c,
197
- "--chat-list-width": `${g}px`
198
+ "--chat-list-width": `${b}px`
198
199
  },
199
- className: x(Pe, "@container relative flex min-h-0 min-w-0 overflow-hidden", o),
200
+ className: f(Pe, "@container relative flex min-h-0 min-w-0 overflow-hidden", s),
200
201
  ...u
201
202
  })
202
203
  });
203
204
  }
204
- function ze({ className: t, children: r, id: a, ...l }) {
205
- const { layout: o, pane: c, direction: s, swap: u, swapped: f } = A("List"), m = Z(), g = xe(), w = a ?? g, i = x("border-pho-secondary bg-pho-page relative z-10 flex min-h-0 shrink-0 flex-col", o === "default" && "min-w-64 w-[var(--chat-list-width)] border-r", o === "compact" && "w-full", o === "auto" && x("w-full @2xl:min-w-64 @2xl:w-[var(--chat-list-width)] @2xl:border-r", !u && c === "thread" && "@max-2xl:hidden"), t), n = /* @__PURE__ */ y(Y, { children: [r, o !== "compact" && /* @__PURE__ */ e(De, { controlsId: w })] }), p = {
206
- id: w,
205
+ function De({ className: t, children: r, id: a, ...o }) {
206
+ const { layout: s, pane: c, direction: l, swap: u, swapped: m } = A("List"), v = Z(), b = xe(), g = a ?? b, i = f("border-pho-secondary bg-pho-page relative z-10 flex min-h-0 shrink-0 flex-col", s === "default" && "min-w-64 w-[var(--chat-list-width)] border-r", s === "compact" && "w-full", s === "auto" && f("w-full @2xl:min-w-64 @2xl:w-[var(--chat-list-width)] @2xl:border-r", !u && c === "thread" && "@max-2xl:hidden"), t), n = /* @__PURE__ */ y(Y, { children: [r, s !== "compact" && /* @__PURE__ */ e(We, { controlsId: g })] }), p = {
207
+ id: g,
207
208
  "aria-label": "Conversations",
208
209
  "data-chat-list": "",
209
210
  className: i,
210
- ...l
211
+ ...o
211
212
  };
212
213
  return u ? /* @__PURE__ */ e(re, {
213
214
  as: "aside",
214
215
  show: c === "list",
215
- swapped: f,
216
- direction: s,
217
- reduceMotion: m,
216
+ swapped: m,
217
+ direction: l,
218
+ reduceMotion: v,
218
219
  ...p,
219
220
  children: n
220
221
  }) : /* @__PURE__ */ e("aside", {
@@ -222,71 +223,72 @@ function ze({ className: t, children: r, id: a, ...l }) {
222
223
  children: n
223
224
  });
224
225
  }
225
- function De({ controlsId: t }) {
226
- const { layout: r, listWidth: a, frameWidth: l, resizeList: o, rootRef: c } = A("Splitter"), s = k(null), u = (i) => {
227
- i.button === 0 && (i.currentTarget.setPointerCapture?.(i.pointerId), s.current = {
226
+ function We({ controlsId: t }) {
227
+ const { layout: r, listWidth: a, frameWidth: o, resizeList: s, rootRef: c } = A("Splitter"), l = S(null), u = (i) => {
228
+ i.button === 0 && (i.currentTarget.setPointerCapture?.(i.pointerId), l.current = {
228
229
  x: i.clientX,
229
230
  width: a
230
231
  });
231
- }, f = (i) => {
232
- const n = s.current;
232
+ }, m = (i) => {
233
+ const n = l.current;
233
234
  if (n == null) return;
234
- const p = c.current, v = p != null && getComputedStyle(p).direction === "rtl", h = (i.clientX - n.x) * (v ? -1 : 1);
235
- o(n.width + h);
236
- }, m = () => {
237
- s.current = null;
238
- }, g = (i) => {
239
- const n = c.current, p = n != null && getComputedStyle(n).direction === "rtl", v = p ? "ArrowRight" : "ArrowLeft", h = p ? "ArrowLeft" : "ArrowRight", b = i.shiftKey ? 32 : Ie;
240
- if (i.key === v)
241
- i.preventDefault(), o(a - b);
235
+ const p = c.current, x = p != null && getComputedStyle(p).direction === "rtl", h = (i.clientX - n.x) * (x ? -1 : 1);
236
+ s(n.width + h);
237
+ }, v = () => {
238
+ l.current = null;
239
+ }, b = (i) => {
240
+ const n = c.current, p = n != null && getComputedStyle(n).direction === "rtl", x = p ? "ArrowRight" : "ArrowLeft", h = p ? "ArrowLeft" : "ArrowRight", w = i.shiftKey ? 32 : Le;
241
+ if (i.key === x)
242
+ i.preventDefault(), s(a - w);
242
243
  else if (i.key === h)
243
- i.preventDefault(), o(a + b);
244
+ i.preventDefault(), s(a + w);
244
245
  else if (i.key === "Home")
245
- i.preventDefault(), o(_);
246
+ i.preventDefault(), s(k);
246
247
  else if (i.key === "End") {
247
248
  i.preventDefault();
248
249
  const d = n?.clientWidth ?? 0;
249
- d > 0 && o(d - O);
250
+ d > 0 && s(d - O);
250
251
  }
251
- }, w = l > 0 ? Math.max(_, l - O) : a;
252
+ }, g = o > 0 ? Math.max(k, o - O) : a;
252
253
  return /* @__PURE__ */ e("div", {
253
254
  role: "separator",
254
255
  "aria-orientation": "vertical",
255
256
  "aria-label": "Resize conversation list",
256
257
  "aria-controls": t,
257
258
  "aria-valuenow": a,
258
- "aria-valuemin": _,
259
- "aria-valuemax": w,
259
+ "aria-valuemin": k,
260
+ "aria-valuemax": g,
260
261
  "aria-valuetext": `${a} pixels`,
261
262
  tabIndex: 0,
262
263
  "data-chat-splitter": "",
263
264
  onPointerDown: u,
264
- onPointerMove: f,
265
- onPointerUp: m,
266
- onPointerCancel: m,
267
- onKeyDown: g,
268
- className: x("absolute inset-y-0 -right-3 z-10 w-6 cursor-col-resize touch-none select-none", "outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-2", "after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent", "[@media(hover:hover)]:hover:after:bg-pho-brand focus-visible:after:bg-pho-brand", r === "auto" && "@max-2xl:hidden")
265
+ onPointerMove: m,
266
+ onPointerUp: v,
267
+ onPointerCancel: v,
268
+ onKeyDown: b,
269
+ className: f("absolute inset-y-0 -right-3 z-10 w-6 cursor-col-resize touch-none select-none", "outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-2", "after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent", "[@media(hover:hover)]:hover:after:bg-pho-brand focus-visible:after:bg-pho-brand", r === "auto" && "@max-2xl:hidden")
269
270
  });
270
271
  }
271
- function We({ className: t, placeholder: r = "Search", ...a }) {
272
+ function He({ className: t, wrapperClassName: r, placeholder: a = "Search", ...o }) {
272
273
  return /* @__PURE__ */ e("div", {
273
274
  "data-chat-search": "",
274
- className: x("p-3", ee, t),
275
+ className: f("p-3", ee, t),
275
276
  children: /* @__PURE__ */ e(de, {
276
277
  size: "sm",
277
278
  icon: ue,
278
- placeholder: r,
279
+ placeholder: a,
279
280
  "aria-label": "Search conversations",
280
281
  autoComplete: "off",
281
282
  spellCheck: !1,
282
- ...a
283
+ wrapperClassName: f(he, "[&:focus-within>svg]:text-pho-primary [&>svg]:transition-colors [&>svg]:duration-100", r),
284
+ ...o
283
285
  })
284
286
  });
285
287
  }
286
- function He({ className: t, children: r, ...a }) {
288
+ function Ue({ className: t, children: r, ...a }) {
287
289
  return /* @__PURE__ */ e("div", {
288
290
  "data-chat-conversations": "",
289
- className: x("flex min-h-0 flex-1 flex-col", t),
291
+ className: f("flex min-h-0 flex-1 flex-col", t),
290
292
  ...a,
291
293
  children: /* @__PURE__ */ y(C.Root, {
292
294
  className: "min-h-0 flex-1",
@@ -301,24 +303,24 @@ function He({ className: t, children: r, ...a }) {
301
303
  function Ve({ className: t, ...r }) {
302
304
  return /* @__PURE__ */ e("ul", {
303
305
  "data-chat-conversation-list": "",
304
- className: x("m-0 flex list-none flex-col gap-0.5 *:m-0", t),
306
+ className: f("m-0 flex list-none flex-col gap-0.5 *:m-0", t),
305
307
  ...r
306
308
  });
307
309
  }
308
- var Xe = "outline-pho-brand rounded-base flex w-full cursor-pointer items-center gap-3 px-2 py-2.5 text-left transition-colors focus-visible:outline-2 focus-visible:-outline-offset-1", Ue = "bg-pho-primary text-pho-primary ring-pho-secondary ring-1 ring-inset *:data-icon:text-pho-primary", $e = "hover:bg-pho-ghost-hover", J = {
310
+ var Xe = "outline-pho-brand rounded-base flex w-full cursor-pointer items-center gap-3 px-2 py-2.5 text-left transition-colors focus-visible:outline-2 focus-visible:-outline-offset-1", Fe = "bg-pho-primary text-pho-primary ring-pho-secondary ring-1 ring-inset *:data-icon:text-pho-primary", $e = "hover:bg-pho-ghost-hover", q = {
309
311
  initial: !1,
310
- whileTap: { scale: se },
312
+ whileTap: { scale: oe },
311
313
  transition: le
312
314
  };
313
- function Fe({ title: t, time: r, preview: a, avatar: l, group: o, active: c, className: s, href: u, onClick: f, ...m }) {
314
- const { layout: g, setPane: w } = A("Conversation"), i = oe(), n = Q(() => M.create(i), [i]), p = x(Xe, c ? Ue : $e, s), v = () => {
315
- g !== "default" && w("thread");
316
- }, h = /* @__PURE__ */ y(Y, { children: [l ?? /* @__PURE__ */ e(B.Root, {
315
+ function je({ title: t, time: r, preview: a, avatar: o, group: s, active: c, className: l, href: u, onClick: m, ...v }) {
316
+ const { layout: b, setPane: g } = A("Conversation"), i = se(), n = J(() => I.create(i), [i]), p = f(Xe, c ? Fe : $e, l), x = () => {
317
+ b !== "default" && g("thread");
318
+ }, h = /* @__PURE__ */ y(Y, { children: [o ?? /* @__PURE__ */ e(B.Root, {
317
319
  size: "sm",
318
- children: /* @__PURE__ */ e(B.Fallback, { children: o ? /* @__PURE__ */ e(_e, {
320
+ children: /* @__PURE__ */ e(B.Fallback, { children: s ? /* @__PURE__ */ e(Re, {
319
321
  className: "size-4",
320
322
  "aria-hidden": !0
321
- }) : /* @__PURE__ */ e(ke, {
323
+ }) : /* @__PURE__ */ e(_e, {
322
324
  className: "size-4",
323
325
  "aria-hidden": !0
324
326
  }) })
@@ -341,68 +343,68 @@ function Fe({ title: t, time: r, preview: a, avatar: l, group: o, active: c, cla
341
343
  return u !== void 0 ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, {
342
344
  href: u,
343
345
  "aria-current": c ? "page" : void 0,
344
- ...m,
345
- onClick: (b) => {
346
- f?.(b), b.defaultPrevented || v();
346
+ ...v,
347
+ onClick: (w) => {
348
+ m?.(w), w.defaultPrevented || x();
347
349
  },
348
350
  className: p,
349
- ...J,
351
+ ...q,
350
352
  children: h
351
- }) }) : /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(M.button, {
353
+ }) }) : /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(I.button, {
352
354
  type: "button",
353
355
  "aria-current": c ? "true" : void 0,
354
- ...m,
355
- onClick: (b) => {
356
- f?.(b), b.defaultPrevented || v();
356
+ ...v,
357
+ onClick: (w) => {
358
+ m?.(w), w.defaultPrevented || x();
357
359
  },
358
360
  className: p,
359
- ...J,
361
+ ...q,
360
362
  children: h
361
363
  }) });
362
364
  }
363
- function je({ className: t, children: r, ...a }) {
364
- const { layout: l, pane: o, direction: c, swap: s, swapped: u } = A("Thread"), f = Z(), m = x("bg-pho-primary flex min-h-0 flex-1 flex-col", l === "default" && "min-w-80", l === "compact" && "min-w-0", l === "auto" && "min-w-0 @2xl:min-w-80", !s && l === "auto" && o === "list" && "@max-2xl:hidden", t);
365
- return s ? /* @__PURE__ */ e(re, {
365
+ function Ke({ className: t, children: r, ...a }) {
366
+ const { layout: o, pane: s, direction: c, swap: l, swapped: u } = A("Thread"), m = Z(), v = f("bg-pho-primary flex min-h-0 flex-1 flex-col", o === "default" && "min-w-80", o === "compact" && "min-w-0", o === "auto" && "min-w-0 @2xl:min-w-80", !l && o === "auto" && s === "list" && "@max-2xl:hidden", t);
367
+ return l ? /* @__PURE__ */ e(re, {
366
368
  as: "section",
367
- show: o === "thread",
369
+ show: s === "thread",
368
370
  swapped: u,
369
371
  direction: c,
370
- reduceMotion: f,
372
+ reduceMotion: m,
371
373
  "aria-label": "Conversation",
372
374
  "data-chat-thread": "",
373
- className: m,
375
+ className: v,
374
376
  ...a,
375
377
  children: r
376
378
  }) : /* @__PURE__ */ e("section", {
377
379
  "aria-label": "Conversation",
378
380
  "data-chat-thread": "",
379
- className: m,
381
+ className: v,
380
382
  ...a,
381
383
  children: r
382
384
  });
383
385
  }
384
- function Ke({ avatar: t, actions: r, backLabel: a = "Back to conversations", className: l, children: o, ...c }) {
385
- const { layout: s, setPane: u } = A("Header");
386
+ function Be({ avatar: t, actions: r, backLabel: a = "Back to conversations", className: o, children: s, ...c }) {
387
+ const { layout: l, setPane: u } = A("Header");
386
388
  return /* @__PURE__ */ y("header", {
387
389
  "data-chat-header": "",
388
- className: x("flex shrink-0 items-center gap-3 px-4 py-1.5", ee, l),
390
+ className: f("flex shrink-0 items-center gap-3 px-4 py-1.5", ee, o),
389
391
  ...c,
390
392
  children: [
391
- s !== "default" && /* @__PURE__ */ e(z, {
393
+ l !== "default" && /* @__PURE__ */ e(z, {
392
394
  variant: "ghost",
393
395
  size: "sm",
394
396
  shape: "circle",
395
397
  svgOnly: !0,
396
398
  "aria-label": a,
397
399
  "data-chat-back": "",
398
- className: x("-ml-1 shrink-0", s === "auto" && "@2xl:hidden"),
400
+ className: f("-ml-1 shrink-0", l === "auto" && "@2xl:hidden"),
399
401
  onClick: () => u("list"),
400
- children: /* @__PURE__ */ e(ge, {})
402
+ children: /* @__PURE__ */ e(ye, {})
401
403
  }),
402
404
  t,
403
405
  /* @__PURE__ */ e("div", {
404
406
  className: "flex min-w-0 flex-1 flex-col",
405
- children: o
407
+ children: s
406
408
  }),
407
409
  r != null && /* @__PURE__ */ e("div", {
408
410
  className: "flex shrink-0 items-center gap-1",
@@ -411,60 +413,60 @@ function Ke({ avatar: t, actions: r, backLabel: a = "Back to conversations", cla
411
413
  ]
412
414
  });
413
415
  }
414
- function Be({ className: t, children: r, ...a }) {
416
+ function Ge({ className: t, children: r, ...a }) {
415
417
  return /* @__PURE__ */ e("h2", {
416
418
  "data-chat-title": "",
417
- className: x("text-pho-primary m-0 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 overflow-visible text-base font-medium", t),
419
+ className: f("text-pho-primary m-0 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 overflow-visible text-base font-medium", t),
418
420
  ...a,
419
421
  children: r
420
422
  });
421
423
  }
422
- function Ge({ className: t, ...r }) {
424
+ function Qe({ className: t, ...r }) {
423
425
  return /* @__PURE__ */ e("p", {
424
426
  "data-chat-description": "",
425
- className: x("text-pho-description m-0 min-w-0 truncate text-xs", t),
427
+ className: f("text-pho-description m-0 min-w-0 truncate text-xs", t),
426
428
  ...r
427
429
  });
428
430
  }
429
431
  var qe = 40;
430
- function Je({ hasEarlier: t = !1, loadingEarlier: r = !1, onLoadEarlier: a, earlierLabel: l = "Load earlier messages", className: o, children: c, ...s }) {
431
- const u = k(null), f = k(null), m = k(!0), g = k(null);
432
+ function Je({ hasEarlier: t = !1, loadingEarlier: r = !1, onLoadEarlier: a, earlierLabel: o = "Load earlier messages", className: s, children: c, ...l }) {
433
+ const u = S(null), m = S(null), v = S(!0), b = S(null);
432
434
  D(() => {
433
- const n = u.current, p = f.current;
435
+ const n = u.current, p = m.current;
434
436
  if (!n || !p) return;
435
- const v = () => {
436
- const b = g.current;
437
- if (b) {
438
- g.current = null, n.scrollTop = n.scrollHeight - b.height + b.top;
437
+ const x = () => {
438
+ const w = b.current;
439
+ if (w) {
440
+ b.current = null, n.scrollTop = n.scrollHeight - w.height + w.top;
439
441
  return;
440
442
  }
441
- m.current && (n.scrollTop = n.scrollHeight);
443
+ v.current && (n.scrollTop = n.scrollHeight);
442
444
  };
443
- if (v(), typeof ResizeObserver > "u") return;
444
- const h = new ResizeObserver(v);
445
+ if (x(), typeof ResizeObserver > "u") return;
446
+ const h = new ResizeObserver(x);
445
447
  return h.observe(p), h.observe(n), () => h.disconnect();
446
448
  }, []);
447
- const w = () => {
449
+ const g = () => {
448
450
  const n = u.current;
449
- n && (m.current = n.scrollHeight - n.scrollTop - n.clientHeight < qe);
451
+ n && (v.current = n.scrollHeight - n.scrollTop - n.clientHeight < qe);
450
452
  }, i = () => {
451
453
  const n = u.current;
452
- n && (g.current = {
454
+ n && (b.current = {
453
455
  height: n.scrollHeight,
454
456
  top: n.scrollTop
455
- }), m.current = !1, a?.();
457
+ }), v.current = !1, a?.();
456
458
  };
457
459
  return /* @__PURE__ */ e("div", {
458
460
  "data-chat-messages": "",
459
- className: x("flex min-h-0 flex-1 flex-col [--pho-bubble-backdrop:var(--background-color-pho-primary)]", o),
460
- ...s,
461
+ className: f("flex min-h-0 flex-1 flex-col [--pho-bubble-backdrop:var(--background-color-pho-primary)]", s),
462
+ ...l,
461
463
  children: /* @__PURE__ */ y(C.Root, {
462
464
  className: "min-h-0 flex-1",
463
465
  children: [/* @__PURE__ */ e(C.Viewport, {
464
466
  ref: u,
465
- onScroll: w,
467
+ onScroll: g,
466
468
  children: /* @__PURE__ */ y(C.Content, {
467
- ref: f,
469
+ ref: m,
468
470
  style: { minWidth: 0 },
469
471
  className: "flex min-h-full flex-col gap-1 p-4",
470
472
  children: [t && /* @__PURE__ */ e("div", {
@@ -474,7 +476,7 @@ function Je({ hasEarlier: t = !1, loadingEarlier: r = !1, onLoadEarlier: a, earl
474
476
  size: "sm",
475
477
  loading: r,
476
478
  onClick: i,
477
- children: l
479
+ children: o
478
480
  })
479
481
  }), c]
480
482
  })
@@ -482,53 +484,53 @@ function Je({ hasEarlier: t = !1, loadingEarlier: r = !1, onLoadEarlier: a, earl
482
484
  })
483
485
  });
484
486
  }
485
- function Qe({ className: t, children: r, ...a }) {
487
+ function Ye({ className: t, children: r, ...a }) {
486
488
  return /* @__PURE__ */ e("div", {
487
489
  "data-chat-divider": "",
488
- className: x("text-pho-description py-1 text-center text-xs", t),
490
+ className: f("text-pho-description py-1 text-center text-xs", t),
489
491
  ...a,
490
492
  children: r
491
493
  });
492
494
  }
493
- function Ye({ className: t, ...r }) {
495
+ function Ze({ className: t, ...r }) {
494
496
  return /* @__PURE__ */ e("footer", {
495
497
  "data-chat-footer": "",
496
- className: x("shrink-0 px-4 py-3", t),
498
+ className: f("shrink-0 px-4 py-3", t),
497
499
  ...r
498
500
  });
499
501
  }
500
- var Ze = 200;
501
- function et({ value: t, onValueChange: r, onSend: a, placeholder: l = "Message", sending: o = !1, disabled: c = !1, canSend: s, prefix: u, meta: f, sendLabel: m = "Send", children: g, textareaRef: w, className: i, ...n }) {
502
- const p = k(null), v = !o && !c && (s ?? t.trim().length > 0);
502
+ var et = 200;
503
+ function tt({ value: t, onValueChange: r, onSend: a, placeholder: o = "Message", sending: s = !1, disabled: c = !1, canSend: l, prefix: u, meta: m, sendLabel: v = "Send", children: b, textareaRef: g, className: i, ...n }) {
504
+ const p = S(null), x = !s && !c && (l ?? t.trim().length > 0);
503
505
  D(() => {
504
506
  const d = p.current;
505
- d && (d.style.height = "0px", d.style.height = `${Math.min(d.scrollHeight, Ze)}px`);
507
+ d && (d.style.height = "0px", d.style.height = `${Math.min(d.scrollHeight, et)}px`);
506
508
  }, [t]);
507
509
  const h = (d) => {
508
- d.preventDefault(), v && a();
509
- }, b = (d) => {
510
- d.key === "Enter" && !d.shiftKey && !d.nativeEvent.isComposing && (d.preventDefault(), v && a());
510
+ d.preventDefault(), x && a();
511
+ }, w = (d) => {
512
+ d.key === "Enter" && !d.shiftKey && !d.nativeEvent.isComposing && (d.preventDefault(), x && a());
511
513
  };
512
514
  return /* @__PURE__ */ y("form", {
513
515
  "aria-label": "Message composer",
514
516
  "data-chat-composer": "",
515
517
  onSubmit: h,
516
- className: x("rounded-base bg-pho-primary ring-pho-primary focus-within:ring-pho-brand ring-1 transition-shadow duration-100 ease-linear ring-inset focus-within:ring-2", c && "opacity-50", i),
518
+ className: f("rounded-base bg-pho-primary ring-pho-primary focus-within:ring-pho-brand ring-1 transition-shadow duration-100 ease-linear ring-inset focus-within:ring-2", c && "opacity-50", i),
517
519
  ...n,
518
520
  children: [
519
- g,
521
+ b,
520
522
  /* @__PURE__ */ e("textarea", {
521
523
  ref: (d) => {
522
- p.current = d, typeof w == "function" ? w(d) : w && (w.current = d);
524
+ p.current = d, typeof g == "function" ? g(d) : g && (g.current = d);
523
525
  },
524
526
  value: t,
525
527
  onChange: (d) => r(d.target.value),
526
- onKeyDown: b,
528
+ onKeyDown: w,
527
529
  rows: 1,
528
- placeholder: l,
530
+ placeholder: o,
529
531
  "aria-label": "Message",
530
532
  disabled: c,
531
- readOnly: o,
533
+ readOnly: s,
532
534
  className: "text-pho-primary placeholder:text-pho-placeholder m-0 block w-full resize-none bg-transparent px-4 pt-3 pb-1 text-base outline-none disabled:cursor-not-allowed"
533
535
  }),
534
536
  /* @__PURE__ */ y("div", {
@@ -537,83 +539,83 @@ function et({ value: t, onValueChange: r, onSend: a, placeholder: l = "Message",
537
539
  u,
538
540
  /* @__PURE__ */ e("p", {
539
541
  className: "text-pho-description m-0 min-w-0 flex-1 truncate text-xs",
540
- children: f
542
+ children: m
541
543
  }),
542
544
  /* @__PURE__ */ e(z, {
543
545
  type: "submit",
544
546
  size: "sm",
545
547
  shape: "circle",
546
548
  svgOnly: !0,
547
- "aria-label": m,
548
- disabled: !v,
549
- loading: o,
550
- children: /* @__PURE__ */ e(Ne, {})
549
+ "aria-label": v,
550
+ disabled: !x,
551
+ loading: s,
552
+ children: /* @__PURE__ */ e(Ce, {})
551
553
  })
552
554
  ]
553
555
  })
554
556
  ]
555
557
  });
556
558
  }
557
- function tt({ className: t, size: r = "sm", ...a }) {
559
+ function rt({ className: t, size: r = "sm", ...a }) {
558
560
  return /* @__PURE__ */ e("div", {
559
561
  "data-chat-empty": "",
560
- className: x("flex flex-1 flex-col items-center justify-center px-6 py-8", t),
562
+ className: f("flex flex-1 flex-col items-center justify-center px-6 py-8", t),
561
563
  children: /* @__PURE__ */ e(pe, {
562
564
  size: r,
563
565
  ...a
564
566
  })
565
567
  });
566
568
  }
567
- function rt({ rows: t = 5 }) {
569
+ function at({ rows: t = 5 }) {
568
570
  return /* @__PURE__ */ e("div", {
569
571
  "aria-hidden": !0,
570
572
  "data-chat-conversations-loading": "",
571
573
  className: "flex flex-col gap-0.5",
572
574
  children: Array.from({ length: t }, (r, a) => /* @__PURE__ */ y("div", {
573
575
  className: "flex items-center gap-3 px-2 py-2.5",
574
- children: [/* @__PURE__ */ e(S, { className: "size-8 shrink-0 rounded-full" }), /* @__PURE__ */ y("div", {
576
+ children: [/* @__PURE__ */ e(_, { className: "size-8 shrink-0 rounded-full" }), /* @__PURE__ */ y("div", {
575
577
  className: "min-w-0 flex-1",
576
578
  children: [/* @__PURE__ */ y("div", {
577
579
  className: "flex items-center justify-between gap-2",
578
- children: [/* @__PURE__ */ e(S, { className: "h-3.5 w-32" }), /* @__PURE__ */ e(S, { className: "h-2.5 w-8" })]
579
- }), /* @__PURE__ */ e(S, { className: "mt-2 h-2.5 w-44" })]
580
+ children: [/* @__PURE__ */ e(_, { className: "h-3.5 w-32" }), /* @__PURE__ */ e(_, { className: "h-2.5 w-8" })]
581
+ }), /* @__PURE__ */ e(_, { className: "mt-2 h-2.5 w-44" })]
580
582
  })]
581
583
  }, a))
582
584
  });
583
585
  }
584
- function at() {
586
+ function nt() {
585
587
  return /* @__PURE__ */ y("div", {
586
588
  "aria-hidden": !0,
587
589
  "data-chat-messages-loading": "",
588
590
  className: "flex flex-col gap-3",
589
591
  children: [
590
- /* @__PURE__ */ e(S, { className: "rounded-base h-10 w-1/2 self-start" }),
591
- /* @__PURE__ */ e(S, { className: "rounded-base h-10 w-2/5 self-end" }),
592
- /* @__PURE__ */ e(S, { className: "rounded-base h-16 w-3/5 self-start" })
592
+ /* @__PURE__ */ e(_, { className: "rounded-base h-10 w-1/2 self-start" }),
593
+ /* @__PURE__ */ e(_, { className: "rounded-base h-10 w-2/5 self-end" }),
594
+ /* @__PURE__ */ e(_, { className: "rounded-base h-16 w-3/5 self-start" })
593
595
  ]
594
596
  });
595
597
  }
596
- var wt = {
597
- Root: Oe,
598
- List: ze,
599
- Search: We,
600
- Conversations: He,
598
+ var yt = {
599
+ Root: ze,
600
+ List: De,
601
+ Search: He,
602
+ Conversations: Ue,
601
603
  ConversationList: Ve,
602
- Conversation: Fe,
603
- Thread: je,
604
- Header: Ke,
605
- Title: Be,
606
- Description: Ge,
604
+ Conversation: je,
605
+ Thread: Ke,
606
+ Header: Be,
607
+ Title: Ge,
608
+ Description: Qe,
607
609
  Messages: Je,
608
- Divider: Qe,
609
- Footer: Ye,
610
- Composer: et,
611
- Empty: tt,
612
- ConversationsLoading: rt,
613
- MessagesLoading: at
610
+ Divider: Ye,
611
+ Footer: Ze,
612
+ Composer: tt,
613
+ Empty: rt,
614
+ ConversationsLoading: at,
615
+ MessagesLoading: nt
614
616
  };
615
617
  export {
616
- wt as t
618
+ yt as t
617
619
  };
618
620
 
619
- //# sourceMappingURL=chat-CU3XVm99.js.map
621
+ //# sourceMappingURL=chat-Bu8UyIbT.js.map