@copilotz/chat-ui 0.9.7 → 0.9.8

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.cjs CHANGED
@@ -3363,7 +3363,8 @@ var TargetAgentSelector = (0, import_react5.memo)(({
3363
3363
  onTargetChange,
3364
3364
  label = "Target",
3365
3365
  placeholder = "Select agent",
3366
- disabled = false
3366
+ disabled = false,
3367
+ compact = false
3367
3368
  }) => {
3368
3369
  const agentsWithColors = (0, import_react5.useMemo)(() => assignAgentColors(agents), [agents]);
3369
3370
  const selectedAgent = (0, import_react5.useMemo)(
@@ -3375,7 +3376,7 @@ var TargetAgentSelector = (0, import_react5.memo)(({
3375
3376
  Button,
3376
3377
  {
3377
3378
  variant: "ghost",
3378
- className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
3379
+ className: `gap-1.5 font-medium hover:bg-accent/50 ${compact ? "h-9 rounded-full px-2 text-sm text-muted-foreground hover:text-foreground" : "h-9 px-3 text-base"}`,
3379
3380
  disabled,
3380
3381
  children: [
3381
3382
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react9.AtSign, { className: "h-4 w-4 text-muted-foreground" }),
@@ -4538,6 +4539,9 @@ var ChatInput = (0, import_react8.memo)(function ChatInput2({
4538
4539
  className = "",
4539
4540
  config,
4540
4541
  mentionAgents = [],
4542
+ targetAgentId = null,
4543
+ showTargetAgentSelector = false,
4544
+ targetAgentSelectorPlaceholder,
4541
4545
  onTargetAgentChange
4542
4546
  }) {
4543
4547
  const voiceDefaultMode = config?.voiceCompose?.defaultMode ?? "text";
@@ -5068,7 +5072,7 @@ var ChatInput = (0, import_react8.memo)(function ChatInput2({
5068
5072
  };
5069
5073
  const canAddMoreAttachments = attachments.length < maxAttachments;
5070
5074
  const showVoiceComposer = enableAudioRecording && isVoiceComposerOpen;
5071
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `border-t bg-background/95 py-2 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mx-auto w-full max-w-3xl space-y-3 px-3 md:px-2", children: [
5075
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `bg-transparent py-0 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mx-auto w-full max-w-3xl space-y-3 px-3 md:px-2", children: [
5072
5076
  uploadProgress.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5073
5077
  FileUploadItem,
5074
5078
  {
@@ -5183,38 +5187,51 @@ var ChatInput = (0, import_react8.memo)(function ChatInput2({
5183
5187
  )) }) })
5184
5188
  ] }),
5185
5189
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex min-h-10 items-center justify-between gap-2", children: [
5186
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex min-w-0 items-center gap-1", children: enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5187
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5188
- "input",
5189
- {
5190
- ref: fileInputRef,
5191
- type: "file",
5192
- multiple: true,
5193
- accept: acceptedFileTypes.length > 0 ? acceptedFileTypes.join(",") : void 0,
5194
- onChange: handleFileSelect,
5195
- className: "hidden"
5196
- }
5197
- ),
5198
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
5199
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5200
- Button,
5190
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex min-w-0 items-center gap-1", children: [
5191
+ enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5192
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5193
+ "input",
5201
5194
  {
5202
- type: "button",
5203
- variant: "ghost",
5204
- size: "icon",
5205
- className: "h-9 w-9 rounded-full text-muted-foreground hover:text-foreground",
5206
- onClick: (e) => {
5207
- e.preventDefault();
5208
- e.stopPropagation();
5209
- fileInputRef.current?.click();
5210
- },
5211
- disabled,
5212
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Paperclip, { className: "h-4 w-4" })
5195
+ ref: fileInputRef,
5196
+ type: "file",
5197
+ multiple: true,
5198
+ accept: acceptedFileTypes.length > 0 ? acceptedFileTypes.join(",") : void 0,
5199
+ onChange: handleFileSelect,
5200
+ className: "hidden"
5213
5201
  }
5214
- ) }),
5215
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipContent, { children: config?.labels?.attachFileTooltip })
5216
- ] })
5217
- ] }) }),
5202
+ ),
5203
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
5204
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5205
+ Button,
5206
+ {
5207
+ type: "button",
5208
+ variant: "ghost",
5209
+ size: "icon",
5210
+ className: "h-9 w-9 rounded-full text-muted-foreground hover:text-foreground",
5211
+ onClick: (e) => {
5212
+ e.preventDefault();
5213
+ e.stopPropagation();
5214
+ fileInputRef.current?.click();
5215
+ },
5216
+ disabled,
5217
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Paperclip, { className: "h-4 w-4" })
5218
+ }
5219
+ ) }),
5220
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipContent, { children: config?.labels?.attachFileTooltip })
5221
+ ] })
5222
+ ] }),
5223
+ showTargetAgentSelector && onTargetAgentChange && mentionAgents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5224
+ TargetAgentSelector,
5225
+ {
5226
+ agents: mentionAgents,
5227
+ targetAgentId,
5228
+ onTargetChange: onTargetAgentChange,
5229
+ placeholder: targetAgentSelectorPlaceholder || "Select agent",
5230
+ disabled: disabled || isGenerating,
5231
+ compact: true
5232
+ }
5233
+ )
5234
+ ] }),
5218
5235
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex shrink-0 items-center gap-1", children: [
5219
5236
  enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
