@lukeashford/aurelius 3.8.1 → 3.9.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.
package/dist/index.mjs CHANGED
@@ -4646,6 +4646,7 @@ var ChatInput = React59.forwardRef(
4646
4646
  onStop,
4647
4647
  attachments: controlledAttachments,
4648
4648
  onAttachmentsChange,
4649
+ onAttachmentRemove,
4649
4650
  showAttachmentButton = true,
4650
4651
  acceptedFileTypes,
4651
4652
  notice,
@@ -4732,15 +4733,19 @@ var ChatInput = React59.forwardRef(
4732
4733
  );
4733
4734
  const handleRemoveAttachment = useCallback13(
4734
4735
  (id) => {
4736
+ const attachment = attachments.find((a) => a.id === id);
4737
+ if (attachment && onAttachmentRemove) {
4738
+ onAttachmentRemove(attachment);
4739
+ }
4735
4740
  setAttachments((prev) => {
4736
- const attachment = prev.find((a) => a.id === id);
4737
- if (attachment?.previewUrl) {
4738
- URL.revokeObjectURL(attachment.previewUrl);
4741
+ const attachmentToRemove = prev.find((a) => a.id === id);
4742
+ if (attachmentToRemove?.previewUrl) {
4743
+ URL.revokeObjectURL(attachmentToRemove.previewUrl);
4739
4744
  }
4740
4745
  return prev.filter((a) => a.id !== id);
4741
4746
  });
4742
4747
  },
4743
- [setAttachments]
4748
+ [attachments, onAttachmentRemove, setAttachments]
4744
4749
  );
4745
4750
  const handleDragEnter = useCallback13((e) => {
4746
4751
  e.preventDefault();
@@ -4772,7 +4777,8 @@ var ChatInput = React59.forwardRef(
4772
4777
  );
4773
4778
  const isCentered = position === "centered";
4774
4779
  const hasAttachments = attachments.length > 0;
4775
- const canSubmit = value.trim() && !disabled && !isStreaming;
4780
+ const isUploading = attachments.some((a) => a.status === "uploading");
4781
+ const canSubmit = value.trim() && !disabled && !isStreaming && !isUploading;
4776
4782
  return /* @__PURE__ */ React59.createElement(
4777
4783
  "div",
4778
4784
  {
@@ -6686,6 +6692,7 @@ var ChatInterface = React74.forwardRef(
6686
6692
  enableMessageActions = true,
6687
6693
  attachments: propsAttachments,
6688
6694
  onAttachmentsChange,
6695
+ onAttachmentRemove,
6689
6696
  artifactNodes,
6690
6697
  isArtifactsPanelOpen,
6691
6698
  onArtifactsPanelOpenChange,
@@ -6995,6 +7002,7 @@ var ChatInterface = React74.forwardRef(
6995
7002
  showAttachmentButton,
6996
7003
  attachments: propsAttachments,
6997
7004
  onAttachmentsChange,
7005
+ onAttachmentRemove,
6998
7006
  notice: inputNotice,
6999
7007
  onInputChange,
7000
7008
  initialInputValue,