@proteos/ui 0.41.0 → 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 +4 -4
- 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.d.cts
CHANGED
|
@@ -1174,6 +1174,8 @@ interface DraftMessageComposerProps {
|
|
|
1174
1174
|
onSent?: (message: Message) => void;
|
|
1175
1175
|
/** Fires once the draft was declined. */
|
|
1176
1176
|
onRejected?: (message: Message) => void;
|
|
1177
|
+
/** Fires when the human approved the send but delivery failed. */
|
|
1178
|
+
onFailed?: (message: Message) => void;
|
|
1177
1179
|
/**
|
|
1178
1180
|
* Default true. When false the internal Send / Save draft / Reject row is
|
|
1179
1181
|
* hidden — the composer becomes a pure preview/edit surface driven by
|
|
@@ -1181,8 +1183,11 @@ interface DraftMessageComposerProps {
|
|
|
1181
1183
|
*/
|
|
1182
1184
|
showActions?: boolean;
|
|
1183
1185
|
className?: string;
|
|
1186
|
+
/** Composes onto the body textarea (MessageComposer.bodyClassName) — review
|
|
1187
|
+
* surfaces raise the growth cap so a whole email fits. */
|
|
1188
|
+
bodyClassName?: string;
|
|
1184
1189
|
}
|
|
1185
|
-
declare function DraftMessageComposer({ messageId, client, onSent, onRejected, showActions, className, }: DraftMessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1190
|
+
declare function DraftMessageComposer({ messageId, client, onSent, onRejected, onFailed, showActions, className, bodyClassName, }: DraftMessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1186
1191
|
|
|
1187
1192
|
declare function publishDraftMessageOutcome(messageId: string, outcome: DraftMessageOutcome): void;
|
|
1188
1193
|
declare function subscribeDraftMessageOutcome(messageId: string, listener: () => void): () => void;
|
|
@@ -1520,8 +1525,11 @@ interface MessageComposerProps {
|
|
|
1520
1525
|
showSendButton?: boolean;
|
|
1521
1526
|
/** Composes onto the outer box chrome (`messageComposerStyles`). */
|
|
1522
1527
|
className?: string;
|
|
1528
|
+
/** Composes onto the body textarea — review surfaces override the default
|
|
1529
|
+
* `max-h-48` growth cap (e.g. `max-h-[55dvh]`) so a whole email fits. */
|
|
1530
|
+
bodyClassName?: string;
|
|
1523
1531
|
}
|
|
1524
|
-
declare function MessageComposer({ mode, value, onValueChange, placeholder, subjectPrefill, isSubjectReadOnly, disabledReason, onSend, connectionId, connectionPicker, showToField, showRecipientFields, searchRecipients, to: toProp, cc: ccProp, bcc: bccProp, onToChange, onCcChange, onBccChange, attachments, onAddFiles, onRemoveAttachment, hasUploadingAttachments, showSendButton, className, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1532
|
+
declare function MessageComposer({ mode, value, onValueChange, placeholder, subjectPrefill, isSubjectReadOnly, disabledReason, onSend, connectionId, connectionPicker, showToField, showRecipientFields, searchRecipients, to: toProp, cc: ccProp, bcc: bccProp, onToChange, onCcChange, onBccChange, attachments, onAddFiles, onRemoveAttachment, hasUploadingAttachments, showSendButton, className, bodyClassName, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1525
1533
|
|
|
1526
1534
|
/** Stateful root. Pass `isOpen` + `onOpenChange` for controlled usage. */
|
|
1527
1535
|
declare function Modal(props: DialogTriggerProps): react_jsx_runtime.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1174,6 +1174,8 @@ interface DraftMessageComposerProps {
|
|
|
1174
1174
|
onSent?: (message: Message) => void;
|
|
1175
1175
|
/** Fires once the draft was declined. */
|
|
1176
1176
|
onRejected?: (message: Message) => void;
|
|
1177
|
+
/** Fires when the human approved the send but delivery failed. */
|
|
1178
|
+
onFailed?: (message: Message) => void;
|
|
1177
1179
|
/**
|
|
1178
1180
|
* Default true. When false the internal Send / Save draft / Reject row is
|
|
1179
1181
|
* hidden — the composer becomes a pure preview/edit surface driven by
|
|
@@ -1181,8 +1183,11 @@ interface DraftMessageComposerProps {
|
|
|
1181
1183
|
*/
|
|
1182
1184
|
showActions?: boolean;
|
|
1183
1185
|
className?: string;
|
|
1186
|
+
/** Composes onto the body textarea (MessageComposer.bodyClassName) — review
|
|
1187
|
+
* surfaces raise the growth cap so a whole email fits. */
|
|
1188
|
+
bodyClassName?: string;
|
|
1184
1189
|
}
|
|
1185
|
-
declare function DraftMessageComposer({ messageId, client, onSent, onRejected, showActions, className, }: DraftMessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1190
|
+
declare function DraftMessageComposer({ messageId, client, onSent, onRejected, onFailed, showActions, className, bodyClassName, }: DraftMessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1186
1191
|
|
|
1187
1192
|
declare function publishDraftMessageOutcome(messageId: string, outcome: DraftMessageOutcome): void;
|
|
1188
1193
|
declare function subscribeDraftMessageOutcome(messageId: string, listener: () => void): () => void;
|
|
@@ -1520,8 +1525,11 @@ interface MessageComposerProps {
|
|
|
1520
1525
|
showSendButton?: boolean;
|
|
1521
1526
|
/** Composes onto the outer box chrome (`messageComposerStyles`). */
|
|
1522
1527
|
className?: string;
|
|
1528
|
+
/** Composes onto the body textarea — review surfaces override the default
|
|
1529
|
+
* `max-h-48` growth cap (e.g. `max-h-[55dvh]`) so a whole email fits. */
|
|
1530
|
+
bodyClassName?: string;
|
|
1523
1531
|
}
|
|
1524
|
-
declare function MessageComposer({ mode, value, onValueChange, placeholder, subjectPrefill, isSubjectReadOnly, disabledReason, onSend, connectionId, connectionPicker, showToField, showRecipientFields, searchRecipients, to: toProp, cc: ccProp, bcc: bccProp, onToChange, onCcChange, onBccChange, attachments, onAddFiles, onRemoveAttachment, hasUploadingAttachments, showSendButton, className, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1532
|
+
declare function MessageComposer({ mode, value, onValueChange, placeholder, subjectPrefill, isSubjectReadOnly, disabledReason, onSend, connectionId, connectionPicker, showToField, showRecipientFields, searchRecipients, to: toProp, cc: ccProp, bcc: bccProp, onToChange, onCcChange, onBccChange, attachments, onAddFiles, onRemoveAttachment, hasUploadingAttachments, showSendButton, className, bodyClassName, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
|
|
1525
1533
|
|
|
1526
1534
|
/** Stateful root. Pass `isOpen` + `onOpenChange` for controlled usage. */
|
|
1527
1535
|
declare function Modal(props: DialogTriggerProps): react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -3298,7 +3298,8 @@ function MessageComposer({
|
|
|
3298
3298
|
onRemoveAttachment,
|
|
3299
3299
|
hasUploadingAttachments,
|
|
3300
3300
|
showSendButton,
|
|
3301
|
-
className
|
|
3301
|
+
className,
|
|
3302
|
+
bodyClassName
|
|
3302
3303
|
}) {
|
|
3303
3304
|
const [isSending, setIsSending] = useState(false);
|
|
3304
3305
|
const [sendError, setSendError] = useState(null);
|
|
@@ -3307,6 +3308,9 @@ function MessageComposer({
|
|
|
3307
3308
|
const [internalBcc, setInternalBcc] = useState([]);
|
|
3308
3309
|
const [showCcBcc, setShowCcBcc] = useState(false);
|
|
3309
3310
|
const textareaRef = useRef(null);
|
|
3311
|
+
useEffect(() => {
|
|
3312
|
+
if (textareaRef.current) autoGrow(textareaRef.current);
|
|
3313
|
+
}, [value.text]);
|
|
3310
3314
|
const to = toProp ?? internalTo;
|
|
3311
3315
|
const cc = ccProp ?? internalCc;
|
|
3312
3316
|
const bcc = bccProp ?? internalBcc;
|
|
@@ -3489,14 +3493,12 @@ function MessageComposer({
|
|
|
3489
3493
|
value: value.text,
|
|
3490
3494
|
placeholder,
|
|
3491
3495
|
rows: 1,
|
|
3492
|
-
onChange: (event) => {
|
|
3493
|
-
onValueChange({ ...value, text: event.target.value });
|
|
3494
|
-
autoGrow(event.currentTarget);
|
|
3495
|
-
},
|
|
3496
|
+
onChange: (event) => onValueChange({ ...value, text: event.target.value }),
|
|
3496
3497
|
onKeyDown: onKeyDown2,
|
|
3497
3498
|
className: cn(
|
|
3498
3499
|
"w-full resize-none bg-transparent outline-none",
|
|
3499
|
-
"min-h-[40px] max-h-48 text-[14px] leading-[1.5] text-ink placeholder:text-ink-4"
|
|
3500
|
+
"min-h-[40px] max-h-48 text-[14px] leading-[1.5] text-ink placeholder:text-ink-4",
|
|
3501
|
+
bodyClassName
|
|
3500
3502
|
),
|
|
3501
3503
|
"data-conversations-composer": true
|
|
3502
3504
|
}
|
|
@@ -3559,7 +3561,7 @@ function MessageComposer({
|
|
|
3559
3561
|
}
|
|
3560
3562
|
function autoGrow(node) {
|
|
3561
3563
|
node.style.height = "auto";
|
|
3562
|
-
node.style.height = `${
|
|
3564
|
+
node.style.height = `${node.scrollHeight}px`;
|
|
3563
3565
|
}
|
|
3564
3566
|
var listenersByMessageId2 = /* @__PURE__ */ new Map();
|
|
3565
3567
|
var lastOutcomeByMessageId = /* @__PURE__ */ new Map();
|
|
@@ -3634,8 +3636,10 @@ function DraftMessageComposer({
|
|
|
3634
3636
|
client,
|
|
3635
3637
|
onSent,
|
|
3636
3638
|
onRejected,
|
|
3639
|
+
onFailed,
|
|
3637
3640
|
showActions = true,
|
|
3638
|
-
className
|
|
3641
|
+
className,
|
|
3642
|
+
bodyClassName
|
|
3639
3643
|
}) {
|
|
3640
3644
|
const [phase, setPhase] = useState("loading");
|
|
3641
3645
|
const [busy, setBusy] = useState("idle");
|
|
@@ -3758,6 +3762,7 @@ function DraftMessageComposer({
|
|
|
3758
3762
|
if (result.status === "failed") {
|
|
3759
3763
|
setTerminalKind("failed");
|
|
3760
3764
|
setPhase("terminal");
|
|
3765
|
+
onFailed?.(result);
|
|
3761
3766
|
return;
|
|
3762
3767
|
}
|
|
3763
3768
|
setTerminalKind("sent");
|
|
@@ -3777,6 +3782,7 @@ function DraftMessageComposer({
|
|
|
3777
3782
|
client,
|
|
3778
3783
|
messageId,
|
|
3779
3784
|
onSent,
|
|
3785
|
+
onFailed,
|
|
3780
3786
|
areRecipientsEditable,
|
|
3781
3787
|
conversation,
|
|
3782
3788
|
to
|
|
@@ -3869,6 +3875,7 @@ function DraftMessageComposer({
|
|
|
3869
3875
|
value,
|
|
3870
3876
|
onValueChange: setValue,
|
|
3871
3877
|
placeholder: "Draft body\u2026",
|
|
3878
|
+
...bodyClassName !== void 0 ? { bodyClassName } : {},
|
|
3872
3879
|
...isEmail && !isSubjectEditable ? { isSubjectReadOnly: true } : {},
|
|
3873
3880
|
onSend: async () => send(),
|
|
3874
3881
|
...areRecipientsEditable && message.connection_id ? {
|