@alquimia-ai/ui 1.7.1 → 1.8.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.
@@ -59,9 +59,10 @@ interface AssistantInputProps extends React$1.FormHTMLAttributes<HTMLFormElement
59
59
  sendMessageFunc: (event: React$1.FormEvent<HTMLFormElement>) => Promise<void>;
60
60
  isButtonDisabled: boolean;
61
61
  input: string;
62
- handleInputChange: (event: React$1.ChangeEvent<HTMLInputElement>) => void;
62
+ handleInputChange: (event: React$1.ChangeEvent<HTMLTextAreaElement>) => void;
63
63
  isMessageStreaming: boolean;
64
64
  speechToTextComponent?: React$1.ReactNode;
65
+ userToolboxComponent?: React$1.ReactNode;
65
66
  placeholders?: [string, string];
66
67
  }
67
68
  declare const AssistantInput: React$1.ForwardRefExoticComponent<AssistantInputProps & React$1.RefAttributes<HTMLFormElement>>;
@@ -59,9 +59,10 @@ interface AssistantInputProps extends React$1.FormHTMLAttributes<HTMLFormElement
59
59
  sendMessageFunc: (event: React$1.FormEvent<HTMLFormElement>) => Promise<void>;
60
60
  isButtonDisabled: boolean;
61
61
  input: string;
62
- handleInputChange: (event: React$1.ChangeEvent<HTMLInputElement>) => void;
62
+ handleInputChange: (event: React$1.ChangeEvent<HTMLTextAreaElement>) => void;
63
63
  isMessageStreaming: boolean;
64
64
  speechToTextComponent?: React$1.ReactNode;
65
+ userToolboxComponent?: React$1.ReactNode;
65
66
  placeholders?: [string, string];
66
67
  }
67
68
  declare const AssistantInput: React$1.ForwardRefExoticComponent<AssistantInputProps & React$1.RefAttributes<HTMLFormElement>>;
@@ -2822,6 +2822,7 @@ var AssistantInput = React34.forwardRef(
2822
2822
  handleInputChange,
2823
2823
  isMessageStreaming,
2824
2824
  speechToTextComponent,
2825
+ userToolboxComponent,
2825
2826
  placeholders,
2826
2827
  ...props
2827
2828
  }, ref) => {
@@ -2830,40 +2831,48 @@ var AssistantInput = React34.forwardRef(
2830
2831
  "form",
2831
2832
  {
2832
2833
  onSubmit: sendMessageFunc,
2833
- className: cn("flex items-center space-x-4", className),
2834
+ className: cn("flex items-center relative", className),
2834
2835
  ref,
2835
2836
  ...props,
2836
2837
  children: [
2837
2838
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2838
- "input",
2839
+ "textarea",
2839
2840
  {
2840
- type: "text",
2841
2841
  disabled: isButtonDisabled,
2842
2842
  value: input,
2843
2843
  onChange: handleInputChange,
2844
2844
  placeholder,
2845
2845
  className: cn(
2846
- "flex-1 text-sm p-3 rounded-lg focus:outline-none w-full",
2846
+ "flex-1 text-sm p-3 rounded-lg focus:outline-none w-full resize-none",
2847
2847
  "border border-input bg-background text-foreground",
2848
2848
  "placeholder:text-muted-foreground",
2849
2849
  "focus:ring-2 focus:ring-ring",
2850
2850
  "disabled:opacity-50 disabled:cursor-not-allowed"
2851
- )
2852
- }
2853
- ),
2854
- speechToTextComponent && speechToTextComponent,
2855
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2856
- "button",
2857
- {
2858
- type: "submit",
2859
- disabled: isButtonDisabled,
2860
- className: cn(
2861
- "w-10 h-10 rounded-full flex items-center justify-center alq--assistant-button-send",
2862
- isButtonDisabled ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
2863
2851
  ),
2864
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react14.Send, { className: "w-5 h-5" })
2852
+ onKeyDown: (e) => {
2853
+ if (e.key === "Enter" && !e.shiftKey) {
2854
+ e.preventDefault();
2855
+ sendMessageFunc(e);
2856
+ }
2857
+ }
2865
2858
  }
2866
- )
2859
+ ),
2860
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "relative alq--assistant-actions", children: [
2861
+ userToolboxComponent && userToolboxComponent,
2862
+ speechToTextComponent && speechToTextComponent,
2863
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2864
+ "button",
2865
+ {
2866
+ type: "submit",
2867
+ disabled: isButtonDisabled,
2868
+ className: cn(
2869
+ "w-10 h-10 rounded-full flex items-center justify-center alq--assistant-button-send",
2870
+ isButtonDisabled ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
2871
+ ),
2872
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react14.Send, { className: "w-5 h-5" })
2873
+ }
2874
+ )
2875
+ ] })
2867
2876
  ]
2868
2877
  }
2869
2878
  );