@geomak/ui 6.29.2 → 6.30.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/index.cjs CHANGED
@@ -2304,6 +2304,19 @@ var ArrowDown = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 2
2304
2304
  function TypingDots() {
2305
2305
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center gap-1", "aria-hidden": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-foreground-muted", style: { animationDelay: `${i * 0.15}s` } }, i)) });
2306
2306
  }
2307
+ var SKELETON_ROWS = [
2308
+ { own: false, w: 150 },
2309
+ { own: false, w: 110 },
2310
+ { own: true, w: 180 },
2311
+ { own: false, w: 130 },
2312
+ { own: true, w: 90 }
2313
+ ];
2314
+ function ChatSkeleton() {
2315
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", "aria-hidden": "true", children: SKELETON_ROWS.map((r, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["flex items-end gap-2", r.own ? "flex-row-reverse" : ""].filter(Boolean).join(" "), children: [
2316
+ !r.own && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-6 w-6 flex-shrink-0 animate-pulse rounded-full bg-surface" }),
2317
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-8 animate-pulse rounded-2xl bg-surface", style: { width: r.w } })
2318
+ ] }, i)) });
2319
+ }
2307
2320
  function Chat({
2308
2321
  messages,
2309
2322
  currentUserId,
@@ -2316,6 +2329,7 @@ function Chat({
2316
2329
  placeholder = "Write a message\u2026",
2317
2330
  disabled = false,
2318
2331
  hideComposer = false,
2332
+ loading = false,
2319
2333
  emptyState,
2320
2334
  height = 480,
2321
2335
  className = "",
@@ -2325,7 +2339,6 @@ function Chat({
2325
2339
  const atBottomRef = React28.useRef(true);
2326
2340
  const [showJump, setShowJump] = React28.useState(false);
2327
2341
  const [draft, setDraft] = React28.useState("");
2328
- const taRef = React28.useRef(null);
2329
2342
  const hasHeader = title != null || subtitle != null || avatar != null || headerActions != null;
2330
2343
  const isTyping = typingNames.length > 0;
2331
2344
  const scrollToBottom = React28.useCallback((smooth = true) => {
@@ -2347,12 +2360,6 @@ function Chat({
2347
2360
  React28.useEffect(() => {
2348
2361
  scrollToBottom(false);
2349
2362
  }, [scrollToBottom]);
2350
- React28.useLayoutEffect(() => {
2351
- const ta = taRef.current;
2352
- if (!ta) return;
2353
- ta.style.height = "auto";
2354
- ta.style.height = `${Math.min(ta.scrollHeight, 120)}px`;
2355
- }, [draft]);
2356
2363
  const send = () => {
2357
2364
  const text = draft.trim();
2358
2365
  if (!text || disabled) return;
@@ -2381,7 +2388,7 @@ function Chat({
2381
2388
  ] }),
2382
2389
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 overflow-hidden", children: [
2383
2390
  /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: listRef, onScroll, className: "flex h-full flex-col gap-1 overflow-y-auto bg-background px-4 py-3", children: [
2384
- messages.length === 0 && !isTyping ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center text-center text-sm text-foreground-muted", children: emptyState ?? "No messages yet. Say hello \u{1F44B}" }) : messages.map((m, i) => {
2391
+ loading && messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ChatSkeleton, {}) : messages.length === 0 && !isTyping ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center text-center text-sm text-foreground-muted", children: emptyState ?? "No messages yet. Say hello \u{1F44B}" }) : messages.map((m, i) => {
2385
2392
  const own = m.authorId === currentUserId;
2386
2393
  const prev = messages[i - 1];
2387
2394
  const next = messages[i + 1];
@@ -2436,15 +2443,14 @@ function Chat({
2436
2443
  /* @__PURE__ */ jsxRuntime.jsx(
2437
2444
  "textarea",
2438
2445
  {
2439
- ref: taRef,
2440
- rows: 1,
2446
+ rows: 2,
2441
2447
  value: draft,
2442
2448
  disabled,
2443
2449
  placeholder,
2444
2450
  onChange: (e) => setDraft(e.target.value),
2445
2451
  onKeyDown,
2446
2452
  "aria-label": "Message",
2447
- className: `${fieldShell({ size: "md", hasError: false, disabled, sized: false })} max-h-[120px] flex-1 resize-none px-3 py-2 leading-snug`
2453
+ className: `${fieldShell({ size: "md", hasError: false, disabled, sized: false })} h-[4.5rem] flex-1 resize-none px-3 py-2 leading-snug`
2448
2454
  }
2449
2455
  ),
2450
2456
  /* @__PURE__ */ jsxRuntime.jsx(