@geomak/ui 6.29.1 → 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 +23 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -17
- package/dist/index.js.map +1 -1
- package/dist/styles.css +36 -11
- package/package.json +1 -1
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
|
-
|
|
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 })}
|
|
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(
|
|
@@ -5562,9 +5568,10 @@ function Pagination({
|
|
|
5562
5568
|
}, [serverSide, options.perPage, picker]);
|
|
5563
5569
|
const currentOpt = picker.find((o) => o.key === displayPerPageKey);
|
|
5564
5570
|
const currentPerPageLabel = currentOpt?.label ?? currentOpt?.value ?? options.perPage ?? "";
|
|
5565
|
-
const
|
|
5566
|
-
const
|
|
5567
|
-
const
|
|
5571
|
+
const FOCUS = "focus-visible:!ring-0 focus-visible:!border-accent";
|
|
5572
|
+
const navBtn = (icon, disabled, onClick, title) => /* @__PURE__ */ jsxRuntime.jsx(Button_default, { variant: "outline", size: "sm", disabled, onClick, icon, className: `w-7 !px-0 ${FOCUS}`, "aria-label": title, title });
|
|
5573
|
+
const chevronRight = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" }) });
|
|
5574
|
+
const doubleChevronRight = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l6 6-6 6M12 6l6 6-6 6" }) });
|
|
5568
5575
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-x-4 gap-y-3", children: [
|
|
5569
5576
|
options.withPicker && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mr-auto flex items-center gap-2", children: [
|
|
5570
5577
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "whitespace-nowrap text-xs text-foreground-muted", children: "Rows per page" }),
|
|
@@ -5574,7 +5581,7 @@ function Pagination({
|
|
|
5574
5581
|
variant: "outline",
|
|
5575
5582
|
size: "sm",
|
|
5576
5583
|
side: "top",
|
|
5577
|
-
className:
|
|
5584
|
+
className: FOCUS,
|
|
5578
5585
|
label: String(currentPerPageLabel),
|
|
5579
5586
|
items: picker.map((o) => ({
|
|
5580
5587
|
key: o.key,
|
|
@@ -5590,7 +5597,7 @@ function Pagination({
|
|
|
5590
5597
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
5591
5598
|
navBtn(/* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex rotate-180", children: doubleChevronRight }), activePage === 0, () => onPageChange(0), "First page"),
|
|
5592
5599
|
navBtn(/* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex rotate-180", children: chevronRight }), activePage === 0, () => activePage > 0 && onPageChange(activePage - 1), "Previous page"),
|
|
5593
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-2 text-
|
|
5600
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-2 text-xs tabular-nums text-foreground-secondary select-none", children: [
|
|
5594
5601
|
activePage + 1,
|
|
5595
5602
|
" ",
|
|
5596
5603
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-foreground-muted", children: [
|