@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.
package/dist/index.js CHANGED
@@ -2906,6 +2906,7 @@ RatingComment.displayName = "RatingComment";
2906
2906
 
2907
2907
  // src/components/molecules/call-out.tsx
2908
2908
  var React33 = __toESM(require("react"));
2909
+ var import_lucide_react14 = require("lucide-react");
2909
2910
 
2910
2911
  // src/components/hooks/use-text-streaming.ts
2911
2912
  var import_react11 = require("react");
@@ -3036,10 +3037,26 @@ var CallOutActions = React33.forwardRef(({ className, actions, role, message, ..
3036
3037
  )) });
3037
3038
  });
3038
3039
  var CallOutResponse = React33.forwardRef(
3039
- ({ className, children, role, additionalInfo, isStreaming, handleIsTextStreaming, ...props }, ref) => {
3040
+ ({
3041
+ className,
3042
+ children,
3043
+ role,
3044
+ additionalInfo,
3045
+ toggleAdditionalInfo,
3046
+ isStreaming,
3047
+ handleIsTextStreaming,
3048
+ ...props
3049
+ }, ref) => {
3050
+ const [isAdditionalInfoOpen, setIsAdditionalInfoOpen] = React33.useState(false);
3040
3051
  const content = String(children || "");
3041
3052
  const shouldStream = role === "assistant" && isStreaming;
3042
- const displayedContent = useTextStreaming(content, shouldStream ?? false, handleIsTextStreaming);
3053
+ const displayedContent = useTextStreaming(
3054
+ content,
3055
+ shouldStream ?? false,
3056
+ handleIsTextStreaming
3057
+ );
3058
+ const showAsToggle = additionalInfo && toggleAdditionalInfo;
3059
+ const showInline = additionalInfo && !toggleAdditionalInfo;
3043
3060
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
3044
3061
  "div",
3045
3062
  {
@@ -3054,16 +3071,52 @@ var CallOutResponse = React33.forwardRef(
3054
3071
  ...props,
3055
3072
  children: [
3056
3073
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RichText, { content: displayedContent }),
3057
- additionalInfo && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3074
+ showInline && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3058
3075
  "div",
3059
3076
  {
3060
3077
  className: cn(
3061
3078
  "alq--callout-response-additional-info",
3062
- "mt-2 text-sm text-muted-foreground",
3079
+ "mt-2 text-sm text-muted-foreground whitespace-pre-line",
3063
3080
  "border-t border-border pt-2"
3064
3081
  ),
3065
3082
  children: additionalInfo
3066
3083
  }
3084
+ ),
3085
+ showAsToggle && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
3086
+ "div",
3087
+ {
3088
+ className: cn(
3089
+ "alq--callout-response-additional-info",
3090
+ "mt-2 border-t border-border pt-2"
3091
+ ),
3092
+ children: [
3093
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
3094
+ Button,
3095
+ {
3096
+ type: "button",
3097
+ variant: "ghost",
3098
+ size: "sm",
3099
+ className: "h-auto py-1.5 px-0 text-xs text-muted-foreground hover:bg-transparent hover:text-muted-foreground -ml-1",
3100
+ onClick: () => setIsAdditionalInfoOpen((prev) => !prev),
3101
+ "aria-expanded": isAdditionalInfoOpen,
3102
+ children: [
3103
+ isAdditionalInfoOpen ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.ChevronUp, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react14.ChevronDown, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }),
3104
+ isAdditionalInfoOpen ? "Hide details" : "Show details"
3105
+ ]
3106
+ }
3107
+ ),
3108
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3109
+ "div",
3110
+ {
3111
+ className: cn(
3112
+ "grid transition-[grid-template-rows] duration-200 ease-out",
3113
+ isAdditionalInfoOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
3114
+ ),
3115
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "text-sm text-muted-foreground pt-1 whitespace-pre-line", children: additionalInfo }) })
3116
+ }
3117
+ )
3118
+ ]
3119
+ }
3067
3120
  )
3068
3121
  ]
3069
3122
  }
@@ -3076,7 +3129,7 @@ CallOutActions.displayName = "CallOutActions";
3076
3129
  CallOutResponse.displayName = "CallOutResponse";
3077
3130
 
3078
3131
  // src/components/organisms/assistant.tsx
3079
- var import_lucide_react14 = require("lucide-react");
3132
+ var import_lucide_react15 = require("lucide-react");
3080
3133
  var import_jsx_runtime48 = require("react/jsx-runtime");
3081
3134
  var Assistant = React34.forwardRef(
3082
3135
  ({ className, sdk, title, description, children, ...props }, ref) => {
@@ -3152,7 +3205,9 @@ var AssistantMessageArea = React34.forwardRef(
3152
3205
  {
3153
3206
  role: "assistant",
3154
3207
  "data-error-code": message.error_code,
3155
- additionalInfo: showDetailedErrors ? message.error_detail : void 0,
3208
+ additionalInfo: showDetailedErrors ? `${message.error_detail}
3209
+ stream id: ${message.stream_id}` : void 0,
3210
+ toggleAdditionalInfo: true,
3156
3211
  children: getErrorMessage(message.error_code)
3157
3212
  }
3158
3213
  ),
@@ -3260,7 +3315,7 @@ var AssistantInput = React34.forwardRef(
3260
3315
  "w-10 h-10 rounded-full flex items-center justify-center alq--assistant-button-send",
3261
3316
  isButtonDisabled ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
3262
3317
  ),
3263
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react14.Send, { className: "w-5 h-5" })
3318
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react15.Send, { className: "w-5 h-5" })
3264
3319
  }
3265
3320
  )
3266
3321
  ] })