@remit/ui 0.0.204 → 0.0.205
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/package.json +1 -1
- package/src/components/compose-action-bar.stories.tsx +24 -0
- package/src/components/compose-action-bar.tsx +46 -1
- package/src/components/compose-attachments.render.test.ts +103 -0
- package/src/components/compose-attachments.stories.tsx +145 -0
- package/src/components/compose-attachments.tsx +119 -0
- package/src/components/compose-form-shell.tsx +4 -0
- package/src/index.ts +6 -0
package/package.json
CHANGED
|
@@ -104,6 +104,30 @@ export const NoRecipient: Story = {
|
|
|
104
104
|
},
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* The paperclip opens the file picker, and every file picked is handed on in
|
|
109
|
+
* one call — several files are one gesture, not one each.
|
|
110
|
+
*/
|
|
111
|
+
export const AttachFiles: Story = {
|
|
112
|
+
name: "Attach — pick one or more files",
|
|
113
|
+
args: { onAttach: fn() },
|
|
114
|
+
play: async ({ args, canvasElement }) => {
|
|
115
|
+
const canvas = within(canvasElement);
|
|
116
|
+
await expect(
|
|
117
|
+
canvas.getByRole("button", { name: "Attach files" }),
|
|
118
|
+
).toBeInTheDocument();
|
|
119
|
+
const report = new File(["%PDF-1.4"], "report.pdf", {
|
|
120
|
+
type: "application/pdf",
|
|
121
|
+
});
|
|
122
|
+
const notes = new File(["notes"], "notes.txt", { type: "text/plain" });
|
|
123
|
+
await userEvent.upload(canvas.getByTestId("compose-attach-input"), [
|
|
124
|
+
report,
|
|
125
|
+
notes,
|
|
126
|
+
]);
|
|
127
|
+
await expect(args.onAttach).toHaveBeenCalledWith([report, notes]);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
107
131
|
export const SmtpMissing: Story = {
|
|
108
132
|
name: "Blocked — the account cannot send",
|
|
109
133
|
args: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Loader2, Send, Trash2 } from "lucide-react";
|
|
1
|
+
import { Loader2, Paperclip, Send, Trash2 } from "lucide-react";
|
|
2
|
+
import { useRef } from "react";
|
|
2
3
|
import { Button } from "./button.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -36,8 +37,50 @@ export interface ComposeActionBarProps {
|
|
|
36
37
|
onBlocked: (reason: string) => void;
|
|
37
38
|
onDiscard: () => void;
|
|
38
39
|
save?: ComposeSaveState;
|
|
40
|
+
/** Called with the files picked. Absent, the composer offers no attach control. */
|
|
41
|
+
onAttach?: (files: File[]) => void;
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
const AttachControl = ({
|
|
45
|
+
disabled,
|
|
46
|
+
onAttach,
|
|
47
|
+
}: {
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
onAttach: (files: File[]) => void;
|
|
50
|
+
}) => {
|
|
51
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<Button
|
|
55
|
+
variant="ghost"
|
|
56
|
+
size="md"
|
|
57
|
+
aria-label="Attach files"
|
|
58
|
+
title="Attach files"
|
|
59
|
+
aria-busy={disabled}
|
|
60
|
+
className="min-h-11 min-w-11 px-2"
|
|
61
|
+
data-testid="compose-attach"
|
|
62
|
+
icon={<Paperclip className="size-4" />}
|
|
63
|
+
onClick={() => {
|
|
64
|
+
if (disabled) return;
|
|
65
|
+
inputRef.current?.click();
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
<input
|
|
69
|
+
ref={inputRef}
|
|
70
|
+
type="file"
|
|
71
|
+
multiple
|
|
72
|
+
hidden
|
|
73
|
+
data-testid="compose-attach-input"
|
|
74
|
+
onChange={(event) => {
|
|
75
|
+
const files = Array.from(event.currentTarget.files ?? []);
|
|
76
|
+
event.currentTarget.value = "";
|
|
77
|
+
if (files.length > 0) onAttach(files);
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
41
84
|
const SaveStateIndicator = ({ save }: { save: ComposeSaveState }) => {
|
|
42
85
|
if (save.status === "saving") {
|
|
43
86
|
return (
|
|
@@ -70,6 +113,7 @@ export function ComposeActionBar({
|
|
|
70
113
|
onBlocked,
|
|
71
114
|
onDiscard,
|
|
72
115
|
save = { status: "idle" },
|
|
116
|
+
onAttach,
|
|
73
117
|
}: ComposeActionBarProps) {
|
|
74
118
|
const sending = send.status === "sending";
|
|
75
119
|
const blockedReason = send.status === "blocked" ? send.reason : undefined;
|
|
@@ -102,6 +146,7 @@ export function ComposeActionBar({
|
|
|
102
146
|
>
|
|
103
147
|
Send
|
|
104
148
|
</Button>
|
|
149
|
+
{onAttach && <AttachControl disabled={sending} onAttach={onAttach} />}
|
|
105
150
|
<SaveStateIndicator save={save} />
|
|
106
151
|
</div>
|
|
107
152
|
<Button
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import { createElement } from "react";
|
|
4
|
+
import { renderToString } from "react-dom/server";
|
|
5
|
+
import { ComposeActionBar } from "./compose-action-bar.js";
|
|
6
|
+
import {
|
|
7
|
+
type ComposeAttachmentItem,
|
|
8
|
+
ComposeAttachments,
|
|
9
|
+
} from "./compose-attachments.js";
|
|
10
|
+
|
|
11
|
+
const render = (items: ComposeAttachmentItem[]): string =>
|
|
12
|
+
renderToString(
|
|
13
|
+
createElement(ComposeAttachments, {
|
|
14
|
+
items,
|
|
15
|
+
onRemove: () => undefined,
|
|
16
|
+
onRetry: () => undefined,
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const item = (
|
|
21
|
+
overrides: Partial<ComposeAttachmentItem> = {},
|
|
22
|
+
): ComposeAttachmentItem => ({
|
|
23
|
+
key: "att-1",
|
|
24
|
+
filename: "report.pdf",
|
|
25
|
+
sizeBytes: 1024 * 512,
|
|
26
|
+
state: { status: "attached" },
|
|
27
|
+
...overrides,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("ComposeAttachments", () => {
|
|
31
|
+
it("renders nothing for a draft with no files", () => {
|
|
32
|
+
assert.equal(render([]), "");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("names each file and its size, with a labelled control to remove it", () => {
|
|
36
|
+
const html = render([item()]);
|
|
37
|
+
assert.match(html, /report\.pdf/);
|
|
38
|
+
assert.match(html, /512 KB/);
|
|
39
|
+
assert.match(html, /aria-label="Remove report\.pdf"/);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("says a file is still uploading", () => {
|
|
43
|
+
assert.match(
|
|
44
|
+
render([item({ state: { status: "uploading" } })]),
|
|
45
|
+
/Uploading/,
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("states a refusal and offers no retry when the same file would be refused again", () => {
|
|
50
|
+
const html = render([
|
|
51
|
+
item({
|
|
52
|
+
state: {
|
|
53
|
+
status: "failed",
|
|
54
|
+
reason:
|
|
55
|
+
'"report.pdf" is 30.0 MB, over the 25.0 MB a message can carry.',
|
|
56
|
+
retryable: false,
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
]);
|
|
60
|
+
assert.match(html, /role="alert"/);
|
|
61
|
+
assert.match(html, /over the 25\.0 MB a message can carry/);
|
|
62
|
+
assert.doesNotMatch(html, /Try again/);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("offers a retry for an upload that can succeed on a second attempt", () => {
|
|
66
|
+
const html = render([
|
|
67
|
+
item({
|
|
68
|
+
state: {
|
|
69
|
+
status: "failed",
|
|
70
|
+
reason: '"report.pdf" did not finish uploading.',
|
|
71
|
+
retryable: true,
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
]);
|
|
75
|
+
assert.match(html, /Try again/);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe("ComposeActionBar attach control", () => {
|
|
80
|
+
const baseProps = {
|
|
81
|
+
send: { status: "ready" } as const,
|
|
82
|
+
onSend: () => undefined,
|
|
83
|
+
onBlocked: () => undefined,
|
|
84
|
+
onDiscard: () => undefined,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
it("offers a file picker taking several files when the composer can attach", () => {
|
|
88
|
+
const html = renderToString(
|
|
89
|
+
createElement(ComposeActionBar, {
|
|
90
|
+
...baseProps,
|
|
91
|
+
onAttach: () => undefined,
|
|
92
|
+
}),
|
|
93
|
+
);
|
|
94
|
+
assert.match(html, /aria-label="Attach files"/);
|
|
95
|
+
assert.match(html, /type="file"/);
|
|
96
|
+
assert.match(html, /multiple=""/);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("offers no attach control where the composer cannot attach", () => {
|
|
100
|
+
const html = renderToString(createElement(ComposeActionBar, baseProps));
|
|
101
|
+
assert.doesNotMatch(html, /Attach files/);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { expect, fn, userEvent, within } from "storybook/test";
|
|
4
|
+
import {
|
|
5
|
+
type ComposeAttachmentItem,
|
|
6
|
+
ComposeAttachments,
|
|
7
|
+
} from "./compose-attachments.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The files on a draft while it is being written (#679). The app owns the
|
|
11
|
+
* upload and hands back per-file state; a refusal carries the server's own
|
|
12
|
+
* sentence, which names the file, its size and the cap.
|
|
13
|
+
*/
|
|
14
|
+
const meta: Meta<typeof ComposeAttachments> = {
|
|
15
|
+
title: "Design System/Compose/ComposeAttachments",
|
|
16
|
+
component: ComposeAttachments,
|
|
17
|
+
parameters: { layout: "padded" },
|
|
18
|
+
args: {
|
|
19
|
+
onRemove: fn(),
|
|
20
|
+
onRetry: fn(),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof ComposeAttachments>;
|
|
26
|
+
|
|
27
|
+
const boardPack: ComposeAttachmentItem = {
|
|
28
|
+
key: "att-1",
|
|
29
|
+
filename: "Q3 board pack.pdf",
|
|
30
|
+
sizeBytes: 2_411_724,
|
|
31
|
+
state: { status: "attached" },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const sitePlan: ComposeAttachmentItem = {
|
|
35
|
+
key: "att-2",
|
|
36
|
+
filename: "site-plan.png",
|
|
37
|
+
sizeBytes: 486_120,
|
|
38
|
+
state: { status: "attached" },
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const OVER_LIMIT_REASON =
|
|
42
|
+
'"site-survey.mov" is 31.4 MB, over the 25.0 MB a message can carry.';
|
|
43
|
+
|
|
44
|
+
export const Attached: Story = {
|
|
45
|
+
name: "Attached — two files ready to send",
|
|
46
|
+
args: { items: [boardPack, sitePlan] },
|
|
47
|
+
play: async ({ canvasElement }) => {
|
|
48
|
+
const canvas = within(canvasElement);
|
|
49
|
+
const rows = canvas.getAllByTestId("compose-attachment");
|
|
50
|
+
await expect(rows).toHaveLength(2);
|
|
51
|
+
await expect(rows[0]).toHaveTextContent("Q3 board pack.pdf");
|
|
52
|
+
await expect(rows[0]).toHaveTextContent("2.3 MB");
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const Uploading: Story = {
|
|
57
|
+
name: "Uploading — one file still on its way",
|
|
58
|
+
args: {
|
|
59
|
+
items: [
|
|
60
|
+
boardPack,
|
|
61
|
+
{
|
|
62
|
+
key: "att-3",
|
|
63
|
+
filename: "minutes.docx",
|
|
64
|
+
sizeBytes: 88_064,
|
|
65
|
+
state: { status: "uploading" },
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A file over the cap is refused by the server before a byte moves, and the
|
|
73
|
+
* row stays until it is removed, carrying the refusal. There is no retry: the
|
|
74
|
+
* same file would be refused the same way.
|
|
75
|
+
*/
|
|
76
|
+
export const OverLimit: Story = {
|
|
77
|
+
name: "Refused — the file is over the message limit",
|
|
78
|
+
args: {
|
|
79
|
+
items: [
|
|
80
|
+
boardPack,
|
|
81
|
+
{
|
|
82
|
+
key: "refused-1",
|
|
83
|
+
filename: "site-survey.mov",
|
|
84
|
+
sizeBytes: 32_925_696,
|
|
85
|
+
state: {
|
|
86
|
+
status: "failed",
|
|
87
|
+
reason: OVER_LIMIT_REASON,
|
|
88
|
+
retryable: false,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
render: (args) => {
|
|
94
|
+
const [items, setItems] = useState(args.items);
|
|
95
|
+
return (
|
|
96
|
+
<ComposeAttachments
|
|
97
|
+
{...args}
|
|
98
|
+
items={items}
|
|
99
|
+
onRemove={(key) => {
|
|
100
|
+
args.onRemove(key);
|
|
101
|
+
setItems((current) => current.filter((item) => item.key !== key));
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
play: async ({ args, canvasElement }) => {
|
|
107
|
+
const canvas = within(canvasElement);
|
|
108
|
+
await expect(canvas.getByRole("alert")).toHaveTextContent(
|
|
109
|
+
OVER_LIMIT_REASON,
|
|
110
|
+
);
|
|
111
|
+
await expect(
|
|
112
|
+
canvas.queryByRole("button", { name: "Try again" }),
|
|
113
|
+
).not.toBeInTheDocument();
|
|
114
|
+
await userEvent.click(
|
|
115
|
+
canvas.getByRole("button", { name: "Remove site-survey.mov" }),
|
|
116
|
+
);
|
|
117
|
+
await expect(args.onRemove).toHaveBeenCalledWith("refused-1");
|
|
118
|
+
await expect(canvas.queryByRole("alert")).not.toBeInTheDocument();
|
|
119
|
+
await expect(canvas.getAllByTestId("compose-attachment")).toHaveLength(1);
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const UploadFailed: Story = {
|
|
124
|
+
name: "Failed — the upload dropped, and can be tried again",
|
|
125
|
+
args: {
|
|
126
|
+
items: [
|
|
127
|
+
{
|
|
128
|
+
key: "att-4",
|
|
129
|
+
filename: "contract.pdf",
|
|
130
|
+
sizeBytes: 1_204_224,
|
|
131
|
+
state: {
|
|
132
|
+
status: "failed",
|
|
133
|
+
reason:
|
|
134
|
+
'"contract.pdf" did not finish uploading: the connection dropped. Try again.',
|
|
135
|
+
retryable: true,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
play: async ({ args, canvasElement }) => {
|
|
141
|
+
const canvas = within(canvasElement);
|
|
142
|
+
await userEvent.click(canvas.getByRole("button", { name: "Try again" }));
|
|
143
|
+
await expect(args.onRetry).toHaveBeenCalledWith("att-4");
|
|
144
|
+
},
|
|
145
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { AlertCircle, Loader2, Paperclip, X } from "lucide-react";
|
|
2
|
+
import { formatByteSize } from "../lib/attachment-file.js";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Where one file on a draft stands. A refusal cannot be built without the
|
|
7
|
+
* sentence that says why, and says whether pressing again can change it: a
|
|
8
|
+
* file over the cap stays over the cap, a dropped connection may not.
|
|
9
|
+
*/
|
|
10
|
+
export type ComposeAttachmentState =
|
|
11
|
+
| { status: "uploading" }
|
|
12
|
+
| { status: "attached" }
|
|
13
|
+
| { status: "failed"; reason: string; retryable: boolean };
|
|
14
|
+
|
|
15
|
+
export interface ComposeAttachmentItem {
|
|
16
|
+
key: string;
|
|
17
|
+
filename: string;
|
|
18
|
+
sizeBytes: number;
|
|
19
|
+
state: ComposeAttachmentState;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ComposeAttachmentsProps {
|
|
23
|
+
items: readonly ComposeAttachmentItem[];
|
|
24
|
+
onRemove: (key: string) => void;
|
|
25
|
+
onRetry: (key: string) => void;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const StateIcon = ({ state }: { state: ComposeAttachmentState }) => {
|
|
30
|
+
if (state.status === "uploading") {
|
|
31
|
+
return (
|
|
32
|
+
<Loader2
|
|
33
|
+
className="size-4 shrink-0 animate-spin text-fg-subtle"
|
|
34
|
+
aria-hidden
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
if (state.status === "failed") {
|
|
39
|
+
return <AlertCircle className="size-4 shrink-0 text-danger" aria-hidden />;
|
|
40
|
+
}
|
|
41
|
+
return <Paperclip className="size-4 shrink-0 text-fg-subtle" aria-hidden />;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The files a message is going out with, while it is being written: each one's
|
|
46
|
+
* name and size, whether it has arrived, and a control that takes it off.
|
|
47
|
+
* Nothing is dropped quietly — a file the server refused stays in the list with
|
|
48
|
+
* the reason until it is removed.
|
|
49
|
+
*/
|
|
50
|
+
export function ComposeAttachments({
|
|
51
|
+
items,
|
|
52
|
+
onRemove,
|
|
53
|
+
onRetry,
|
|
54
|
+
className,
|
|
55
|
+
}: ComposeAttachmentsProps) {
|
|
56
|
+
if (items.length === 0) return null;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ul
|
|
60
|
+
aria-label="Attached files"
|
|
61
|
+
data-testid="compose-attachments"
|
|
62
|
+
className={cn("flex flex-col gap-1 px-3 py-2", className)}
|
|
63
|
+
>
|
|
64
|
+
{items.map((item) => (
|
|
65
|
+
<li
|
|
66
|
+
key={item.key}
|
|
67
|
+
data-testid="compose-attachment"
|
|
68
|
+
data-state={item.state.status}
|
|
69
|
+
className={cn(
|
|
70
|
+
"rounded-sm border bg-surface",
|
|
71
|
+
item.state.status === "failed" ? "border-danger/40" : "border-line",
|
|
72
|
+
)}
|
|
73
|
+
>
|
|
74
|
+
<div className="flex items-center gap-2 px-2 py-1.5">
|
|
75
|
+
<StateIcon state={item.state} />
|
|
76
|
+
<span className="min-w-0 flex-1">
|
|
77
|
+
<bdi
|
|
78
|
+
className="block truncate text-sm text-fg"
|
|
79
|
+
title={item.filename}
|
|
80
|
+
>
|
|
81
|
+
{item.filename}
|
|
82
|
+
</bdi>
|
|
83
|
+
<span className="block text-2xs text-fg-subtle">
|
|
84
|
+
{formatByteSize(item.sizeBytes)}
|
|
85
|
+
{item.state.status === "uploading" ? " · Uploading…" : ""}
|
|
86
|
+
</span>
|
|
87
|
+
</span>
|
|
88
|
+
{item.state.status === "failed" && item.state.retryable && (
|
|
89
|
+
<button
|
|
90
|
+
type="button"
|
|
91
|
+
onClick={() => onRetry(item.key)}
|
|
92
|
+
className="text-xs font-medium text-accent hover:underline"
|
|
93
|
+
>
|
|
94
|
+
Try again
|
|
95
|
+
</button>
|
|
96
|
+
)}
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
aria-label={`Remove ${item.filename}`}
|
|
100
|
+
onClick={() => onRemove(item.key)}
|
|
101
|
+
className="inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-sunken hover:text-fg"
|
|
102
|
+
>
|
|
103
|
+
<X className="size-4" aria-hidden />
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
{item.state.status === "failed" && (
|
|
107
|
+
<p
|
|
108
|
+
role="alert"
|
|
109
|
+
data-testid="compose-attachment-error"
|
|
110
|
+
className="border-t border-danger/30 bg-danger-soft px-2 py-1.5 text-xs text-danger"
|
|
111
|
+
>
|
|
112
|
+
{item.state.reason}
|
|
113
|
+
</p>
|
|
114
|
+
)}
|
|
115
|
+
</li>
|
|
116
|
+
))}
|
|
117
|
+
</ul>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
@@ -18,6 +18,8 @@ export interface ComposeFormShellProps {
|
|
|
18
18
|
children: ReactNode;
|
|
19
19
|
/** Quoted reply / forwarded content under the body. */
|
|
20
20
|
quoted?: ReactNode;
|
|
21
|
+
/** The files the message carries, above the action bar. */
|
|
22
|
+
attachments?: ReactNode;
|
|
21
23
|
/** The ComposeActionBar. */
|
|
22
24
|
actionBar: ReactNode;
|
|
23
25
|
layout?: ComposeShellLayout;
|
|
@@ -46,6 +48,7 @@ export function ComposeFormShell({
|
|
|
46
48
|
header,
|
|
47
49
|
children,
|
|
48
50
|
quoted,
|
|
51
|
+
attachments,
|
|
49
52
|
actionBar,
|
|
50
53
|
layout = "fill",
|
|
51
54
|
}: ComposeFormShellProps) {
|
|
@@ -63,6 +66,7 @@ export function ComposeFormShell({
|
|
|
63
66
|
{children}
|
|
64
67
|
{quoted && <div className="shrink-0 px-3 pb-2">{quoted}</div>}
|
|
65
68
|
</div>
|
|
69
|
+
{attachments && <div className="shrink-0">{attachments}</div>}
|
|
66
70
|
{fills ? (
|
|
67
71
|
actionBar
|
|
68
72
|
) : (
|
package/src/index.ts
CHANGED
|
@@ -283,6 +283,12 @@ export {
|
|
|
283
283
|
type ComposeAddressFieldProps,
|
|
284
284
|
type ParsedAddressInput,
|
|
285
285
|
} from "./components/compose-address-field.js";
|
|
286
|
+
export {
|
|
287
|
+
type ComposeAttachmentItem,
|
|
288
|
+
type ComposeAttachmentState,
|
|
289
|
+
ComposeAttachments,
|
|
290
|
+
type ComposeAttachmentsProps,
|
|
291
|
+
} from "./components/compose-attachments.js";
|
|
286
292
|
export { ComposeBodySkeleton } from "./components/compose-body-skeleton.js";
|
|
287
293
|
export {
|
|
288
294
|
ComposeFormShell,
|