5220
5237
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -6476,50 +6493,41 @@ var ChatUI = ({
6476
6493
  ] })
6477
6494
  }
6478
6495
  ),
6479
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
6480
- isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-4 pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6481
- TargetAgentSelector,
6482
- {
6483
- agents: participantIds && participantIds.length > 0 ? agentOptions.filter(
6484
- (a) => participantIds.includes(a.id)
6485
- ) : agentOptions,
6486
- targetAgentId,
6487
- onTargetChange: onTargetAgentChange,
6488
- placeholder: config.agentSelector?.label || "Select agent",
6489
- disabled: isGenerating
6490
- }
6491
- ) }),
6492
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6493
- ChatInput,
6494
- {
6495
- value: inputValue,
6496
- onChange: (value) => {
6497
- setInputValue(value);
6498
- if (initialInputApplied.current && !initialInputConsumedRef.current) {
6499
- initialInputConsumedRef.current = true;
6500
- onInitialInputConsumed?.();
6501
- }
6502
- },
6503
- onSubmit: handleSendMessage,
6504
- attachments,
6505
- onAttachmentsChange: setAttachments,
6506
- placeholder: config.labels.inputPlaceholder,
6507
- disabled: false,
6508
- isGenerating,
6509
- onStopGeneration: callbacks.onStopGeneration,
6510
- enableFileUpload: config.features.enableFileUpload,
6511
- enableAudioRecording: config.features.enableAudioRecording,
6512
- maxAttachments: config.features.maxAttachments,
6513
- maxFileSize: config.features.maxFileSize,
6514
- acceptedFileTypes: config.features.acceptedFileTypes,
6515
- config,
6516
- mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter(
6517
- (a) => participantIds.includes(a.id)
6518
- ) : agentOptions,
6519
- onTargetAgentChange
6520
- }
6521
- )
6522
- ] })
6496
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "-mt-8 bg-gradient-to-t from-background via-background/95 to-transparent px-0 pb-[env(safe-area-inset-bottom)] pt-10", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6497
+ ChatInput,
6498
+ {
6499
+ value: inputValue,
6500
+ onChange: (value) => {
6501
+ setInputValue(value);
6502
+ if (initialInputApplied.current && !initialInputConsumedRef.current) {
6503
+ initialInputConsumedRef.current = true;
6504
+ onInitialInputConsumed?.();
6505
+ }
6506
+ },
6507
+ onSubmit: handleSendMessage,
6508
+ attachments,
6509
+ onAttachmentsChange: setAttachments,
6510
+ placeholder: config.labels.inputPlaceholder,
6511
+ disabled: false,
6512
+ isGenerating,
6513
+ onStopGeneration: callbacks.onStopGeneration,
6514
+ enableFileUpload: config.features.enableFileUpload,
6515
+ enableAudioRecording: config.features.enableAudioRecording,
6516
+ maxAttachments: config.features.maxAttachments,
6517
+ maxFileSize: config.features.maxFileSize,
6518
+ acceptedFileTypes: config.features.acceptedFileTypes,
6519
+ config,
6520
+ mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter(
6521
+ (a) => participantIds.includes(a.id)
6522
+ ) : agentOptions,
6523
+ targetAgentId,
6524
+ showTargetAgentSelector: Boolean(
6525
+ isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange
6526
+ ),
6527
+ targetAgentSelectorPlaceholder: config.agentSelector?.label || "Select agent",
6528
+ onTargetAgentChange
6529
+ }
6530
+ ) })
6523
6531
  ] }),
6524
6532
  config?.customComponent?.component && !isMobile && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6525
6533
  "div",