@alquimia-ai/ui 1.8.2 → 1.8.4

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.
@@ -139,6 +139,7 @@ declare const CallOutActions: React$1.ForwardRefExoticComponent<React$1.HTMLAttr
139
139
  declare const CallOutResponse: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & {
140
140
  role: Message["role"];
141
141
  additionalInfo?: string;
142
+ toggleAdditionalInfo?: boolean;
142
143
  isStreaming?: boolean;
143
144
  handleIsTextStreaming?: (isStreaming: boolean) => void;
144
145
  } & React$1.RefAttributes<HTMLDivElement>>;
@@ -139,6 +139,7 @@ declare const CallOutActions: React$1.ForwardRefExoticComponent<React$1.HTMLAttr
139
139
  declare const CallOutResponse: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & {
140
140
  role: Message["role"];
141
141
  additionalInfo?: string;
142
+ toggleAdditionalInfo?: boolean;
142
143
  isStreaming?: boolean;
143
144
  handleIsTextStreaming?: (isStreaming: boolean) => void;
144
145
  } & React$1.RefAttributes<HTMLDivElement>>;
@@ -2265,6 +2265,7 @@ RatingComment.displayName = "RatingComment";
2265
2265
 
2266
2266
  // src/components/molecules/call-out.tsx
2267
2267
  var React33 = __toESM(require("react"));
2268
+ var import_lucide_react13 = require("lucide-react");
2268
2269
 
2269
2270
  // src/components/hooks/use-text-streaming.ts
2270
2271
  var import_react6 = require("react");
@@ -2395,10 +2396,26 @@ var CallOutActions = React33.forwardRef(({ className, actions, role, message, ..
2395
2396
  )) });
2396
2397
  });
2397
2398
  var CallOutResponse = React33.forwardRef(
2398
- ({ className, children, role, additionalInfo, isStreaming, handleIsTextStreaming, ...props }, ref) => {
2399
+ ({
2400
+ className,
2401
+ children,
2402
+ role,
2403
+ additionalInfo,
2404
+ toggleAdditionalInfo,
2405
+ isStreaming,
2406
+ handleIsTextStreaming,
2407
+ ...props
2408
+ }, ref) => {
2409
+ const [isAdditionalInfoOpen, setIsAdditionalInfoOpen] = React33.useState(false);
2399
2410
  const content = String(children || "");
2400
2411
  const shouldStream = role === "assistant" && isStreaming;
2401
- const displayedContent = useTextStreaming(content, shouldStream ?? false, handleIsTextStreaming);
2412
+ const displayedContent = useTextStreaming(
2413
+ content,
2414
+ shouldStream ?? false,
2415
+ handleIsTextStreaming
2416
+ );
2417
+ const showAsToggle = additionalInfo && toggleAdditionalInfo;
2418
+ const showInline = additionalInfo && !toggleAdditionalInfo;
2402
2419
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
2403
2420
  "div",
2404
2421
  {
@@ -2413,16 +2430,52 @@ var CallOutResponse = React33.forwardRef(
2413
2430
  ...props,
2414
2431
  children: [
2415
2432
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RichText, { content: displayedContent }),
2416
- additionalInfo && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2433
+ showInline && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2417
2434
  "div",
2418
2435
  {
2419
2436
  className: cn(
2420
2437
  "alq--callout-response-additional-info",
2421
- "mt-2 text-sm text-muted-foreground",
2438
+ "mt-2 text-sm text-muted-foreground whitespace-pre-line",
2422
2439
  "border-t border-border pt-2"
2423
2440
  ),
2424
2441
  children: additionalInfo
2425
2442
  }
2443
+ ),
2444
+ showAsToggle && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
2445
+ "div",
2446
+ {
2447
+ className: cn(
2448
+ "alq--callout-response-additional-info",
2449
+ "mt-2 border-t border-border pt-2"
2450
+ ),
2451
+ children: [
2452
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
2453
+ Button,
2454
+ {
2455
+ type: "button",
2456
+ variant: "ghost",
2457
+ size: "sm",
2458
+ className: "h-auto py-1.5 px-0 text-xs text-muted-foreground hover:bg-transparent hover:text-muted-foreground -ml-1",
2459
+ onClick: () => setIsAdditionalInfoOpen((prev) => !prev),
2460
+ "aria-expanded": isAdditionalInfoOpen,
2461
+ children: [
2462
+ isAdditionalInfoOpen ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react13.ChevronUp, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react13.ChevronDown, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }),
2463
+ isAdditionalInfoOpen ? "Hide details" : "Show details"
2464
+ ]
2465
+ }
2466
+ ),
2467
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2468
+ "div",
2469
+ {
2470
+ className: cn(
2471
+ "grid transition-[grid-template-rows] duration-200 ease-out",
2472
+ isAdditionalInfoOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
2473
+ ),
2474
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-sm text-muted-foreground pt-1 whitespace-pre-line", children: additionalInfo }) })
2475
+ }
2476
+ )
2477
+ ]
2478
+ }
2426
2479
  )
2427
2480
  ]
2428
2481
  }