@linktr.ee/messaging-react 3.14.4-rc-1784706159 → 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/{Card-DuC8HoTd.js → Card-CZq9t0G_.js} +2 -2
- package/dist/{Card-DuC8HoTd.js.map → Card-CZq9t0G_.js.map} +1 -1
- package/dist/{Card-ChHoC89L.cjs → Card-F4L-jBFd.cjs} +2 -2
- package/dist/{Card-ChHoC89L.cjs.map → Card-F4L-jBFd.cjs.map} +1 -1
- package/dist/{index-DlUa6O7r.cjs → index-BZNP-Xf_.cjs} +2 -2
- package/dist/{index-DlUa6O7r.cjs.map → index-BZNP-Xf_.cjs.map} +1 -1
- package/dist/{index-CP0I8AHU.js → index-BiiMPaUs.js} +168 -184
- package/dist/{index-CP0I8AHU.js.map → index-BiiMPaUs.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/CustomLinkPreviewList/index.tsx +1 -1
- package/src/components/CustomMessageInput/index.tsx +28 -65
- package/src/utils/formatRelativeTime.test.ts +20 -4
- package/src/utils/formatRelativeTime.ts +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
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-
|
|
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
|
|
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.
|
|
53
|
+
"@linktr.ee/messaging-core": "^2.2.0",
|
|
54
54
|
"@phosphor-icons/react": "^2.1.10"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
@@ -40,7 +40,7 @@ export const CustomLinkPreviewList = () => {
|
|
|
40
40
|
// block so it keeps its intrinsic height and the container scrolls — a
|
|
41
41
|
// bare flex-column child would be shrunk on the column axis and its
|
|
42
42
|
// fixed-height hero would spill out of the collapsed card box.
|
|
43
|
-
<div className="messaging-link-preview-list flex min-h-0 flex-col items-stretch w-full gap-2 overflow-y-auto overscroll-contain">
|
|
43
|
+
<div className="messaging-link-preview-list flex min-h-0 flex-col items-stretch w-full gap-2 mb-4 overflow-y-auto overscroll-contain">
|
|
44
44
|
{stateLinkPreviews.map((linkPreview) => (
|
|
45
45
|
<div key={linkPreview.og_scrape_url} className="w-full shrink-0">
|
|
46
46
|
<CustomLinkPreviewCard link={linkPreview} onDismiss={handleDismiss} />
|
|
@@ -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)]
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<div className="
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
58
|
-
return date.toLocaleDateString(
|
|
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
|
}
|