@nextclaw/agent-chat-ui 0.1.1 → 0.2.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.d.ts CHANGED
@@ -160,7 +160,7 @@ type ChatMessageTexts = {
160
160
  type ChatMessageListProps = {
161
161
  messages: ChatMessageViewModel[];
162
162
  isSending: boolean;
163
- hasStreamingDraft: boolean;
163
+ hasAssistantDraft: boolean;
164
164
  texts: ChatMessageTexts;
165
165
  className?: string;
166
166
  };
package/dist/index.js CHANGED
@@ -374,8 +374,18 @@ var ChatButton = React5.forwardRef(
374
374
  ChatButton.displayName = "ChatButton";
375
375
 
376
376
  // src/components/chat/ui/chat-input-bar/chat-input-bar-actions.tsx
377
- import { ArrowUp, Square } from "lucide-react";
377
+ import { ArrowUp } from "lucide-react";
378
378
  import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
379
+ function StopIcon() {
380
+ return /* @__PURE__ */ jsx9(
381
+ "span",
382
+ {
383
+ "aria-hidden": "true",
384
+ "data-testid": "chat-stop-icon",
385
+ className: "block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]"
386
+ }
387
+ );
388
+ }
379
389
  function ChatInputBarActions(props) {
380
390
  const { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } = ChatUiPrimitives;
381
391
  return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-end gap-1", children: [
@@ -389,7 +399,7 @@ function ChatInputBarActions(props) {
389
399
  "aria-label": props.stopButtonLabel,
390
400
  onClick: () => void props.onStop(),
391
401
  disabled: props.stopDisabled,
392
- children: /* @__PURE__ */ jsx9(Square, { className: "h-3 w-3 fill-current" })
402
+ children: /* @__PURE__ */ jsx9(StopIcon, {})
393
403
  }
394
404
  ) : /* @__PURE__ */ jsx9(TooltipProvider, { children: /* @__PURE__ */ jsxs4(Tooltip, { children: [
395
405
  /* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx9("span", { children: /* @__PURE__ */ jsx9(
@@ -400,7 +410,7 @@ function ChatInputBarActions(props) {
400
410
  className: "h-8 w-8 rounded-full",
401
411
  "aria-label": props.stopButtonLabel,
402
412
  disabled: true,
403
- children: /* @__PURE__ */ jsx9(Square, { className: "h-3 w-3 fill-current" })
413
+ children: /* @__PURE__ */ jsx9(StopIcon, {})
404
414
  }
405
415
  ) }) }),
406
416
  /* @__PURE__ */ jsx9(TooltipContent, { side: "top", children: /* @__PURE__ */ jsx9("p", { className: "text-xs", children: props.stopHint }) })
@@ -738,12 +748,33 @@ import { Bot, User, Wrench } from "lucide-react";
738
748
  import { jsx as jsx13 } from "react/jsx-runtime";
739
749
  function ChatMessageAvatar({ role }) {
740
750
  if (role === "user") {
741
- return /* @__PURE__ */ jsx13("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-primary text-white shadow-sm", children: /* @__PURE__ */ jsx13(User, { className: "h-4 w-4" }) });
751
+ return /* @__PURE__ */ jsx13(
752
+ "div",
753
+ {
754
+ "data-testid": "chat-message-avatar-user",
755
+ className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-white shadow-sm",
756
+ children: /* @__PURE__ */ jsx13(User, { className: "h-4 w-4" })
757
+ }
758
+ );
742
759
  }
743
- if (role === "assistant") {
744
- return /* @__PURE__ */ jsx13("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-slate-900 text-white shadow-sm", children: /* @__PURE__ */ jsx13(Bot, { className: "h-4 w-4" }) });
760
+ if (role === "tool") {
761
+ return /* @__PURE__ */ jsx13(
762
+ "div",
763
+ {
764
+ "data-testid": "chat-message-avatar-tool",
765
+ className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-700 shadow-sm",
766
+ children: /* @__PURE__ */ jsx13(Wrench, { className: "h-4 w-4" })
767
+ }
768
+ );
745
769
  }
746
- return /* @__PURE__ */ jsx13("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-amber-100 text-amber-700 shadow-sm", children: /* @__PURE__ */ jsx13(Wrench, { className: "h-4 w-4" }) });
770
+ return /* @__PURE__ */ jsx13(
771
+ "div",
772
+ {
773
+ "data-testid": "chat-message-avatar-assistant",
774
+ className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200/80 bg-gray-900 text-white shadow-sm",
775
+ children: /* @__PURE__ */ jsx13(Bot, { className: "h-4 w-4" })
776
+ }
777
+ );
747
778
  }
748
779
 
749
780
  // src/components/chat/ui/chat-message-list/chat-message-markdown.tsx
@@ -990,7 +1021,7 @@ function ChatMessageMarkdown(props) {
990
1021
  // src/components/chat/ui/chat-message-list/chat-reasoning-block.tsx
991
1022
  import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
992
1023
  function ChatReasoningBlock(props) {
993
- return /* @__PURE__ */ jsxs9("details", { className: "mt-3", children: [
1024
+ return /* @__PURE__ */ jsxs9("details", { className: "mt-3", open: true, children: [
994
1025
  /* @__PURE__ */ jsx16("summary", { className: cn("cursor-pointer text-xs", props.isUser ? "text-primary-100" : "text-gray-500"), children: props.label }),
995
1026
  /* @__PURE__ */ jsx16(
996
1027
  "pre",
@@ -1098,11 +1129,20 @@ function ChatMessage(props) {
1098
1129
  // src/components/chat/ui/chat-message-list/chat-message-meta.tsx
1099
1130
  import { jsxs as jsxs12 } from "react/jsx-runtime";
1100
1131
  function ChatMessageMeta(props) {
1101
- return /* @__PURE__ */ jsxs12("div", { className: cn("px-1 text-[11px]", props.isUser ? "text-primary-300" : "text-gray-400"), children: [
1102
- props.roleLabel,
1103
- " \xB7 ",
1104
- props.timestampLabel
1105
- ] });
1132
+ return /* @__PURE__ */ jsxs12(
1133
+ "div",
1134
+ {
1135
+ className: cn(
1136
+ "px-1 text-[11px] leading-4 text-gray-400",
1137
+ props.isUser ? "text-right" : "text-left"
1138
+ ),
1139
+ children: [
1140
+ props.roleLabel,
1141
+ " \xB7 ",
1142
+ props.timestampLabel
1143
+ ]
1144
+ }
1145
+ );
1106
1146
  }
1107
1147
 
1108
1148
  // src/components/chat/ui/chat-message-list/chat-message-list.tsx
@@ -1120,7 +1160,7 @@ function ChatMessageList(props) {
1120
1160
  isUser ? /* @__PURE__ */ jsx20(ChatMessageAvatar, { role: message.role }) : null
1121
1161
  ] }, message.id);
1122
1162
  }),
1123
- props.isSending && !props.hasStreamingDraft ? /* @__PURE__ */ jsxs13("div", { className: "flex justify-start gap-3", children: [
1163
+ props.isSending && !props.hasAssistantDraft ? /* @__PURE__ */ jsxs13("div", { className: "flex justify-start gap-3", children: [
1124
1164
  /* @__PURE__ */ jsx20(ChatMessageAvatar, { role: "assistant" }),
1125
1165
  /* @__PURE__ */ jsx20("div", { className: "rounded-2xl border border-gray-200 bg-white px-4 py-3 text-sm text-gray-500 shadow-sm", children: props.texts.typingLabel })
1126
1166
  ] }) : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/agent-chat-ui",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "description": "Reusable Nextclaw agent chat UI primitives and default skin.",
6
6
  "type": "module",