@photon-ai/pho-ui 4.21.0 → 4.23.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-B78a6jpw.js → basic-page-DnB4YSRj.js} +15 -15
- package/dist/chunks/basic-page-DnB4YSRj.js.map +1 -0
- package/dist/chunks/{chat-Dfbkf7g8.js → chat-C5W6L_Jg.js} +51 -51
- package/dist/chunks/chat-C5W6L_Jg.js.map +1 -0
- package/dist/chunks/{checkbox-DpWLbKVS.js → checkbox-D8smFViR.js} +2 -2
- package/dist/chunks/{checkbox-DpWLbKVS.js.map → checkbox-D8smFViR.js.map} +1 -1
- package/dist/chunks/chrome-Dyvv0FVf.js +14 -0
- package/dist/chunks/{chrome-Ds7WykBJ.js.map → chrome-Dyvv0FVf.js.map} +1 -1
- package/dist/chunks/{combobox-OQOi5hlB.js → combobox-C_yfFCFL.js} +2 -2
- package/dist/chunks/{combobox-OQOi5hlB.js.map → combobox-C_yfFCFL.js.map} +1 -1
- package/dist/chunks/{data-table-CAz_8HQw.js → data-table-C1tLUdw0.js} +4 -4
- package/dist/chunks/{data-table-CAz_8HQw.js.map → data-table-C1tLUdw0.js.map} +1 -1
- package/dist/chunks/{date-picker-vJQrTol9.js → date-picker-D-sWo3i8.js} +2 -2
- package/dist/chunks/{date-picker-vJQrTol9.js.map → date-picker-D-sWo3i8.js.map} +1 -1
- package/dist/chunks/{description-list-Duhhralt.js → description-list-DcTvBHzI.js} +6 -6
- package/dist/chunks/{description-list-Duhhralt.js.map → description-list-DcTvBHzI.js.map} +1 -1
- package/dist/chunks/{dialog-CDL6qY2a.js → dialog-e4_mOYGp.js} +5 -5
- package/dist/chunks/dialog-e4_mOYGp.js.map +1 -0
- package/dist/chunks/{error-BObcQClz.js → error-BjSn7wLu.js} +3 -3
- package/dist/chunks/{error-BObcQClz.js.map → error-BjSn7wLu.js.map} +1 -1
- package/dist/chunks/{filter-bar-qqCZf1x4.js → filter-bar-CLLonntH.js} +2 -2
- package/dist/chunks/{filter-bar-qqCZf1x4.js.map → filter-bar-CLLonntH.js.map} +1 -1
- package/dist/chunks/{log-list-QbSYHZu3.js → log-list-BqaJv2oA.js} +2 -2
- package/dist/chunks/{log-list-QbSYHZu3.js.map → log-list-BqaJv2oA.js.map} +1 -1
- package/dist/chunks/{menu-CC3fhf83.js → menu-CZSn8JAX.js} +2 -2
- package/dist/chunks/{menu-CC3fhf83.js.map → menu-CZSn8JAX.js.map} +1 -1
- package/dist/chunks/{popover-B0NBrYV5.js → popover-Dtp9C6Qg.js} +4 -4
- package/dist/chunks/{popover-B0NBrYV5.js.map → popover-Dtp9C6Qg.js.map} +1 -1
- package/dist/chunks/{select-xhSvDNbw.js → select-Dux2SBVc.js} +2 -2
- package/dist/chunks/{select-xhSvDNbw.js.map → select-Dux2SBVc.js.map} +1 -1
- package/dist/chunks/{sidebar-DHYyBBUj.js → sidebar-BsBlAVM9.js} +2 -2
- package/dist/chunks/sidebar-BsBlAVM9.js.map +1 -0
- package/dist/chunks/{stat-VxA1SvS_.js → stat-DUq4roVt.js} +16 -16
- package/dist/chunks/{stat-VxA1SvS_.js.map → stat-DUq4roVt.js.map} +1 -1
- package/dist/chunks/{status-view-I_Y6eEyX.js → status-view-Buhh1UBJ.js} +2 -2
- package/dist/chunks/status-view-Buhh1UBJ.js.map +1 -0
- package/dist/chunks/{toast-B1GAdxXP.js → toast-K549iZEX.js} +2 -2
- package/dist/chunks/{toast-B1GAdxXP.js.map → toast-K549iZEX.js.map} +1 -1
- package/dist/chunks/{trace-D9F0sne7.js → trace-5Rh1ade9.js} +2 -2
- package/dist/chunks/{trace-D9F0sne7.js.map → trace-5Rh1ade9.js.map} +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/autocomplete.js +5 -5
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/chat.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/context-menu.js +5 -5
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.js +2 -2
- package/dist/components/date-picker.js +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.js +5 -5
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/error.js +1 -1
- package/dist/components/field.js +26 -24
- package/dist/components/field.js.map +1 -1
- package/dist/components/fieldset.js +5 -5
- package/dist/components/fieldset.js.map +1 -1
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/log-list.js +1 -1
- package/dist/components/menu.js +1 -1
- package/dist/components/meter.js +12 -12
- package/dist/components/meter.js.map +1 -1
- package/dist/components/notification.js +2 -2
- package/dist/components/notification.js.map +1 -1
- package/dist/components/phone-input.js +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/progress.js +16 -16
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/scope.js +3 -3
- package/dist/components/scope.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/slider.js +16 -16
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat.js +1 -1
- package/dist/components/status-view.js +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/trace.js +1 -1
- package/dist/index.js +13 -13
- package/dist/sections/basic-page.js +2 -2
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/data-table/chrome.d.ts +1 -1
- package/dist/src/components/drawer/drawer.d.ts +1 -0
- package/dist/src/components/field/field.d.ts +10 -2
- package/dist/src/components/status-view/status-view.d.ts +4 -3
- package/dist/src/sections/sidebar/sidebar.d.ts +7 -2
- package/package.json +1 -1
- package/src/styles/fonts.css +6 -4
- package/src/styles/theme.css +5 -3
- package/dist/chunks/basic-page-B78a6jpw.js.map +0 -1
- package/dist/chunks/chat-Dfbkf7g8.js.map +0 -1
- package/dist/chunks/chrome-Ds7WykBJ.js +0 -14
- package/dist/chunks/dialog-CDL6qY2a.js.map +0 -1
- package/dist/chunks/sidebar-DHYyBBUj.js.map +0 -1
- package/dist/chunks/status-view-I_Y6eEyX.js.map +0 -1
|
@@ -9,7 +9,7 @@ import { t as ve } from "./input-DWnb33UF.js";
|
|
|
9
9
|
import { n as J } from "./avatar-PgBOfszL.js";
|
|
10
10
|
import { t as xe } from "./IconSearch-DkcWWZ1H.js";
|
|
11
11
|
import { t as k } from "./scroll-area-DjdSnx2p.js";
|
|
12
|
-
import { i as ge } from "./status-view-
|
|
12
|
+
import { i as ge } from "./status-view-Buhh1UBJ.js";
|
|
13
13
|
import { t as A } from "./skeleton-CqZlGphn.js";
|
|
14
14
|
import { n as we } from "./box-search-CMl5bQ7Y.js";
|
|
15
15
|
import { createContext as be, useCallback as O, useContext as ye, useEffect as re, useId as Ne, useLayoutEffect as Ce, useMemo as ne, useRef as S, useState as I } from "react";
|
|
@@ -64,14 +64,14 @@ var ke = [
|
|
|
64
64
|
d: "M21 21v-2a4 4 0 0 0 -3 -3.85",
|
|
65
65
|
key: "svg-3"
|
|
66
66
|
}]
|
|
67
|
-
], Me = D("outline", "users", "Users", Te), Le = "rounded-base border border-pho-secondary bg-pho-primary", Ee = 672, Oe = 24, ze = 8,
|
|
67
|
+
], Me = D("outline", "users", "Users", Te), Le = "rounded-base border border-pho-secondary bg-pho-primary", Ee = 672, Oe = 24, ze = 8, oe = "min-h-[61px]", De = 273, P = 256, V = 320, He = 16;
|
|
68
68
|
function Y(t, e) {
|
|
69
69
|
const a = Math.max(P, t);
|
|
70
70
|
return e <= 0 ? Number.isFinite(a) ? a : P : Math.min(a, Math.max(P, e - V));
|
|
71
71
|
}
|
|
72
|
-
var
|
|
72
|
+
var se = be(null);
|
|
73
73
|
function M(t) {
|
|
74
|
-
const e = ye(
|
|
74
|
+
const e = ye(se);
|
|
75
75
|
if (e == null) throw new Error(`Chat.${t} must be used inside Chat.Root`);
|
|
76
76
|
return e;
|
|
77
77
|
}
|
|
@@ -118,10 +118,10 @@ function Ue(t) {
|
|
|
118
118
|
leave: (e) => E(e, t).exit
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
function le({ as: t, show: e, swapped: a, direction:
|
|
122
|
-
const u = E(
|
|
123
|
-
custom:
|
|
124
|
-
variants: Ue(
|
|
121
|
+
function le({ as: t, show: e, swapped: a, direction: s, reduceMotion: o, children: d, ...c }) {
|
|
122
|
+
const u = E(s, o), h = {
|
|
123
|
+
custom: s,
|
|
124
|
+
variants: Ue(o),
|
|
125
125
|
initial: "enter",
|
|
126
126
|
animate: "rest",
|
|
127
127
|
exit: "leave",
|
|
@@ -130,7 +130,7 @@ function le({ as: t, show: e, swapped: a, direction: o, reduceMotion: s, childre
|
|
|
130
130
|
return /* @__PURE__ */ r(Se, {
|
|
131
131
|
initial: !a && e ? !1 : void 0,
|
|
132
132
|
mode: "popLayout",
|
|
133
|
-
custom:
|
|
133
|
+
custom: s,
|
|
134
134
|
children: e ? t === "aside" ? /* @__PURE__ */ r(z.aside, {
|
|
135
135
|
...c,
|
|
136
136
|
...h,
|
|
@@ -142,13 +142,13 @@ function le({ as: t, show: e, swapped: a, direction: o, reduceMotion: s, childre
|
|
|
142
142
|
}, "thread") : null
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
function Ve({ layout: t = "default", pane: e, defaultPane: a = "list", onPaneChange:
|
|
145
|
+
function Ve({ layout: t = "default", pane: e, defaultPane: a = "list", onPaneChange: s, className: o, style: d, ref: c, ...u }) {
|
|
146
146
|
const [h, w] = I(a), [y, m] = I(De), [i, p] = I(0), f = S(null), v = e !== void 0, x = v ? e : h, [b, n] = I(() => W(x)), [l, R] = I(!1), L = S(x);
|
|
147
147
|
let _ = b, H = l;
|
|
148
148
|
L.current !== x && (_ = W(x), H = !0, L.current = x, _ !== b && n(_), l || R(!0));
|
|
149
149
|
const $ = O((C) => {
|
|
150
|
-
n(W(C)), v || w(C),
|
|
151
|
-
}, [v,
|
|
150
|
+
n(W(C)), v || w(C), s?.(C);
|
|
151
|
+
}, [v, s]), j = O((C) => {
|
|
152
152
|
m(Y(C, f.current?.clientWidth ?? 0));
|
|
153
153
|
}, []), B = We(t, i);
|
|
154
154
|
T(() => {
|
|
@@ -184,7 +184,7 @@ function Ve({ layout: t = "default", pane: e, defaultPane: a = "list", onPaneCha
|
|
|
184
184
|
i,
|
|
185
185
|
j
|
|
186
186
|
]);
|
|
187
|
-
return /* @__PURE__ */ r(
|
|
187
|
+
return /* @__PURE__ */ r(se.Provider, {
|
|
188
188
|
value: ce,
|
|
189
189
|
children: /* @__PURE__ */ r("div", {
|
|
190
190
|
ref: (C) => {
|
|
@@ -198,18 +198,18 @@ function Ve({ layout: t = "default", pane: e, defaultPane: a = "list", onPaneCha
|
|
|
198
198
|
...d,
|
|
199
199
|
"--chat-list-width": `${y}px`
|
|
200
200
|
},
|
|
201
|
-
className: g(Le, "@container relative flex min-h-0 min-w-0 overflow-hidden",
|
|
201
|
+
className: g(Le, "@container relative flex min-h-0 min-w-0 overflow-hidden", o),
|
|
202
202
|
...u
|
|
203
203
|
})
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
function Xe({ className: t, children: e, id: a, ...
|
|
207
|
-
const { layout:
|
|
206
|
+
function Xe({ className: t, children: e, id: a, ...s }) {
|
|
207
|
+
const { layout: o, pane: d, direction: c, swap: u, swapped: h } = M("List"), w = ie(), y = Ne(), m = a ?? y, i = g("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" && g("w-full @2xl:min-w-64 @2xl:w-[var(--chat-list-width)] @2xl:border-r", !u && d === "thread" && "@max-2xl:hidden"), t), p = /* @__PURE__ */ N(ae, { children: [e, o !== "compact" && /* @__PURE__ */ r(Fe, { controlsId: m })] }), f = {
|
|
208
208
|
id: m,
|
|
209
209
|
"aria-label": "Conversations",
|
|
210
210
|
"data-chat-list": "",
|
|
211
211
|
className: i,
|
|
212
|
-
...
|
|
212
|
+
...s
|
|
213
213
|
};
|
|
214
214
|
return u ? /* @__PURE__ */ r(le, {
|
|
215
215
|
as: "aside",
|
|
@@ -225,7 +225,7 @@ function Xe({ className: t, children: e, id: a, ...o }) {
|
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
function Fe({ controlsId: t }) {
|
|
228
|
-
const { layout: e, listWidth: a, frameWidth:
|
|
228
|
+
const { layout: e, listWidth: a, frameWidth: s, resizeList: o, rootRef: d } = M("Splitter"), c = S(null), u = (i) => {
|
|
229
229
|
i.button === 0 && (i.currentTarget.setPointerCapture?.(i.pointerId), c.current = {
|
|
230
230
|
x: i.clientX,
|
|
231
231
|
width: a
|
|
@@ -234,23 +234,23 @@ function Fe({ controlsId: t }) {
|
|
|
234
234
|
const p = c.current;
|
|
235
235
|
if (p == null) return;
|
|
236
236
|
const f = d.current, v = f != null && getComputedStyle(f).direction === "rtl", x = (i.clientX - p.x) * (v ? -1 : 1);
|
|
237
|
-
|
|
237
|
+
o(p.width + x);
|
|
238
238
|
}, w = () => {
|
|
239
239
|
c.current = null;
|
|
240
240
|
}, y = (i) => {
|
|
241
241
|
const p = d.current, f = p != null && getComputedStyle(p).direction === "rtl", v = f ? "ArrowRight" : "ArrowLeft", x = f ? "ArrowLeft" : "ArrowRight", b = i.shiftKey ? 32 : He;
|
|
242
242
|
if (i.key === v)
|
|
243
|
-
i.preventDefault(),
|
|
243
|
+
i.preventDefault(), o(a - b);
|
|
244
244
|
else if (i.key === x)
|
|
245
|
-
i.preventDefault(),
|
|
245
|
+
i.preventDefault(), o(a + b);
|
|
246
246
|
else if (i.key === "Home")
|
|
247
|
-
i.preventDefault(),
|
|
247
|
+
i.preventDefault(), o(P);
|
|
248
248
|
else if (i.key === "End") {
|
|
249
249
|
i.preventDefault();
|
|
250
250
|
const n = p?.clientWidth ?? 0;
|
|
251
|
-
n > 0 &&
|
|
251
|
+
n > 0 && o(n - V);
|
|
252
252
|
}
|
|
253
|
-
}, m =
|
|
253
|
+
}, m = s > 0 ? Math.max(P, s - V) : a;
|
|
254
254
|
return /* @__PURE__ */ r("div", {
|
|
255
255
|
role: "separator",
|
|
256
256
|
"aria-orientation": "vertical",
|
|
@@ -270,10 +270,10 @@ function Fe({ controlsId: t }) {
|
|
|
270
270
|
className: g("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", e === "auto" && "@max-2xl:hidden")
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
|
-
function $e({ className: t, wrapperClassName: e, placeholder: a = "Search", ...
|
|
273
|
+
function $e({ className: t, wrapperClassName: e, placeholder: a = "Search", ...s }) {
|
|
274
274
|
return /* @__PURE__ */ r("div", {
|
|
275
275
|
"data-chat-search": "",
|
|
276
|
-
className: g("p-3",
|
|
276
|
+
className: g("p-3", oe, t),
|
|
277
277
|
children: /* @__PURE__ */ r(ve, {
|
|
278
278
|
size: "sm",
|
|
279
279
|
icon: xe,
|
|
@@ -282,7 +282,7 @@ function $e({ className: t, wrapperClassName: e, placeholder: a = "Search", ...o
|
|
|
282
282
|
autoComplete: "off",
|
|
283
283
|
spellCheck: !1,
|
|
284
284
|
wrapperClassName: g(we, "[&:focus-within>svg]:text-pho-primary [&>svg]:transition-colors [&>svg]:duration-100", e),
|
|
285
|
-
...
|
|
285
|
+
...s
|
|
286
286
|
})
|
|
287
287
|
});
|
|
288
288
|
}
|
|
@@ -313,12 +313,12 @@ var Ke = "outline-pho-brand rounded-base flex w-full cursor-pointer items-center
|
|
|
313
313
|
whileTap: { scale: fe },
|
|
314
314
|
transition: pe
|
|
315
315
|
};
|
|
316
|
-
function Qe({ title: t, time: e, preview: a, avatar:
|
|
316
|
+
function Qe({ title: t, time: e, preview: a, avatar: s, group: o, active: d, className: c, href: u, onClick: h, ...w }) {
|
|
317
317
|
const { layout: y, setPane: m } = M("Conversation"), i = de(), p = ne(() => z.create(i), [i]), f = g(Ke, d ? Ge : qe, c), v = () => {
|
|
318
318
|
y !== "default" && m("thread");
|
|
319
|
-
}, x = /* @__PURE__ */ N(ae, { children: [
|
|
319
|
+
}, x = /* @__PURE__ */ N(ae, { children: [s ?? /* @__PURE__ */ r(J.Root, {
|
|
320
320
|
size: "sm",
|
|
321
|
-
children: /* @__PURE__ */ r(J.Fallback, { children:
|
|
321
|
+
children: /* @__PURE__ */ r(J.Fallback, { children: o ? /* @__PURE__ */ r(Me, {
|
|
322
322
|
className: "size-4",
|
|
323
323
|
"aria-hidden": !0
|
|
324
324
|
}) : /* @__PURE__ */ r(Ie, {
|
|
@@ -330,14 +330,14 @@ function Qe({ title: t, time: e, preview: a, avatar: o, group: s, active: d, cla
|
|
|
330
330
|
children: [/* @__PURE__ */ N("span", {
|
|
331
331
|
className: "flex items-baseline justify-between gap-2",
|
|
332
332
|
children: [/* @__PURE__ */ r("span", {
|
|
333
|
-
className: "text-pho-primary min-w-0 truncate text-base font-medium",
|
|
333
|
+
className: "text-pho-primary font-heading min-w-0 truncate text-base font-medium",
|
|
334
334
|
children: t
|
|
335
335
|
}), e != null && /* @__PURE__ */ r("span", {
|
|
336
336
|
className: "text-pho-description shrink-0 text-xs font-normal whitespace-nowrap tabular-nums",
|
|
337
337
|
children: e
|
|
338
338
|
})]
|
|
339
339
|
}), a != null && /* @__PURE__ */ r("span", {
|
|
340
|
-
className: "text-pho-description
|
|
340
|
+
className: "text-pho-description block min-w-0 truncate text-xs font-normal",
|
|
341
341
|
children: a
|
|
342
342
|
})]
|
|
343
343
|
})] });
|
|
@@ -364,10 +364,10 @@ function Qe({ title: t, time: e, preview: a, avatar: o, group: s, active: d, cla
|
|
|
364
364
|
}) });
|
|
365
365
|
}
|
|
366
366
|
function Je({ className: t, children: e, ...a }) {
|
|
367
|
-
const { layout:
|
|
367
|
+
const { layout: s, pane: o, direction: d, swap: c, swapped: u } = M("Thread"), h = ie(), w = g("bg-pho-primary flex min-h-0 flex-1 flex-col", s === "default" && "min-w-80", s === "compact" && "min-w-0", s === "auto" && "min-w-0 @2xl:min-w-80", !c && s === "auto" && o === "list" && "@max-2xl:hidden", t);
|
|
368
368
|
return c ? /* @__PURE__ */ r(le, {
|
|
369
369
|
as: "section",
|
|
370
|
-
show:
|
|
370
|
+
show: o === "thread",
|
|
371
371
|
swapped: u,
|
|
372
372
|
direction: d,
|
|
373
373
|
reduceMotion: h,
|
|
@@ -384,11 +384,11 @@ function Je({ className: t, children: e, ...a }) {
|
|
|
384
384
|
children: e
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
|
-
function Ye({ avatar: t, actions: e, backLabel: a = "Back to conversations", className:
|
|
387
|
+
function Ye({ avatar: t, actions: e, backLabel: a = "Back to conversations", className: s, children: o, ...d }) {
|
|
388
388
|
const { layout: c, setPane: u } = M("Header");
|
|
389
389
|
return /* @__PURE__ */ N("header", {
|
|
390
390
|
"data-chat-header": "",
|
|
391
|
-
className: g("flex shrink-0 items-center gap-3 px-4 py-1.5",
|
|
391
|
+
className: g("flex shrink-0 items-center gap-3 px-4 py-1.5", oe, s),
|
|
392
392
|
...d,
|
|
393
393
|
children: [
|
|
394
394
|
c !== "default" && /* @__PURE__ */ r(F, {
|
|
@@ -405,7 +405,7 @@ function Ye({ avatar: t, actions: e, backLabel: a = "Back to conversations", cla
|
|
|
405
405
|
t,
|
|
406
406
|
/* @__PURE__ */ r("div", {
|
|
407
407
|
className: "flex min-w-0 flex-1 flex-col",
|
|
408
|
-
children:
|
|
408
|
+
children: o
|
|
409
409
|
}),
|
|
410
410
|
e != null && /* @__PURE__ */ r("div", {
|
|
411
411
|
className: "flex shrink-0 items-center gap-1",
|
|
@@ -417,7 +417,7 @@ function Ye({ avatar: t, actions: e, backLabel: a = "Back to conversations", cla
|
|
|
417
417
|
function Ze({ className: t, children: e, ...a }) {
|
|
418
418
|
return /* @__PURE__ */ r("h2", {
|
|
419
419
|
"data-chat-title": "",
|
|
420
|
-
className: g("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
|
+
className: g("text-pho-primary font-heading m-0 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 overflow-visible text-base font-medium", t),
|
|
421
421
|
...a,
|
|
422
422
|
children: e
|
|
423
423
|
});
|
|
@@ -440,7 +440,7 @@ function te(t) {
|
|
|
440
440
|
const e = t?.querySelector("[data-message]") ?? null;
|
|
441
441
|
return X(e) ? e : null;
|
|
442
442
|
}
|
|
443
|
-
function rt({ hasEarlier: t = !1, loadingEarlier: e = !1, onLoadEarlier: a, earlierLabel:
|
|
443
|
+
function rt({ hasEarlier: t = !1, loadingEarlier: e = !1, onLoadEarlier: a, earlierLabel: s = "Load earlier messages", className: o, children: d, ...c }) {
|
|
444
444
|
const u = S(null), h = S(null), w = S(null), y = S(!0), m = S(null), i = S(e), p = S(!1), f = S(a);
|
|
445
445
|
T(() => {
|
|
446
446
|
f.current = a;
|
|
@@ -504,7 +504,7 @@ function rt({ hasEarlier: t = !1, loadingEarlier: e = !1, onLoadEarlier: a, earl
|
|
|
504
504
|
b
|
|
505
505
|
]), /* @__PURE__ */ r("div", {
|
|
506
506
|
"data-chat-messages": "",
|
|
507
|
-
className: g("flex min-h-0 flex-1 flex-col [--pho-bubble-backdrop:var(--background-color-pho-primary)]",
|
|
507
|
+
className: g("flex min-h-0 flex-1 flex-col [--pho-bubble-backdrop:var(--background-color-pho-primary)]", o),
|
|
508
508
|
...c,
|
|
509
509
|
children: /* @__PURE__ */ N(k.Root, {
|
|
510
510
|
className: "min-h-0 flex-1",
|
|
@@ -529,7 +529,7 @@ function rt({ hasEarlier: t = !1, loadingEarlier: e = !1, onLoadEarlier: a, earl
|
|
|
529
529
|
onClick: (n) => {
|
|
530
530
|
n.currentTarget === document.activeElement && u.current?.focus({ preventScroll: !0 }), p.current = !1, b();
|
|
531
531
|
},
|
|
532
|
-
children:
|
|
532
|
+
children: s
|
|
533
533
|
})
|
|
534
534
|
}), d]
|
|
535
535
|
})
|
|
@@ -553,8 +553,8 @@ function at({ className: t, ...e }) {
|
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
var it = 200;
|
|
556
|
-
function
|
|
557
|
-
const f = S(null), v = !
|
|
556
|
+
function ot({ value: t, onValueChange: e, onSend: a, placeholder: s = "Message", sending: o = !1, disabled: d = !1, canSend: c, prefix: u, meta: h, sendLabel: w = "Send", children: y, textareaRef: m, className: i, ...p }) {
|
|
557
|
+
const f = S(null), v = !o && !d && (c ?? t.trim().length > 0);
|
|
558
558
|
T(() => {
|
|
559
559
|
const n = f.current;
|
|
560
560
|
n && (n.style.height = "0px", n.style.height = `${Math.min(n.scrollHeight, it)}px`);
|
|
@@ -580,10 +580,10 @@ function st({ value: t, onValueChange: e, onSend: a, placeholder: o = "Message",
|
|
|
580
580
|
onChange: (n) => e(n.target.value),
|
|
581
581
|
onKeyDown: b,
|
|
582
582
|
rows: 1,
|
|
583
|
-
placeholder:
|
|
583
|
+
placeholder: s,
|
|
584
584
|
"aria-label": "Message",
|
|
585
585
|
disabled: d,
|
|
586
|
-
readOnly:
|
|
586
|
+
readOnly: o,
|
|
587
587
|
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"
|
|
588
588
|
}),
|
|
589
589
|
/* @__PURE__ */ N("div", {
|
|
@@ -601,7 +601,7 @@ function st({ value: t, onValueChange: e, onSend: a, placeholder: o = "Message",
|
|
|
601
601
|
svgOnly: !0,
|
|
602
602
|
"aria-label": w,
|
|
603
603
|
disabled: !v,
|
|
604
|
-
loading:
|
|
604
|
+
loading: o,
|
|
605
605
|
children: /* @__PURE__ */ r(Ae, {})
|
|
606
606
|
})
|
|
607
607
|
]
|
|
@@ -609,7 +609,7 @@ function st({ value: t, onValueChange: e, onSend: a, placeholder: o = "Message",
|
|
|
609
609
|
]
|
|
610
610
|
});
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function st({ className: t, size: e = "sm", ...a }) {
|
|
613
613
|
return /* @__PURE__ */ r("div", {
|
|
614
614
|
"data-chat-empty": "",
|
|
615
615
|
className: g("flex flex-1 flex-col items-center justify-center px-6 py-8", t),
|
|
@@ -631,7 +631,7 @@ function lt({ rows: t = 5 }) {
|
|
|
631
631
|
children: [/* @__PURE__ */ N("div", {
|
|
632
632
|
className: "flex items-center justify-between gap-2",
|
|
633
633
|
children: [/* @__PURE__ */ r(A, { className: "h-3.5 w-32" }), /* @__PURE__ */ r(A, { className: "h-2.5 w-8" })]
|
|
634
|
-
}), /* @__PURE__ */ r(A, { className: "mt-
|
|
634
|
+
}), /* @__PURE__ */ r(A, { className: "mt-1.5 h-2.5 w-44" })]
|
|
635
635
|
})]
|
|
636
636
|
}, a))
|
|
637
637
|
});
|
|
@@ -662,8 +662,8 @@ var _t = {
|
|
|
662
662
|
Messages: rt,
|
|
663
663
|
Divider: nt,
|
|
664
664
|
Footer: at,
|
|
665
|
-
Composer:
|
|
666
|
-
Empty:
|
|
665
|
+
Composer: ot,
|
|
666
|
+
Empty: st,
|
|
667
667
|
ConversationsLoading: lt,
|
|
668
668
|
MessagesLoading: ct
|
|
669
669
|
};
|
|
@@ -671,4 +671,4 @@ export {
|
|
|
671
671
|
_t as t
|
|
672
672
|
};
|
|
673
673
|
|
|
674
|
-
//# sourceMappingURL=chat-
|
|
674
|
+
//# sourceMappingURL=chat-C5W6L_Jg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-C5W6L_Jg.js","names":["__iconNode","__iconNode","__iconNode","_Fragment","cn","useLinkComponent","FADE_SWAP","PRESS_SCALE_ROW","SPRING_PRESS","TRAVEL_LINEAR","Spinner","Button","createReactComponent","Input","Avatar","IconSearch","ScrollArea","StatusView","Skeleton","QUIET_SEARCH_FOCUS","createContext","useCallback","useContext","useEffect","useId","useLayoutEffect","useMemo","useRef","useState","Fragment$1","jsx","jsxs","AnimatePresence","motion","useReducedMotion","__iconNode$3","IconArrowLeft","__iconNode$2","IconArrowUp","__iconNode$1","IconUser","__iconNode","IconUsers","CHAT_SURFACE","AUTO_WIDE_PX","PANE_TRAVEL_PX","PANE_LEAVE_PX","TOP_BAR","LIST_WIDTH_PX","LIST_MIN_PX","THREAD_MIN_PX","SPLIT_STEP_PX","clampListWidth","width","rootWidth","next","ChatContext","useChat","part","ctx","useIsoLayoutEffect","paneDirectionFor","pane","isPaneSwap","layout","frameWidth","paneSwapMotion","direction","reduceMotion","paneSwapVariants","SwapPane","as","show","swapped","children","props","swap","motionProps","Root","paneProp","defaultPane","onPaneChange","className","style","ref","uncontrolledPane","setUncontrolledPane","listWidth","setListWidth","setFrameWidth","rootRef","controlled","setDirection","setSwapped","prevPaneRef","renderedDirection","renderedSwapped","setPane","resizeList","root","tighten","frame","current","observer","value","node","List","idProp","uid","listId","listClass","body","Splitter","rest","controlsId","drag","onPointerDown","event","onPointerMove","start","rtl","delta","onPointerUp","onKeyDown","shrink","grow","step","valueMax","Search","wrapperClassName","placeholder","Conversations","ConversationList","CONVERSATION_ROW","CONVERSATION_ROW_ACTIVE","CONVERSATION_ROW_INACTIVE","CONVERSATION_PRESS","Conversation","title","time","preview","avatar","group","active","href","onClick","Link","MotionLink","rowClass","open","Thread","threadClass","Header","actions","backLabel","Title","Description","PIN_SLACK_PX","EARLIER_AHEAD","offsetIn","viewport","row","placed","oldestMessage","content","Messages","hasEarlier","loadingEarlier","onLoadEarlier","earlierLabel","viewportRef","contentRef","sentinelRef","pinned","anchor","loading","stalled","askEarlier","settle","kept","onScroll","loadEarlier","sentinel","entries","entry","Divider","Footer","COMPOSER_MAX_HEIGHT_PX","Composer","onValueChange","onSend","sending","disabled","canSend","prefix","meta","sendLabel","textareaRef","innerRef","ready","element","submit","Empty","size","ConversationsLoading","rows","_","MessagesLoading","Chat"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowLeft.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowUp.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconUser.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconUsers.mjs","../../src/components/chat/chat.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M5 12l14 0\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M5 12l6 6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 12l6 -6\", \"key\": \"svg-2\" }]];\nconst IconArrowLeft = createReactComponent(\"outline\", \"arrow-left\", \"ArrowLeft\", __iconNode);\n\nexport { __iconNode, IconArrowLeft as default };\n","/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M12 5l0 14\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M18 11l-6 -6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M6 11l6 -6\", \"key\": \"svg-2\" }]];\nconst IconArrowUp = createReactComponent(\"outline\", \"arrow-up\", \"ArrowUp\", __iconNode);\n\nexport { __iconNode, IconArrowUp as default };\n","/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2\", \"key\": \"svg-1\" }]];\nconst IconUser = createReactComponent(\"outline\", \"user\", \"User\", __iconNode);\n\nexport { __iconNode, IconUser as default };\n","/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M16 3.13a4 4 0 0 1 0 7.75\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M21 21v-2a4 4 0 0 0 -3 -3.85\", \"key\": \"svg-3\" }]];\nconst IconUsers = createReactComponent(\"outline\", \"users\", \"Users\", __iconNode);\n\nexport { __iconNode, IconUsers as default };\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type CSSProperties,\n type ComponentProps,\n type ComponentType,\n type FormEvent,\n type KeyboardEvent,\n type PointerEvent,\n type ReactNode,\n type Ref,\n type RefObject,\n} from \"react\";\nimport {\n IconArrowLeft,\n IconArrowUp,\n IconSearch,\n IconUser,\n IconUsers,\n} from \"@tabler/icons-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport {\n BLUR_PX,\n FADE_SWAP,\n PRESS_SCALE_ROW,\n SPRING_PRESS,\n TRAVEL_LINEAR,\n} from \"../../motion\";\nimport { Avatar } from \"../avatar\";\nimport { Button } from \"../button\";\nimport { Input, type InputProps } from \"../input\";\nimport { QUIET_SEARCH_FOCUS } from \"../input-group/box-search\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { Skeleton } from \"../skeleton\";\nimport { Spinner } from \"../spinner\";\nimport { StatusView, type StatusViewProps } from \"../status-view\";\nimport { cn } from \"../../utils/cn\";\nimport { useLinkComponent } from \"../../utils/link-provider\";\n\n/**\n * Chat — an inbox in one card: the conversations down the left, the open\n * thread on the right with its messages scrolling up from the composer.\n * It composes the smaller parts (`Message` rows of `Bubble`s in a\n * `ScrollArea`, an `Input` for search, `Button`s to send and go back) the\n * way `Sidebar` composes a rail: rows that press, one active, links\n * through the host's `LinkProvider`.\n *\n * Two layouts. `default` seats both panes side by side — the divider\n * between them drags so either pane can grow, each down to a min width.\n * `compact` shows one at a time — the list, then the thread with a way\n * back — for a narrow column or a phone. Opening a conversation pushes\n * the thread in from the right; back pops the list in from the left, a\n * short drift on `TRAVEL_LINEAR` with a `FADE_SWAP` fade. `auto` is\n * compact only while the frame is narrower than 42rem (a container\n * query, so it follows the card, not the viewport). Which pane is up is\n * `pane`, controlled or not; opening a conversation moves to the thread,\n * the header's back button returns.\n *\n * Presentational, like every Pho part: the page fetches, formats times,\n * and decides who is who. The thread stays pinned to its newest message\n * while the reader is at the bottom, and keeps its place when earlier\n * pages arrive above.\n */\n\nexport type ChatLayout = \"default\" | \"compact\" | \"auto\";\nexport type ChatPane = \"list\" | \"thread\";\n/** Push is 1 (thread from the right); pop is −1 (list from the left). */\nexport type ChatPaneDirection = 1 | -1;\n\n/** Same chrome as `BasicPage.Card` and `LogList` — one card surface. */\nconst CHAT_SURFACE = \"rounded-base border border-pho-secondary bg-pho-primary\";\n\n// Below this frame width `auto` is compact: the `@2xl` container variant\n// (42rem) in the class strings below. Those variants are spelled out in\n// full on purpose — Tailwind finds utilities by scanning source text, so\n// a variant built from a variable (`${AUTO_WIDE}` before the colon) never\n// reached a consumer's CSS and `auto` stayed single-pane at every width.\n// chat.test.tsx keeps it that way.\n/** `42rem` in px at the 16px root — `frameWidth` is measured in px. */\nconst AUTO_WIDE_PX = 672;\n/**\n * Compact pane travel — a short drift, the same scale as `BAR_RISE_PX`,\n * not a full-width slide.\n */\nconst PANE_TRAVEL_PX = 24;\n/** Outgoing pane drift — same distance as BasicPage `BACK_LABEL_LEAVE_X`. */\nconst PANE_LEAVE_PX = 8;\n\n/** Search (`p-3` + sm Input) is the pane top-bar height; Header matches it. */\nconst TOP_BAR = \"min-h-[61px]\";\n\n/**\n * Wide layouts start the list at 273 — the measured inbox column, not\n * `w-80`. It will not go below `min-w-64` (256); the thread will not go\n * below `min-w-80` (320).\n */\nconst LIST_WIDTH_PX = 273;\nconst LIST_MIN_PX = 256;\nconst THREAD_MIN_PX = 320;\nconst SPLIT_STEP_PX = 16;\n\nfunction clampListWidth(width: number, rootWidth: number) {\n const next = Math.max(LIST_MIN_PX, width);\n if (rootWidth <= 0) return Number.isFinite(next) ? next : LIST_MIN_PX;\n return Math.min(next, Math.max(LIST_MIN_PX, rootWidth - THREAD_MIN_PX));\n}\n\ninterface ChatContextValue {\n layout: ChatLayout;\n pane: ChatPane;\n setPane: (pane: ChatPane) => void;\n /** Latest list ↔ thread step: 1 push, −1 pop. */\n direction: ChatPaneDirection;\n /** One pane at a time — compact, or `auto` once the frame measures narrow. */\n swap: boolean;\n /** True after the first list ↔ thread step — later remounts still push. */\n swapped: boolean;\n listWidth: number;\n frameWidth: number;\n resizeList: (width: number) => void;\n rootRef: RefObject<HTMLDivElement | null>;\n}\n\nconst ChatContext = createContext<ChatContextValue | null>(null);\n\nfunction useChat(part: string): ChatContextValue {\n const ctx = useContext(ChatContext);\n if (ctx == null) {\n throw new Error(`Chat.${part} must be used inside Chat.Root`);\n }\n return ctx;\n}\n\n// React 18 warns that useLayoutEffect does nothing on the server; fall\n// back to useEffect there so SSR'd docs stay quiet.\nconst useIsoLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nfunction paneDirectionFor(pane: ChatPane): ChatPaneDirection {\n return pane === \"thread\" ? 1 : -1;\n}\n\n/**\n * Compact (and `auto` once the frame measures narrower than 42rem) mounts\n * one pane at a time so `AnimatePresence` can push/pop. `frameWidth` 0 is\n * the unmeasured / SSR frame — treat it as wide so both panes render and\n * nothing flashes.\n */\nfunction isPaneSwap(layout: ChatLayout, frameWidth: number) {\n return (\n layout === \"compact\" ||\n (layout === \"auto\" && frameWidth > 0 && frameWidth < AUTO_WIDE_PX)\n );\n}\n\n/**\n * The compact pane swap — incoming travels `PANE_TRAVEL_PX` on\n * `TRAVEL_LINEAR`, fades and breathes `BLUR_PX` on `FADE_SWAP`; outgoing\n * drifts `PANE_LEAVE_PX` the other way. Under reduced motion: opacity\n * only, and instant.\n */\nexport function paneSwapMotion(\n direction: ChatPaneDirection,\n reduceMotion?: boolean | null,\n) {\n if (reduceMotion) {\n return {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n transition: { duration: 0 },\n };\n }\n return {\n initial: {\n x: direction * PANE_TRAVEL_PX,\n opacity: 0,\n filter: `blur(${BLUR_PX}px)`,\n },\n animate: { x: 0, opacity: 1, filter: \"blur(0px)\" },\n exit: {\n x: -direction * PANE_LEAVE_PX,\n opacity: 0,\n filter: `blur(${BLUR_PX}px)`,\n },\n transition: { x: TRAVEL_LINEAR, opacity: FADE_SWAP, filter: FADE_SWAP },\n };\n}\n\nfunction paneSwapVariants(reduceMotion: boolean | null) {\n return {\n enter: (direction: ChatPaneDirection) =>\n paneSwapMotion(direction, reduceMotion).initial,\n rest: (direction: ChatPaneDirection) =>\n paneSwapMotion(direction, reduceMotion).animate,\n leave: (direction: ChatPaneDirection) =>\n paneSwapMotion(direction, reduceMotion).exit,\n };\n}\n\n/**\n * DOM handlers whose React signatures clash with Motion's gesture props.\n * Same omit list as `Button` — swap panes and conversation rows render\n * through `motion.*`.\n */\ntype MotionHandlerConflicts =\n | \"onAnimationStart\"\n | \"onAnimationEnd\"\n | \"onAnimationIteration\"\n | \"onDrag\"\n | \"onDragStart\"\n | \"onDragEnd\"\n | \"onDragEnter\"\n | \"onDragExit\"\n | \"onDragLeave\"\n | \"onDragOver\"\n | \"onDrop\";\n\ntype SwapPaneProps = {\n show: boolean;\n swapped: boolean;\n direction: ChatPaneDirection;\n reduceMotion: boolean | null;\n children?: ReactNode;\n} & (\n | ({ as: \"aside\" } & Omit<\n ComponentProps<\"aside\">,\n \"children\" | MotionHandlerConflicts\n >)\n | ({ as: \"section\" } & Omit<\n ComponentProps<\"section\">,\n \"children\" | MotionHandlerConflicts\n >)\n);\n\ntype SwapMotionProps = {\n custom: ChatPaneDirection;\n variants: ReturnType<typeof paneSwapVariants>;\n initial: \"enter\";\n animate: \"rest\";\n exit: \"leave\";\n transition: ReturnType<typeof paneSwapMotion>[\"transition\"];\n};\n\n/**\n * The compact face — Root's `AnimatePresence` keys list vs thread. `custom`\n * on that presence feeds this step's push/pop into the exiting face.\n */\nfunction SwapPane({\n as,\n show,\n swapped,\n direction,\n reduceMotion,\n children,\n ...props\n}: SwapPaneProps) {\n const swap = paneSwapMotion(direction, reduceMotion);\n const motionProps: SwapMotionProps = {\n custom: direction,\n variants: paneSwapVariants(reduceMotion),\n initial: \"enter\",\n animate: \"rest\",\n exit: \"leave\",\n transition: swap.transition,\n };\n // Skip the first paint only before any pane change — a Thread that\n // remounts (host `key`) on the way in still pushes.\n return (\n <AnimatePresence\n initial={!swapped && show ? false : undefined}\n mode=\"popLayout\"\n custom={direction}\n >\n {show ? (\n as === \"aside\" ? (\n <motion.aside key=\"list\" {...props} {...motionProps}>\n {children}\n </motion.aside>\n ) : (\n <motion.section key=\"thread\" {...props} {...motionProps}>\n {children}\n </motion.section>\n )\n ) : null}\n </AnimatePresence>\n );\n}\n\n/* --------------------------------- root --------------------------------- */\n\nexport interface ChatRootProps extends ComponentProps<\"div\"> {\n /**\n * `default` shows both panes; `compact` one at a time; `auto` is\n * compact while the frame is narrower than 42rem.\n * @default \"default\"\n */\n layout?: ChatLayout;\n /** The pane that is up in a compact layout. Pair with `onPaneChange`. */\n pane?: ChatPane;\n /** Initial pane when uncontrolled. @default \"list\" */\n defaultPane?: ChatPane;\n /** Called with the next pane — a row opened a thread, back was pressed. */\n onPaneChange?: (pane: ChatPane) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * The card. Give it a height (`h-[32rem]`, or `min-h-0 flex-1` in a\n * column that fills the page); the panes scroll inside it.\n */\nfunction Root({\n layout = \"default\",\n pane: paneProp,\n defaultPane = \"list\",\n onPaneChange,\n className,\n style,\n ref,\n ...props\n}: ChatRootProps) {\n const [uncontrolledPane, setUncontrolledPane] = useState(defaultPane);\n const [listWidth, setListWidth] = useState(LIST_WIDTH_PX);\n const [frameWidth, setFrameWidth] = useState(0);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const controlled = paneProp !== undefined;\n const pane = controlled ? paneProp : uncontrolledPane;\n const [direction, setDirection] = useState<ChatPaneDirection>(() =>\n paneDirectionFor(pane),\n );\n const [swapped, setSwapped] = useState(false);\n const prevPaneRef = useRef(pane);\n // Keep this render's direction aligned with `pane` so a controlled\n // update and a `setPane` call both push/pop on the same frame.\n let renderedDirection = direction;\n let renderedSwapped = swapped;\n if (prevPaneRef.current !== pane) {\n renderedDirection = paneDirectionFor(pane);\n renderedSwapped = true;\n prevPaneRef.current = pane;\n if (renderedDirection !== direction) setDirection(renderedDirection);\n if (!swapped) setSwapped(true);\n }\n const setPane = useCallback(\n (next: ChatPane) => {\n setDirection(paneDirectionFor(next));\n if (!controlled) setUncontrolledPane(next);\n onPaneChange?.(next);\n },\n [controlled, onPaneChange],\n );\n const resizeList = useCallback((width: number) => {\n setListWidth(clampListWidth(width, rootRef.current?.clientWidth ?? 0));\n }, []);\n const swap = isPaneSwap(layout, frameWidth);\n useIsoLayoutEffect(() => {\n const root = rootRef.current;\n if (!root || typeof ResizeObserver === \"undefined\") return;\n const tighten = () => {\n const frame = root.clientWidth;\n setFrameWidth(frame);\n setListWidth((current) => clampListWidth(current, frame));\n };\n tighten();\n const observer = new ResizeObserver(tighten);\n observer.observe(root);\n return () => observer.disconnect();\n }, []);\n const value = useMemo(\n () => ({\n layout,\n pane,\n setPane,\n direction: renderedDirection,\n swap,\n swapped: renderedSwapped,\n listWidth,\n frameWidth,\n resizeList,\n rootRef,\n }),\n [\n layout,\n pane,\n setPane,\n renderedDirection,\n swap,\n renderedSwapped,\n listWidth,\n frameWidth,\n resizeList,\n ],\n );\n return (\n <ChatContext.Provider value={value}>\n <div\n ref={(node) => {\n rootRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) {\n (ref as { current: HTMLDivElement | null }).current = node;\n }\n }}\n data-chat=\"\"\n data-basic-page-card=\"\"\n data-layout={layout}\n data-pane={pane}\n style={\n {\n ...style,\n \"--chat-list-width\": `${listWidth}px`,\n } as CSSProperties\n }\n className={cn(\n CHAT_SURFACE,\n \"@container relative flex min-h-0 min-w-0 overflow-hidden\",\n className,\n )}\n {...props}\n />\n </ChatContext.Provider>\n );\n}\n\n/* --------------------------------- list --------------------------------- */\n\n/** The left pane — search above, conversations below, on the page wash. */\nfunction List({\n className,\n children,\n id: idProp,\n ...props\n}: ComponentProps<\"aside\">) {\n const { layout, pane, direction, swap, swapped } = useChat(\"List\");\n const reduceMotion = useReducedMotion();\n const uid = useId();\n const listId = idProp ?? uid;\n const listClass = cn(\n \"border-pho-secondary bg-pho-page relative z-10 flex min-h-0 shrink-0 flex-col\",\n layout === \"default\" && \"min-w-64 w-[var(--chat-list-width)] border-r\",\n layout === \"compact\" && \"w-full\",\n layout === \"auto\" &&\n cn(\n \"w-full @2xl:min-w-64 @2xl:w-[var(--chat-list-width)] @2xl:border-r\",\n !swap && pane === \"thread\" && \"@max-2xl:hidden\",\n ),\n className,\n );\n const body = (\n <>\n {children}\n {layout !== \"compact\" && <Splitter controlsId={listId} />}\n </>\n );\n const rest = {\n id: listId,\n \"aria-label\": \"Conversations\",\n \"data-chat-list\": \"\",\n className: listClass,\n ...props,\n };\n if (!swap) {\n return <aside {...rest}>{body}</aside>;\n }\n return (\n <SwapPane\n as=\"aside\"\n show={pane === \"list\"}\n swapped={swapped}\n direction={direction}\n reduceMotion={reduceMotion}\n {...rest}\n >\n {body}\n </SwapPane>\n );\n}\n\n/**\n * The drag between the panes — a focusable separator. Hidden in\n * `compact`, and in `auto` while the frame is narrow.\n */\nfunction Splitter({ controlsId }: { controlsId: string }) {\n const { layout, listWidth, frameWidth, resizeList, rootRef } =\n useChat(\"Splitter\");\n const drag = useRef<{ x: number; width: number } | null>(null);\n\n const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.currentTarget.setPointerCapture?.(event.pointerId);\n drag.current = { x: event.clientX, width: listWidth };\n };\n\n const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const start = drag.current;\n if (start == null) return;\n const root = rootRef.current;\n const rtl = root != null && getComputedStyle(root).direction === \"rtl\";\n const delta = (event.clientX - start.x) * (rtl ? -1 : 1);\n resizeList(start.width + delta);\n };\n\n const onPointerUp = () => {\n drag.current = null;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const root = rootRef.current;\n const rtl = root != null && getComputedStyle(root).direction === \"rtl\";\n const shrink = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n const grow = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const step = event.shiftKey ? SPLIT_STEP_PX * 2 : SPLIT_STEP_PX;\n if (event.key === shrink) {\n event.preventDefault();\n resizeList(listWidth - step);\n } else if (event.key === grow) {\n event.preventDefault();\n resizeList(listWidth + step);\n } else if (event.key === \"Home\") {\n event.preventDefault();\n resizeList(LIST_MIN_PX);\n } else if (event.key === \"End\") {\n event.preventDefault();\n const frame = root?.clientWidth ?? 0;\n if (frame > 0) resizeList(frame - THREAD_MIN_PX);\n }\n };\n\n const valueMax =\n frameWidth > 0\n ? Math.max(LIST_MIN_PX, frameWidth - THREAD_MIN_PX)\n : listWidth;\n\n return (\n <div\n // WAI-ARIA window splitter: a focusable separator with a value. An\n // `hr` can neither take focus nor carry the value attributes.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label=\"Resize conversation list\"\n aria-controls={controlsId}\n aria-valuenow={listWidth}\n aria-valuemin={LIST_MIN_PX}\n aria-valuemax={valueMax}\n aria-valuetext={`${listWidth} pixels`}\n tabIndex={0}\n data-chat-splitter=\"\"\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n onKeyDown={onKeyDown}\n className={cn(\n \"absolute inset-y-0 -right-3 z-10 w-6 cursor-col-resize touch-none select-none\",\n \"outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-2\",\n \"after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent\",\n \"[@media(hover:hover)]:hover:after:bg-pho-brand focus-visible:after:bg-pho-brand\",\n layout === \"auto\" && \"@max-2xl:hidden\",\n )}\n />\n );\n}\n\nexport interface ChatSearchProps extends Omit<\n InputProps,\n \"size\" | \"icon\" | \"label\" | \"hint\" | \"labelTrailing\"\n> {}\n\n/**\n * The search row pinned over the conversations — an `sm` `Input` with a\n * search's quiet focus: no ring, the magnifier takes the ink.\n */\nfunction Search({\n className,\n wrapperClassName,\n placeholder = \"Search\",\n ...props\n}: ChatSearchProps) {\n return (\n <div data-chat-search=\"\" className={cn(\"p-3\", TOP_BAR, className)}>\n <Input\n size=\"sm\"\n icon={IconSearch}\n placeholder={placeholder}\n aria-label=\"Search conversations\"\n autoComplete=\"off\"\n spellCheck={false}\n wrapperClassName={cn(\n QUIET_SEARCH_FOCUS,\n \"[&:focus-within>svg]:text-pho-primary [&>svg]:transition-colors [&>svg]:duration-100\",\n wrapperClassName,\n )}\n {...props}\n />\n </div>\n );\n}\n\n/**\n * The scrolling part of the list. Put a `ConversationList` in it — or a\n * `ConversationsLoading`, an `Empty` — and anything that belongs after\n * the rows (a load-older button).\n */\nfunction Conversations({\n className,\n children,\n ...props\n}: ComponentProps<\"div\">) {\n return (\n <div\n data-chat-conversations=\"\"\n className={cn(\"flex min-h-0 flex-1 flex-col\", className)}\n {...props}\n >\n <ScrollArea.Root className=\"min-h-0 flex-1\">\n <ScrollArea.Viewport>\n <ScrollArea.Content\n // Base UI sets `minWidth: fit-content` on Content; a long\n // title must truncate, not widen the pane.\n style={{ minWidth: 0 }}\n // Same horizontal rail as Sidebar sm (`px-3`): the selected\n // chip sits in the page wash instead of kissing the aside.\n className=\"flex min-h-full flex-col px-3 py-1\"\n >\n {children}\n </ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n </ScrollArea.Root>\n </div>\n );\n}\n\n/** The rows. */\nfunction ConversationList({ className, ...props }: ComponentProps<\"ul\">) {\n return (\n <ul\n data-chat-conversation-list=\"\"\n // list-none/m-0/p-0 shield the rows from host prose styles.\n className={cn(\"m-0 flex list-none flex-col gap-0.5 *:m-0\", className)}\n {...props}\n />\n );\n}\n\n/* ------------------------------ conversation ---------------------------- */\n\n/**\n * DOM handlers whose React signatures clash with Motion's gesture props.\n * Same omit list as `Button` — rows render through `motion.*`.\n */\ninterface ConversationBaseProps {\n /** Who — a number, a name, the members of a group. */\n title: ReactNode;\n /** When — the page's relative time (`2d ago`), trailing. */\n time?: ReactNode;\n /** The latest message, one truncated line. */\n preview?: ReactNode;\n /** Replace the default avatar (a person, or people for a `group`). */\n avatar?: ReactNode;\n /** A group conversation — the default avatar shows people. */\n group?: boolean;\n /** The open conversation. */\n active?: boolean;\n className?: string;\n}\n\nexport interface ChatConversationLinkProps\n extends\n ConversationBaseProps,\n Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof ConversationBaseProps | MotionHandlerConflicts\n > {\n /** Destination — rendered through the host's `LinkProvider`. */\n href: string;\n}\n\nexport interface ChatConversationButtonProps\n extends\n ConversationBaseProps,\n Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n keyof ConversationBaseProps | MotionHandlerConflicts\n > {\n href?: undefined;\n}\n\nexport type ChatConversationProps =\n ChatConversationLinkProps | ChatConversationButtonProps;\n\n/** The row at rest, on hover, and while open — one pointer target. */\nconst CONVERSATION_ROW =\n \"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\";\n/**\n * Open row — same chip as `Sidebar.Item` current (`aria-current=page`).\n * Weight lives on the title span, not here: time and preview stay Regular.\n */\nconst CONVERSATION_ROW_ACTIVE =\n \"bg-pho-primary text-pho-primary ring-pho-secondary ring-1 ring-inset *:data-icon:text-pho-primary\";\nconst CONVERSATION_ROW_INACTIVE = \"hover:bg-pho-ghost-hover\";\n\nconst CONVERSATION_PRESS = {\n initial: false as const,\n whileTap: { scale: PRESS_SCALE_ROW },\n transition: SPRING_PRESS,\n};\n\n/**\n * One conversation — a link when `href` is given (through the host's\n * `LinkProvider`), otherwise a button. Opening it in a compact layout\n * brings the thread up.\n */\nfunction Conversation({\n title,\n time,\n preview,\n avatar,\n group,\n active,\n className,\n href,\n onClick,\n ...rest\n}: ChatConversationProps) {\n const { layout, setPane } = useChat(\"Conversation\");\n const Link = useLinkComponent();\n // Same bridge as `Sidebar.Item` — host `LinkProvider` + Motion press.\n const MotionLink = useMemo(\n () =>\n motion.create(Link as unknown as ComponentType<Record<string, unknown>>),\n [Link],\n );\n const rowClass = cn(\n CONVERSATION_ROW,\n active ? CONVERSATION_ROW_ACTIVE : CONVERSATION_ROW_INACTIVE,\n className,\n );\n const open = () => {\n if (layout !== \"default\") setPane(\"thread\");\n };\n const body = (\n <>\n {avatar ?? (\n <Avatar.Root size=\"sm\">\n <Avatar.Fallback>\n {group ? (\n <IconUsers className=\"size-4\" aria-hidden />\n ) : (\n <IconUser className=\"size-4\" aria-hidden />\n )}\n </Avatar.Fallback>\n </Avatar.Root>\n )}\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex items-baseline justify-between gap-2\">\n <span className=\"text-pho-primary font-heading min-w-0 truncate text-base font-medium\">\n {title}\n </span>\n {time != null && (\n <span className=\"text-pho-description shrink-0 text-xs font-normal whitespace-nowrap tabular-nums\">\n {time}\n </span>\n )}\n </span>\n {preview != null && (\n <span className=\"text-pho-description block min-w-0 truncate text-xs font-normal\">\n {preview}\n </span>\n )}\n </span>\n </>\n );\n\n if (href !== undefined) {\n return (\n <li>\n <MotionLink\n href={href}\n aria-current={active ? \"page\" : undefined}\n {...(rest as AnchorHTMLAttributes<HTMLAnchorElement>)}\n onClick={(event: React.MouseEvent<HTMLAnchorElement>) => {\n (onClick as AnchorHTMLAttributes<HTMLAnchorElement>[\"onClick\"])?.(\n event,\n );\n if (!event.defaultPrevented) open();\n }}\n className={rowClass}\n {...CONVERSATION_PRESS}\n >\n {body}\n </MotionLink>\n </li>\n );\n }\n\n return (\n <li>\n <motion.button\n type=\"button\"\n aria-current={active ? \"true\" : undefined}\n {...(rest as Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n MotionHandlerConflicts\n >)}\n onClick={(event) => {\n (onClick as ButtonHTMLAttributes<HTMLButtonElement>[\"onClick\"])?.(\n event,\n );\n if (!event.defaultPrevented) open();\n }}\n className={rowClass}\n {...CONVERSATION_PRESS}\n >\n {body}\n </motion.button>\n </li>\n );\n}\n\n/* -------------------------------- thread -------------------------------- */\n\n/** The right pane — header, messages, and the docked footer, on the card. */\nfunction Thread({ className, children, ...props }: ComponentProps<\"section\">) {\n const { layout, pane, direction, swap, swapped } = useChat(\"Thread\");\n const reduceMotion = useReducedMotion();\n const threadClass = cn(\n \"bg-pho-primary flex min-h-0 flex-1 flex-col\",\n layout === \"default\" && \"min-w-80\",\n layout === \"compact\" && \"min-w-0\",\n layout === \"auto\" && \"min-w-0 @2xl:min-w-80\",\n !swap && layout === \"auto\" && pane === \"list\" && \"@max-2xl:hidden\",\n className,\n );\n if (!swap) {\n return (\n <section\n aria-label=\"Conversation\"\n data-chat-thread=\"\"\n className={threadClass}\n {...props}\n >\n {children}\n </section>\n );\n }\n return (\n <SwapPane\n as=\"section\"\n show={pane === \"thread\"}\n swapped={swapped}\n direction={direction}\n reduceMotion={reduceMotion}\n aria-label=\"Conversation\"\n data-chat-thread=\"\"\n className={threadClass}\n {...props}\n >\n {children}\n </SwapPane>\n );\n}\n\nexport interface ChatHeaderProps extends ComponentProps<\"header\"> {\n /** The other side's avatar — an `Avatar.Root`. */\n avatar?: ReactNode;\n /** Controls at the trailing edge — a details button, a menu. */\n actions?: ReactNode;\n /** The back button's accessible name. @default \"Back to conversations\" */\n backLabel?: string;\n}\n\n/**\n * Who the thread is with. Children are a `Title` and a `Description`.\n * In a compact layout a back button leads the row; `auto` shows it only\n * while the frame is narrow.\n */\nfunction Header({\n avatar,\n actions,\n backLabel = \"Back to conversations\",\n className,\n children,\n ...props\n}: ChatHeaderProps) {\n const { layout, setPane } = useChat(\"Header\");\n return (\n <header\n data-chat-header=\"\"\n className={cn(\n \"flex shrink-0 items-center gap-3 px-4 py-1.5\",\n TOP_BAR,\n className,\n )}\n {...props}\n >\n {layout !== \"default\" && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n shape=\"circle\"\n svgOnly\n aria-label={backLabel}\n data-chat-back=\"\"\n className={cn(\"-ml-1 shrink-0\", layout === \"auto\" && \"@2xl:hidden\")}\n onClick={() => setPane(\"list\")}\n >\n <IconArrowLeft />\n </Button>\n )}\n {avatar}\n <div className=\"flex min-w-0 flex-1 flex-col\">{children}</div>\n {actions != null && (\n <div className=\"flex shrink-0 items-center gap-1\">{actions}</div>\n )}\n </header>\n );\n}\n\n/** The other side's name. Inline extras (a copy button, a badge) sit after it. */\nfunction Title({ className, children, ...props }: ComponentProps<\"h2\">) {\n return (\n <h2\n data-chat-title=\"\"\n className={cn(\n \"text-pho-primary font-heading m-0 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 overflow-visible text-base font-medium\",\n className,\n )}\n {...props}\n >\n {children}\n </h2>\n );\n}\n\n/** One line under the title — from whom, a status. */\nfunction Description({ className, ...props }: ComponentProps<\"p\">) {\n return (\n <p\n data-chat-description=\"\"\n className={cn(\n \"text-pho-description m-0 min-w-0 truncate text-xs\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ------------------------------- messages ------------------------------- */\n\n/** Within this many px of the bottom the pane counts as pinned. */\nconst PIN_SLACK_PX = 40;\n\n/** How far above the top the earlier page is asked for, ahead of the reader. */\nconst EARLIER_AHEAD = \"200px 0px 0px 0px\";\n\nexport interface ChatMessagesProps extends ComponentProps<\"div\"> {\n /** Earlier pages exist — the top of the pane asks for them. */\n hasEarlier?: boolean;\n /** The earlier page is on its way — a spinner shows and nothing is asked. */\n loadingEarlier?: boolean;\n /** Ask for the page before the first message shown. */\n onLoadEarlier?: () => void;\n /** The button's label. @default \"Load earlier messages\" */\n earlierLabel?: ReactNode;\n}\n\n/** A row's distance from the top of the pane, in px. */\nfunction offsetIn(viewport: HTMLElement, row: Element) {\n return row.getBoundingClientRect().top - viewport.getBoundingClientRect().top;\n}\n\n/** Still in the thread and laid out (a `display: contents` wrapper isn't). */\nfunction placed(row: Element | null): row is Element {\n return row != null && row.isConnected && row.getClientRects().length > 0;\n}\n\n/** The oldest message shown: an earlier page goes in above it. */\nfunction oldestMessage(content: Element | null) {\n const row = content?.querySelector(\"[data-message]\") ?? null;\n return placed(row) ? row : null;\n}\n\n/**\n * The messages, oldest to newest, on the thread surface. The pane starts at\n * the bottom and stays there as messages arrive unless the reader has\n * scrolled up. With `hasEarlier`, the earlier page is asked for as the top\n * comes into view (an `IntersectionObserver`, 200px ahead) — the same\n * request as the button there, which stays for keyboards and for a browser\n * without the observer. While `loadingEarlier` a spinner takes its place,\n * and when the page arrives above, what they were reading stays put.\n * Children are `Message` rows and `Divider`s. Its state belongs to one\n * conversation: key the `Thread` by it.\n */\nfunction Messages({\n hasEarlier = false,\n loadingEarlier = false,\n onLoadEarlier,\n earlierLabel = \"Load earlier messages\",\n className,\n children,\n ...props\n}: ChatMessagesProps) {\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const sentinelRef = useRef<HTMLDivElement | null>(null);\n const pinned = useRef(true);\n // Where the reader was when the earlier page was asked for: a row and how\n // far it sat from the pane's top, kept current as they go on scrolling,\n // until the page is in. The height and scroll position stand in when\n // there is no row to hold on to.\n const anchor = useRef<{\n row: Element | null;\n offset: number;\n height: number;\n top: number;\n } | null>(null);\n const loading = useRef(loadingEarlier);\n // The last request brought no messages (it failed, or the page was\n // empty). The top would ask again at once and go on asking, so it waits\n // for the button, or for another thread.\n const stalled = useRef(false);\n const askEarlier = useRef(onLoadEarlier);\n useIsoLayoutEffect(() => {\n askEarlier.current = onLoadEarlier;\n });\n\n // Holds the reader's place while an earlier page is on its way and once\n // it lands; otherwise keeps a pinned pane at the bottom.\n const settle = useCallback(() => {\n const viewport = viewportRef.current;\n if (!viewport) return;\n const kept = anchor.current;\n if (kept) {\n if (placed(kept.row)) {\n viewport.scrollTop += offsetIn(viewport, kept.row) - kept.offset;\n } else {\n viewport.scrollTop = viewport.scrollHeight - kept.height + kept.top;\n }\n if (loading.current) return;\n anchor.current = null;\n pinned.current =\n viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight <\n PIN_SLACK_PX;\n return;\n }\n if (pinned.current) viewport.scrollTop = viewport.scrollHeight;\n }, []);\n\n useIsoLayoutEffect(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n if (!viewport || !content) return;\n settle();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(settle);\n observer.observe(content);\n observer.observe(viewport);\n return () => observer.disconnect();\n }, [settle]);\n\n // The page is in (or the request is over): let go of the reader's place\n // before paint, even when nothing changed size.\n useIsoLayoutEffect(() => {\n loading.current = loadingEarlier;\n if (loadingEarlier) return;\n const kept = anchor.current;\n if (kept) stalled.current = oldestMessage(contentRef.current) === kept.row;\n settle();\n }, [loadingEarlier, settle]);\n\n const onScroll = () => {\n const viewport = viewportRef.current;\n if (!viewport) return;\n const kept = anchor.current;\n if (kept) {\n kept.height = viewport.scrollHeight;\n kept.top = viewport.scrollTop;\n if (placed(kept.row)) kept.offset = offsetIn(viewport, kept.row);\n }\n pinned.current =\n viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight <\n PIN_SLACK_PX;\n };\n\n const loadEarlier = useCallback(() => {\n const viewport = viewportRef.current;\n if (viewport) {\n // New messages go in below the oldest one and the page above it, and\n // unlike a day's divider it stays when the page arrives.\n const row = oldestMessage(contentRef.current);\n anchor.current = {\n row,\n offset: row ? offsetIn(viewport, row) : 0,\n height: viewport.scrollHeight,\n top: viewport.scrollTop,\n };\n }\n pinned.current = false;\n askEarlier.current?.();\n }, []);\n\n useEffect(() => {\n const viewport = viewportRef.current;\n const sentinel = sentinelRef.current;\n if (!hasEarlier) {\n stalled.current = false;\n return;\n }\n if (loadingEarlier || stalled.current || !viewport || !sentinel) return;\n if (typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) loadEarlier();\n },\n { root: viewport, rootMargin: EARLIER_AHEAD },\n );\n observer.observe(sentinel);\n return () => observer.disconnect();\n }, [hasEarlier, loadingEarlier, loadEarlier]);\n\n return (\n <div\n data-chat-messages=\"\"\n className={cn(\n // Bubbles' focus and selected rings offset against the thread.\n \"flex min-h-0 flex-1 flex-col [--pho-bubble-backdrop:var(--background-color-pho-primary)]\",\n className,\n )}\n {...props}\n >\n <ScrollArea.Root className=\"min-h-0 flex-1\">\n <ScrollArea.Viewport ref={viewportRef} onScroll={onScroll}>\n <ScrollArea.Content\n ref={contentRef}\n style={{ minWidth: 0 }}\n className=\"flex min-h-full flex-col gap-1 p-4\"\n >\n {hasEarlier && (\n <div\n ref={sentinelRef}\n data-chat-earlier=\"\"\n aria-busy={loadingEarlier || undefined}\n className=\"flex min-h-8 items-center justify-center\"\n >\n {loadingEarlier ? (\n <Spinner\n aria-label=\"Loading earlier messages\"\n className=\"text-pho-secondary\"\n />\n ) : (\n <Button\n variant=\"outlined\"\n size=\"sm\"\n onClick={(event) => {\n // The spinner takes the button's place: keyboard focus\n // stays in the pane.\n if (event.currentTarget === document.activeElement) {\n viewportRef.current?.focus({ preventScroll: true });\n }\n stalled.current = false;\n loadEarlier();\n }}\n >\n {earlierLabel}\n </Button>\n )}\n </div>\n )}\n {children}\n </ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n </ScrollArea.Root>\n </div>\n );\n}\n\n/** A centered caption in the thread — the day, \"Unread\". */\nfunction Divider({ className, children, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n data-chat-divider=\"\"\n className={cn(\"text-pho-description py-1 text-center text-xs\", className)}\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/* -------------------------------- footer -------------------------------- */\n\n/** The docked bar under the messages — usually a `Composer`. */\nfunction Footer({ className, ...props }: ComponentProps<\"footer\">) {\n return (\n <footer\n data-chat-footer=\"\"\n className={cn(\"shrink-0 px-4 py-3\", className)}\n {...props}\n />\n );\n}\n\n/** The draft box grows with the text up to this, then scrolls. */\nconst COMPOSER_MAX_HEIGHT_PX = 200;\n\nexport interface ChatComposerProps extends Omit<\n ComponentProps<\"form\">,\n \"onSubmit\" | \"prefix\" | \"children\"\n> {\n /** The draft. */\n value: string;\n onValueChange: (value: string) => void;\n /** Enter, or the send button. Not called while `sending` or with nothing to send. */\n onSend: () => void;\n placeholder?: string;\n /** The send is in flight — the button spins, the box waits. */\n sending?: boolean;\n disabled?: boolean;\n /**\n * There is something to send besides text (an attachment). By default\n * the send button wakes when the draft has a non-blank character.\n */\n canSend?: boolean;\n /** Controls at the start of the bottom row — an add-attachment button. */\n prefix?: ReactNode;\n /** A quiet line between `prefix` and the send button — a count, a size. */\n meta?: ReactNode;\n /** The send button's accessible name. @default \"Send\" */\n sendLabel?: string;\n /** Above the text — attachment thumbnails. */\n children?: ReactNode;\n /** The `<textarea>`. */\n textareaRef?: Ref<HTMLTextAreaElement>;\n}\n\n/**\n * The message box: text that grows with the draft, Enter to send and\n * Shift+Enter for a new line, one round send button. Attachments are the\n * page's: put their thumbnails in `children`, the button that adds them\n * in `prefix`, and flip `canSend` when they alone should send.\n */\nfunction Composer({\n value,\n onValueChange,\n onSend,\n placeholder = \"Message\",\n sending = false,\n disabled = false,\n canSend,\n prefix,\n meta,\n sendLabel = \"Send\",\n children,\n textareaRef,\n className,\n ...props\n}: ChatComposerProps) {\n const innerRef = useRef<HTMLTextAreaElement | null>(null);\n const ready = !sending && !disabled && (canSend ?? value.trim().length > 0);\n\n useIsoLayoutEffect(() => {\n const element = innerRef.current;\n if (!element) return;\n element.style.height = \"0px\";\n element.style.height = `${Math.min(element.scrollHeight, COMPOSER_MAX_HEIGHT_PX)}px`;\n }, [value]);\n\n const submit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (ready) onSend();\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (\n event.key === \"Enter\" &&\n !event.shiftKey &&\n !event.nativeEvent.isComposing\n ) {\n event.preventDefault();\n if (ready) onSend();\n }\n };\n\n return (\n <form\n aria-label=\"Message composer\"\n data-chat-composer=\"\"\n onSubmit={submit}\n className={cn(\n // The field surface, as `Input`: hairline at rest, brand ring while\n // anything inside has focus.\n \"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\",\n disabled && \"opacity-50\",\n className,\n )}\n {...props}\n >\n {children}\n <textarea\n ref={(node) => {\n innerRef.current = node;\n if (typeof textareaRef === \"function\") textareaRef(node);\n else if (textareaRef) {\n (textareaRef as { current: HTMLTextAreaElement | null }).current =\n node;\n }\n }}\n value={value}\n onChange={(event) => onValueChange(event.target.value)}\n onKeyDown={onKeyDown}\n rows={1}\n placeholder={placeholder}\n aria-label=\"Message\"\n disabled={disabled}\n // In flight the box holds its text but stays focusable — `disabled`\n // would drop focus mid-send; `ready` already blocks a second send.\n readOnly={sending}\n 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\"\n />\n <div className=\"flex items-center gap-2 px-2 pb-2\">\n {prefix}\n <p className=\"text-pho-description m-0 min-w-0 flex-1 truncate text-xs\">\n {meta}\n </p>\n <Button\n type=\"submit\"\n size=\"sm\"\n shape=\"circle\"\n svgOnly\n aria-label={sendLabel}\n disabled={!ready}\n loading={sending}\n >\n <IconArrowUp />\n </Button>\n </div>\n </form>\n );\n}\n\n/* --------------------------------- states ------------------------------- */\n\nexport interface ChatEmptyProps extends StatusViewProps {}\n\n/**\n * The standing-in view for either pane — no conversations, no thread\n * chosen, nothing said yet. `StatusView` at card size, centered in\n * whatever room the pane has.\n */\nfunction Empty({ className, size = \"sm\", ...props }: ChatEmptyProps) {\n return (\n <div\n data-chat-empty=\"\"\n className={cn(\n \"flex flex-1 flex-col items-center justify-center px-6 py-8\",\n className,\n )}\n >\n <StatusView size={size} {...props} />\n </div>\n );\n}\n\n/** Bones in the shape of conversation rows — avatar, who, when, preview. */\nfunction ConversationsLoading({ rows = 5 }: { rows?: number }) {\n return (\n <div\n aria-hidden\n data-chat-conversations-loading=\"\"\n className=\"flex flex-col gap-0.5\"\n >\n {Array.from({ length: rows }, (_, row) => (\n <div key={row} className=\"flex items-center gap-3 px-2 py-2.5\">\n <Skeleton className=\"size-8 shrink-0 rounded-full\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center justify-between gap-2\">\n <Skeleton className=\"h-3.5 w-32\" />\n <Skeleton className=\"h-2.5 w-8\" />\n </div>\n <Skeleton className=\"mt-1.5 h-2.5 w-44\" />\n </div>\n </div>\n ))}\n </div>\n );\n}\n\n/** Bones in a thread's shape — theirs left, ours right. */\nfunction MessagesLoading() {\n return (\n <div\n aria-hidden\n data-chat-messages-loading=\"\"\n className=\"flex flex-col gap-3\"\n >\n <Skeleton className=\"rounded-base h-10 w-1/2 self-start\" />\n <Skeleton className=\"rounded-base h-10 w-2/5 self-end\" />\n <Skeleton className=\"rounded-base h-16 w-3/5 self-start\" />\n </div>\n );\n}\n\n/**\n * The composed inbox. Assemble the two panes and fill them:\n *\n * ```tsx\n * <Chat.Root layout=\"auto\" className=\"h-[32rem]\">\n * <Chat.List>\n * <Chat.Search value={query} onChange={…} />\n * <Chat.Conversations>\n * <Chat.ConversationList>\n * <Chat.Conversation title=\"+1 (315) 997-8332\" time=\"2d ago\" preview=\"…\" active />\n * </Chat.ConversationList>\n * </Chat.Conversations>\n * </Chat.List>\n * <Chat.Thread>\n * <Chat.Header avatar={<Avatar.Root size=\"md\">…</Avatar.Root>}>\n * <Chat.Title>+1 (315) 997-8332</Chat.Title>\n * <Chat.Description>From …</Chat.Description>\n * </Chat.Header>\n * <Chat.Messages>\n * <Chat.Divider>September 12</Chat.Divider>\n * <Message.Root>…</Message.Root>\n * </Chat.Messages>\n * <Chat.Footer>\n * <Chat.Composer value={draft} onValueChange={setDraft} onSend={send} />\n * </Chat.Footer>\n * </Chat.Thread>\n * </Chat.Root>\n * ```\n */\nexport const Chat = {\n Root,\n List,\n Search,\n Conversations,\n ConversationList,\n Conversation,\n Thread,\n Header,\n Title,\n Description,\n Messages,\n Divider,\n Footer,\n Composer,\n Empty,\n ConversationsLoading,\n MessagesLoading,\n};\n"],"ignoreList":[0,1,2,3],"mappings":";;;;;;;;;;;;;;;;;AASA,IAAMA,KAAa;AAAA,EAAC,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAc,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAa,KAAO;AAAA,EAAQ,CAAC;AAAA,E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UAAA,CACE,gBAAAD,EAACZ,GAAD,EAAU,WAAU,aAAc,CAAA,GAClC,gBAAAY,EAACZ,GAAD,EAAU,WAAU,YAAa,CAAA,CAC9B;AAAA,QACL,CAAA,GAAA,gBAAAY,EAACZ,GAAD,EAAU,WAAU,oBAAqB,CAAA,CACtC;AAAA,MACF,CAAA,CAAA;AAAA,IATK,GAAA+I,CASL,CACN;AAAA,EACE,CAAA;AAET;AAGA,SAAS8C,KAAkB;AACzB,SACE,gBAAAhL,EAAC,OAAD;AAAA,IACE,eAAA;AAAA,IACA,8BAA2B;AAAA,IAC3B,WAAU;AAAA,IAHZ,UAAA;AAAA,MAKE,gBAAAD,EAACZ,GAAD,EAAU,WAAU,qCAAsC,CAAA;AAAA,MAC1D,gBAAAY,EAACZ,GAAD,EAAU,WAAU,mCAAoC,CAAA;AAAA,MACxD,gBAAAY,EAACZ,GAAD,EAAU,WAAU,qCAAsC,CAAA;AAAA,IACvD;AAAA,E;AAET;AA+BA,IAAa8L,KAAO;AAAA,EAClB,MAAAlI;AAAA,EACA,MAAA4B;AAAA,EACA,QAAAsB;AAAA,EACA,eAAAG;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAK;AAAA,EACA,QAAAa;AAAA,EACA,QAAAE;AAAA,EACA,OAAAG;AAAA,EACA,aAAAC;AAAA,EACA,UAAAS;AAAA,EACA,SAAAoB;AAAA,EACA,QAAAC;AAAA,EACA,UAAAE;AAAA,EACA,OAAAc;AAAA,EACA,sBAAAE;AAAA,EACA,iBAAAG;AACF"}
|
|
@@ -78,7 +78,7 @@ function R({ title: r, description: o }) {
|
|
|
78
78
|
return /* @__PURE__ */ p("span", {
|
|
79
79
|
className: "flex min-w-0 flex-1 flex-col",
|
|
80
80
|
children: [/* @__PURE__ */ e("span", {
|
|
81
|
-
className: "text-pho-primary block font-medium",
|
|
81
|
+
className: "text-pho-primary font-heading block font-medium",
|
|
82
82
|
children: r
|
|
83
83
|
}), o ? /* @__PURE__ */ e("span", {
|
|
84
84
|
className: "text-pho-description block",
|
|
@@ -130,4 +130,4 @@ export {
|
|
|
130
130
|
O as t
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
//# sourceMappingURL=checkbox-
|
|
133
|
+
//# sourceMappingURL=checkbox-D8smFViR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-DpWLbKVS.js","names":["Checkbox","BaseCheckbox","CheckboxGroup","BaseCheckboxGroup","BaseCheckbox","usePressPulse","CHOICE_CARD_PRESS_SCALE","CHOICE_CARD_PRESS_TRANSITION","CHOICE_CARD_BASE","jsx","jsxs","motion","Checkbox","CheckboxGroup","CHECK_PATH","MINUS_PATH","DRAW_TRANSITION","DrawnCheckGlyph","indeterminate","className","BOX","ICON","Checkbox$1","label","size","disabled","props","motionProps","onPointerDown","boxMotionProps","box","cn","CheckboxGroup$1","CardCopy","title","description","CheckboxCard","icon","hasIcon"],"sources":["../../src/components/checkbox/check-glyph.tsx","../../src/components/checkbox/checkbox.tsx","../../src/components/checkbox/checkbox-group.tsx","../../src/components/checkbox/checkbox-card.tsx"],"sourcesContent":["import { motion } from \"motion/react\";\n\n// Tabler's IconCheck / IconMinus paths, redrawn as a single animatable\n// `motion.path` — same 24×24 outline geometry, round caps/joins. Tabler\n// draws at stroke 2 for a 24px icon; the box shows this one at 12–14px,\n// where 2 thins to a hair, so it strokes at 3 and reads with the same\n// weight the icons around it have.\nconst CHECK_PATH = \"M5 12l5 5l10 -10\";\nconst MINUS_PATH = \"M5 12l14 0\";\n\nconst DRAW_TRANSITION = { duration: 0.22, ease: \"easeOut\" } as const;\n\n/**\n * The checkbox glyph, stroked on rather than popped in solid — same\n * considered-motion spirit as Button's press/wake effects. Re-keyed per\n * state (check vs. dash) so every appearance draws fresh from empty instead\n * of resuming a stroke left mid-way by whatever the glyph showed before.\n */\nexport function DrawnCheckGlyph({\n indeterminate,\n className,\n}: {\n indeterminate?: boolean;\n className?: string;\n}) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden=\"true\"\n >\n <motion.path\n key={indeterminate ? \"minus\" : \"check\"}\n d={indeterminate ? MINUS_PATH : CHECK_PATH}\n initial={{ pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={DRAW_TRANSITION}\n />\n </svg>\n );\n}\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { Checkbox as BaseCheckbox } from \"@base-ui/react/checkbox\";\nimport { motion } from \"motion/react\";\nimport { DrawnCheckGlyph } from \"./check-glyph\";\nimport { cn } from \"../../utils/cn\";\nimport { usePressPulse } from \"../../utils/use-press-pulse\";\n\nexport type CheckboxSize = \"sm\" | \"md\";\n\nconst BOX: Record<CheckboxSize, string> = { sm: \"size-4\", md: \"size-5\" };\nconst ICON: Record<CheckboxSize, string> = { sm: \"size-3\", md: \"size-3.5\" };\n\nexport interface CheckboxProps extends Omit<\n ComponentProps<typeof BaseCheckbox.Root>,\n \"className\"\n> {\n className?: string;\n /** Text rendered beside the box; the whole row toggles the checkbox. */\n label?: ReactNode;\n /** Size variant. @default \"md\" */\n size?: CheckboxSize;\n}\n\n/**\n * Checkbox built on Base UI `Checkbox`. Supports checked, unchecked, and\n * `indeterminate` states; pass `label` for a clickable text row, or omit it\n * and provide an `aria-label`. For a set of related options that submit\n * together, wrap them in `CheckboxGroup`.\n *\n * Animation is the Effect Button family scaled to a toggle, kept restrained:\n * a quick shallow press pulse on pointer-down (always plays out), the\n * fill/stroke easing between states, and the glyph popping in.\n */\nexport function Checkbox({\n className,\n label,\n size = \"md\",\n disabled,\n indeterminate,\n ...props\n}: CheckboxProps) {\n const { motionProps } = usePressPulse({\n scale: 0.94,\n disabled: Boolean(disabled),\n });\n // With a label, the whole row is the hit target — press-trigger from there\n // (pointerdown bubbles up from the label text too) so the box still\n // animates when the text, not the box itself, is what's clicked.\n const { onPointerDown, ...boxMotionProps } = motionProps;\n\n const box = (\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n render={\n <motion.span\n {...boxMotionProps}\n onPointerDown={label ? undefined : onPointerDown}\n />\n }\n className={cn(\n // Flat field surface with the input-strength ring; the glyph only shows\n // on the brand-solid checked fill, so it must be on-brand (not white —\n // brand-solid is white in dark mode).\n \"group/cb outline-pho-brand bg-pho-primary ring-pho-primary text-pho-on-brand flex shrink-0 cursor-pointer items-center justify-center rounded-sm ring-1 ring-inset focus-visible:outline-2 focus-visible:outline-offset-2\",\n // Fill and stroke ease between states (stroke dissolves into the\n // fill on tick). Transform stays out — Motion owns the press pulse.\n \"transition-[background-color,box-shadow,color,outline-color] duration-150 ease-out\",\n // group-hover covers hovering the label text, not just the box itself.\n \"hover:bg-pho-primary-hover hover:ring-pho-ink group-hover:bg-pho-primary-hover group-hover:ring-pho-ink\",\n \"data-[checked]:bg-pho-brand-solid data-[checked]:ring-transparent\",\n \"data-[indeterminate]:bg-pho-brand-solid data-[indeterminate]:ring-transparent\",\n \"data-[checked]:hover:bg-pho-brand-solid-hover data-[checked]:group-hover:bg-pho-brand-solid-hover\",\n \"data-[indeterminate]:hover:bg-pho-brand-solid-hover data-[indeterminate]:group-hover:bg-pho-brand-solid-hover\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\n BOX[size],\n className,\n )}\n {...props}\n >\n {/* The glyph draws itself on (see DrawnCheckGlyph) — no separate\n pop-in needed. A quick fade covers the exit, since an unmount\n can't play the stroke backwards. */}\n <BaseCheckbox.Indicator\n className={cn(\n \"flex items-center justify-center transition-opacity duration-100 ease-out\",\n \"data-[ending-style]:opacity-0\",\n )}\n >\n <DrawnCheckGlyph indeterminate={indeterminate} className={ICON[size]} />\n </BaseCheckbox.Indicator>\n </BaseCheckbox.Root>\n );\n\n if (!label) return box;\n return (\n <label\n className=\"group flex cursor-pointer items-center gap-2 select-none\"\n onPointerDown={onPointerDown}\n >\n {box}\n <span className=\"text-pho-secondary text-base\">{label}</span>\n </label>\n );\n}\n\nCheckbox.displayName = \"Checkbox\";\n","import { type ComponentProps } from \"react\";\nimport { CheckboxGroup as BaseCheckboxGroup } from \"@base-ui/react/checkbox-group\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface CheckboxGroupProps extends Omit<\n ComponentProps<typeof BaseCheckboxGroup>,\n \"className\"\n> {\n className?: string;\n}\n\n/**\n * Groups related `Checkbox`es and tracks their values as one. Built on Base UI\n * `CheckboxGroup` — supports a parent \"select all\" checkbox via `allValues`.\n * Control with `value` / `onValueChange` or leave uncontrolled with\n * `defaultValue`.\n */\nexport function CheckboxGroup({ className, ...props }: CheckboxGroupProps) {\n return (\n <BaseCheckboxGroup\n className={cn(\"flex flex-col gap-3\", className)}\n {...props}\n />\n );\n}\n\nCheckboxGroup.displayName = \"CheckboxGroup\";\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { Checkbox as BaseCheckbox } from \"@base-ui/react/checkbox\";\nimport { motion } from \"motion/react\";\nimport { DrawnCheckGlyph } from \"./check-glyph\";\nimport { cn } from \"../../utils/cn\";\nimport { usePressPulse } from \"../../utils/use-press-pulse\";\nimport {\n CHOICE_CARD_BASE,\n CHOICE_CARD_WITH_ICON,\n CHOICE_CARD_PRESS_SCALE,\n CHOICE_CARD_PRESS_TRANSITION,\n} from \"../../utils/choice-card\";\n\nexport interface CheckboxCardProps extends Omit<\n ComponentProps<typeof BaseCheckbox.Root>,\n \"className\" | \"title\"\n> {\n className?: string;\n /** Tile heading. */\n title: ReactNode;\n /** Supporting copy shown below the title. */\n description?: ReactNode;\n /** Glyph stacked above the title. When set, it replaces the checkbox box. */\n icon?: ReactNode;\n}\n\nfunction CardCopy({\n title,\n description,\n}: {\n title: ReactNode;\n description?: ReactNode;\n}) {\n return (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"text-pho-primary block font-medium\">{title}</span>\n {description ? (\n <span className=\"text-pho-description block\">{description}</span>\n ) : null}\n </span>\n );\n}\n\n/**\n * A `Checkbox` styled as a bordered, selectable tile — title, optional\n * description, and either a stacked icon above them or the checkbox box at\n * the end of the title row. The tile is a\n * `<label>` around the control so clicks (including on the icon/title) are a\n * trusted activation of the hidden input Base UI renders beside the root.\n */\nexport function CheckboxCard({\n className,\n title,\n description,\n icon,\n disabled,\n indeterminate,\n ...props\n}: CheckboxCardProps) {\n const { motionProps } = usePressPulse({\n scale: CHOICE_CARD_PRESS_SCALE,\n disabled: Boolean(disabled),\n transition: CHOICE_CARD_PRESS_TRANSITION,\n });\n const hasIcon = icon != null;\n\n return (\n <motion.label\n {...motionProps}\n className={cn(\n CHOICE_CARD_BASE,\n hasIcon && CHOICE_CARD_WITH_ICON,\n className,\n )}\n data-disabled={disabled ? \"\" : undefined}\n >\n {hasIcon ? (\n <span\n aria-hidden\n className=\"text-pho-secondary flex size-6 shrink-0 items-center justify-center [&>svg]:size-6\"\n >\n {icon}\n </span>\n ) : null}\n <CardCopy title={title} description={description} />\n {/* The box sits at the end of the title row, centered on the title's\n line and the same half step from the right edge, square in the\n corner; with an icon it is the hidden control the label\n activates. */}\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n className={\n hasIcon\n ? \"sr-only\"\n : cn(\n \"bg-pho-primary ring-pho-primary text-pho-on-brand mt-0.5 mr-0.5 flex size-4 shrink-0 items-center justify-center rounded-sm ring-1 ring-inset\",\n \"group-hover:bg-pho-primary-hover group-hover:ring-pho-ink transition-[background-color,box-shadow,color] duration-150 ease-out\",\n \"data-[checked]:bg-pho-brand-solid data-[checked]:group-hover:bg-pho-brand-solid-hover data-[checked]:ring-transparent\",\n \"data-[indeterminate]:bg-pho-brand-solid data-[indeterminate]:group-hover:bg-pho-brand-solid-hover data-[indeterminate]:ring-transparent\",\n )\n }\n {...props}\n >\n {hasIcon ? null : (\n <BaseCheckbox.Indicator\n className={cn(\n \"flex items-center justify-center transition-opacity duration-100 ease-out\",\n \"data-[ending-style]:opacity-0\",\n )}\n >\n <DrawnCheckGlyph\n indeterminate={indeterminate}\n className=\"size-2.5\"\n />\n </BaseCheckbox.Indicator>\n )}\n </BaseCheckbox.Root>\n </motion.label>\n );\n}\n\nCheckboxCard.displayName = \"CheckboxCard\";\n"],"mappings":";;;;;;;;;AAOA,IAAMc,IAAa,oBACbC,IAAa,cAEbC,IAAkB;AAAA,EAAE,UAAU;AAAA,EAAM,MAAM;AAAU;AAQ1D,SAAgBC,EAAgB,EAC9B,eAAAC,GACA,WAAAC,EAAA,GAIC;AACD,SACE,gBAAAV,EAAC,OAAD;AAAA,IACE,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAc;AAAA,IACd,gBAAe;AAAA,IACJ,WAAAU;AAAA,IACX,eAAY;AAAA,IAEZ,UAAA,gBAAAV,EAACE,EAAO,MAAR;AAAA,MAEE,GAAGO,IAAgBH,IAAaD;AAAA,MAChC,SAAS,EAAE,YAAY,EAAE;AAAA,MACzB,SAAS,EAAE,YAAY,EAAE;AAAA,MACzB,YAAYE;AAAA,IACb,GALME,IAAgB,UAAU,OAKhC;AAAA,EACE,CAAA;AAET;ACpCA,IAAME,IAAoC;AAAA,EAAE,IAAI;AAAA,EAAU,IAAI;AAAS,GACjEC,IAAqC;AAAA,EAAE,IAAI;AAAA,EAAU,IAAI;AAAW;AAuB1E,SAAgBrB,EAAS,EACvB,WAAAmB,GACA,OAAAI,GACA,MAAAC,IAAO,MACP,UAAAC,GACA,eAAAP,GACA,GAAGQ,EAAA,GACa;AAChB,QAAM,EAAE,aAAAC,EAAA,IAAgBtB,EAAc;AAAA,IACpC,OAAO;AAAA,IACP,UAAU,EAAQoB;AAAA,EACpB,CAAC,GAIK,EAAE,eAAAG,GAAe,GAAGC,EAAA,IAAmBF,GAEvCG,IACJ,gBAAArB,EAACR,EAAa,MAAd;AAAA,IACY,UAAAwB;AAAA,IACK,eAAAP;AAAA,IACf,QACE,gBAAAT,EAACE,EAAO,MAAR;AAAA,MACE,GAAI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AAE,GACA,UAAAZ,GACA,eAAAP,GACA,GAAGQ,EAAA,GACiB;AACpB,QAAM,EAAE,aAAAC,EAAA,IAAgBtB,EAAc;AAAA,IACpC,OAAOC;AAAA,IACP,UAAU,EAAQmB;AAAA,IAClB,YAAYlB;AAAA,EACd,CAAC,GACK+B,IAAUD,KAAQ;AAExB,SACE,gBAAA3B,EAACC,EAAO,OAAR;AAAA,IACE,GAAIgB;AAAA,IACJ,WAAWI,EACTvB,GACA8B,KAAA,oBACAnB,CACF;AAAA,IACA,iBAAeM,IAAW,KAAK;AAAA,IAPjC,UAAA;AAAA,MASGa,IACC,gBAAA7B,EAAC,QAAD;AAAA,QACE,eAAA;AAAA,QACA,WAAU;AAAA,QAET,UAAA4B;AAAA,MACG,CAAA,IACJ;AAAA,MACJ,gBAAA5B,EAACwB,GAAD;AAAA,QAAiB,OAAAC;AAAA,QAAoB,aAAAC;AAAA,MAAc,CAAA;AAAA,MAKnD,gBAAA1B,EAACL,EAAa,MAAd;AAAA,QACY,UAAAqB;AAAA,QACK,eAAAP;AAAA,QACf,WACEoB,IACI,YACAP,EACE,iJACA,kIACA,yHACA,yIACF;AAAA,QAEN,GAAIL;AAAA,QAEH,UAAAY,IAAU,OACT,gBAAA7B,EAACL,EAAa,WAAd;AAAA,UACE,WAAW2B,EACT,6EACA,+BACF;AAAA,UAEA,UAAA,gBAAAtB,EAACQ,GAAD;AAAA,YACiB,eAAAC;AAAA,YACf,WAAU;AAAA,UACX,CAAA;AAAA,QACqB,CAAA;AAAA,MAET,CAAA;AAAA,IACP;AAAA,E;AAElB;AAEAkB,EAAa,cAAc"}
|
|
1
|
+
{"version":3,"file":"checkbox-D8smFViR.js","names":["Checkbox","BaseCheckbox","CheckboxGroup","BaseCheckboxGroup","BaseCheckbox","usePressPulse","CHOICE_CARD_PRESS_SCALE","CHOICE_CARD_PRESS_TRANSITION","CHOICE_CARD_BASE","jsx","jsxs","motion","Checkbox","CheckboxGroup","CHECK_PATH","MINUS_PATH","DRAW_TRANSITION","DrawnCheckGlyph","indeterminate","className","BOX","ICON","Checkbox$1","label","size","disabled","props","motionProps","onPointerDown","boxMotionProps","box","cn","CheckboxGroup$1","CardCopy","title","description","CheckboxCard","icon","hasIcon"],"sources":["../../src/components/checkbox/check-glyph.tsx","../../src/components/checkbox/checkbox.tsx","../../src/components/checkbox/checkbox-group.tsx","../../src/components/checkbox/checkbox-card.tsx"],"sourcesContent":["import { motion } from \"motion/react\";\n\n// Tabler's IconCheck / IconMinus paths, redrawn as a single animatable\n// `motion.path` — same 24×24 outline geometry, round caps/joins. Tabler\n// draws at stroke 2 for a 24px icon; the box shows this one at 12–14px,\n// where 2 thins to a hair, so it strokes at 3 and reads with the same\n// weight the icons around it have.\nconst CHECK_PATH = \"M5 12l5 5l10 -10\";\nconst MINUS_PATH = \"M5 12l14 0\";\n\nconst DRAW_TRANSITION = { duration: 0.22, ease: \"easeOut\" } as const;\n\n/**\n * The checkbox glyph, stroked on rather than popped in solid — same\n * considered-motion spirit as Button's press/wake effects. Re-keyed per\n * state (check vs. dash) so every appearance draws fresh from empty instead\n * of resuming a stroke left mid-way by whatever the glyph showed before.\n */\nexport function DrawnCheckGlyph({\n indeterminate,\n className,\n}: {\n indeterminate?: boolean;\n className?: string;\n}) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden=\"true\"\n >\n <motion.path\n key={indeterminate ? \"minus\" : \"check\"}\n d={indeterminate ? MINUS_PATH : CHECK_PATH}\n initial={{ pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={DRAW_TRANSITION}\n />\n </svg>\n );\n}\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { Checkbox as BaseCheckbox } from \"@base-ui/react/checkbox\";\nimport { motion } from \"motion/react\";\nimport { DrawnCheckGlyph } from \"./check-glyph\";\nimport { cn } from \"../../utils/cn\";\nimport { usePressPulse } from \"../../utils/use-press-pulse\";\n\nexport type CheckboxSize = \"sm\" | \"md\";\n\nconst BOX: Record<CheckboxSize, string> = { sm: \"size-4\", md: \"size-5\" };\nconst ICON: Record<CheckboxSize, string> = { sm: \"size-3\", md: \"size-3.5\" };\n\nexport interface CheckboxProps extends Omit<\n ComponentProps<typeof BaseCheckbox.Root>,\n \"className\"\n> {\n className?: string;\n /** Text rendered beside the box; the whole row toggles the checkbox. */\n label?: ReactNode;\n /** Size variant. @default \"md\" */\n size?: CheckboxSize;\n}\n\n/**\n * Checkbox built on Base UI `Checkbox`. Supports checked, unchecked, and\n * `indeterminate` states; pass `label` for a clickable text row, or omit it\n * and provide an `aria-label`. For a set of related options that submit\n * together, wrap them in `CheckboxGroup`.\n *\n * Animation is the Effect Button family scaled to a toggle, kept restrained:\n * a quick shallow press pulse on pointer-down (always plays out), the\n * fill/stroke easing between states, and the glyph popping in.\n */\nexport function Checkbox({\n className,\n label,\n size = \"md\",\n disabled,\n indeterminate,\n ...props\n}: CheckboxProps) {\n const { motionProps } = usePressPulse({\n scale: 0.94,\n disabled: Boolean(disabled),\n });\n // With a label, the whole row is the hit target — press-trigger from there\n // (pointerdown bubbles up from the label text too) so the box still\n // animates when the text, not the box itself, is what's clicked.\n const { onPointerDown, ...boxMotionProps } = motionProps;\n\n const box = (\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n render={\n <motion.span\n {...boxMotionProps}\n onPointerDown={label ? undefined : onPointerDown}\n />\n }\n className={cn(\n // Flat field surface with the input-strength ring; the glyph only shows\n // on the brand-solid checked fill, so it must be on-brand (not white —\n // brand-solid is white in dark mode).\n \"group/cb outline-pho-brand bg-pho-primary ring-pho-primary text-pho-on-brand flex shrink-0 cursor-pointer items-center justify-center rounded-sm ring-1 ring-inset focus-visible:outline-2 focus-visible:outline-offset-2\",\n // Fill and stroke ease between states (stroke dissolves into the\n // fill on tick). Transform stays out — Motion owns the press pulse.\n \"transition-[background-color,box-shadow,color,outline-color] duration-150 ease-out\",\n // group-hover covers hovering the label text, not just the box itself.\n \"hover:bg-pho-primary-hover hover:ring-pho-ink group-hover:bg-pho-primary-hover group-hover:ring-pho-ink\",\n \"data-[checked]:bg-pho-brand-solid data-[checked]:ring-transparent\",\n \"data-[indeterminate]:bg-pho-brand-solid data-[indeterminate]:ring-transparent\",\n \"data-[checked]:hover:bg-pho-brand-solid-hover data-[checked]:group-hover:bg-pho-brand-solid-hover\",\n \"data-[indeterminate]:hover:bg-pho-brand-solid-hover data-[indeterminate]:group-hover:bg-pho-brand-solid-hover\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\n BOX[size],\n className,\n )}\n {...props}\n >\n {/* The glyph draws itself on (see DrawnCheckGlyph) — no separate\n pop-in needed. A quick fade covers the exit, since an unmount\n can't play the stroke backwards. */}\n <BaseCheckbox.Indicator\n className={cn(\n \"flex items-center justify-center transition-opacity duration-100 ease-out\",\n \"data-[ending-style]:opacity-0\",\n )}\n >\n <DrawnCheckGlyph indeterminate={indeterminate} className={ICON[size]} />\n </BaseCheckbox.Indicator>\n </BaseCheckbox.Root>\n );\n\n if (!label) return box;\n return (\n <label\n className=\"group flex cursor-pointer items-center gap-2 select-none\"\n onPointerDown={onPointerDown}\n >\n {box}\n <span className=\"text-pho-secondary text-base\">{label}</span>\n </label>\n );\n}\n\nCheckbox.displayName = \"Checkbox\";\n","import { type ComponentProps } from \"react\";\nimport { CheckboxGroup as BaseCheckboxGroup } from \"@base-ui/react/checkbox-group\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface CheckboxGroupProps extends Omit<\n ComponentProps<typeof BaseCheckboxGroup>,\n \"className\"\n> {\n className?: string;\n}\n\n/**\n * Groups related `Checkbox`es and tracks their values as one. Built on Base UI\n * `CheckboxGroup` — supports a parent \"select all\" checkbox via `allValues`.\n * Control with `value` / `onValueChange` or leave uncontrolled with\n * `defaultValue`.\n */\nexport function CheckboxGroup({ className, ...props }: CheckboxGroupProps) {\n return (\n <BaseCheckboxGroup\n className={cn(\"flex flex-col gap-3\", className)}\n {...props}\n />\n );\n}\n\nCheckboxGroup.displayName = \"CheckboxGroup\";\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { Checkbox as BaseCheckbox } from \"@base-ui/react/checkbox\";\nimport { motion } from \"motion/react\";\nimport { DrawnCheckGlyph } from \"./check-glyph\";\nimport { cn } from \"../../utils/cn\";\nimport { usePressPulse } from \"../../utils/use-press-pulse\";\nimport {\n CHOICE_CARD_BASE,\n CHOICE_CARD_WITH_ICON,\n CHOICE_CARD_PRESS_SCALE,\n CHOICE_CARD_PRESS_TRANSITION,\n} from \"../../utils/choice-card\";\n\nexport interface CheckboxCardProps extends Omit<\n ComponentProps<typeof BaseCheckbox.Root>,\n \"className\" | \"title\"\n> {\n className?: string;\n /** Tile heading. */\n title: ReactNode;\n /** Supporting copy shown below the title. */\n description?: ReactNode;\n /** Glyph stacked above the title. When set, it replaces the checkbox box. */\n icon?: ReactNode;\n}\n\nfunction CardCopy({\n title,\n description,\n}: {\n title: ReactNode;\n description?: ReactNode;\n}) {\n return (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"text-pho-primary font-heading block font-medium\">\n {title}\n </span>\n {description ? (\n <span className=\"text-pho-description block\">{description}</span>\n ) : null}\n </span>\n );\n}\n\n/**\n * A `Checkbox` styled as a bordered, selectable tile — title, optional\n * description, and either a stacked icon above them or the checkbox box at\n * the end of the title row. The tile is a\n * `<label>` around the control so clicks (including on the icon/title) are a\n * trusted activation of the hidden input Base UI renders beside the root.\n */\nexport function CheckboxCard({\n className,\n title,\n description,\n icon,\n disabled,\n indeterminate,\n ...props\n}: CheckboxCardProps) {\n const { motionProps } = usePressPulse({\n scale: CHOICE_CARD_PRESS_SCALE,\n disabled: Boolean(disabled),\n transition: CHOICE_CARD_PRESS_TRANSITION,\n });\n const hasIcon = icon != null;\n\n return (\n <motion.label\n {...motionProps}\n className={cn(\n CHOICE_CARD_BASE,\n hasIcon && CHOICE_CARD_WITH_ICON,\n className,\n )}\n data-disabled={disabled ? \"\" : undefined}\n >\n {hasIcon ? (\n <span\n aria-hidden\n className=\"text-pho-secondary flex size-6 shrink-0 items-center justify-center [&>svg]:size-6\"\n >\n {icon}\n </span>\n ) : null}\n <CardCopy title={title} description={description} />\n {/* The box sits at the end of the title row, centered on the title's\n line and the same half step from the right edge, square in the\n corner; with an icon it is the hidden control the label\n activates. */}\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n className={\n hasIcon\n ? \"sr-only\"\n : cn(\n \"bg-pho-primary ring-pho-primary text-pho-on-brand mt-0.5 mr-0.5 flex size-4 shrink-0 items-center justify-center rounded-sm ring-1 ring-inset\",\n \"group-hover:bg-pho-primary-hover group-hover:ring-pho-ink transition-[background-color,box-shadow,color] duration-150 ease-out\",\n \"data-[checked]:bg-pho-brand-solid data-[checked]:group-hover:bg-pho-brand-solid-hover data-[checked]:ring-transparent\",\n \"data-[indeterminate]:bg-pho-brand-solid data-[indeterminate]:group-hover:bg-pho-brand-solid-hover data-[indeterminate]:ring-transparent\",\n )\n }\n {...props}\n >\n {hasIcon ? null : (\n <BaseCheckbox.Indicator\n className={cn(\n \"flex items-center justify-center transition-opacity duration-100 ease-out\",\n \"data-[ending-style]:opacity-0\",\n )}\n >\n <DrawnCheckGlyph\n indeterminate={indeterminate}\n className=\"size-2.5\"\n />\n </BaseCheckbox.Indicator>\n )}\n </BaseCheckbox.Root>\n </motion.label>\n );\n}\n\nCheckboxCard.displayName = \"CheckboxCard\";\n"],"mappings":";;;;;;;;;AAOA,IAAMc,IAAa,oBACbC,IAAa,cAEbC,IAAkB;AAAA,EAAE,UAAU;AAAA,EAAM,MAAM;AAAU;AAQ1D,SAAgBC,EAAgB,EAC9B,eAAAC,GACA,WAAAC,EAAA,GAIC;AACD,SACE,gBAAAV,EAAC,OAAD;AAAA,IACE,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAa;AAAA,IACb,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A;AAAA,QACA,WAAU;AAAA,QAET,UAAA4B;AAAA,MACG,CAAA,IACJ;AAAA,MACJ,gBAAA5B,EAACwB,GAAD;AAAA,QAAiB,OAAAC;AAAA,QAAoB,aAAAC;AAAA,MAAc,CAAA;AAAA,MAKnD,gBAAA1B,EAACL,EAAa,MAAd;AAAA,QACY,UAAAqB;AAAA,QACK,eAAAP;AAAA,QACf,WACEoB,IACI,YACAP,EACE,iJACA,kIACA,yHACA,yIACF;AAAA,QAEN,GAAIL;AAAA,QAEH,UAAAY,IAAU,OACT,gBAAA7B,EAACL,EAAa,WAAd;AAAA,UACE,WAAW2B,EACT,6EACA,+BACF;AAAA,UAEA,UAAA,gBAAAtB,EAACQ,GAAD;AAAA,YACiB,eAAAC;AAAA,YACf,WAAU;AAAA,UACX,CAAA;AAAA,QACqB,CAAA;AAAA,MAET,CAAA;AAAA,IACP;AAAA,E;AAElB;AAEAkB,EAAa,cAAc"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var e = "rounded-base border border-pho-secondary bg-pho-primary", r = "text-pho-description font-heading h-10 text-left align-middle font-normal whitespace-nowrap", a = "divide-pho-secondary border-pho-secondary divide-y border-t", o = {
|
|
3
|
+
sm: "text-xs",
|
|
4
|
+
base: "text-base",
|
|
5
|
+
lg: "text-md"
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
o as i,
|
|
9
|
+
r as n,
|
|
10
|
+
e as r,
|
|
11
|
+
a as t
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=chrome-Dyvv0FVf.js.map
|