@linktr.ee/messaging-react 1.23.0 → 1.24.1-rc-1772717771
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.ts +6 -0
- package/dist/index.js +195 -194
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/index.tsx +5 -2
- package/src/components/ChannelView.tsx +1 -1
- package/src/components/CustomLinkPreviewList/index.tsx +1 -1
- package/src/components/CustomMessage/MessageVoteButtons.tsx +2 -2
- package/src/components/CustomMessageInput/index.tsx +1 -1
- package/src/components/FaqList/FaqListItem.tsx +1 -1
- package/src/components/MessagingShell/ErrorState.tsx +1 -1
- package/src/components/ParticipantPicker/index.tsx +1 -1
- package/src/types.ts +6 -0
package/package.json
CHANGED
|
@@ -8,6 +8,8 @@ import type { ChannelListProps } from '../../types'
|
|
|
8
8
|
import { ChannelListProvider } from './ChannelListContext'
|
|
9
9
|
import CustomChannelPreview from './CustomChannelPreview'
|
|
10
10
|
|
|
11
|
+
const DEFAULT_SORT = { last_message_at: -1 } as const
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* Channel list component with customizable header and actions
|
|
13
15
|
*/
|
|
@@ -16,6 +18,7 @@ export const ChannelList = React.memo<ChannelListProps>(
|
|
|
16
18
|
onChannelSelect,
|
|
17
19
|
selectedChannel,
|
|
18
20
|
filters,
|
|
21
|
+
sort = DEFAULT_SORT,
|
|
19
22
|
className,
|
|
20
23
|
customEmptyStateIndicator,
|
|
21
24
|
renderMessagePreview,
|
|
@@ -56,9 +59,9 @@ export const ChannelList = React.memo<ChannelListProps>(
|
|
|
56
59
|
<div className="flex-1 overflow-hidden min-w-0">
|
|
57
60
|
<ChannelListProvider value={contextValue}>
|
|
58
61
|
<StreamChannelList
|
|
59
|
-
key={JSON.stringify(filters)}
|
|
62
|
+
key={`${JSON.stringify(filters)}:${JSON.stringify(sort)}`}
|
|
60
63
|
filters={filters}
|
|
61
|
-
sort={
|
|
64
|
+
sort={sort}
|
|
62
65
|
options={{ limit: 30 }}
|
|
63
66
|
Preview={CustomChannelPreview}
|
|
64
67
|
EmptyStateIndicator={customEmptyStateIndicator}
|
|
@@ -49,7 +49,7 @@ type BlockedUser = {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const ICON_BTN_CLASS =
|
|
52
|
-
'size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150'
|
|
52
|
+
'size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150 focus-ring'
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Custom channel header component
|
|
@@ -48,7 +48,7 @@ const CustomLinkPreviewCard: React.FC<CustomLinkPreviewCardProps> = ({
|
|
|
48
48
|
<button
|
|
49
49
|
type="button"
|
|
50
50
|
onClick={handleDismissLink}
|
|
51
|
-
className="absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl"
|
|
51
|
+
className="absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl focus-ring"
|
|
52
52
|
aria-label="Close link preview"
|
|
53
53
|
>
|
|
54
54
|
<XIcon className="size-4 text-black/90" />
|
|
@@ -42,7 +42,7 @@ export const MessageVoteButtons: React.FC<MessageVoteButtonsProps> = ({
|
|
|
42
42
|
<div className="message-vote-buttons">
|
|
43
43
|
<button
|
|
44
44
|
type="button"
|
|
45
|
-
className={`message-vote-button${selected === 'up' ? ' message-vote-button--selected' : ''}`}
|
|
45
|
+
className={`message-vote-button${selected === 'up' ? ' message-vote-button--selected' : ''} focus-ring`}
|
|
46
46
|
onClick={onVoteUp}
|
|
47
47
|
aria-label="Helpful"
|
|
48
48
|
aria-pressed={selected === 'up'}
|
|
@@ -51,7 +51,7 @@ export const MessageVoteButtons: React.FC<MessageVoteButtonsProps> = ({
|
|
|
51
51
|
</button>
|
|
52
52
|
<button
|
|
53
53
|
type="button"
|
|
54
|
-
className={`message-vote-button${selected === 'down' ? ' message-vote-button--selected' : ''}`}
|
|
54
|
+
className={`message-vote-button${selected === 'down' ? ' message-vote-button--selected' : ''} focus-ring`}
|
|
55
55
|
onClick={onVoteDown}
|
|
56
56
|
aria-label="Not helpful"
|
|
57
57
|
aria-pressed={selected === 'down'}
|
|
@@ -39,7 +39,7 @@ const CustomMessageInputInner: React.FC = () => {
|
|
|
39
39
|
</div>
|
|
40
40
|
<button
|
|
41
41
|
aria-label="Send"
|
|
42
|
-
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"
|
|
42
|
+
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"
|
|
43
43
|
data-testid="send-button"
|
|
44
44
|
disabled={!hasSendableData}
|
|
45
45
|
onClick={handleSubmit}
|
|
@@ -20,7 +20,7 @@ export const FaqListItem: React.FC<FaqListItemProps> = ({
|
|
|
20
20
|
disabled={loading}
|
|
21
21
|
style={{ backgroundColor: '#E6E5E3' }}
|
|
22
22
|
className={classNames(
|
|
23
|
-
'w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors',
|
|
23
|
+
'w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors focus-ring',
|
|
24
24
|
{
|
|
25
25
|
'hover:brightness-95 active:brightness-90': !loading,
|
|
26
26
|
'opacity-50 cursor-not-allowed': loading,
|
|
@@ -23,7 +23,7 @@ export const ErrorState = React.memo<ErrorStateProps>(({ message, onBack }) => (
|
|
|
23
23
|
<button
|
|
24
24
|
type="button"
|
|
25
25
|
onClick={onBack}
|
|
26
|
-
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[#7f22fe] hover:bg-primary-alt rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition-colors"
|
|
26
|
+
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[#7f22fe] hover:bg-primary-alt rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition-colors focus-ring"
|
|
27
27
|
>
|
|
28
28
|
Go Back
|
|
29
29
|
</button>
|
|
@@ -199,7 +199,7 @@ export const ParticipantPicker: React.FC<ParticipantPickerProps> = ({
|
|
|
199
199
|
type="button"
|
|
200
200
|
onClick={() => handleSelectParticipant(participant)}
|
|
201
201
|
onKeyDown={(e) => handleKeyDown(e, participant)}
|
|
202
|
-
className="w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus
|
|
202
|
+
className="w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus-ring"
|
|
203
203
|
>
|
|
204
204
|
<div className="flex items-center justify-between">
|
|
205
205
|
<div className="flex items-center space-x-3 flex-1 min-w-0">
|
package/src/types.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
import type {
|
|
6
6
|
Channel,
|
|
7
7
|
ChannelFilters,
|
|
8
|
+
ChannelSort,
|
|
8
9
|
LocalMessage,
|
|
9
10
|
SendMessageAPIResponse,
|
|
10
11
|
} from 'stream-chat'
|
|
@@ -67,6 +68,11 @@ export interface ChannelListProps {
|
|
|
67
68
|
participantLabel?: string
|
|
68
69
|
className?: string
|
|
69
70
|
filters: ChannelFilters
|
|
71
|
+
/**
|
|
72
|
+
* Sort order for the channel list query.
|
|
73
|
+
* Defaults to `{ last_message_at: -1 }` (most recent first).
|
|
74
|
+
*/
|
|
75
|
+
sort?: ChannelSort
|
|
70
76
|
customEmptyStateIndicator?: React.ComponentType<EmptyStateIndicatorProps>
|
|
71
77
|
renderMessagePreview?: (
|
|
72
78
|
message: LocalMessage | undefined,
|