@photon-ai/pho-ui 4.20.0 → 4.20.1

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 (29) hide show
  1. package/dist/chunks/{basic-page-DTomHxEo.js → basic-page-B78a6jpw.js} +4 -4
  2. package/dist/chunks/{basic-page-DTomHxEo.js.map → basic-page-B78a6jpw.js.map} +1 -1
  3. package/dist/chunks/chat-Dfbkf7g8.js +674 -0
  4. package/dist/chunks/chat-Dfbkf7g8.js.map +1 -0
  5. package/dist/chunks/{code-block-Yxg2wZGJ.js → code-block-B7MibV6r.js} +2 -2
  6. package/dist/chunks/{code-block-Yxg2wZGJ.js.map → code-block-B7MibV6r.js.map} +1 -1
  7. package/dist/chunks/{dialog-DORIrfyJ.js → dialog-CDL6qY2a.js} +2 -2
  8. package/dist/chunks/{dialog-DORIrfyJ.js.map → dialog-CDL6qY2a.js.map} +1 -1
  9. package/dist/chunks/{scroll-area-Dhl5hqay.js → scroll-area-DjdSnx2p.js} +2 -2
  10. package/dist/chunks/scroll-area-DjdSnx2p.js.map +1 -0
  11. package/dist/chunks/{sidebar-CgaSEWVr.js → sidebar-DHYyBBUj.js} +2 -2
  12. package/dist/chunks/{sidebar-CgaSEWVr.js.map → sidebar-DHYyBBUj.js.map} +1 -1
  13. package/dist/chunks/{toast-B3oURNJC.js → toast-B1GAdxXP.js} +2 -2
  14. package/dist/chunks/{toast-B3oURNJC.js.map → toast-B1GAdxXP.js.map} +1 -1
  15. package/dist/components/chat.js +1 -1
  16. package/dist/components/code-block.js +1 -1
  17. package/dist/components/command.js +1 -1
  18. package/dist/components/dialog.js +1 -1
  19. package/dist/components/scroll-area.js +1 -1
  20. package/dist/components/toast.js +1 -1
  21. package/dist/index.js +5 -5
  22. package/dist/sections/basic-page.js +1 -1
  23. package/dist/sections/sidebar.js +1 -1
  24. package/dist/src/components/chat/chat.d.ts +9 -4
  25. package/dist/src/components/scroll-area/scroll-area-edges.d.ts +1 -0
  26. package/package.json +1 -1
  27. package/dist/chunks/chat-ZUzGmTWE.js +0 -621
  28. package/dist/chunks/chat-ZUzGmTWE.js.map +0 -1
  29. package/dist/chunks/scroll-area-Dhl5hqay.js.map +0 -1
