@linktr.ee/messaging-react 3.14.4-rc-1784697283 → 3.14.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.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BzVBF7uo.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageBubble=e.MessageBubble;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BZNP-Xf_.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageBubble=e.MessageBubble;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-DlSpSy1_.js";
1
+ import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-BiiMPaUs.js";
2
2
  export {
3
3
  e as ActionButton,
4
4
  t as Avatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "3.14.4-rc-1784697283",
3
+ "version": "3.14.4",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@linktr.ee/component-library": "11.8.6",
53
- "@linktr.ee/messaging-core": "2.3.0-rc-1784697283",
53
+ "@linktr.ee/messaging-core": "^2.2.0",
54
54
  "@phosphor-icons/react": "^2.1.10"
55
55
  },
56
56
  "devDependencies": {
@@ -79,76 +79,39 @@ const CustomMessageInputInner: React.FC = () => {
79
79
  // content height and the squeeze never reaches the preview list. Stream's
80
80
  // <MessageInput> renders its Input directly (context providers only, no
81
81
  // wrapper element), so this is a direct flex item of that row.
82
- //
83
- // The container itself carries no padding of its own: it used to (p-2),
84
- // but that inset now lives on the textarea as padding instead, so the
85
- // textarea's actual (clickable) box is as large as the container — save
86
- // for the small margin and the send button on the right (MES-1325).
87
- // Visually nothing moves; the container ends up exactly the size of the
88
- // textarea + send button row it contains.
89
- //
90
- // Some hosts portal staged-media thumbnails (e.g. ComposerPendingMediaPortal,
91
- // see this component's stories) straight into `.central-container` rather
92
- // than through this React tree, bypassing the two wrappers below. The
93
- // `[&>:not(...)]:p-2` variant restores the container's old inset for any
94
- // such foreign direct child, without re-adding it to our own wrappers.
95
82
  <div
96
- className="central-container flex min-h-0 flex-col min-w-0 w-full self-stretch bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)] [&>:not(.messaging-composer-previews):not(.messaging-composer-row)]:p-2"
83
+ className="central-container flex min-h-0 flex-col gap-2 min-w-0 w-full self-stretch p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]"
97
84
  data-dd-privacy="mask"
98
85
  >
99
- {/* empty:hidden collapses this row (padding, gap, and all) when none of
100
- the previews below have anything to render, so an idle composer has
101
- no leftover top inset before the textarea row. */}
102
- <div className="messaging-composer-previews empty:hidden flex min-h-0 flex-col gap-2 px-2 pt-2">
103
- <QuotedMessagePreview />
104
- <CustomLinkPreviewList />
105
- <AttachmentPreviewList />
106
- </div>
107
- <div className="messaging-composer-row flex shrink-0 items-start">
108
- <TextareaComposer
109
- aria-disabled={disabled || undefined}
110
- // TextareaComposer wraps the real <textarea> in its own div, so
111
- // `containerClassName` (not `className`) is what joins the row's
112
- // flex layout; `leading-[0]` drops the line-height space an
113
- // inline-level parent otherwise reserves, keeping that wrapper
114
- // exactly the textarea's height rather than stretched by the row
115
- // (items-start above is a second guard against that same stretch).
116
- containerClassName="min-w-0 flex-1 leading-[0]"
117
- // bg-transparent: the container has no padding to inset it behind
118
- // anymore, so an opaque textarea would paint over its rounded corners.
119
- className="w-full resize-none bg-transparent py-3.5 pl-4 pr-4 outline-none leading-5 placeholder:text-black/30 text-sm"
120
- // While this might usually be considered an anti-pattern, in most
121
- // cases, when a message thread is rendered, we want the input to
122
- // gain focus automatically.
123
- // eslint-disable-next-line jsx-a11y/no-autofocus
124
- autoFocus={!disabled}
125
- // Enter sends (Shift+Enter inserts a newline), so label the
126
- // on-screen keyboard's return key accordingly.
127
- enterKeyHint="send"
128
- maxRows={4}
129
- readOnly={disabled}
130
- tabIndex={disabled ? -1 : undefined}
131
- />
132
- {/* The container no longer has its own p-2, so this inset — and the
133
- mt-auto that anchors the button to the bottom as the textarea
134
- grows — lives on a wrapper instead of the button's own
135
- className: a host-supplied SendButton can (and, per our own
136
- stories, does) spread its own className over the one we pass in,
137
- which would otherwise silently drop this spacing. */}
138
- <div className="mt-auto mb-2 mr-2 shrink-0">
139
- <SendButton
140
- sendMessage={handleSubmit}
141
- aria-label="Send"
142
- // before:-inset-2 extends the button's clickable area to 48x48
143
- // (MES-1325) via an invisible pseudo-element — clicks on it still
144
- // land on the button itself — without growing the 32x32 circle
145
- // `size-8`/`rounded-full`/`bg-[#121110]` visually describe.
146
- className="str-chat__send-button relative flex justify-center items-center rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white focus-ring before:absolute before:-inset-2 before:content-['']"
147
- data-testid="send-button"
148
- disabled={isSendDisabled}
149
- type="button"
86
+ <QuotedMessagePreview />
87
+ <CustomLinkPreviewList />
88
+ <AttachmentPreviewList />
89
+ <div className="flex shrink-0">
90
+ <div className="w-full ml-2 mr-4 self-center leading-[0]">
91
+ <TextareaComposer
92
+ aria-disabled={disabled || undefined}
93
+ className="w-full resize-none outline-none leading-5 placeholder:text-black/30 text-sm"
94
+ // While this might usually be considered an anti-pattern, in most
95
+ // cases, when a message thread is rendered, we want the input to
96
+ // gain focus automatically.
97
+ // eslint-disable-next-line jsx-a11y/no-autofocus
98
+ autoFocus={!disabled}
99
+ // Enter sends (Shift+Enter inserts a newline), so label the
100
+ // on-screen keyboard's return key accordingly.
101
+ enterKeyHint="send"
102
+ maxRows={4}
103
+ readOnly={disabled}
104
+ tabIndex={disabled ? -1 : undefined}
150
105
  />
151
106
  </div>
107
+ <SendButton
108
+ sendMessage={handleSubmit}
109
+ aria-label="Send"
110
+ className="str-chat__send-button mt-auto flex justify-center items-center flex-shrink-0 rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white focus-ring"
111
+ data-testid="send-button"
112
+ disabled={isSendDisabled}
113
+ type="button"
114
+ />
152
115
  </div>
153
116
  </div>
154
117
  )
@@ -95,16 +95,32 @@ describe('formatRelativeTime', () => {
95
95
  })
96
96
 
97
97
  describe('Date format', () => {
98
- it('should return MM/DD/YY format for messages more than 4 weeks ago', () => {
98
+ // The absolute-date branch intentionally uses the runtime locale
99
+ // (toLocaleDateString(undefined, …)), so assertions avoid a fixed
100
+ // string that would depend on the test runner's ambient ICU locale.
101
+ // Instead we assert the locale-independent behaviour: a spelled-out
102
+ // month (alphabetic) rather than the old all-numeric M/D/YY, plus the
103
+ // day and 2-digit year in any order.
104
+ const numericDatePattern = /^\d{1,2}\/\d{1,2}\/\d{2}$/
105
+
106
+ it('should return a spelled-month date for messages more than 4 weeks ago', () => {
99
107
  mockDate('2024-02-15T12:00:00Z')
100
108
  const date = new Date('2024-01-01T12:00:00Z')
101
- expect(formatRelativeTime(date)).toBe('1/1/24')
109
+ const result = formatRelativeTime(date)
110
+ expect(result).not.toMatch(numericDatePattern)
111
+ expect(result).toMatch(/\p{L}/u) // spelled-out month
112
+ expect(result).toMatch(/\b1\b/) // day
113
+ expect(result).toMatch(/24/) // 2-digit year
102
114
  })
103
115
 
104
- it('should return MM/DD/YY format for messages from last year', () => {
116
+ it('should return a spelled-month date for messages from last year', () => {
105
117
  mockDate('2024-01-15T12:00:00Z')
106
118
  const date = new Date('2023-12-01T12:00:00Z')
107
- expect(formatRelativeTime(date)).toBe('12/1/23')
119
+ const result = formatRelativeTime(date)
120
+ expect(result).not.toMatch(numericDatePattern)
121
+ expect(result).toMatch(/\p{L}/u) // spelled-out month
122
+ expect(result).toMatch(/\b1\b/) // day
123
+ expect(result).toMatch(/23/) // 2-digit year
108
124
  })
109
125
  })
110
126
 
@@ -54,10 +54,10 @@ export const formatRelativeTime = (date: Date): string => {
54
54
  return `${weeks}w`
55
55
  }
56
56
 
57
- // More than 4 weeks - show date as MM/DD/YY
58
- return date.toLocaleDateString('en-US', {
59
- month: 'numeric',
57
+ // More than 4 weeks - show locale-aware date with spelled-out month
58
+ return date.toLocaleDateString(undefined, {
60
59
  day: 'numeric',
60
+ month: 'short',
61
61
  year: '2-digit',
62
62
  })
63
63
  }