@liveblocks/react-ui 2.24.1 → 2.25.0-aiprivatebeta1
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/_private/index.cjs +6 -0
- package/dist/_private/index.cjs.map +1 -1
- package/dist/_private/index.d.cts +166 -10
- package/dist/_private/index.d.ts +166 -10
- package/dist/_private/index.js +3 -0
- package/dist/_private/index.js.map +1 -1
- package/dist/components/AiChat/AiChat.cjs +211 -0
- package/dist/components/AiChat/AiChat.cjs.map +1 -0
- package/dist/components/AiChat/AiChat.js +209 -0
- package/dist/components/AiChat/AiChat.js.map +1 -0
- package/dist/components/internal/AiChatAssistantMessage.cjs +353 -0
- package/dist/components/internal/AiChatAssistantMessage.cjs.map +1 -0
- package/dist/components/internal/AiChatAssistantMessage.js +351 -0
- package/dist/components/internal/AiChatAssistantMessage.js.map +1 -0
- package/dist/components/internal/AiChatComposer.cjs +385 -0
- package/dist/components/internal/AiChatComposer.cjs.map +1 -0
- package/dist/components/internal/AiChatComposer.js +379 -0
- package/dist/components/internal/AiChatComposer.js.map +1 -0
- package/dist/components/internal/AiChatUserMessage.cjs +187 -0
- package/dist/components/internal/AiChatUserMessage.cjs.map +1 -0
- package/dist/components/internal/AiChatUserMessage.js +185 -0
- package/dist/components/internal/AiChatUserMessage.js.map +1 -0
- package/dist/icons/Copy.cjs +26 -0
- package/dist/icons/Copy.cjs.map +1 -0
- package/dist/icons/Copy.js +24 -0
- package/dist/icons/Copy.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -4
- package/dist/index.d.ts +65 -4
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/overrides.cjs +13 -1
- package/dist/overrides.cjs.map +1 -1
- package/dist/overrides.js +13 -1
- package/dist/overrides.js.map +1 -1
- package/dist/primitives/Chat/Composer/index.cjs +323 -0
- package/dist/primitives/Chat/Composer/index.cjs.map +1 -0
- package/dist/primitives/Chat/Composer/index.js +315 -0
- package/dist/primitives/Chat/Composer/index.js.map +1 -0
- package/dist/primitives/index.cjs +9 -4
- package/dist/primitives/index.cjs.map +1 -1
- package/dist/primitives/index.d.cts +108 -2
- package/dist/primitives/index.d.ts +108 -2
- package/dist/primitives/index.js +1 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/internal/Collapsible.cjs +99 -0
- package/dist/primitives/internal/Collapsible.cjs.map +1 -0
- package/dist/primitives/internal/Collapsible.js +95 -0
- package/dist/primitives/internal/Collapsible.js.map +1 -0
- package/dist/primitives/internal/Markdown.cjs +444 -0
- package/dist/primitives/internal/Markdown.cjs.map +1 -0
- package/dist/primitives/internal/Markdown.js +440 -0
- package/dist/primitives/internal/Markdown.js.map +1 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +5 -5
- package/src/styles/constants.css +4 -0
- package/src/styles/dark/index.css +1 -0
- package/src/styles/index.css +510 -0
- package/styles/dark/attributes.css +1 -1
- package/styles/dark/attributes.css.map +1 -1
- package/styles/dark/media-query.css +1 -1
- package/styles/dark/media-query.css.map +1 -1
- package/styles.css +1 -1
- package/styles.css.map +1 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { nanoid, kInternal, HttpError } from '@liveblocks/core';
|
|
3
|
+
import { useClient } from '@liveblocks/react';
|
|
4
|
+
import { useLayoutEffect } from '@liveblocks/react/_private';
|
|
5
|
+
import { createContext, forwardRef, useRef, useState, useCallback, useImperativeHandle, useContext, useEffect, useMemo } from 'react';
|
|
6
|
+
import { createEditor, Transforms, Editor as Editor$1 } from 'slate';
|
|
7
|
+
import { withHistory } from 'slate-history';
|
|
8
|
+
import { withReact, ReactEditor, Slate, Editable } from 'slate-react';
|
|
9
|
+
import { withNormalize } from '../../../slate/plugins/normalize.js';
|
|
10
|
+
import { isEmpty } from '../../../slate/utils/is-empty.js';
|
|
11
|
+
import { AttachmentTooLargeError } from '../../Composer/utils.js';
|
|
12
|
+
|
|
13
|
+
const ComposerContext = createContext(null);
|
|
14
|
+
const MAX_ATTACHMENTS = 10;
|
|
15
|
+
const MAX_ATTACHMENT_SIZE = 1024 * 1024 * 1024;
|
|
16
|
+
const Form = forwardRef(
|
|
17
|
+
({ onComposerSubmit, onSubmit, disabled, chatId, ...props }, forwardedRef) => {
|
|
18
|
+
const formRef = useRef(null);
|
|
19
|
+
const fileInputRef = useRef(null);
|
|
20
|
+
const editorRef = useRef(
|
|
21
|
+
null
|
|
22
|
+
);
|
|
23
|
+
if (editorRef.current === null) {
|
|
24
|
+
editorRef.current = withNormalize(withHistory(withReact(createEditor())));
|
|
25
|
+
}
|
|
26
|
+
const editor = editorRef.current;
|
|
27
|
+
const [isEditorEmpty, setIsEditorEmpty] = useState(true);
|
|
28
|
+
const [attachments, setAttachments] = useState([]);
|
|
29
|
+
const handleSubmit = useCallback(
|
|
30
|
+
(event) => {
|
|
31
|
+
if (disabled || isEmpty(editor, editor.children))
|
|
32
|
+
return;
|
|
33
|
+
onSubmit?.(event);
|
|
34
|
+
if (onComposerSubmit === void 0 || event.isDefaultPrevented()) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const content = editor.children.map((block) => {
|
|
39
|
+
if ("type" in block && block.type === "paragraph") {
|
|
40
|
+
return block.children.map((child) => {
|
|
41
|
+
if ("text" in child) {
|
|
42
|
+
return child.text;
|
|
43
|
+
}
|
|
44
|
+
return "";
|
|
45
|
+
}).join("");
|
|
46
|
+
}
|
|
47
|
+
return "";
|
|
48
|
+
}).join("\n");
|
|
49
|
+
onComposerSubmit({ text: content }, event);
|
|
50
|
+
if (event.isDefaultPrevented()) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
Transforms.delete(editor, {
|
|
55
|
+
at: {
|
|
56
|
+
anchor: Editor$1.start(editor, []),
|
|
57
|
+
focus: Editor$1.end(editor, [])
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
[disabled, editor, onSubmit, onComposerSubmit]
|
|
62
|
+
);
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
setIsEditorEmpty(isEmpty(editor, editor.children));
|
|
65
|
+
}, [editor]);
|
|
66
|
+
const handleEditorValueChange = useCallback(() => {
|
|
67
|
+
setIsEditorEmpty(isEmpty(editor, editor.children));
|
|
68
|
+
}, [editor]);
|
|
69
|
+
const requestFormSubmit = useCallback(() => {
|
|
70
|
+
if (isEmpty(editor, editor.children))
|
|
71
|
+
return;
|
|
72
|
+
if (attachments.some((attachment) => attachment.status === "uploading")) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
requestAnimationFrame(() => {
|
|
76
|
+
if (formRef.current === null)
|
|
77
|
+
return;
|
|
78
|
+
if (typeof formRef.current.requestSubmit === "function") {
|
|
79
|
+
return formRef.current.requestSubmit();
|
|
80
|
+
}
|
|
81
|
+
const submitter = document.createElement("input");
|
|
82
|
+
submitter.type = "submit";
|
|
83
|
+
submitter.hidden = true;
|
|
84
|
+
formRef.current.appendChild(submitter);
|
|
85
|
+
submitter.click();
|
|
86
|
+
formRef.current.removeChild(submitter);
|
|
87
|
+
});
|
|
88
|
+
}, [editor, attachments]);
|
|
89
|
+
const handleAttachFiles = useCallback(() => {
|
|
90
|
+
if (disabled)
|
|
91
|
+
return;
|
|
92
|
+
fileInputRef.current?.click();
|
|
93
|
+
}, [disabled]);
|
|
94
|
+
const handleRemoveAttachment = useCallback((id) => {
|
|
95
|
+
setAttachments(
|
|
96
|
+
(attachments2) => attachments2.filter((attachment) => attachment.id !== id)
|
|
97
|
+
);
|
|
98
|
+
}, []);
|
|
99
|
+
useImperativeHandle(
|
|
100
|
+
forwardedRef,
|
|
101
|
+
() => formRef.current,
|
|
102
|
+
[]
|
|
103
|
+
);
|
|
104
|
+
const client = useClient();
|
|
105
|
+
return /* @__PURE__ */ jsxs(ComposerContext.Provider, {
|
|
106
|
+
value: {
|
|
107
|
+
chatId,
|
|
108
|
+
editor,
|
|
109
|
+
onEditorValueChange: handleEditorValueChange,
|
|
110
|
+
isEditorEmpty,
|
|
111
|
+
requestFormSubmit,
|
|
112
|
+
disabled: disabled || false,
|
|
113
|
+
attachments,
|
|
114
|
+
onAttachFiles: handleAttachFiles,
|
|
115
|
+
onRemoveAttachment: handleRemoveAttachment,
|
|
116
|
+
numOfAttachments: attachments.length
|
|
117
|
+
},
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx("form", {
|
|
120
|
+
onSubmit: handleSubmit,
|
|
121
|
+
...props,
|
|
122
|
+
ref: formRef
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ jsx("input", {
|
|
125
|
+
type: "file",
|
|
126
|
+
multiple: true,
|
|
127
|
+
accept: "image/png, image/jpeg",
|
|
128
|
+
ref: fileInputRef,
|
|
129
|
+
onClick: (event) => {
|
|
130
|
+
event.stopPropagation();
|
|
131
|
+
},
|
|
132
|
+
onChange: function(event) {
|
|
133
|
+
if (disabled)
|
|
134
|
+
return;
|
|
135
|
+
if (event.target.files === null)
|
|
136
|
+
return;
|
|
137
|
+
if (event.target.files.length === 0)
|
|
138
|
+
return;
|
|
139
|
+
for (const file of Array.from(event.target.files).slice(
|
|
140
|
+
0,
|
|
141
|
+
MAX_ATTACHMENTS - attachments.length
|
|
142
|
+
)) {
|
|
143
|
+
const id = `at_${nanoid()}`;
|
|
144
|
+
if (file.size > MAX_ATTACHMENT_SIZE) {
|
|
145
|
+
setAttachments((attachments2) => [
|
|
146
|
+
...attachments2,
|
|
147
|
+
{
|
|
148
|
+
id,
|
|
149
|
+
file,
|
|
150
|
+
status: "error",
|
|
151
|
+
error: new AttachmentTooLargeError("File is too large.")
|
|
152
|
+
}
|
|
153
|
+
]);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
setAttachments((attachments2) => [
|
|
157
|
+
...attachments2,
|
|
158
|
+
{
|
|
159
|
+
id,
|
|
160
|
+
file,
|
|
161
|
+
status: "uploading"
|
|
162
|
+
}
|
|
163
|
+
]);
|
|
164
|
+
client[kInternal].httpClient.uploadChatAttachment({
|
|
165
|
+
chatId,
|
|
166
|
+
attachment: {
|
|
167
|
+
id,
|
|
168
|
+
file
|
|
169
|
+
}
|
|
170
|
+
}).then(() => {
|
|
171
|
+
setAttachments(
|
|
172
|
+
(attachments2) => attachments2.map(
|
|
173
|
+
(attachment) => attachment.id === id ? { ...attachment, status: "uploaded" } : attachment
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
}).catch((error) => {
|
|
177
|
+
if (error instanceof Error) {
|
|
178
|
+
setAttachments(
|
|
179
|
+
(attachments2) => attachments2.map(
|
|
180
|
+
(attachment) => attachment.id === id ? {
|
|
181
|
+
...attachment,
|
|
182
|
+
status: "error",
|
|
183
|
+
error: error instanceof HttpError && error.status === 413 ? new AttachmentTooLargeError(
|
|
184
|
+
"File is too large"
|
|
185
|
+
) : error
|
|
186
|
+
} : attachment
|
|
187
|
+
)
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
event.target.value = "";
|
|
193
|
+
},
|
|
194
|
+
tabIndex: -1,
|
|
195
|
+
style: { display: "none" }
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
const Editor = forwardRef(
|
|
202
|
+
({ defaultValue = "", onKeyDown, disabled, autoFocus, ...props }, forwardedRef) => {
|
|
203
|
+
const context = useContext(ComposerContext);
|
|
204
|
+
if (context === null) {
|
|
205
|
+
throw new Error("Editor must be a descendant of Form.");
|
|
206
|
+
}
|
|
207
|
+
const {
|
|
208
|
+
editor,
|
|
209
|
+
onEditorValueChange,
|
|
210
|
+
requestFormSubmit,
|
|
211
|
+
disabled: isFormDisabled
|
|
212
|
+
} = context;
|
|
213
|
+
const handleKeyDown = useCallback(
|
|
214
|
+
(event) => {
|
|
215
|
+
onKeyDown?.(event);
|
|
216
|
+
if (event.isDefaultPrevented())
|
|
217
|
+
return;
|
|
218
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
219
|
+
event.preventDefault();
|
|
220
|
+
requestFormSubmit();
|
|
221
|
+
} else if (event.key === "Enter" && event.shiftKey) {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
editor.insertBreak();
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
[editor, onKeyDown, requestFormSubmit]
|
|
227
|
+
);
|
|
228
|
+
useImperativeHandle(
|
|
229
|
+
forwardedRef,
|
|
230
|
+
() => ReactEditor.toDOMNode(editor, editor),
|
|
231
|
+
[editor]
|
|
232
|
+
);
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
if (!autoFocus)
|
|
235
|
+
return;
|
|
236
|
+
try {
|
|
237
|
+
if (!ReactEditor.isFocused(editor)) {
|
|
238
|
+
Transforms.select(editor, Editor$1.end(editor, []));
|
|
239
|
+
ReactEditor.focus(editor);
|
|
240
|
+
}
|
|
241
|
+
} catch {
|
|
242
|
+
}
|
|
243
|
+
}, [editor, autoFocus]);
|
|
244
|
+
const initialValue = useMemo(() => {
|
|
245
|
+
return defaultValue.split("\n").map((text) => ({ type: "paragraph", children: [{ text }] }));
|
|
246
|
+
}, [defaultValue]);
|
|
247
|
+
return /* @__PURE__ */ jsx(Slate, {
|
|
248
|
+
editor,
|
|
249
|
+
initialValue,
|
|
250
|
+
onValueChange: onEditorValueChange,
|
|
251
|
+
children: /* @__PURE__ */ jsx(Editable, {
|
|
252
|
+
enterKeyHint: "send",
|
|
253
|
+
autoCapitalize: "sentences",
|
|
254
|
+
onKeyDown: handleKeyDown,
|
|
255
|
+
"data-disabled": disabled || isFormDisabled || void 0,
|
|
256
|
+
...props,
|
|
257
|
+
readOnly: disabled || isFormDisabled,
|
|
258
|
+
disabled: disabled || isFormDisabled,
|
|
259
|
+
renderPlaceholder: function({ attributes, children }) {
|
|
260
|
+
const { opacity: _opacity, ...style } = attributes.style;
|
|
261
|
+
return /* @__PURE__ */ jsx("span", {
|
|
262
|
+
...attributes,
|
|
263
|
+
style,
|
|
264
|
+
"data-placeholder": "",
|
|
265
|
+
children
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
const Submit = forwardRef(
|
|
273
|
+
({ disabled, ...props }, forwardedRef) => {
|
|
274
|
+
const context = useContext(ComposerContext);
|
|
275
|
+
if (context === null) {
|
|
276
|
+
throw new Error("Submit must be a descendant of Form.");
|
|
277
|
+
}
|
|
278
|
+
const { disabled: isFormDisabled, isEditorEmpty, attachments } = context;
|
|
279
|
+
return /* @__PURE__ */ jsx("button", {
|
|
280
|
+
type: "submit",
|
|
281
|
+
...props,
|
|
282
|
+
ref: forwardedRef,
|
|
283
|
+
disabled: disabled || isFormDisabled || isEditorEmpty || attachments.some((attachment) => attachment.status === "uploading")
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
const AttachFiles = forwardRef(
|
|
288
|
+
({ onClick, disabled, ...props }, forwardedRef) => {
|
|
289
|
+
const context = useContext(ComposerContext);
|
|
290
|
+
if (context === null) {
|
|
291
|
+
throw new Error("AttachFiles must be a descendant of Form.");
|
|
292
|
+
}
|
|
293
|
+
const {
|
|
294
|
+
disabled: isFormDisabled,
|
|
295
|
+
onAttachFiles,
|
|
296
|
+
numOfAttachments
|
|
297
|
+
} = context;
|
|
298
|
+
return /* @__PURE__ */ jsx("button", {
|
|
299
|
+
type: "button",
|
|
300
|
+
...props,
|
|
301
|
+
onClick: function(event) {
|
|
302
|
+
onClick?.(event);
|
|
303
|
+
if (event.isDefaultPrevented())
|
|
304
|
+
return;
|
|
305
|
+
onAttachFiles();
|
|
306
|
+
},
|
|
307
|
+
onPointerDown: (event) => event.preventDefault(),
|
|
308
|
+
ref: forwardedRef,
|
|
309
|
+
disabled: isFormDisabled || disabled || numOfAttachments >= MAX_ATTACHMENTS
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
export { AttachFiles, ComposerContext, Editor, Form, MAX_ATTACHMENTS, MAX_ATTACHMENT_SIZE, Submit };
|
|
315
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/primitives/Chat/Composer/index.tsx"],"sourcesContent":["import { HttpError, kInternal, nanoid } from \"@liveblocks/core\";\nimport { useClient } from \"@liveblocks/react\";\nimport { useLayoutEffect } from \"@liveblocks/react/_private\";\nimport type {\n ButtonHTMLAttributes,\n FormEvent,\n FormHTMLAttributes,\n HTMLAttributes,\n KeyboardEvent,\n} from \"react\";\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { BaseEditor, Descendant } from \"slate\";\nimport { createEditor, Editor as SlateEditor, Transforms } from \"slate\";\nimport type { HistoryEditor } from \"slate-history\";\nimport { withHistory } from \"slate-history\";\nimport { Editable, ReactEditor, Slate, withReact } from \"slate-react\";\n\nimport { withNormalize } from \"../../../slate/plugins/normalize\";\nimport { isEmpty } from \"../../../slate/utils/is-empty\";\nimport { AttachmentTooLargeError } from \"../../Composer/utils\";\n\n/* -------------------------------------------------------------------------------------------------\n * Form\n * -----------------------------------------------------------------------------------------------*/\nexport const ComposerContext = createContext<{\n chatId: string;\n\n editor: SlateEditor;\n onEditorValueChange: (value: Descendant[]) => void;\n isEditorEmpty: boolean;\n\n attachments: ({\n id: string;\n file: File;\n } & (\n | {\n status: \"uploading\" | \"uploaded\";\n }\n | {\n status: \"error\";\n error: Error;\n }\n ))[];\n onAttachFiles: () => void;\n onRemoveAttachment: (id: string) => void;\n numOfAttachments: number;\n\n requestFormSubmit: () => void;\n disabled: boolean;\n} | null>(null);\n\nexport const MAX_ATTACHMENTS = 10;\nexport const MAX_ATTACHMENT_SIZE = 1024 * 1024 * 1024; // 1 GB\n\nexport type FormProps = FormHTMLAttributes<HTMLFormElement> & {\n /**\n * The event handler called when a chat message is submitted.\n */\n onComposerSubmit?: (\n message: {\n /**\n * The submitted message text.\n */\n text: string;\n },\n event: FormEvent<HTMLFormElement>\n ) => void;\n /**\n * Whether the composer is disabled.\n */\n disabled?: boolean;\n /**\n * The id of the chat the composer belongs to.\n */\n chatId: string;\n};\n\n/**\n * Surrounds the chat composer's content and handles submissions.\n *\n * @example\n * <Form onComposerSubmit={({ text }) => {}}>\n *\t <Editor />\n * <Submit />\n * </Form>\n */\nexport const Form = forwardRef<HTMLFormElement, FormProps>(\n (\n { onComposerSubmit, onSubmit, disabled, chatId, ...props },\n forwardedRef\n ) => {\n const formRef = useRef<HTMLFormElement | null>(null);\n const fileInputRef = useRef<HTMLInputElement | null>(null);\n\n const editorRef = useRef<(BaseEditor & ReactEditor & HistoryEditor) | null>(\n null\n );\n if (editorRef.current === null) {\n editorRef.current = withNormalize(withHistory(withReact(createEditor())));\n }\n const editor = editorRef.current;\n\n const [isEditorEmpty, setIsEditorEmpty] = useState(true);\n\n const [attachments, setAttachments] = useState<\n ({\n id: string;\n file: File;\n } & (\n | {\n status: \"uploading\" | \"uploaded\";\n }\n | {\n status: \"error\";\n error: Error;\n }\n ))[]\n >([]);\n\n const handleSubmit = useCallback(\n (event: FormEvent<HTMLFormElement>) => {\n if (disabled || isEmpty(editor, editor.children)) return;\n\n onSubmit?.(event);\n\n if (onComposerSubmit === undefined || event.isDefaultPrevented()) {\n event.preventDefault();\n return;\n }\n\n // Extract the text content from the editor.\n const content = editor.children\n .map((block) => {\n if (\"type\" in block && block.type === \"paragraph\") {\n return block.children\n .map((child) => {\n if (\"text\" in child) {\n return child.text;\n }\n return \"\";\n })\n .join(\"\");\n }\n return \"\";\n })\n .join(\"\\n\");\n\n onComposerSubmit({ text: content }, event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n event.preventDefault();\n\n // Clear the editor after dispatching the message.\n Transforms.delete(editor, {\n at: {\n anchor: SlateEditor.start(editor, []),\n focus: SlateEditor.end(editor, []),\n },\n });\n },\n [disabled, editor, onSubmit, onComposerSubmit]\n );\n\n useLayoutEffect(() => {\n setIsEditorEmpty(isEmpty(editor, editor.children));\n }, [editor]);\n\n const handleEditorValueChange = useCallback(() => {\n setIsEditorEmpty(isEmpty(editor, editor.children));\n }, [editor]);\n\n const requestFormSubmit = useCallback(() => {\n if (isEmpty(editor, editor.children)) return;\n\n if (attachments.some((attachment) => attachment.status === \"uploading\")) {\n return;\n }\n\n // We need to wait for the next frame in some cases like when composing diacritics,\n // we want any native handling to be done first while still being handled on `keydown`.\n requestAnimationFrame(() => {\n if (formRef.current === null) return;\n if (typeof formRef.current.requestSubmit === \"function\") {\n return formRef.current.requestSubmit();\n }\n const submitter = document.createElement(\"input\");\n submitter.type = \"submit\";\n submitter.hidden = true;\n formRef.current.appendChild(submitter);\n submitter.click();\n formRef.current.removeChild(submitter);\n });\n }, [editor, attachments]);\n\n const handleAttachFiles = useCallback(() => {\n if (disabled) return;\n fileInputRef.current?.click();\n }, [disabled]);\n\n const handleRemoveAttachment = useCallback((id: string) => {\n setAttachments((attachments) =>\n attachments.filter((attachment) => attachment.id !== id)\n );\n }, []);\n\n useImperativeHandle<HTMLFormElement | null, HTMLFormElement | null>(\n forwardedRef,\n () => formRef.current,\n []\n );\n\n const client = useClient();\n\n return (\n <ComposerContext.Provider\n value={{\n chatId,\n editor,\n onEditorValueChange: handleEditorValueChange,\n isEditorEmpty,\n requestFormSubmit,\n disabled: disabled || false,\n attachments,\n onAttachFiles: handleAttachFiles,\n onRemoveAttachment: handleRemoveAttachment,\n numOfAttachments: attachments.length,\n }}\n >\n <form onSubmit={handleSubmit} {...props} ref={formRef} />\n <input\n type=\"file\"\n multiple\n accept=\"image/png, image/jpeg\"\n ref={fileInputRef}\n onClick={(event) => {\n event.stopPropagation();\n }}\n onChange={function (event) {\n if (disabled) return;\n\n if (event.target.files === null) return;\n if (event.target.files.length === 0) return;\n\n for (const file of Array.from(event.target.files).slice(\n 0,\n MAX_ATTACHMENTS - attachments.length\n )) {\n const id = `at_${nanoid()}`;\n if (file.size > MAX_ATTACHMENT_SIZE) {\n setAttachments((attachments) => [\n ...attachments,\n {\n id,\n file,\n status: \"error\",\n error: new AttachmentTooLargeError(\"File is too large.\"),\n },\n ]);\n continue;\n }\n\n setAttachments((attachments) => [\n ...attachments,\n {\n id,\n file,\n status: \"uploading\",\n },\n ]);\n\n client[kInternal].httpClient\n .uploadChatAttachment({\n chatId,\n attachment: {\n id,\n file,\n },\n })\n .then(() => {\n setAttachments((attachments) =>\n attachments.map((attachment) =>\n attachment.id === id\n ? { ...attachment, status: \"uploaded\" }\n : attachment\n )\n );\n })\n .catch((error) => {\n if (error instanceof Error) {\n setAttachments((attachments) =>\n attachments.map((attachment) =>\n attachment.id === id\n ? {\n ...attachment,\n status: \"error\",\n error:\n error instanceof HttpError &&\n error.status === 413\n ? new AttachmentTooLargeError(\n \"File is too large\"\n )\n : error,\n }\n : attachment\n )\n );\n }\n });\n }\n\n event.target.value = \"\";\n }}\n tabIndex={-1}\n style={{ display: \"none\" }}\n />\n </ComposerContext.Provider>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Editor\n * -----------------------------------------------------------------------------------------------*/\nexport type EditorProps = Omit<\n HTMLAttributes<HTMLDivElement>,\n \"defaultValue\"\n> & {\n /**\n * The editor's initial value.\n */\n defaultValue?: string;\n /**\n * The text to display when the editor is empty.\n */\n placeholder?: string;\n /**\n * Whether the editor is disabled.\n */\n disabled?: boolean;\n /**\n * Whether to focus the editor on mount.\n */\n autoFocus?: boolean;\n};\n\n/**\n * Displays the chat composer's editor.\n *\n * @example\n * <Editor placeholder=\"Write a message…\" />\n */\nexport const Editor = forwardRef<HTMLDivElement, EditorProps>(\n (\n { defaultValue = \"\", onKeyDown, disabled, autoFocus, ...props },\n forwardedRef\n ) => {\n const context = useContext(ComposerContext);\n if (context === null) {\n throw new Error(\"Editor must be a descendant of Form.\");\n }\n\n const {\n editor,\n onEditorValueChange,\n requestFormSubmit,\n disabled: isFormDisabled,\n } = context;\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.isDefaultPrevented()) return;\n\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n requestFormSubmit();\n } else if (event.key === \"Enter\" && event.shiftKey) {\n event.preventDefault();\n editor.insertBreak();\n }\n },\n [editor, onKeyDown, requestFormSubmit]\n );\n\n useImperativeHandle(\n forwardedRef,\n () => ReactEditor.toDOMNode(editor, editor) as HTMLDivElement,\n [editor]\n );\n\n useEffect(() => {\n if (!autoFocus) return;\n\n try {\n if (!ReactEditor.isFocused(editor)) {\n Transforms.select(editor, SlateEditor.end(editor, []));\n ReactEditor.focus(editor);\n }\n } catch {\n // Slate's DOM-specific methods will throw if the editor's DOM node no longer exists. This action doesn't make sense on an unmounted editor so we can safely ignore it.\n }\n }, [editor, autoFocus]);\n\n const initialValue: { type: \"paragraph\"; children: { text: string }[] }[] =\n useMemo(() => {\n return defaultValue\n .split(\"\\n\")\n .map((text) => ({ type: \"paragraph\", children: [{ text }] }));\n }, [defaultValue]);\n\n return (\n <Slate\n editor={editor}\n initialValue={initialValue}\n onValueChange={onEditorValueChange}\n >\n <Editable\n enterKeyHint=\"send\"\n autoCapitalize=\"sentences\"\n onKeyDown={handleKeyDown}\n data-disabled={disabled || isFormDisabled || undefined}\n {...props}\n readOnly={disabled || isFormDisabled}\n disabled={disabled || isFormDisabled}\n renderPlaceholder={function ({ attributes, children }) {\n const { opacity: _opacity, ...style } = attributes.style;\n return (\n <span {...attributes} style={style} data-placeholder=\"\">\n {children}\n </span>\n );\n }}\n />\n </Slate>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Submit\n * -----------------------------------------------------------------------------------------------*/\nexport type SubmitProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * A button to submit a chat message.\n *\n * @example\n * <ChatComposer.Submit>Send</ChatComposer.Submit>\n */\nexport const Submit = forwardRef<HTMLButtonElement, SubmitProps>(\n ({ disabled, ...props }, forwardedRef) => {\n const context = useContext(ComposerContext);\n if (context === null) {\n throw new Error(\"Submit must be a descendant of Form.\");\n }\n\n const { disabled: isFormDisabled, isEditorEmpty, attachments } = context;\n\n return (\n <button\n type=\"submit\"\n {...props}\n ref={forwardedRef}\n disabled={\n disabled ||\n isFormDisabled ||\n isEditorEmpty ||\n attachments.some((attachment) => attachment.status === \"uploading\")\n }\n />\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AttachFiles\n * -----------------------------------------------------------------------------------------------*/\nexport type AttachFilesProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * A button which opens a file picker to create attachments.\n *\n * @example\n * <Composer.AttachFiles>Attach files</Composer.AttachFiles>\n */\nexport const AttachFiles = forwardRef<HTMLButtonElement, AttachFilesProps>(\n ({ onClick, disabled, ...props }, forwardedRef) => {\n const context = useContext(ComposerContext);\n if (context === null) {\n throw new Error(\"AttachFiles must be a descendant of Form.\");\n }\n\n const {\n disabled: isFormDisabled,\n onAttachFiles,\n numOfAttachments,\n } = context;\n\n return (\n <button\n type=\"button\"\n {...props}\n onClick={function (event) {\n onClick?.(event);\n if (event.isDefaultPrevented()) return;\n onAttachFiles();\n }}\n onPointerDown={(event) => event.preventDefault()}\n ref={forwardedRef}\n disabled={\n isFormDisabled || disabled || numOfAttachments >= MAX_ATTACHMENTS\n }\n />\n );\n }\n);\n"],"names":["SlateEditor","attachments"],"mappings":";;;;;;;;;;;;AAkCa,MAAA,eAAA,GAAkB,cAyBrB,IAAI,EAAA;AAEP,MAAM,eAAkB,GAAA,GAAA;AAClB,MAAA,mBAAA,GAAsB,OAAO,IAAO,GAAA,KAAA;AAkC1C,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/index.cjs');
|
|
4
|
+
var index$1 = require('./Comment/index.cjs');
|
|
5
|
+
var index$2 = require('./Composer/index.cjs');
|
|
5
6
|
var contexts = require('./Composer/contexts.cjs');
|
|
6
7
|
var utils = require('./Composer/utils.cjs');
|
|
7
8
|
var FileSize = require('./FileSize.cjs');
|
|
@@ -9,8 +10,12 @@ var Timestamp = require('./Timestamp.cjs');
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
13
|
+
exports.ChatComposerAttachFiles = index.AttachFiles;
|
|
14
|
+
exports.ChatComposerEditor = index.Editor;
|
|
15
|
+
exports.ChatComposerForm = index.Form;
|
|
16
|
+
exports.ChatComposerSubmit = index.Submit;
|
|
17
|
+
exports.Comment = index$1;
|
|
18
|
+
exports.Composer = index$2;
|
|
14
19
|
exports.useComposer = contexts.useComposer;
|
|
15
20
|
exports.AttachmentTooLargeError = utils.AttachmentTooLargeError;
|
|
16
21
|
exports.FileSize = FileSize.FileSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef, FormHTMLAttributes, FormEvent, HTMLAttributes, ButtonHTMLAttributes, ReactNode, ComponentType } from 'react';
|
|
3
3
|
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
4
|
|
|
5
5
|
type Direction = "ltr" | "rtl";
|
|
@@ -22,6 +22,112 @@ type ComposerBodyMarks = {
|
|
|
22
22
|
[K in ComposerBodyMark]: boolean;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
type FormProps = FormHTMLAttributes<HTMLFormElement> & {
|
|
26
|
+
/**
|
|
27
|
+
* The event handler called when a chat message is submitted.
|
|
28
|
+
*/
|
|
29
|
+
onComposerSubmit?: (message: {
|
|
30
|
+
/**
|
|
31
|
+
* The submitted message text.
|
|
32
|
+
*/
|
|
33
|
+
text: string;
|
|
34
|
+
}, event: FormEvent<HTMLFormElement>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the composer is disabled.
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The id of the chat the composer belongs to.
|
|
41
|
+
*/
|
|
42
|
+
chatId: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Surrounds the chat composer's content and handles submissions.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <Form onComposerSubmit={({ text }) => {}}>
|
|
49
|
+
* <Editor />
|
|
50
|
+
* <Submit />
|
|
51
|
+
* </Form>
|
|
52
|
+
*/
|
|
53
|
+
declare const Form: react.ForwardRefExoticComponent<FormHTMLAttributes<HTMLFormElement> & {
|
|
54
|
+
/**
|
|
55
|
+
* The event handler called when a chat message is submitted.
|
|
56
|
+
*/
|
|
57
|
+
onComposerSubmit?: (message: {
|
|
58
|
+
/**
|
|
59
|
+
* The submitted message text.
|
|
60
|
+
*/
|
|
61
|
+
text: string;
|
|
62
|
+
}, event: FormEvent<HTMLFormElement>) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the composer is disabled.
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The id of the chat the composer belongs to.
|
|
69
|
+
*/
|
|
70
|
+
chatId: string;
|
|
71
|
+
} & react.RefAttributes<HTMLFormElement>>;
|
|
72
|
+
type EditorProps = Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> & {
|
|
73
|
+
/**
|
|
74
|
+
* The editor's initial value.
|
|
75
|
+
*/
|
|
76
|
+
defaultValue?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The text to display when the editor is empty.
|
|
79
|
+
*/
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the editor is disabled.
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether to focus the editor on mount.
|
|
87
|
+
*/
|
|
88
|
+
autoFocus?: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Displays the chat composer's editor.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* <Editor placeholder="Write a message…" />
|
|
95
|
+
*/
|
|
96
|
+
declare const Editor: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> & {
|
|
97
|
+
/**
|
|
98
|
+
* The editor's initial value.
|
|
99
|
+
*/
|
|
100
|
+
defaultValue?: string;
|
|
101
|
+
/**
|
|
102
|
+
* The text to display when the editor is empty.
|
|
103
|
+
*/
|
|
104
|
+
placeholder?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Whether the editor is disabled.
|
|
107
|
+
*/
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Whether to focus the editor on mount.
|
|
111
|
+
*/
|
|
112
|
+
autoFocus?: boolean;
|
|
113
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
114
|
+
type SubmitProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
115
|
+
/**
|
|
116
|
+
* A button to submit a chat message.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* <ChatComposer.Submit>Send</ChatComposer.Submit>
|
|
120
|
+
*/
|
|
121
|
+
declare const Submit: react.ForwardRefExoticComponent<SubmitProps & react.RefAttributes<HTMLButtonElement>>;
|
|
122
|
+
type AttachFilesProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
123
|
+
/**
|
|
124
|
+
* A button which opens a file picker to create attachments.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* <Composer.AttachFiles>Attach files</Composer.AttachFiles>
|
|
128
|
+
*/
|
|
129
|
+
declare const AttachFiles: react.ForwardRefExoticComponent<AttachFilesProps & react.RefAttributes<HTMLButtonElement>>;
|
|
130
|
+
|
|
25
131
|
type CommentMentionProps = ComponentPropsWithSlot<"span">;
|
|
26
132
|
type CommentBodyMentionProps = {
|
|
27
133
|
/**
|
|
@@ -494,4 +600,4 @@ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children"
|
|
|
494
600
|
*/
|
|
495
601
|
declare const Timestamp: react.ForwardRefExoticComponent<TimestampProps & react.RefAttributes<HTMLTimeElement>>;
|
|
496
602
|
|
|
497
|
-
export { AttachmentTooLargeError, index$1 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
|
603
|
+
export { AttachmentTooLargeError, AttachFiles as ChatComposerAttachFiles, AttachFilesProps as ChatComposerAttachFilesProps, Editor as ChatComposerEditor, EditorProps as ChatComposerEditorProps, Form as ChatComposerForm, FormProps as ChatComposerFormProps, Submit as ChatComposerSubmit, SubmitProps as ChatComposerSubmitProps, index$1 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef, FormHTMLAttributes, FormEvent, HTMLAttributes, ButtonHTMLAttributes, ReactNode, ComponentType } from 'react';
|
|
3
3
|
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
4
|
|
|
5
5
|
type Direction = "ltr" | "rtl";
|
|
@@ -22,6 +22,112 @@ type ComposerBodyMarks = {
|
|
|
22
22
|
[K in ComposerBodyMark]: boolean;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
type FormProps = FormHTMLAttributes<HTMLFormElement> & {
|
|
26
|
+
/**
|
|
27
|
+
* The event handler called when a chat message is submitted.
|
|
28
|
+
*/
|
|
29
|
+
onComposerSubmit?: (message: {
|
|
30
|
+
/**
|
|
31
|
+
* The submitted message text.
|
|
32
|
+
*/
|
|
33
|
+
text: string;
|
|
34
|
+
}, event: FormEvent<HTMLFormElement>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the composer is disabled.
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The id of the chat the composer belongs to.
|
|
41
|
+
*/
|
|
42
|
+
chatId: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Surrounds the chat composer's content and handles submissions.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <Form onComposerSubmit={({ text }) => {}}>
|
|
49
|
+
* <Editor />
|
|
50
|
+
* <Submit />
|
|
51
|
+
* </Form>
|
|
52
|
+
*/
|
|
53
|
+
declare const Form: react.ForwardRefExoticComponent<FormHTMLAttributes<HTMLFormElement> & {
|
|
54
|
+
/**
|
|
55
|
+
* The event handler called when a chat message is submitted.
|
|
56
|
+
*/
|
|
57
|
+
onComposerSubmit?: (message: {
|
|
58
|
+
/**
|
|
59
|
+
* The submitted message text.
|
|
60
|
+
*/
|
|
61
|
+
text: string;
|
|
62
|
+
}, event: FormEvent<HTMLFormElement>) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the composer is disabled.
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The id of the chat the composer belongs to.
|
|
69
|
+
*/
|
|
70
|
+
chatId: string;
|
|
71
|
+
} & react.RefAttributes<HTMLFormElement>>;
|
|
72
|
+
type EditorProps = Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> & {
|
|
73
|
+
/**
|
|
74
|
+
* The editor's initial value.
|
|
75
|
+
*/
|
|
76
|
+
defaultValue?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The text to display when the editor is empty.
|
|
79
|
+
*/
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the editor is disabled.
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether to focus the editor on mount.
|
|
87
|
+
*/
|
|
88
|
+
autoFocus?: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Displays the chat composer's editor.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* <Editor placeholder="Write a message…" />
|
|
95
|
+
*/
|
|
96
|
+
declare const Editor: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> & {
|
|
97
|
+
/**
|
|
98
|
+
* The editor's initial value.
|
|
99
|
+
*/
|
|
100
|
+
defaultValue?: string;
|
|
101
|
+
/**
|
|
102
|
+
* The text to display when the editor is empty.
|
|
103
|
+
*/
|
|
104
|
+
placeholder?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Whether the editor is disabled.
|
|
107
|
+
*/
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Whether to focus the editor on mount.
|
|
111
|
+
*/
|
|
112
|
+
autoFocus?: boolean;
|
|
113
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
114
|
+
type SubmitProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
115
|
+
/**
|
|
116
|
+
* A button to submit a chat message.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* <ChatComposer.Submit>Send</ChatComposer.Submit>
|
|
120
|
+
*/
|
|
121
|
+
declare const Submit: react.ForwardRefExoticComponent<SubmitProps & react.RefAttributes<HTMLButtonElement>>;
|
|
122
|
+
type AttachFilesProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
123
|
+
/**
|
|
124
|
+
* A button which opens a file picker to create attachments.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* <Composer.AttachFiles>Attach files</Composer.AttachFiles>
|
|
128
|
+
*/
|
|
129
|
+
declare const AttachFiles: react.ForwardRefExoticComponent<AttachFilesProps & react.RefAttributes<HTMLButtonElement>>;
|
|
130
|
+
|
|
25
131
|
type CommentMentionProps = ComponentPropsWithSlot<"span">;
|
|
26
132
|
type CommentBodyMentionProps = {
|
|
27
133
|
/**
|
|
@@ -494,4 +600,4 @@ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children"
|
|
|
494
600
|
*/
|
|
495
601
|
declare const Timestamp: react.ForwardRefExoticComponent<TimestampProps & react.RefAttributes<HTMLTimeElement>>;
|
|
496
602
|
|
|
497
|
-
export { AttachmentTooLargeError, index$1 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
|
603
|
+
export { AttachmentTooLargeError, AttachFiles as ChatComposerAttachFiles, AttachFilesProps as ChatComposerAttachFilesProps, Editor as ChatComposerEditor, EditorProps as ChatComposerEditorProps, Form as ChatComposerForm, FormProps as ChatComposerFormProps, Submit as ChatComposerSubmit, SubmitProps as ChatComposerSubmitProps, index$1 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
package/dist/primitives/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AttachFiles as ChatComposerAttachFiles, Editor as ChatComposerEditor, Form as ChatComposerForm, Submit as ChatComposerSubmit } from './Chat/Composer/index.js';
|
|
1
2
|
import * as index from './Comment/index.js';
|
|
2
3
|
export { index as Comment };
|
|
3
4
|
import * as index$1 from './Composer/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|