@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.
@@ -2190,6 +2190,7 @@ RatingComment.displayName = "RatingComment";
2190
2190
 
2191
2191
  // src/components/molecules/call-out.tsx
2192
2192
  import * as React33 from "react";
2193
+ import { ChevronDown as ChevronDown3, ChevronUp as ChevronUp2 } from "lucide-react";
2193
2194
 
2194
2195
  // src/components/hooks/use-text-streaming.ts
2195
2196
  import { useState as useState8, useEffect as useEffect8, useRef, useCallback as useCallback2 } from "react";
@@ -2320,10 +2321,26 @@ var CallOutActions = React33.forwardRef(({ className, actions, role, message, ..
2320
2321
  )) });
2321
2322
  });
2322
2323
  var CallOutResponse = React33.forwardRef(
2323
- ({ className, children, role, additionalInfo, isStreaming, handleIsTextStreaming, ...props }, ref) => {
2324
+ ({
2325
+ className,
2326
+ children,
2327
+ role,
2328
+ additionalInfo,
2329
+ toggleAdditionalInfo,
2330
+ isStreaming,
2331
+ handleIsTextStreaming,
2332
+ ...props
2333
+ }, ref) => {
2334
+ const [isAdditionalInfoOpen, setIsAdditionalInfoOpen] = React33.useState(false);
2324
2335
  const content = String(children || "");
2325
2336
  const shouldStream = role === "assistant" && isStreaming;
2326
- const displayedContent = useTextStreaming(content, shouldStream ?? false, handleIsTextStreaming);
2337
+ const displayedContent = useTextStreaming(
2338
+ content,
2339
+ shouldStream ?? false,
2340
+ handleIsTextStreaming
2341
+ );
2342
+ const showAsToggle = additionalInfo && toggleAdditionalInfo;
2343
+ const showInline = additionalInfo && !toggleAdditionalInfo;
2327
2344
  return /* @__PURE__ */ jsxs18(
2328
2345
  "div",
2329
2346
  {
@@ -2338,16 +2355,52 @@ var CallOutResponse = React33.forwardRef(
2338
2355
  ...props,
2339
2356
  children: [
2340
2357
  /* @__PURE__ */ jsx40(RichText, { content: displayedContent }),
2341
- additionalInfo && /* @__PURE__ */ jsx40(
2358
+ showInline && /* @__PURE__ */ jsx40(
2342
2359
  "div",
2343
2360
  {
2344
2361
  className: cn(
2345
2362
  "alq--callout-response-additional-info",
2346
- "mt-2 text-sm text-muted-foreground",
2363
+ "mt-2 text-sm text-muted-foreground whitespace-pre-line",
2347
2364
  "border-t border-border pt-2"
2348
2365
  ),
2349
2366
  children: additionalInfo
2350
2367
  }
2368
+ ),
2369
+ showAsToggle && /* @__PURE__ */ jsxs18(
2370
+ "div",
2371
+ {
2372
+ className: cn(
2373
+ "alq--callout-response-additional-info",
2374
+ "mt-2 border-t border-border pt-2"
2375
+ ),
2376
+ children: [
2377
+ /* @__PURE__ */ jsxs18(
2378
+ Button,
2379
+ {
2380
+ type: "button",
2381
+ variant: "ghost",
2382
+ size: "sm",
2383
+ className: "h-auto py-1.5 px-0 text-xs text-muted-foreground hover:bg-transparent hover:text-muted-foreground -ml-1",
2384
+ onClick: () => setIsAdditionalInfoOpen((prev) => !prev),
2385
+ "aria-expanded": isAdditionalInfoOpen,
2386
+ children: [
2387
+ isAdditionalInfoOpen ? /* @__PURE__ */ jsx40(ChevronUp2, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }) : /* @__PURE__ */ jsx40(ChevronDown3, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }),
2388
+ isAdditionalInfoOpen ? "Hide details" : "Show details"
2389
+ ]
2390
+ }
2391
+ ),
2392
+ /* @__PURE__ */ jsx40(
2393
+ "div",
2394
+ {
2395
+ className: cn(
2396
+ "grid transition-[grid-template-rows] duration-200 ease-out",
2397
+ isAdditionalInfoOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
2398
+ ),
2399
+ children: /* @__PURE__ */ jsx40("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx40("div", { className: "text-sm text-muted-foreground pt-1 whitespace-pre-line", children: additionalInfo }) })
2400
+ }
2401
+ )
2402
+ ]
2403
+ }
2351
2404
  )
2352
2405
  ]
2353
2406
  }