@mieweb/ui 0.9.0-dev.0 → 0.9.0-dev.1
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/{chunk-WIAQQNFU.cjs → chunk-2A2FLQJC.cjs} +1138 -12
- package/dist/chunk-2A2FLQJC.cjs.map +1 -0
- package/dist/{chunk-5BVFVXHN.cjs → chunk-5VXRKOPR.cjs} +16 -525
- package/dist/chunk-5VXRKOPR.cjs.map +1 -0
- package/dist/{chunk-O6GJ4IYS.js → chunk-IF3X2WZP.js} +16 -521
- package/dist/chunk-IF3X2WZP.js.map +1 -0
- package/dist/{chunk-22CYDCXA.js → chunk-KATEJG2F.js} +1137 -13
- package/dist/chunk-KATEJG2F.js.map +1 -0
- package/dist/{chunk-FQBTGS3E.cjs → chunk-O425FKDI.cjs} +563 -55
- package/dist/chunk-O425FKDI.cjs.map +1 -0
- package/dist/{chunk-MXQ7J4BB.js → chunk-RPG2ZP2T.js} +557 -53
- package/dist/chunk-RPG2ZP2T.js.map +1 -0
- package/dist/components/SuperChat/index.cjs +36 -17
- package/dist/components/SuperChat/index.cjs.map +1 -1
- package/dist/components/SuperChat/index.d.cts +16 -3
- package/dist/components/SuperChat/index.d.ts +16 -3
- package/dist/components/SuperChat/index.js +31 -12
- package/dist/components/SuperChat/index.js.map +1 -1
- package/dist/components/SuperChat/plugins/index.cjs +3 -3
- package/dist/components/SuperChat/plugins/index.js +2 -2
- package/dist/index.cjs +820 -1930
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +663 -1780
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-22CYDCXA.js.map +0 -1
- package/dist/chunk-5BVFVXHN.cjs.map +0 -1
- package/dist/chunk-FQBTGS3E.cjs.map +0 -1
- package/dist/chunk-MXQ7J4BB.js.map +0 -1
- package/dist/chunk-O6GJ4IYS.js.map +0 -1
- package/dist/chunk-WIAQQNFU.cjs.map +0 -1
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
|
|
4
4
|
var chunkAOHJILLU_cjs = require('./chunk-AOHJILLU.cjs');
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var classVarianceAuthority = require('class-variance-authority');
|
|
8
7
|
var reactDom = require('react-dom');
|
|
9
8
|
|
|
10
9
|
function _interopNamespace(e) {
|
|
@@ -25,7 +24,7 @@ function _interopNamespace(e) {
|
|
|
25
24
|
return Object.freeze(n);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
var
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
28
|
|
|
30
29
|
function getFileType(mimeType) {
|
|
31
30
|
if (mimeType.startsWith("image/")) return "image";
|
|
@@ -271,7 +270,7 @@ function AttachmentPreviewItem({
|
|
|
271
270
|
);
|
|
272
271
|
}
|
|
273
272
|
AttachmentPreviewItem.displayName = "AttachmentPreviewItem";
|
|
274
|
-
var AttachmentPicker =
|
|
273
|
+
var AttachmentPicker = React__namespace.forwardRef(
|
|
275
274
|
({
|
|
276
275
|
onFilesSelected,
|
|
277
276
|
acceptedTypes = ["image/*", "video/*", ".pdf", ".doc", ".docx"],
|
|
@@ -284,8 +283,8 @@ var AttachmentPicker = React3__namespace.forwardRef(
|
|
|
284
283
|
className,
|
|
285
284
|
children
|
|
286
285
|
}, ref) => {
|
|
287
|
-
const inputRef =
|
|
288
|
-
|
|
286
|
+
const inputRef = React__namespace.useRef(null);
|
|
287
|
+
React__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
289
288
|
const handleClick = () => {
|
|
290
289
|
inputRef.current?.click();
|
|
291
290
|
};
|
|
@@ -378,8 +377,8 @@ function DragDropZone({
|
|
|
378
377
|
children,
|
|
379
378
|
className
|
|
380
379
|
}) {
|
|
381
|
-
const [isDragging, setIsDragging] =
|
|
382
|
-
const dragCounterRef =
|
|
380
|
+
const [isDragging, setIsDragging] = React__namespace.useState(false);
|
|
381
|
+
const dragCounterRef = React__namespace.useRef(0);
|
|
383
382
|
const handleDragEnter = (event) => {
|
|
384
383
|
event.preventDefault();
|
|
385
384
|
event.stopPropagation();
|
|
@@ -481,7 +480,7 @@ function CameraButton({
|
|
|
481
480
|
disabled = false,
|
|
482
481
|
className
|
|
483
482
|
}) {
|
|
484
|
-
const inputRef =
|
|
483
|
+
const inputRef = React__namespace.useRef(null);
|
|
485
484
|
const handleClick = () => {
|
|
486
485
|
inputRef.current?.click();
|
|
487
486
|
};
|
|
@@ -573,14 +572,14 @@ function useMentionAutocomplete({
|
|
|
573
572
|
textareaRef
|
|
574
573
|
}) {
|
|
575
574
|
const enabled = !!options && options.length > 0;
|
|
576
|
-
const [mention, setMention] =
|
|
577
|
-
const [highlight, setHighlight] =
|
|
578
|
-
const listId =
|
|
579
|
-
const optionId =
|
|
575
|
+
const [mention, setMention] = React__namespace.useState(null);
|
|
576
|
+
const [highlight, setHighlight] = React__namespace.useState(0);
|
|
577
|
+
const listId = React__namespace.useId();
|
|
578
|
+
const optionId = React__namespace.useCallback(
|
|
580
579
|
(index) => `${listId}-option-${index}`,
|
|
581
580
|
[listId]
|
|
582
581
|
);
|
|
583
|
-
const suggestions =
|
|
582
|
+
const suggestions = React__namespace.useMemo(() => {
|
|
584
583
|
if (!mention || !options) return [];
|
|
585
584
|
const q = mention.query.toLowerCase();
|
|
586
585
|
return options.filter((o) => o.label.toLowerCase().includes(q));
|
|
@@ -597,7 +596,7 @@ function useMentionAutocomplete({
|
|
|
597
596
|
});
|
|
598
597
|
const clampedHighlight = menuOpen ? Math.min(highlight, suggestions.length - 1) : -1;
|
|
599
598
|
const activeOptionId = menuOpen ? optionId(clampedHighlight) : void 0;
|
|
600
|
-
const sync =
|
|
599
|
+
const sync = React__namespace.useCallback(
|
|
601
600
|
(nextValue, caret) => {
|
|
602
601
|
if (!enabled) return;
|
|
603
602
|
setMention(activeMentionQuery(nextValue, caret));
|
|
@@ -722,523 +721,15 @@ function MentionMenu({
|
|
|
722
721
|
);
|
|
723
722
|
}
|
|
724
723
|
MentionMenu.displayName = "MentionMenu";
|
|
725
|
-
function isFileAccepted(file, accepted) {
|
|
726
|
-
if (!accepted || accepted.length === 0) return true;
|
|
727
|
-
const mime = file.type;
|
|
728
|
-
const name = file.name.toLowerCase();
|
|
729
|
-
return accepted.some((token) => {
|
|
730
|
-
if (token.startsWith(".")) return name.endsWith(token.toLowerCase());
|
|
731
|
-
if (token.endsWith("/*")) return mime.startsWith(token.slice(0, -1));
|
|
732
|
-
if (token.includes("/")) return mime === token;
|
|
733
|
-
return false;
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
function CharacterCounter({
|
|
737
|
-
current,
|
|
738
|
-
max,
|
|
739
|
-
showWarningAt = 0.9,
|
|
740
|
-
className
|
|
741
|
-
}) {
|
|
742
|
-
const percentage = current / max;
|
|
743
|
-
const isWarning = percentage >= showWarningAt && percentage < 1;
|
|
744
|
-
const isOver = current > max;
|
|
745
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
746
|
-
"span",
|
|
747
|
-
{
|
|
748
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
749
|
-
"text-xs tabular-nums",
|
|
750
|
-
isOver ? "font-medium text-red-700 dark:text-red-400" : isWarning ? "text-amber-700 dark:text-amber-400" : "text-neutral-600 dark:text-neutral-400",
|
|
751
|
-
className
|
|
752
|
-
),
|
|
753
|
-
"aria-live": "polite",
|
|
754
|
-
"aria-label": `${current} of ${max} characters`,
|
|
755
|
-
children: [
|
|
756
|
-
current,
|
|
757
|
-
"/",
|
|
758
|
-
max
|
|
759
|
-
]
|
|
760
|
-
}
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
CharacterCounter.displayName = "CharacterCounter";
|
|
764
|
-
var sendButtonVariants = classVarianceAuthority.cva(
|
|
765
|
-
[
|
|
766
|
-
"inline-flex items-center justify-center",
|
|
767
|
-
"rounded-full p-3 self-start",
|
|
768
|
-
"transition-all duration-200",
|
|
769
|
-
"focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
770
|
-
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
771
|
-
],
|
|
772
|
-
{
|
|
773
|
-
variants: {
|
|
774
|
-
variant: {
|
|
775
|
-
primary: [
|
|
776
|
-
"bg-primary-800 text-white",
|
|
777
|
-
"hover:bg-primary-900",
|
|
778
|
-
"active:scale-95"
|
|
779
|
-
],
|
|
780
|
-
subtle: [
|
|
781
|
-
"bg-transparent text-primary-800",
|
|
782
|
-
"hover:bg-primary-50 dark:hover:bg-primary-900/20"
|
|
783
|
-
]
|
|
784
|
-
},
|
|
785
|
-
canSend: {
|
|
786
|
-
true: "",
|
|
787
|
-
false: "opacity-50 cursor-not-allowed"
|
|
788
|
-
}
|
|
789
|
-
},
|
|
790
|
-
defaultVariants: {
|
|
791
|
-
variant: "primary",
|
|
792
|
-
canSend: false
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
);
|
|
796
|
-
var SendButton = React3__namespace.forwardRef(
|
|
797
|
-
({ className, variant, canSend, isLoading, disabled, ...props }, ref) => {
|
|
798
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
799
|
-
"button",
|
|
800
|
-
{
|
|
801
|
-
ref,
|
|
802
|
-
type: "submit",
|
|
803
|
-
disabled: disabled || !canSend || isLoading,
|
|
804
|
-
"data-slot": "composer-send-button",
|
|
805
|
-
className: chunkS5RVSXDV_cjs.cn(sendButtonVariants({ variant, canSend }), className),
|
|
806
|
-
"aria-label": isLoading ? "Sending message" : "Send message",
|
|
807
|
-
...props,
|
|
808
|
-
children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
809
|
-
"svg",
|
|
810
|
-
{
|
|
811
|
-
"aria-hidden": "true",
|
|
812
|
-
className: "h-5 w-5 animate-spin",
|
|
813
|
-
fill: "none",
|
|
814
|
-
viewBox: "0 0 24 24",
|
|
815
|
-
children: [
|
|
816
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
817
|
-
"circle",
|
|
818
|
-
{
|
|
819
|
-
className: "opacity-25",
|
|
820
|
-
cx: "12",
|
|
821
|
-
cy: "12",
|
|
822
|
-
r: "10",
|
|
823
|
-
stroke: "currentColor",
|
|
824
|
-
strokeWidth: "4"
|
|
825
|
-
}
|
|
826
|
-
),
|
|
827
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
828
|
-
"path",
|
|
829
|
-
{
|
|
830
|
-
className: "opacity-75",
|
|
831
|
-
fill: "currentColor",
|
|
832
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
833
|
-
}
|
|
834
|
-
)
|
|
835
|
-
]
|
|
836
|
-
}
|
|
837
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
838
|
-
"svg",
|
|
839
|
-
{
|
|
840
|
-
"aria-hidden": "true",
|
|
841
|
-
className: "h-5 w-5",
|
|
842
|
-
fill: "none",
|
|
843
|
-
viewBox: "0 0 24 24",
|
|
844
|
-
stroke: "currentColor",
|
|
845
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
846
|
-
"path",
|
|
847
|
-
{
|
|
848
|
-
strokeLinecap: "round",
|
|
849
|
-
strokeLinejoin: "round",
|
|
850
|
-
strokeWidth: 2,
|
|
851
|
-
d: "M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
|
|
852
|
-
}
|
|
853
|
-
)
|
|
854
|
-
}
|
|
855
|
-
)
|
|
856
|
-
}
|
|
857
|
-
);
|
|
858
|
-
}
|
|
859
|
-
);
|
|
860
|
-
SendButton.displayName = "SendButton";
|
|
861
|
-
var MessageComposer = React3__namespace.forwardRef(
|
|
862
|
-
({
|
|
863
|
-
onSend,
|
|
864
|
-
onTypingStart,
|
|
865
|
-
onTypingStop,
|
|
866
|
-
value: controlledValue,
|
|
867
|
-
onValueChange,
|
|
868
|
-
placeholder = "Type a message...",
|
|
869
|
-
maxLength = 1600,
|
|
870
|
-
showCharacterCount = false,
|
|
871
|
-
disabled = false,
|
|
872
|
-
isSending = false,
|
|
873
|
-
showAttachmentPicker = true,
|
|
874
|
-
showCameraButton = false,
|
|
875
|
-
acceptedFileTypes = ["image/*", "video/*", ".pdf", ".doc", ".docx"],
|
|
876
|
-
maxFileSize = 25 * 1024 * 1024,
|
|
877
|
-
maxAttachments = 10,
|
|
878
|
-
onError,
|
|
879
|
-
autoFocus = false,
|
|
880
|
-
replyTo = null,
|
|
881
|
-
onCancelReply,
|
|
882
|
-
variant = "default",
|
|
883
|
-
inputTrailing,
|
|
884
|
-
mentionOptions,
|
|
885
|
-
className
|
|
886
|
-
}, ref) => {
|
|
887
|
-
const textareaRef = React3__namespace.useRef(null);
|
|
888
|
-
const [internalContent, setInternalContent] = React3__namespace.useState("");
|
|
889
|
-
const isControlled = controlledValue !== void 0;
|
|
890
|
-
const content = isControlled ? controlledValue : internalContent;
|
|
891
|
-
const setContent = React3__namespace.useCallback(
|
|
892
|
-
(val) => {
|
|
893
|
-
if (isControlled) {
|
|
894
|
-
const newVal = typeof val === "function" ? val(controlledValue) : val;
|
|
895
|
-
onValueChange?.(newVal);
|
|
896
|
-
} else {
|
|
897
|
-
setInternalContent(val);
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
|
-
[isControlled, controlledValue, onValueChange]
|
|
901
|
-
);
|
|
902
|
-
const [attachments, setAttachments] = React3__namespace.useState(
|
|
903
|
-
[]
|
|
904
|
-
);
|
|
905
|
-
const [isTyping, setIsTyping] = React3__namespace.useState(false);
|
|
906
|
-
const typingTimeoutRef = React3__namespace.useRef(null);
|
|
907
|
-
React3__namespace.useImperativeHandle(ref, () => textareaRef.current);
|
|
908
|
-
React3__namespace.useEffect(() => {
|
|
909
|
-
const textarea = textareaRef.current;
|
|
910
|
-
if (textarea) {
|
|
911
|
-
textarea.style.height = "auto";
|
|
912
|
-
textarea.style.height = `${Math.min(textarea.scrollHeight, 150)}px`;
|
|
913
|
-
}
|
|
914
|
-
}, [content]);
|
|
915
|
-
React3__namespace.useEffect(() => {
|
|
916
|
-
if (content.length > 0 && !isTyping) {
|
|
917
|
-
setIsTyping(true);
|
|
918
|
-
onTypingStart?.();
|
|
919
|
-
}
|
|
920
|
-
if (typingTimeoutRef.current) {
|
|
921
|
-
clearTimeout(typingTimeoutRef.current);
|
|
922
|
-
}
|
|
923
|
-
typingTimeoutRef.current = setTimeout(() => {
|
|
924
|
-
if (isTyping) {
|
|
925
|
-
setIsTyping(false);
|
|
926
|
-
onTypingStop?.();
|
|
927
|
-
}
|
|
928
|
-
}, 2e3);
|
|
929
|
-
return () => {
|
|
930
|
-
if (typingTimeoutRef.current) {
|
|
931
|
-
clearTimeout(typingTimeoutRef.current);
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
}, [content, isTyping, onTypingStart, onTypingStop]);
|
|
935
|
-
React3__namespace.useEffect(() => {
|
|
936
|
-
if (autoFocus) {
|
|
937
|
-
textareaRef.current?.focus();
|
|
938
|
-
}
|
|
939
|
-
}, [autoFocus]);
|
|
940
|
-
React3__namespace.useEffect(() => {
|
|
941
|
-
if (replyTo) {
|
|
942
|
-
textareaRef.current?.focus();
|
|
943
|
-
}
|
|
944
|
-
}, [replyTo]);
|
|
945
|
-
const mention = useMentionAutocomplete({
|
|
946
|
-
options: mentionOptions,
|
|
947
|
-
value: content,
|
|
948
|
-
setValue: setContent,
|
|
949
|
-
textareaRef
|
|
950
|
-
});
|
|
951
|
-
const canSend = (content.trim().length > 0 || attachments.length > 0) && content.length <= maxLength && !disabled && !isSending;
|
|
952
|
-
const handleSubmit = async (event) => {
|
|
953
|
-
event.preventDefault();
|
|
954
|
-
if (!canSend) return;
|
|
955
|
-
const message = {
|
|
956
|
-
content: content.trim(),
|
|
957
|
-
attachments: attachments.map((a) => a.file),
|
|
958
|
-
replyToId: replyTo?.id
|
|
959
|
-
};
|
|
960
|
-
setContent("");
|
|
961
|
-
setAttachments([]);
|
|
962
|
-
setIsTyping(false);
|
|
963
|
-
onTypingStop?.();
|
|
964
|
-
try {
|
|
965
|
-
await onSend(message);
|
|
966
|
-
} catch {
|
|
967
|
-
setContent(message.content);
|
|
968
|
-
onError?.("Failed to send message");
|
|
969
|
-
}
|
|
970
|
-
};
|
|
971
|
-
const handleKeyDown = (event) => {
|
|
972
|
-
if (mention.handleKeyDown(event)) return;
|
|
973
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
974
|
-
event.preventDefault();
|
|
975
|
-
if (canSend) {
|
|
976
|
-
handleSubmit(event);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
};
|
|
980
|
-
const handleFilesSelected = (files) => {
|
|
981
|
-
const remainingSlots = maxAttachments - attachments.length;
|
|
982
|
-
const filesToAdd = files.slice(0, remainingSlots);
|
|
983
|
-
if (files.length > remainingSlots) {
|
|
984
|
-
onError?.(`Maximum ${maxAttachments} attachments allowed`);
|
|
985
|
-
}
|
|
986
|
-
const newAttachments = filesToAdd.map((file) => {
|
|
987
|
-
const type = getFileType(file.type);
|
|
988
|
-
let previewUrl;
|
|
989
|
-
if (type === "image" || type === "video") {
|
|
990
|
-
previewUrl = URL.createObjectURL(file);
|
|
991
|
-
}
|
|
992
|
-
return {
|
|
993
|
-
id: generateAttachmentId(),
|
|
994
|
-
file,
|
|
995
|
-
previewUrl,
|
|
996
|
-
type,
|
|
997
|
-
state: "pending"
|
|
998
|
-
};
|
|
999
|
-
});
|
|
1000
|
-
setAttachments((prev) => [...prev, ...newAttachments]);
|
|
1001
|
-
};
|
|
1002
|
-
const handlePaste = (event) => {
|
|
1003
|
-
if (!showAttachmentPicker || disabled) return;
|
|
1004
|
-
const pasted = Array.from(event.clipboardData.items).filter((item) => item.kind === "file").map((item) => item.getAsFile()).filter((f) => f !== null).filter((f) => isFileAccepted(f, acceptedFileTypes));
|
|
1005
|
-
if (pasted.length === 0) return;
|
|
1006
|
-
event.preventDefault();
|
|
1007
|
-
handleFilesSelected(pasted);
|
|
1008
|
-
};
|
|
1009
|
-
const handleRemoveAttachment = (attachmentId) => {
|
|
1010
|
-
setAttachments((prev) => {
|
|
1011
|
-
const attachment = prev.find((a) => a.id === attachmentId);
|
|
1012
|
-
if (attachment?.previewUrl) {
|
|
1013
|
-
URL.revokeObjectURL(attachment.previewUrl);
|
|
1014
|
-
}
|
|
1015
|
-
return prev.filter((a) => a.id !== attachmentId);
|
|
1016
|
-
});
|
|
1017
|
-
};
|
|
1018
|
-
React3__namespace.useEffect(() => {
|
|
1019
|
-
const currentAttachments = attachments;
|
|
1020
|
-
return () => {
|
|
1021
|
-
currentAttachments.forEach((a) => {
|
|
1022
|
-
if (a.previewUrl) {
|
|
1023
|
-
URL.revokeObjectURL(a.previewUrl);
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
};
|
|
1027
|
-
}, [attachments]);
|
|
1028
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
|
-
DragDropZone,
|
|
1030
|
-
{
|
|
1031
|
-
onFilesDropped: handleFilesSelected,
|
|
1032
|
-
acceptedTypes: acceptedFileTypes,
|
|
1033
|
-
maxFileSize,
|
|
1034
|
-
maxFiles: maxAttachments - attachments.length,
|
|
1035
|
-
disabled: disabled || attachments.length >= maxAttachments,
|
|
1036
|
-
onError,
|
|
1037
|
-
className: chunkS5RVSXDV_cjs.cn("w-full", className),
|
|
1038
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1039
|
-
"form",
|
|
1040
|
-
{
|
|
1041
|
-
onSubmit: handleSubmit,
|
|
1042
|
-
"data-slot": "message-composer",
|
|
1043
|
-
className: "w-full",
|
|
1044
|
-
children: [
|
|
1045
|
-
replyTo && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1046
|
-
"div",
|
|
1047
|
-
{
|
|
1048
|
-
"data-slot": "composer-reply-preview",
|
|
1049
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
1050
|
-
"flex items-center gap-2 px-4 py-2",
|
|
1051
|
-
"bg-neutral-50 dark:bg-neutral-800/50",
|
|
1052
|
-
"border-primary-500 border-s-4"
|
|
1053
|
-
),
|
|
1054
|
-
children: [
|
|
1055
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1056
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-primary-800 dark:text-primary-400 text-xs font-medium", children: [
|
|
1057
|
-
"Replying to ",
|
|
1058
|
-
replyTo.senderName
|
|
1059
|
-
] }),
|
|
1060
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm text-neutral-600 dark:text-neutral-300", children: replyTo.content })
|
|
1061
|
-
] }),
|
|
1062
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1063
|
-
"button",
|
|
1064
|
-
{
|
|
1065
|
-
type: "button",
|
|
1066
|
-
onClick: onCancelReply,
|
|
1067
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
1068
|
-
"shrink-0 rounded p-1",
|
|
1069
|
-
"text-neutral-500 hover:text-neutral-700",
|
|
1070
|
-
"dark:text-neutral-400 dark:hover:text-neutral-200",
|
|
1071
|
-
"focus:ring-primary-500 focus:ring-2 focus:outline-none"
|
|
1072
|
-
),
|
|
1073
|
-
"aria-label": "Cancel reply",
|
|
1074
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1075
|
-
"svg",
|
|
1076
|
-
{
|
|
1077
|
-
"aria-hidden": "true",
|
|
1078
|
-
className: "h-4 w-4",
|
|
1079
|
-
fill: "none",
|
|
1080
|
-
viewBox: "0 0 24 24",
|
|
1081
|
-
stroke: "currentColor",
|
|
1082
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1083
|
-
"path",
|
|
1084
|
-
{
|
|
1085
|
-
strokeLinecap: "round",
|
|
1086
|
-
strokeLinejoin: "round",
|
|
1087
|
-
strokeWidth: 2,
|
|
1088
|
-
d: "M6 18L18 6M6 6l12 12"
|
|
1089
|
-
}
|
|
1090
|
-
)
|
|
1091
|
-
}
|
|
1092
|
-
)
|
|
1093
|
-
}
|
|
1094
|
-
)
|
|
1095
|
-
]
|
|
1096
|
-
}
|
|
1097
|
-
),
|
|
1098
|
-
attachments.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1099
|
-
"div",
|
|
1100
|
-
{
|
|
1101
|
-
"data-slot": "composer-attachments",
|
|
1102
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
1103
|
-
"flex flex-wrap gap-2 p-3",
|
|
1104
|
-
"border-t border-neutral-200 dark:border-neutral-700"
|
|
1105
|
-
),
|
|
1106
|
-
children: attachments.map((attachment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
-
AttachmentPreviewItem,
|
|
1108
|
-
{
|
|
1109
|
-
attachment,
|
|
1110
|
-
onRemove: () => handleRemoveAttachment(attachment.id)
|
|
1111
|
-
},
|
|
1112
|
-
attachment.id
|
|
1113
|
-
))
|
|
1114
|
-
}
|
|
1115
|
-
),
|
|
1116
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1117
|
-
"div",
|
|
1118
|
-
{
|
|
1119
|
-
"data-slot": "composer-input-area",
|
|
1120
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
1121
|
-
"flex items-center gap-2 p-3",
|
|
1122
|
-
"bg-white dark:bg-neutral-900",
|
|
1123
|
-
variant === "default" && "border-t border-neutral-200 dark:border-neutral-700"
|
|
1124
|
-
),
|
|
1125
|
-
children: [
|
|
1126
|
-
showAttachmentPicker && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1127
|
-
AttachmentPicker,
|
|
1128
|
-
{
|
|
1129
|
-
onFilesSelected: handleFilesSelected,
|
|
1130
|
-
acceptedTypes: acceptedFileTypes,
|
|
1131
|
-
maxFileSize,
|
|
1132
|
-
maxFiles: maxAttachments - attachments.length,
|
|
1133
|
-
disabled: disabled || attachments.length >= maxAttachments,
|
|
1134
|
-
onError
|
|
1135
|
-
}
|
|
1136
|
-
),
|
|
1137
|
-
showCameraButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1138
|
-
CameraButton,
|
|
1139
|
-
{
|
|
1140
|
-
onCapture: (file) => handleFilesSelected([file]),
|
|
1141
|
-
disabled: disabled || attachments.length >= maxAttachments
|
|
1142
|
-
}
|
|
1143
|
-
),
|
|
1144
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1145
|
-
"div",
|
|
1146
|
-
{
|
|
1147
|
-
"data-slot": "composer-input-wrapper",
|
|
1148
|
-
className: "relative flex-1",
|
|
1149
|
-
ref: mention.anchorRef,
|
|
1150
|
-
children: [
|
|
1151
|
-
/* @__PURE__ */ jsxRuntime.jsx(MentionMenu, { mention }),
|
|
1152
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1153
|
-
"textarea",
|
|
1154
|
-
{
|
|
1155
|
-
ref: textareaRef,
|
|
1156
|
-
"data-slot": "composer-input",
|
|
1157
|
-
value: content,
|
|
1158
|
-
onChange: (e) => {
|
|
1159
|
-
setContent(e.target.value);
|
|
1160
|
-
mention.sync(
|
|
1161
|
-
e.target.value,
|
|
1162
|
-
e.target.selectionStart ?? e.target.value.length
|
|
1163
|
-
);
|
|
1164
|
-
},
|
|
1165
|
-
onClick: (e) => {
|
|
1166
|
-
const el = e.currentTarget;
|
|
1167
|
-
mention.sync(el.value, el.selectionStart ?? el.value.length);
|
|
1168
|
-
},
|
|
1169
|
-
onKeyDown: handleKeyDown,
|
|
1170
|
-
onPaste: handlePaste,
|
|
1171
|
-
placeholder,
|
|
1172
|
-
disabled: disabled || isSending,
|
|
1173
|
-
rows: 1,
|
|
1174
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
1175
|
-
"w-full resize-none rounded-2xl py-2.5",
|
|
1176
|
-
inputTrailing ? "ps-4 pe-10" : "px-4",
|
|
1177
|
-
"bg-neutral-100 dark:bg-neutral-800",
|
|
1178
|
-
"text-neutral-900 dark:text-neutral-100",
|
|
1179
|
-
"placeholder:text-neutral-400 dark:placeholder:text-neutral-500",
|
|
1180
|
-
"focus:ring-primary-500 focus:ring-2 focus:outline-none",
|
|
1181
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1182
|
-
"transition-colors",
|
|
1183
|
-
"max-h-[150px]"
|
|
1184
|
-
),
|
|
1185
|
-
"aria-label": "Message",
|
|
1186
|
-
"aria-describedby": showCharacterCount ? "char-count" : void 0,
|
|
1187
|
-
...mention.inputProps
|
|
1188
|
-
}
|
|
1189
|
-
),
|
|
1190
|
-
inputTrailing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1191
|
-
"div",
|
|
1192
|
-
{
|
|
1193
|
-
"data-slot": "composer-input-trailing",
|
|
1194
|
-
className: "pointer-events-none absolute end-1 top-0 flex h-[44px] items-center [&>*]:pointer-events-auto",
|
|
1195
|
-
children: inputTrailing
|
|
1196
|
-
}
|
|
1197
|
-
),
|
|
1198
|
-
showCharacterCount && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1199
|
-
"div",
|
|
1200
|
-
{
|
|
1201
|
-
"data-slot": "composer-char-count",
|
|
1202
|
-
id: "char-count",
|
|
1203
|
-
className: "absolute end-3 bottom-1.5",
|
|
1204
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(CharacterCounter, { current: content.length, max: maxLength })
|
|
1205
|
-
}
|
|
1206
|
-
)
|
|
1207
|
-
]
|
|
1208
|
-
}
|
|
1209
|
-
),
|
|
1210
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1211
|
-
SendButton,
|
|
1212
|
-
{
|
|
1213
|
-
canSend,
|
|
1214
|
-
isLoading: isSending,
|
|
1215
|
-
disabled
|
|
1216
|
-
}
|
|
1217
|
-
)
|
|
1218
|
-
]
|
|
1219
|
-
}
|
|
1220
|
-
)
|
|
1221
|
-
]
|
|
1222
|
-
}
|
|
1223
|
-
)
|
|
1224
|
-
}
|
|
1225
|
-
);
|
|
1226
|
-
}
|
|
1227
|
-
);
|
|
1228
|
-
MessageComposer.displayName = "MessageComposer";
|
|
1229
724
|
|
|
1230
725
|
exports.AttachmentPicker = AttachmentPicker;
|
|
1231
726
|
exports.AttachmentPreviewItem = AttachmentPreviewItem;
|
|
1232
727
|
exports.CameraButton = CameraButton;
|
|
1233
|
-
exports.CharacterCounter = CharacterCounter;
|
|
1234
728
|
exports.DragDropZone = DragDropZone;
|
|
1235
729
|
exports.MentionMenu = MentionMenu;
|
|
1236
|
-
exports.MessageComposer = MessageComposer;
|
|
1237
|
-
exports.SendButton = SendButton;
|
|
1238
730
|
exports.generateAttachmentId = generateAttachmentId;
|
|
1239
731
|
exports.getFileType = getFileType;
|
|
1240
|
-
exports.sendButtonVariants = sendButtonVariants;
|
|
1241
732
|
exports.useMentionAutocomplete = useMentionAutocomplete;
|
|
1242
733
|
exports.validateFile = validateFile;
|
|
1243
|
-
//# sourceMappingURL=chunk-
|
|
1244
|
-
//# sourceMappingURL=chunk-
|
|
734
|
+
//# sourceMappingURL=chunk-5VXRKOPR.cjs.map
|
|
735
|
+
//# sourceMappingURL=chunk-5VXRKOPR.cjs.map
|