@poolse/react-ui 0.2.0-alpha.3 → 0.2.0-alpha.4

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.d.cts CHANGED
@@ -101,6 +101,8 @@ interface MessageActionsProps {
101
101
  onReact?: (emoji: string) => void;
102
102
  /** Triggered when the user wants to reply in thread. */
103
103
  onReply?: () => void;
104
+ /** Triggered when the user wants to copy the message body to the clipboard. */
105
+ onCopy?: () => void;
104
106
  /** Triggered when the user wants to edit. Only show on own messages. */
105
107
  onEdit?: () => void;
106
108
  /** Triggered when the user wants to delete. Only show on own messages. */
@@ -108,7 +110,7 @@ interface MessageActionsProps {
108
110
  /** Render any extra trailing action buttons (e.g. "Pin"). */
109
111
  children?: ReactNode;
110
112
  }
111
- declare function MessageActions({ onReact, onReply, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
113
+ declare function MessageActions({ onReact, onReply, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
112
114
 
113
115
  interface TypingIndicatorProps {
114
116
  /** Set of user_ids currently typing. */
package/dist/index.d.ts CHANGED
@@ -101,6 +101,8 @@ interface MessageActionsProps {
101
101
  onReact?: (emoji: string) => void;
102
102
  /** Triggered when the user wants to reply in thread. */
103
103
  onReply?: () => void;
104
+ /** Triggered when the user wants to copy the message body to the clipboard. */
105
+ onCopy?: () => void;
104
106
  /** Triggered when the user wants to edit. Only show on own messages. */
105
107
  onEdit?: () => void;
106
108
  /** Triggered when the user wants to delete. Only show on own messages. */
@@ -108,7 +110,7 @@ interface MessageActionsProps {
108
110
  /** Render any extra trailing action buttons (e.g. "Pin"). */
109
111
  children?: ReactNode;
110
112
  }
111
- declare function MessageActions({ onReact, onReply, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
113
+ declare function MessageActions({ onReact, onReply, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
112
114
 
113
115
  interface TypingIndicatorProps {
114
116
  /** Set of user_ids currently typing. */
package/dist/index.js CHANGED
@@ -766,6 +766,7 @@ function ReactionPicker({
766
766
  function MessageActions({
767
767
  onReact,
768
768
  onReply,
769
+ onCopy,
769
770
  onEdit,
770
771
  onDelete,
771
772
  children
@@ -794,6 +795,7 @@ function MessageActions({
794
795
  ) })
795
796
  ] }),
796
797
  onReply && /* @__PURE__ */ jsx(ActionButton, { label: "Reply in thread", icon: "reply", onClick: onReply }),
798
+ onCopy && /* @__PURE__ */ jsx(ActionButton, { label: "Copy", icon: "copy", onClick: onCopy }),
797
799
  onEdit && /* @__PURE__ */ jsx(ActionButton, { label: "Edit", icon: "edit", onClick: onEdit }),
798
800
  onDelete && /* @__PURE__ */ jsx(ActionButton, { label: "Delete", icon: "trash", danger: true, onClick: onDelete }),
799
801
  children
@@ -837,6 +839,8 @@ function MessageRow({
837
839
  const showReactions = reactions && !msg.deleted_at;
838
840
  const showAttachments = attachments && Array.isArray(msg.attachments) && msg.attachments.length > 0;
839
841
  const showActions = actions && !msg.deleted_at && !editing;
842
+ const replyCount = msg.reply_count ?? 0;
843
+ const showThreadPill = threads && !msg.deleted_at && !msg.thread_root_id && replyCount > 0;
840
844
  const handleSave = onSaveEdit ?? (async () => void 0);
841
845
  const handleCancel = onCancelEdit ?? (() => void 0);
842
846
  return /* @__PURE__ */ jsxs("div", { className: `poolse-message-row ${isSelf ? "poolse-message-row--right" : ""}`, children: [
@@ -861,6 +865,23 @@ function MessageRow({
861
865
  onRemove: (e) => void reactionsHook.removeReaction(e)
862
866
  }
863
867
  ) }),
868
+ showThreadPill && /* @__PURE__ */ jsxs(
869
+ "button",
870
+ {
871
+ type: "button",
872
+ className: `poolse-thread-pill ${isSelf ? "poolse-thread-pill--right" : "poolse-thread-pill--left"}`,
873
+ onClick: onOpenThread,
874
+ "aria-label": `View ${replyCount} ${replyCount === 1 ? "reply" : "replies"}`,
875
+ children: [
876
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "messages", size: 12, label: null }),
877
+ /* @__PURE__ */ jsxs("span", { children: [
878
+ replyCount,
879
+ " ",
880
+ replyCount === 1 ? "reply" : "replies"
881
+ ] })
882
+ ]
883
+ }
884
+ ),
864
885
  showActions && /* @__PURE__ */ jsx(
865
886
  "div",
866
887
  {
@@ -874,6 +895,11 @@ function MessageRow({
874
895
  }
875
896
  } : {},
876
897
  ...threads && onOpenThread ? { onReply: onOpenThread } : {},
898
+ ...msg.body ? {
899
+ onCopy: () => {
900
+ void navigator?.clipboard?.writeText(msg.body ?? "").catch(() => void 0);
901
+ }
902
+ } : {},
877
903
  ...isSelf && onStartEdit ? { onEdit: onStartEdit } : {},
878
904
  ...isSelf && onDelete ? { onDelete } : {}
879
905
  }
@@ -1334,7 +1360,10 @@ function MemberList({
1334
1360
  return /* @__PURE__ */ jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading members\u2026" });
1335
1361
  }
1336
1362
  if (error) {
1337
- return /* @__PURE__ */ jsx("div", { className: "poolse-list poolse-list--placeholder poolse-list--error", children: "Failed to load members." });
1363
+ return /* @__PURE__ */ jsxs("div", { className: "poolse-list poolse-list--placeholder poolse-list--error", children: [
1364
+ /* @__PURE__ */ jsx("div", { children: "Failed to load members." }),
1365
+ error.message && /* @__PURE__ */ jsx("div", { className: "poolse-list__error-detail", children: /* @__PURE__ */ jsx("code", { children: error.message }) })
1366
+ ] });
1338
1367
  }
1339
1368
  if (members.length === 0) {
1340
1369
  return /* @__PURE__ */ jsx("div", { className: "poolse-list poolse-list--placeholder", children: emptyState ?? "No members yet." });