@poolse/react-ui 2.1.5 → 2.2.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 CHANGED
@@ -408,19 +408,22 @@ var MentionInput = react.forwardRef(
408
408
  const visibleUploads = queue.filter((it) => it.status !== "cancelled");
409
409
  const readyCount = queue.filter((it) => it.status === "ready").length;
410
410
  const uploading = queue.some((it) => it.status === "pending" || it.status === "uploading");
411
- const addFiles = (files) => {
412
- if (!attachments || files.length === 0) return;
413
- void uploadAll(
414
- files.map((f) => ({
415
- body: f,
416
- contentType: f.type || "application/octet-stream",
417
- byteSize: f.size,
418
- filename: f.name
419
- }))
420
- ).catch(() => {
421
- });
422
- };
423
- react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles, attachments]);
411
+ const addFiles = react.useCallback(
412
+ (files) => {
413
+ if (!attachments || files.length === 0) return;
414
+ void uploadAll(
415
+ files.map((f) => ({
416
+ body: f,
417
+ contentType: f.type || "application/octet-stream",
418
+ byteSize: f.size,
419
+ filename: f.name
420
+ }))
421
+ ).catch(() => {
422
+ });
423
+ },
424
+ [attachments, uploadAll]
425
+ );
426
+ react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles]);
424
427
  const label = labelFor ?? ((id) => id);
425
428
  const filtered = mention ? members.filter(
426
429
  (m) => label(m.external_id).toLowerCase().includes(mention.query.toLowerCase())
@@ -685,19 +688,22 @@ var MessageComposer = react.forwardRef(
685
688
  const visibleUploads = queue.filter((it) => it.status !== "cancelled");
686
689
  const readyCount = queue.filter((it) => it.status === "ready").length;
687
690
  const uploading = queue.some((it) => it.status === "pending" || it.status === "uploading");
688
- const addFiles = (files) => {
689
- if (!attachments || files.length === 0) return;
690
- void uploadAll(
691
- files.map((f) => ({
692
- body: f,
693
- contentType: f.type || "application/octet-stream",
694
- byteSize: f.size,
695
- filename: f.name
696
- }))
697
- ).catch(() => {
698
- });
699
- };
700
- react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles, attachments]);
691
+ const addFiles = react.useCallback(
692
+ (files) => {
693
+ if (!attachments || files.length === 0) return;
694
+ void uploadAll(
695
+ files.map((f) => ({
696
+ body: f,
697
+ contentType: f.type || "application/octet-stream",
698
+ byteSize: f.size,
699
+ filename: f.name
700
+ }))
701
+ ).catch(() => {
702
+ });
703
+ },
704
+ [attachments, uploadAll]
705
+ );
706
+ react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles]);
701
707
  const submit = async () => {
702
708
  const trimmed = value.trim();
703
709
  const ready = queue.filter((it) => it.status === "ready");