@photon-ai/pho-ui 4.12.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{basic-page-CJ11ekjH.js → basic-page-6dDfY33L.js} +717 -737
- package/dist/chunks/basic-page-6dDfY33L.js.map +1 -0
- package/dist/chunks/box-search-C9EVZgcb.js +56 -0
- package/dist/chunks/box-search-C9EVZgcb.js.map +1 -0
- package/dist/chunks/{chat-CU3XVm99.js → chat-Bu8UyIbT.js} +206 -204
- package/dist/chunks/chat-Bu8UyIbT.js.map +1 -0
- package/dist/chunks/chrome-Ds7WykBJ.js +14 -0
- package/dist/chunks/chrome-Ds7WykBJ.js.map +1 -0
- package/dist/chunks/{data-table-Ce_c6T73.js → data-table-hzZb7Otx.js} +56 -54
- package/dist/chunks/{data-table-Ce_c6T73.js.map → data-table-hzZb7Otx.js.map} +1 -1
- package/dist/chunks/{filter-bar-CMkvhvgL.js → filter-bar-C4sPEjw1.js} +62 -65
- package/dist/chunks/filter-bar-C4sPEjw1.js.map +1 -0
- package/dist/chunks/ghost-search-8PzP73zS.js +50 -0
- package/dist/chunks/ghost-search-8PzP73zS.js.map +1 -0
- package/dist/chunks/{trace-D1fOFzJt.js → trace-DyjsBY-S.js} +15 -13
- package/dist/chunks/{trace-D1fOFzJt.js.map → trace-DyjsBY-S.js.map} +1 -1
- package/dist/components/chat.js +1 -1
- package/dist/components/data-table.js +4 -3
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/scope.js +418 -0
- package/dist/components/scope.js.map +1 -0
- package/dist/components/trace.js +1 -1
- package/dist/index.js +176 -175
- package/dist/motion.js +61 -36
- package/dist/motion.js.map +1 -1
- package/dist/sections/basic-page.js +2 -2
- package/dist/src/components/chat/chat.d.ts +7 -4
- package/dist/src/components/input-group/box-search.d.ts +29 -0
- package/dist/src/components/scope/index.d.ts +1 -0
- package/dist/src/components/scope/scope.d.ts +98 -0
- package/dist/src/motion/index.d.ts +52 -0
- package/dist/src/utils/ghost-search.d.ts +19 -3
- package/package.json +5 -1
- package/dist/chunks/basic-page-CJ11ekjH.js.map +0 -1
- package/dist/chunks/chat-CU3XVm99.js.map +0 -1
- package/dist/chunks/filter-bar-CMkvhvgL.js.map +0 -1
- package/dist/chunks/ghost-search-CNVs9k1o.js +0 -34
- package/dist/chunks/ghost-search-CNVs9k1o.js.map +0 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import { n as
|
|
4
|
-
import { FADE_SWAP as K, PRESS_SCALE_ROW as
|
|
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
|
|
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
|
|
13
|
-
import {
|
|
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
|
|
16
|
-
var
|
|
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
|
-
],
|
|
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
|
-
],
|
|
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
|
-
}]],
|
|
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
|
-
],
|
|
66
|
-
function
|
|
67
|
-
const a = Math.max(
|
|
68
|
-
return r <= 0 ? Number.isFinite(a) ? a :
|
|
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 =
|
|
71
|
+
var te = fe(null);
|
|
71
72
|
function A(t) {
|
|
72
|
-
const r =
|
|
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" ?
|
|
77
|
+
var D = typeof window > "u" ? ve : we;
|
|
77
78
|
function T(t) {
|
|
78
79
|
return t === "thread" ? 1 : -1;
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
return t === "compact" || t === "auto" && r > 0 && r <
|
|
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 *
|
|
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 *
|
|
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
|
|
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:
|
|
120
|
-
const u = E(
|
|
121
|
-
custom:
|
|
122
|
-
variants:
|
|
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(
|
|
129
|
+
return /* @__PURE__ */ e(ge, {
|
|
129
130
|
initial: !a && r ? !1 : void 0,
|
|
130
131
|
mode: "popLayout",
|
|
131
|
-
custom:
|
|
132
|
-
children: r ? t === "aside" ? /* @__PURE__ */ e(
|
|
133
|
-
...
|
|
134
|
-
...
|
|
132
|
+
custom: o,
|
|
133
|
+
children: r ? t === "aside" ? /* @__PURE__ */ e(I.aside, {
|
|
134
|
+
...l,
|
|
135
|
+
...m,
|
|
135
136
|
children: c
|
|
136
|
-
}, "list") : /* @__PURE__ */ e(
|
|
137
|
-
...
|
|
138
|
-
...
|
|
137
|
+
}, "list") : /* @__PURE__ */ e(I.section, {
|
|
138
|
+
...l,
|
|
139
|
+
...m,
|
|
139
140
|
children: c
|
|
140
141
|
}, "thread") : null
|
|
141
142
|
});
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
-
const [
|
|
145
|
-
let
|
|
146
|
-
H.current !== h && (
|
|
147
|
-
const
|
|
148
|
-
d(T(N)),
|
|
149
|
-
}, [
|
|
150
|
-
|
|
151
|
-
}, []),
|
|
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),
|
|
158
|
+
n(j), g((ie) => Q(ie, j));
|
|
158
159
|
};
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
return
|
|
160
|
+
F();
|
|
161
|
+
const $ = new ResizeObserver(F);
|
|
162
|
+
return $.observe(N), () => $.disconnect();
|
|
162
163
|
}, []);
|
|
163
|
-
const ne =
|
|
164
|
+
const ne = J(() => ({
|
|
164
165
|
layout: t,
|
|
165
166
|
pane: h,
|
|
166
|
-
setPane:
|
|
167
|
-
direction:
|
|
168
|
-
swap:
|
|
167
|
+
setPane: U,
|
|
168
|
+
direction: R,
|
|
169
|
+
swap: X,
|
|
169
170
|
swapped: L,
|
|
170
|
-
listWidth:
|
|
171
|
+
listWidth: b,
|
|
171
172
|
frameWidth: i,
|
|
172
|
-
resizeList:
|
|
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
|
-
|
|
182
|
+
b,
|
|
182
183
|
i,
|
|
183
|
-
|
|
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
|
|
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": `${
|
|
198
|
+
"--chat-list-width": `${b}px`
|
|
198
199
|
},
|
|
199
|
-
className:
|
|
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
|
|
205
|
-
const { layout:
|
|
206
|
-
id:
|
|
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
|
-
...
|
|
211
|
+
...o
|
|
211
212
|
};
|
|
212
213
|
return u ? /* @__PURE__ */ e(re, {
|
|
213
214
|
as: "aside",
|
|
214
215
|
show: c === "list",
|
|
215
|
-
swapped:
|
|
216
|
-
direction:
|
|
217
|
-
reduceMotion:
|
|
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
|
|
226
|
-
const { layout: r, listWidth: a, frameWidth:
|
|
227
|
-
i.button === 0 && (i.currentTarget.setPointerCapture?.(i.pointerId),
|
|
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
|
-
},
|
|
232
|
-
const n =
|
|
232
|
+
}, m = (i) => {
|
|
233
|
+
const n = l.current;
|
|
233
234
|
if (n == null) return;
|
|
234
|
-
const p = c.current,
|
|
235
|
-
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
const n = c.current, p = n != null && getComputedStyle(n).direction === "rtl",
|
|
240
|
-
if (i.key ===
|
|
241
|
-
i.preventDefault(),
|
|
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(),
|
|
244
|
+
i.preventDefault(), s(a + w);
|
|
244
245
|
else if (i.key === "Home")
|
|
245
|
-
i.preventDefault(),
|
|
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 &&
|
|
250
|
+
d > 0 && s(d - O);
|
|
250
251
|
}
|
|
251
|
-
},
|
|
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":
|
|
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:
|
|
265
|
-
onPointerUp:
|
|
266
|
-
onPointerCancel:
|
|
267
|
-
onKeyDown:
|
|
268
|
-
className:
|
|
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
|
|
272
|
+
function He({ className: t, wrapperClassName: r, placeholder: a = "Search", ...o }) {
|
|
272
273
|
return /* @__PURE__ */ e("div", {
|
|
273
274
|
"data-chat-search": "",
|
|
274
|
-
className:
|
|
275
|
+
className: f("p-3", ee, t),
|
|
275
276
|
children: /* @__PURE__ */ e(de, {
|
|
276
277
|
size: "sm",
|
|
277
278
|
icon: ue,
|
|
278
|
-
placeholder:
|
|
279
|
+
placeholder: a,
|
|
279
280
|
"aria-label": "Search conversations",
|
|
280
281
|
autoComplete: "off",
|
|
281
282
|
spellCheck: !1,
|
|
282
|
-
|
|
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
|
|
288
|
+
function Ue({ className: t, children: r, ...a }) {
|
|
287
289
|
return /* @__PURE__ */ e("div", {
|
|
288
290
|
"data-chat-conversations": "",
|
|
289
|
-
className:
|
|
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:
|
|
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",
|
|
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:
|
|
312
|
+
whileTap: { scale: oe },
|
|
311
313
|
transition: le
|
|
312
314
|
};
|
|
313
|
-
function
|
|
314
|
-
const { layout:
|
|
315
|
-
|
|
316
|
-
}, h = /* @__PURE__ */ y(Y, { children: [
|
|
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:
|
|
320
|
+
children: /* @__PURE__ */ e(B.Fallback, { children: s ? /* @__PURE__ */ e(Re, {
|
|
319
321
|
className: "size-4",
|
|
320
322
|
"aria-hidden": !0
|
|
321
|
-
}) : /* @__PURE__ */ e(
|
|
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
|
-
...
|
|
345
|
-
onClick: (
|
|
346
|
-
|
|
346
|
+
...v,
|
|
347
|
+
onClick: (w) => {
|
|
348
|
+
m?.(w), w.defaultPrevented || x();
|
|
347
349
|
},
|
|
348
350
|
className: p,
|
|
349
|
-
...
|
|
351
|
+
...q,
|
|
350
352
|
children: h
|
|
351
|
-
}) }) : /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
353
|
+
}) }) : /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(I.button, {
|
|
352
354
|
type: "button",
|
|
353
355
|
"aria-current": c ? "true" : void 0,
|
|
354
|
-
...
|
|
355
|
-
onClick: (
|
|
356
|
-
|
|
356
|
+
...v,
|
|
357
|
+
onClick: (w) => {
|
|
358
|
+
m?.(w), w.defaultPrevented || x();
|
|
357
359
|
},
|
|
358
360
|
className: p,
|
|
359
|
-
...
|
|
361
|
+
...q,
|
|
360
362
|
children: h
|
|
361
363
|
}) });
|
|
362
364
|
}
|
|
363
|
-
function
|
|
364
|
-
const { layout:
|
|
365
|
-
return
|
|
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:
|
|
369
|
+
show: s === "thread",
|
|
368
370
|
swapped: u,
|
|
369
371
|
direction: c,
|
|
370
|
-
reduceMotion:
|
|
372
|
+
reduceMotion: m,
|
|
371
373
|
"aria-label": "Conversation",
|
|
372
374
|
"data-chat-thread": "",
|
|
373
|
-
className:
|
|
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:
|
|
381
|
+
className: v,
|
|
380
382
|
...a,
|
|
381
383
|
children: r
|
|
382
384
|
});
|
|
383
385
|
}
|
|
384
|
-
function
|
|
385
|
-
const { layout:
|
|
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:
|
|
390
|
+
className: f("flex shrink-0 items-center gap-3 px-4 py-1.5", ee, o),
|
|
389
391
|
...c,
|
|
390
392
|
children: [
|
|
391
|
-
|
|
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:
|
|
400
|
+
className: f("-ml-1 shrink-0", l === "auto" && "@2xl:hidden"),
|
|
399
401
|
onClick: () => u("list"),
|
|
400
|
-
children: /* @__PURE__ */ e(
|
|
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:
|
|
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
|
|
416
|
+
function Ge({ className: t, children: r, ...a }) {
|
|
415
417
|
return /* @__PURE__ */ e("h2", {
|
|
416
418
|
"data-chat-title": "",
|
|
417
|
-
className:
|
|
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
|
|
424
|
+
function Qe({ className: t, ...r }) {
|
|
423
425
|
return /* @__PURE__ */ e("p", {
|
|
424
426
|
"data-chat-description": "",
|
|
425
|
-
className:
|
|
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:
|
|
431
|
-
const u =
|
|
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 =
|
|
435
|
+
const n = u.current, p = m.current;
|
|
434
436
|
if (!n || !p) return;
|
|
435
|
-
const
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
|
|
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
|
-
|
|
443
|
+
v.current && (n.scrollTop = n.scrollHeight);
|
|
442
444
|
};
|
|
443
|
-
if (
|
|
444
|
-
const h = new ResizeObserver(
|
|
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
|
|
449
|
+
const g = () => {
|
|
448
450
|
const n = u.current;
|
|
449
|
-
n && (
|
|
451
|
+
n && (v.current = n.scrollHeight - n.scrollTop - n.clientHeight < qe);
|
|
450
452
|
}, i = () => {
|
|
451
453
|
const n = u.current;
|
|
452
|
-
n && (
|
|
454
|
+
n && (b.current = {
|
|
453
455
|
height: n.scrollHeight,
|
|
454
456
|
top: n.scrollTop
|
|
455
|
-
}),
|
|
457
|
+
}), v.current = !1, a?.();
|
|
456
458
|
};
|
|
457
459
|
return /* @__PURE__ */ e("div", {
|
|
458
460
|
"data-chat-messages": "",
|
|
459
|
-
className:
|
|
460
|
-
...
|
|
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:
|
|
467
|
+
onScroll: g,
|
|
466
468
|
children: /* @__PURE__ */ y(C.Content, {
|
|
467
|
-
ref:
|
|
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:
|
|
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
|
|
487
|
+
function Ye({ className: t, children: r, ...a }) {
|
|
486
488
|
return /* @__PURE__ */ e("div", {
|
|
487
489
|
"data-chat-divider": "",
|
|
488
|
-
className:
|
|
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
|
|
495
|
+
function Ze({ className: t, ...r }) {
|
|
494
496
|
return /* @__PURE__ */ e("footer", {
|
|
495
497
|
"data-chat-footer": "",
|
|
496
|
-
className:
|
|
498
|
+
className: f("shrink-0 px-4 py-3", t),
|
|
497
499
|
...r
|
|
498
500
|
});
|
|
499
501
|
}
|
|
500
|
-
var
|
|
501
|
-
function
|
|
502
|
-
const p =
|
|
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,
|
|
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(),
|
|
509
|
-
},
|
|
510
|
-
d.key === "Enter" && !d.shiftKey && !d.nativeEvent.isComposing && (d.preventDefault(),
|
|
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:
|
|
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
|
-
|
|
521
|
+
b,
|
|
520
522
|
/* @__PURE__ */ e("textarea", {
|
|
521
523
|
ref: (d) => {
|
|
522
|
-
p.current = d, typeof
|
|
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:
|
|
528
|
+
onKeyDown: w,
|
|
527
529
|
rows: 1,
|
|
528
|
-
placeholder:
|
|
530
|
+
placeholder: o,
|
|
529
531
|
"aria-label": "Message",
|
|
530
532
|
disabled: c,
|
|
531
|
-
readOnly:
|
|
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:
|
|
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":
|
|
548
|
-
disabled: !
|
|
549
|
-
loading:
|
|
550
|
-
children: /* @__PURE__ */ e(
|
|
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
|
|
559
|
+
function rt({ className: t, size: r = "sm", ...a }) {
|
|
558
560
|
return /* @__PURE__ */ e("div", {
|
|
559
561
|
"data-chat-empty": "",
|
|
560
|
-
className:
|
|
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
|
|
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(
|
|
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(
|
|
579
|
-
}), /* @__PURE__ */ e(
|
|
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
|
|
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(
|
|
591
|
-
/* @__PURE__ */ e(
|
|
592
|
-
/* @__PURE__ */ e(
|
|
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
|
|
597
|
-
Root:
|
|
598
|
-
List:
|
|
599
|
-
Search:
|
|
600
|
-
Conversations:
|
|
598
|
+
var yt = {
|
|
599
|
+
Root: ze,
|
|
600
|
+
List: De,
|
|
601
|
+
Search: He,
|
|
602
|
+
Conversations: Ue,
|
|
601
603
|
ConversationList: Ve,
|
|
602
|
-
Conversation:
|
|
603
|
-
Thread:
|
|
604
|
-
Header:
|
|
605
|
-
Title:
|
|
606
|
-
Description:
|
|
604
|
+
Conversation: je,
|
|
605
|
+
Thread: Ke,
|
|
606
|
+
Header: Be,
|
|
607
|
+
Title: Ge,
|
|
608
|
+
Description: Qe,
|
|
607
609
|
Messages: Je,
|
|
608
|
-
Divider:
|
|
609
|
-
Footer:
|
|
610
|
-
Composer:
|
|
611
|
-
Empty:
|
|
612
|
-
ConversationsLoading:
|
|
613
|
-
MessagesLoading:
|
|
610
|
+
Divider: Ye,
|
|
611
|
+
Footer: Ze,
|
|
612
|
+
Composer: tt,
|
|
613
|
+
Empty: rt,
|
|
614
|
+
ConversationsLoading: at,
|
|
615
|
+
MessagesLoading: nt
|
|
614
616
|
};
|
|
615
617
|
export {
|
|
616
|
-
|
|
618
|
+
yt as t
|
|
617
619
|
};
|
|
618
620
|
|
|
619
|
-
//# sourceMappingURL=chat-
|
|
621
|
+
//# sourceMappingURL=chat-Bu8UyIbT.js.map
|