@proteos/ui 0.41.1 → 0.42.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.cjs +15 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/draft-message-composer/draft-message-composer.test.tsx +9 -2
- package/src/components/draft-message-composer/draft-message-composer.tsx +10 -0
- package/src/components/message-composer/message-composer.tsx +16 -5
package/dist/index.cjs
CHANGED
|
@@ -3299,7 +3299,8 @@ function MessageComposer({
|
|
|
3299
3299
|
onRemoveAttachment,
|
|
3300
3300
|
hasUploadingAttachments,
|
|
3301
3301
|
showSendButton,
|
|
3302
|
-
className
|
|
3302
|
+
className,
|
|
3303
|
+
bodyClassName
|
|
3303
3304
|
}) {
|
|
3304
3305
|
const [isSending, setIsSending] = react.useState(false);
|
|
3305
3306
|
const [sendError, setSendError] = react.useState(null);
|
|
@@ -3308,6 +3309,9 @@ function MessageComposer({
|
|
|
3308
3309
|
const [internalBcc, setInternalBcc] = react.useState([]);
|
|
3309
3310
|
const [showCcBcc, setShowCcBcc] = react.useState(false);
|
|
3310
3311
|
const textareaRef = react.useRef(null);
|
|
3312
|
+
react.useEffect(() => {
|
|
3313
|
+
if (textareaRef.current) autoGrow(textareaRef.current);
|
|
3314
|
+
}, [value.text]);
|
|
3311
3315
|
const to = toProp ?? internalTo;
|
|
3312
3316
|
const cc = ccProp ?? internalCc;
|
|
3313
3317
|
const bcc = bccProp ?? internalBcc;
|
|
@@ -3490,14 +3494,12 @@ function MessageComposer({
|
|
|
3490
3494
|
value: value.text,
|
|
3491
3495
|
placeholder,
|
|
3492
3496
|
rows: 1,
|
|
3493
|
-
onChange: (event) => {
|
|
3494
|
-
onValueChange({ ...value, text: event.target.value });
|
|
3495
|
-
autoGrow(event.currentTarget);
|
|
3496
|
-
},
|
|
3497
|
+
onChange: (event) => onValueChange({ ...value, text: event.target.value }),
|
|
3497
3498
|
onKeyDown: onKeyDown2,
|
|
3498
3499
|
className: chunkMWAXK66H_cjs.cn(
|
|
3499
3500
|
"w-full resize-none bg-transparent outline-none",
|
|
3500
|
-
"min-h-[40px] max-h-48 text-[14px] leading-[1.5] text-ink placeholder:text-ink-4"
|
|
3501
|
+
"min-h-[40px] max-h-48 text-[14px] leading-[1.5] text-ink placeholder:text-ink-4",
|
|
3502
|
+
bodyClassName
|
|
3501
3503
|
),
|
|
3502
3504
|
"data-conversations-composer": true
|
|
3503
3505
|
}
|
|
@@ -3560,7 +3562,7 @@ function MessageComposer({
|
|
|
3560
3562
|
}
|
|
3561
3563
|
function autoGrow(node) {
|
|
3562
3564
|
node.style.height = "auto";
|
|
3563
|
-
node.style.height = `${
|
|
3565
|
+
node.style.height = `${node.scrollHeight}px`;
|
|
3564
3566
|
}
|
|
3565
3567
|
var listenersByMessageId2 = /* @__PURE__ */ new Map();
|
|
3566
3568
|
var lastOutcomeByMessageId = /* @__PURE__ */ new Map();
|
|
@@ -3635,8 +3637,10 @@ function DraftMessageComposer({
|
|
|
3635
3637
|
client,
|
|
3636
3638
|
onSent,
|
|
3637
3639
|
onRejected,
|
|
3640
|
+
onFailed,
|
|
3638
3641
|
showActions = true,
|
|
3639
|
-
className
|
|
3642
|
+
className,
|
|
3643
|
+
bodyClassName
|
|
3640
3644
|
}) {
|
|
3641
3645
|
const [phase, setPhase] = react.useState("loading");
|
|
3642
3646
|
const [busy, setBusy] = react.useState("idle");
|
|
@@ -3759,6 +3763,7 @@ function DraftMessageComposer({
|
|
|
3759
3763
|
if (result.status === "failed") {
|
|
3760
3764
|
setTerminalKind("failed");
|
|
3761
3765
|
setPhase("terminal");
|
|
3766
|
+
onFailed?.(result);
|
|
3762
3767
|
return;
|
|
3763
3768
|
}
|
|
3764
3769
|
setTerminalKind("sent");
|
|
@@ -3778,6 +3783,7 @@ function DraftMessageComposer({
|
|
|
3778
3783
|
client,
|
|
3779
3784
|
messageId,
|
|
3780
3785
|
onSent,
|
|
3786
|
+
onFailed,
|
|
3781
3787
|
areRecipientsEditable,
|
|
3782
3788
|
conversation,
|
|
3783
3789
|
to
|
|
@@ -3870,6 +3876,7 @@ function DraftMessageComposer({
|
|
|
3870
3876
|
value,
|
|
3871
3877
|
onValueChange: setValue,
|
|
3872
3878
|
placeholder: "Draft body\u2026",
|
|
3879
|
+
...bodyClassName !== void 0 ? { bodyClassName } : {},
|
|
3873
3880
|
...isEmail && !isSubjectEditable ? { isSubjectReadOnly: true } : {},
|
|
3874
3881
|
onSend: async () => send(),
|
|
3875
3882
|
...areRecipientsEditable && message.connection_id ? {
|