@@ -1,621 +0,0 @@
1
- "use client";
2
- import { t as f } from "./cn-CPbhpG1q.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
- import { a as z } from "./button-CLfWdqm-.js";
6
- import { t as M } from "./createReactComponent-yKZn9MIX.js";
7
- import { t as de } from "./input-DWnb33UF.js";
8
- import { n as B } from "./avatar-PgBOfszL.js";
9
- import { t as ue } from "./IconSearch-DkcWWZ1H.js";
10
- import { t as C } from "./scroll-area-Dhl5hqay.js";
11
- import { i as pe } from "./status-view-I_Y6eEyX.js";
12
- import { t as _ } from "./skeleton-CqZlGphn.js";
13
- import { n as he } from "./box-search-CMl5bQ7Y.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";
15
- import { Fragment as Y, jsx as e, jsxs as y } from "react/jsx-runtime";
16
- import { AnimatePresence as ge, motion as I, useReducedMotion as Z } from "motion/react";
17
- var be = [
18
- ["path", {
19
- d: "M5 12l14 0",
20
- key: "svg-0"
21
- }],
22
- ["path", {
23
- d: "M5 12l6 6",
24
- key: "svg-1"
25
- }],
26
- ["path", {
27
- d: "M5 12l6 -6",
28
- key: "svg-2"
29
- }]
30
- ], ye = M("outline", "arrow-left", "ArrowLeft", be), Ne = [
31
- ["path", {
32
- d: "M12 5l0 14",
33
- key: "svg-0"
34
- }],
35
- ["path", {
36
- d: "M18 11l-6 -6",
37
- key: "svg-1"
38
- }],
39
- ["path", {
40
- d: "M6 11l6 -6",
41
- key: "svg-2"
42
- }]
43
- ], Ce = M("outline", "arrow-up", "ArrowUp", Ne), Se = [["path", {
44
- d: "M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",
45
- key: "svg-0"
46
- }], ["path", {
47
- d: "M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",
48
- key: "svg-1"
49
- }]], _e = M("outline", "user", "User", Se), ke = [
50
- ["path", {
51
- d: "M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",
52
- key: "svg-0"
53
- }],
54
- ["path", {
55
- d: "M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",
56
- key: "svg-1"
57
- }],
58
- ["path", {
59
- d: "M16 3.13a4 4 0 0 1 0 7.75",
60
- key: "svg-2"
61
- }],
62
- ["path", {
63
- d: "M21 21v-2a4 4 0 0 0 -3 -3.85",
64
- key: "svg-3"
65
- }]
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));
70
- }
71
- var te = fe(null);
72
- function A(t) {
73
- const r = me(te);
74
- if (r == null) throw new Error(`Chat.${t} must be used inside Chat.Root`);
75
- return r;
76
- }
77
- var D = typeof window > "u" ? ve : we;
78
- function T(t) {
79
- return t === "thread" ? 1 : -1;
80
- }
81
- function Te(t, r) {
82
- return t === "compact" || t === "auto" && r > 0 && r < Ae;
83
- }
84
- function E(t, r) {
85
- return r ? {
86
- initial: { opacity: 0 },
87
- animate: { opacity: 1 },
88
- exit: { opacity: 0 },
89
- transition: { duration: 0 }
90
- } : {
91
- initial: {
92
- x: t * Ee,
93
- opacity: 0,
94
- filter: "blur(1px)"
95
- },
96
- animate: {
97
- x: 0,
98
- opacity: 1,
99
- filter: "blur(0px)"
100
- },
101
- exit: {
102
- x: -t * Ie,
103
- opacity: 0,
104
- filter: "blur(1px)"
105
- },
106
- transition: {
107
- x: ce,
108
- opacity: K,
109
- filter: K
110
- }
111
- };
112
- }
113
- function Oe(t) {
114
- return {
115
- enter: (r) => E(r, t).initial,
116
- rest: (r) => E(r, t).animate,
117
- leave: (r) => E(r, t).exit
118
- };
119
- }
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),
124
- initial: "enter",
125
- animate: "rest",
126
- exit: "leave",
127
- transition: u.transition
128
- };
129
- return /* @__PURE__ */ e(ge, {
130
- initial: !a && r ? !1 : void 0,
131
- mode: "popLayout",
132
- custom: o,
133
- children: r ? t === "aside" ? /* @__PURE__ */ e(I.aside, {
134
- ...l,
135
- ...m,
136
- children: c
137
- }, "list") : /* @__PURE__ */ e(I.section, {
138
- ...l,
139
- ...m,
140
- children: c
141
- }, "thread") : null
142
- });
143
- }
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);
153
- D(() => {
154
- const N = p.current;
155
- if (!N || typeof ResizeObserver > "u") return;
156
- const F = () => {
157
- const j = N.clientWidth;
158
- n(j), g((ie) => Q(ie, j));
159
- };
160
- F();
161
- const $ = new ResizeObserver(F);
162
- return $.observe(N), () => $.disconnect();
163
- }, []);
164
- const ne = J(() => ({
165
- layout: t,
166
- pane: h,
167
- setPane: U,
168
- direction: R,
169
- swap: X,
170
- swapped: L,
171
- listWidth: b,
172
- frameWidth: i,
173
- resizeList: V,
174
- rootRef: p
175
- }), [
176
- t,
177
- h,
178
- U,
179
- R,
180
- X,
181
- L,
182
- b,
183
- i,
184
- V
185
- ]);
186
- return /* @__PURE__ */ e(te.Provider, {
187
- value: ne,
188
- children: /* @__PURE__ */ e("div", {
189
- ref: (N) => {
190
- p.current = N, typeof l == "function" ? l(N) : l && (l.current = N);
191
- },
192
- "data-chat": "",
193
- "data-basic-page-card": "",
194
- "data-layout": t,
195
- "data-pane": h,
196
- style: {
197
- ...c,
198
- "--chat-list-width": `${b}px`
199
- },
200
- className: f(Pe, "@container relative flex min-h-0 min-w-0 overflow-hidden", s),
201
- ...u
202
- })
203
- });
204
- }
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,
208
- "aria-label": "Conversations",
209
- "data-chat-list": "",
210
- className: i,
211
- ...o
212
- };
213
- return u ? /* @__PURE__ */ e(re, {
214
- as: "aside",
215
- show: c === "list",
216
- swapped: m,
217
- direction: l,
218
- reduceMotion: v,
219
- ...p,
220
- children: n
221
- }) : /* @__PURE__ */ e("aside", {
222
- ...p,
223
- children: n
224
- });
225
- }
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 = {
229
- x: i.clientX,
230
- width: a
231
- });
232
- }, m = (i) => {
233
- const n = l.current;
234
- if (n == null) return;
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);
243
- else if (i.key === h)
244
- i.preventDefault(), s(a + w);
245
- else if (i.key === "Home")
246
- i.preventDefault(), s(k);
247
- else if (i.key === "End") {
248
- i.preventDefault();
249
- const d = n?.clientWidth ?? 0;
250
- d > 0 && s(d - O);
251
- }
252
- }, g = o > 0 ? Math.max(k, o - O) : a;
253
- return /* @__PURE__ */ e("div", {
254
- role: "separator",
255
- "aria-orientation": "vertical",
256
- "aria-label": "Resize conversation list",
257
- "aria-controls": t,
258
- "aria-valuenow": a,
259
- "aria-valuemin": k,
260
- "aria-valuemax": g,
261
- "aria-valuetext": `${a} pixels`,
262
- tabIndex: 0,
263
- "data-chat-splitter": "",
264
- onPointerDown: u,
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")
270
- });
271
- }
272
- function He({ className: t, wrapperClassName: r, placeholder: a = "Search", ...o }) {
273
- return /* @__PURE__ */ e("div", {
274
- "data-chat-search": "",
275
- className: f("p-3", ee, t),
276
- children: /* @__PURE__ */ e(de, {
277
- size: "sm",
278
- icon: ue,
279
- placeholder: a,
280
- "aria-label": "Search conversations",
281
- autoComplete: "off",
282
- spellCheck: !1,
283
- wrapperClassName: f(he, "[&:focus-within>svg]:text-pho-primary [&>svg]:transition-colors [&>svg]:duration-100", r),
284
- ...o
285
- })
286
- });
287
- }
288
- function Ue({ className: t, children: r, ...a }) {
289
- return /* @__PURE__ */ e("div", {
290
- "data-chat-conversations": "",
291
- className: f("flex min-h-0 flex-1 flex-col", t),
292
- ...a,
293
- children: /* @__PURE__ */ y(C.Root, {
294
- className: "min-h-0 flex-1",
295
- children: [/* @__PURE__ */ e(C.Viewport, { children: /* @__PURE__ */ e(C.Content, {
296
- style: { minWidth: 0 },
297
- className: "flex min-h-full flex-col px-3 py-1",
298
- children: r
299
- }) }), /* @__PURE__ */ e(C.Scrollbar, { children: /* @__PURE__ */ e(C.Thumb, {}) })]
300
- })
301
- });
302
- }
303
- function Ve({ className: t, ...r }) {
304
- return /* @__PURE__ */ e("ul", {
305
- "data-chat-conversation-list": "",
306
- className: f("m-0 flex list-none flex-col gap-0.5 *:m-0", t),
307
- ...r
308
- });
309
- }
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 = {
311
- initial: !1,
312
- whileTap: { scale: oe },
313
- transition: le
314
- };
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, {
319
- size: "sm",
320
- children: /* @__PURE__ */ e(B.Fallback, { children: s ? /* @__PURE__ */ e(Re, {
321
- className: "size-4",
322
- "aria-hidden": !0
323
- }) : /* @__PURE__ */ e(_e, {
324
- className: "size-4",
325
- "aria-hidden": !0
326
- }) })
327
- }), /* @__PURE__ */ y("span", {
328
- className: "min-w-0 flex-1",
329
- children: [/* @__PURE__ */ y("span", {
330
- className: "flex items-baseline justify-between gap-2",
331
- children: [/* @__PURE__ */ e("span", {
332
- className: "text-pho-primary min-w-0 truncate text-base font-medium",
333
- children: t
334
- }), r != null && /* @__PURE__ */ e("span", {
335
- className: "text-pho-description shrink-0 text-xs font-normal whitespace-nowrap tabular-nums",
336
- children: r
337
- })]
338
- }), a != null && /* @__PURE__ */ e("span", {
339
- className: "text-pho-description mt-0.5 block min-w-0 truncate text-xs font-normal",
340
- children: a
341
- })]
342
- })] });
343
- return u !== void 0 ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(n, {
344
- href: u,
345
- "aria-current": c ? "page" : void 0,
346
- ...v,
347
- onClick: (w) => {
348
- m?.(w), w.defaultPrevented || x();
349
- },
350
- className: p,
351
- ...q,
352
- children: h
353
- }) }) : /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(I.button, {
354
- type: "button",
355
- "aria-current": c ? "true" : void 0,
356
- ...v,
357
- onClick: (w) => {
358
- m?.(w), w.defaultPrevented || x();
359
- },
360
- className: p,
361
- ...q,
362
- children: h
363
- }) });
364
- }
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, {
368
- as: "section",
369
- show: s === "thread",
370
- swapped: u,
371
- direction: c,
372
- reduceMotion: m,
373
- "aria-label": "Conversation",
374
- "data-chat-thread": "",
375
- className: v,
376
- ...a,
377
- children: r
378
- }) : /* @__PURE__ */ e("section", {
379
- "aria-label": "Conversation",
380
- "data-chat-thread": "",
381
- className: v,
382
- ...a,
383
- children: r
384
- });
385
- }
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");
388
- return /* @__PURE__ */ y("header", {
389
- "data-chat-header": "",
390
- className: f("flex shrink-0 items-center gap-3 px-4 py-1.5", ee, o),
391
- ...c,
392
- children: [
393
- l !== "default" && /* @__PURE__ */ e(z, {
394
- variant: "ghost",
395
- size: "sm",
396
- shape: "circle",
397
- svgOnly: !0,
398
- "aria-label": a,
399
- "data-chat-back": "",
400
- className: f("-ml-1 shrink-0", l === "auto" && "@2xl:hidden"),
401
- onClick: () => u("list"),
402
- children: /* @__PURE__ */ e(ye, {})
403
- }),
404
- t,
405
- /* @__PURE__ */ e("div", {
406
- className: "flex min-w-0 flex-1 flex-col",
407
- children: s
408
- }),
409
- r != null && /* @__PURE__ */ e("div", {
410
- className: "flex shrink-0 items-center gap-1",
411
- children: r
412
- })
413
- ]
414
- });
415
- }
416
- function Ge({ className: t, children: r, ...a }) {
417
- return /* @__PURE__ */ e("h2", {
418
- "data-chat-title": "",
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),
420
- ...a,
421
- children: r
422
- });
423
- }
424
- function Qe({ className: t, ...r }) {
425
- return /* @__PURE__ */ e("p", {
426
- "data-chat-description": "",
427
- className: f("text-pho-description m-0 min-w-0 truncate text-xs", t),
428
- ...r
429
- });
430
- }
431
- var qe = 40;
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);
434
- D(() => {
435
- const n = u.current, p = m.current;
436
- if (!n || !p) return;
437
- const x = () => {
438
- const w = b.current;
439
- if (w) {
440
- b.current = null, n.scrollTop = n.scrollHeight - w.height + w.top;
441
- return;
442
- }
443
- v.current && (n.scrollTop = n.scrollHeight);
444
- };
445
- if (x(), typeof ResizeObserver > "u") return;
446
- const h = new ResizeObserver(x);
447
- return h.observe(p), h.observe(n), () => h.disconnect();
448
- }, []);
449
- const g = () => {
450
- const n = u.current;
451
- n && (v.current = n.scrollHeight - n.scrollTop - n.clientHeight < qe);
452
- }, i = () => {
453
- const n = u.current;
454
- n && (b.current = {
455
- height: n.scrollHeight,
456
- top: n.scrollTop
457
- }), v.current = !1, a?.();
458
- };
459
- return /* @__PURE__ */ e("div", {
460
- "data-chat-messages": "",
461
- className: f("flex min-h-0 flex-1 flex-col [--pho-bubble-backdrop:var(--background-color-pho-primary)]", s),
462
- ...l,
463
- children: /* @__PURE__ */ y(C.Root, {
464
- className: "min-h-0 flex-1",
465
- children: [/* @__PURE__ */ e(C.Viewport, {
466
- ref: u,
467
- onScroll: g,
468
- children: /* @__PURE__ */ y(C.Content, {
469
- ref: m,
470
- style: { minWidth: 0 },
471
- className: "flex min-h-full flex-col gap-1 p-4",
472
- children: [t && /* @__PURE__ */ e("div", {
473
- className: "flex justify-center",
474
- children: /* @__PURE__ */ e(z, {
475
- variant: "outlined",
476
- size: "sm",
477
- loading: r,
478
- onClick: i,
479
- children: o
480
- })
481
- }), c]
482
- })
483
- }), /* @__PURE__ */ e(C.Scrollbar, { children: /* @__PURE__ */ e(C.Thumb, {}) })]
484
- })
485
- });
486
- }
487
- function Ye({ className: t, children: r, ...a }) {
488
- return /* @__PURE__ */ e("div", {
489
- "data-chat-divider": "",
490
- className: f("text-pho-description py-1 text-center text-xs", t),
491
- ...a,
492
- children: r
493
- });
494
- }
495
- function Ze({ className: t, ...r }) {
496
- return /* @__PURE__ */ e("footer", {
497
- "data-chat-footer": "",
498
- className: f("shrink-0 px-4 py-3", t),
499
- ...r
500
- });
501
- }
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);
505
- D(() => {
506
- const d = p.current;
507
- d && (d.style.height = "0px", d.style.height = `${Math.min(d.scrollHeight, et)}px`);
508
- }, [t]);
509
- const h = (d) => {
510
- d.preventDefault(), x && a();
511
- }, w = (d) => {
512
- d.key === "Enter" && !d.shiftKey && !d.nativeEvent.isComposing && (d.preventDefault(), x && a());
513
- };
514
- return /* @__PURE__ */ y("form", {
515
- "aria-label": "Message composer",
516
- "data-chat-composer": "",
517
- onSubmit: h,
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),
519
- ...n,
520
- children: [
521
- b,
522
- /* @__PURE__ */ e("textarea", {
523
- ref: (d) => {
524
- p.current = d, typeof g == "function" ? g(d) : g && (g.current = d);
525
- },
526
- value: t,
527
- onChange: (d) => r(d.target.value),
528
- onKeyDown: w,
529
- rows: 1,
530
- placeholder: o,
531
- "aria-label": "Message",
532
- disabled: c,
533
- readOnly: s,
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"
535
- }),
536
- /* @__PURE__ */ y("div", {
537
- className: "flex items-center gap-2 px-2 pb-2",
538
- children: [
539
- u,
540
- /* @__PURE__ */ e("p", {
541
- className: "text-pho-description m-0 min-w-0 flex-1 truncate text-xs",
542
- children: m
543
- }),
544
- /* @__PURE__ */ e(z, {
545
- type: "submit",
546
- size: "sm",
547
- shape: "circle",
548
- svgOnly: !0,
549
- "aria-label": v,
550
- disabled: !x,
551
- loading: s,
552
- children: /* @__PURE__ */ e(Ce, {})
553
- })
554
- ]
555
- })
556
- ]
557
- });
558
- }
559
- function rt({ className: t, size: r = "sm", ...a }) {
560
- return /* @__PURE__ */ e("div", {
561
- "data-chat-empty": "",
562
- className: f("flex flex-1 flex-col items-center justify-center px-6 py-8", t),
563
- children: /* @__PURE__ */ e(pe, {
564
- size: r,
565
- ...a
566
- })
567
- });
568
- }
569
- function at({ rows: t = 5 }) {
570
- return /* @__PURE__ */ e("div", {
571
- "aria-hidden": !0,
572
- "data-chat-conversations-loading": "",
573
- className: "flex flex-col gap-0.5",
574
- children: Array.from({ length: t }, (r, a) => /* @__PURE__ */ y("div", {
575
- className: "flex items-center gap-3 px-2 py-2.5",
576
- children: [/* @__PURE__ */ e(_, { className: "size-8 shrink-0 rounded-full" }), /* @__PURE__ */ y("div", {
577
- className: "min-w-0 flex-1",
578
- children: [/* @__PURE__ */ y("div", {
579
- className: "flex items-center justify-between gap-2",
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" })]
582
- })]
583
- }, a))
584
- });
585
- }
586
- function nt() {
587
- return /* @__PURE__ */ y("div", {
588
- "aria-hidden": !0,
589
- "data-chat-messages-loading": "",
590
- className: "flex flex-col gap-3",
591
- children: [
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" })
595
- ]
596
- });
597
- }
598
- var yt = {
599
- Root: ze,
600
- List: De,
601
- Search: He,
602
- Conversations: Ue,
603
- ConversationList: Ve,
604
- Conversation: je,
605
- Thread: Ke,
606
- Header: Be,
607
- Title: Ge,
608
- Description: Qe,
609
- Messages: Je,
610
- Divider: Ye,
611
- Footer: Ze,
612
- Composer: tt,
613
- Empty: rt,
614
- ConversationsLoading: at,
615
- MessagesLoading: nt
616
- };
617
- export {
618
- yt as t
619
- };
620
-
621
- //# sourceMappingURL=chat-ZUzGmTWE.js.map