@solexllc/usx-react 0.11.0 → 0.12.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/README.md +16 -0
- package/dist/Popover-BzDCTuQM.cjs +984 -0
- package/dist/Popover-LToVWsWc.js +985 -0
- package/dist/chat.cjs +1391 -0
- package/dist/chat.js +1391 -0
- package/dist/index.cjs +4428 -5290
- package/dist/index.js +58 -917
- package/package.json +7 -3
- package/src/chat.js +15 -0
- package/src/components/avatar/Avatar.tsx +54 -16
- package/src/components/avatar/avatar.django-snapshot.html +112 -0
- package/src/components/avatar/avatar.django.html +2 -2
- package/src/components/avatar/avatar.html +25 -0
- package/src/components/avatar/avatar.react-snapshot.html +104 -0
- package/src/components/avatar/config.json +13 -15
- package/src/components/avatar-group/AvatarGroup.tsx +17 -15
- package/src/components/avatar-group/avatar-group.django-snapshot.html +22 -0
- package/src/components/avatar-group/avatar-group.django.html +1 -1
- package/src/components/avatar-group/avatar-group.react-snapshot.html +20 -0
- package/src/components/avatar-group/config.json +2 -2
- package/src/components/back-to-top/BackToTop.tsx +21 -57
- package/src/components/back-to-top/back-to-top.django-snapshot.html +101 -202
- package/src/components/back-to-top/back-to-top.django.html +11 -38
- package/src/components/back-to-top/back-to-top.html +22 -106
- package/src/components/back-to-top/back-to-top.react-snapshot.html +94 -148
- package/src/components/back-to-top/config.json +41 -10
- package/src/components/button/Button.tsx +12 -3
- package/src/components/button/button.django-snapshot.html +18 -0
- package/src/components/button/button.django.html +3 -2
- package/src/components/button/button.react-snapshot.html +16 -0
- package/src/components/button/config.json +11 -2
- package/src/components/callout/callout.django.html +1 -1
- package/src/components/callout/config.json +7 -16
- package/src/components/character-count/CharacterCount.tsx +2 -0
- package/src/components/character-count/character-count.react-snapshot.html +7 -0
- package/src/components/chat/Chat.tsx +575 -0
- package/src/components/chat/README.md +174 -0
- package/src/components/chat/avatarProps.ts +32 -0
- package/src/components/chat/chat.django-snapshot.html +23515 -0
- package/src/components/chat/chat.django.html +75 -0
- package/src/components/chat/chat.html +116 -0
- package/src/components/chat/chat.react-snapshot.html +16895 -0
- package/src/components/chat/config.json +1241 -0
- package/src/components/chat-attachment/ChatAttachment.tsx +39 -0
- package/src/components/chat-attachment/chat-attachment.django.html +24 -0
- package/src/components/chat-attachment/chat-attachment.html +10 -0
- package/src/components/chat-attachment/config.json +27 -0
- package/src/components/chat-attachments/ChatAttachments.tsx +17 -0
- package/src/components/chat-attachments/chat-attachments.django-snapshot.html +58 -0
- package/src/components/chat-attachments/chat-attachments.django.html +10 -0
- package/src/components/chat-attachments/chat-attachments.html +14 -0
- package/src/components/chat-attachments/chat-attachments.react-snapshot.html +46 -0
- package/src/components/chat-attachments/config.json +25 -0
- package/src/components/chat-bubble/ChatBubble.tsx +39 -0
- package/src/components/chat-bubble/ChatFormattedText.tsx +138 -0
- package/src/components/chat-bubble/chat-bubble.django-snapshot.html +128 -0
- package/src/components/chat-bubble/chat-bubble.django.html +19 -0
- package/src/components/chat-bubble/chat-bubble.html +1 -0
- package/src/components/chat-bubble/chat-bubble.react-snapshot.html +118 -0
- package/src/components/chat-bubble/config.json +70 -0
- package/src/components/chat-composer/ChatComposer.tsx +210 -0
- package/src/components/chat-composer/README.md +15 -0
- package/src/components/chat-composer/chat-composer.django-snapshot.html +575 -0
- package/src/components/chat-composer/chat-composer.django.html +77 -0
- package/src/components/chat-composer/chat-composer.html +44 -0
- package/src/components/chat-composer/chat-composer.react-snapshot.html +519 -0
- package/src/components/chat-composer/chat-formatting.django.html +59 -0
- package/src/components/chat-composer/config.json +137 -0
- package/src/components/chat-context/ChatContext.tsx +46 -0
- package/src/components/chat-context/chat-context.django-snapshot.html +35 -0
- package/src/components/chat-context/chat-context.django.html +20 -0
- package/src/components/chat-context/chat-context.html +9 -0
- package/src/components/chat-context/chat-context.react-snapshot.html +30 -0
- package/src/components/chat-context/config.json +36 -0
- package/src/components/chat-controls/ChatControls.tsx +67 -0
- package/src/components/chat-controls/chat-controls.django-snapshot.html +114 -0
- package/src/components/chat-controls/chat-controls.django.html +36 -0
- package/src/components/chat-controls/chat-controls.html +11 -0
- package/src/components/chat-controls/chat-controls.react-snapshot.html +107 -0
- package/src/components/chat-controls/config.json +67 -0
- package/src/components/chat-directory/ChatDirectory.tsx +168 -0
- package/src/components/chat-directory/chat-directory.django-snapshot.html +546 -0
- package/src/components/chat-directory/chat-directory.django.html +14 -0
- package/src/components/chat-directory/chat-directory.html +4 -0
- package/src/components/chat-directory/chat-directory.react-snapshot.html +471 -0
- package/src/components/chat-directory/config.json +242 -0
- package/src/components/chat-directory-item/ChatDirectoryItem.tsx +150 -0
- package/src/components/chat-directory-item/chat-directory-item.django-snapshot.html +281 -0
- package/src/components/chat-directory-item/chat-directory-item.django.html +38 -0
- package/src/components/chat-directory-item/chat-directory-item.html +9 -0
- package/src/components/chat-directory-item/chat-directory-item.react-snapshot.html +249 -0
- package/src/components/chat-directory-item/config.json +103 -0
- package/src/components/chat-history/ChatHistory.tsx +30 -0
- package/src/components/chat-history/chat-history.django-snapshot.html +113 -0
- package/src/components/chat-history/chat-history.django.html +20 -0
- package/src/components/chat-history/chat-history.html +9 -0
- package/src/components/chat-history/chat-history.react-snapshot.html +111 -0
- package/src/components/chat-history/config.json +24 -0
- package/src/components/chat-message/ChatMessage.tsx +148 -0
- package/src/components/chat-message/chat-message.django-snapshot.html +758 -0
- package/src/components/chat-message/chat-message.django.html +56 -0
- package/src/components/chat-message/chat-message.html +12 -0
- package/src/components/chat-message/chat-message.react-snapshot.html +627 -0
- package/src/components/chat-message/config.json +278 -0
- package/src/components/chat-message-actions/ChatMessageActions.tsx +133 -0
- package/src/components/chat-message-actions/chat-message-actions.django-snapshot.html +345 -0
- package/src/components/chat-message-actions/chat-message-actions.django.html +29 -0
- package/src/components/chat-message-actions/chat-message-actions.html +53 -0
- package/src/components/chat-message-actions/chat-message-actions.react-snapshot.html +295 -0
- package/src/components/chat-message-actions/config.json +121 -0
- package/src/components/chat-window/ChatWindow.tsx +133 -0
- package/src/components/chat-window/chat-window.django-snapshot.html +448 -0
- package/src/components/chat-window/chat-window.django.html +39 -0
- package/src/components/chat-window/chat-window.html +26 -0
- package/src/components/chat-window/chat-window.react-snapshot.html +286 -0
- package/src/components/chat-window/config.json +123 -0
- package/src/components/clickable/Clickable.tsx +19 -5
- package/src/components/clickable/clickable.django-snapshot.html +11 -2
- package/src/components/clickable/clickable.django.html +2 -0
- package/src/components/clickable/clickable.react-snapshot.html +10 -2
- package/src/components/clickable/config.json +4 -0
- package/src/components/code/code.django-snapshot.html +25 -18
- package/src/components/code/code.react-snapshot.html +41 -4
- package/src/components/copy-to-clipboard/CopyToClipboard.tsx +2 -7
- package/src/components/copy-to-clipboard/copy-to-clipboard.django-snapshot.html +6 -4
- package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +3 -2
- package/src/components/copy-to-clipboard/copy-to-clipboard.react-snapshot.html +14 -2
- package/src/components/file-list/FileList.tsx +3 -2
- package/src/components/file-list/config.json +5 -0
- package/src/components/file-list/file-list.django-snapshot.html +63 -0
- package/src/components/file-list/file-list.django.html +1 -1
- package/src/components/file-list/file-list.react-snapshot.html +53 -0
- package/src/components/footer/footer.django-snapshot.html +0 -3
- package/src/components/header/header.django-snapshot.html +0 -160
- package/src/components/header/header.django.html +2 -2
- package/src/components/hero/hero.django-snapshot.html +0 -20
- package/src/components/hero/hero.django.html +3 -3
- package/src/components/image/image.django.html +4 -4
- package/src/components/input/Input.tsx +1 -1
- package/src/components/input/config.json +2 -3
- package/src/components/input/input.django-snapshot.html +4 -21
- package/src/components/input/input.django.html +2 -2
- package/src/components/link/Link.tsx +7 -4
- package/src/components/link/config.json +2 -3
- package/src/components/link/link.django-snapshot.html +8 -0
- package/src/components/link/link.django.html +2 -2
- package/src/components/link/link.html +4 -1
- package/src/components/link/link.react-snapshot.html +8 -0
- package/src/components/memorable-date/memorable-date.django-snapshot.html +0 -8
- package/src/components/memorable-date/memorable-date.django.html +2 -2
- package/src/components/misc-banner/misc-banner.django-snapshot.html +12 -12
- package/src/components/misc-banner/misc-banner.django.html +4 -2
- package/src/components/popover/Popover.tsx +60 -9
- package/src/components/popover/PopoverMenu.tsx +33 -15
- package/src/components/popover/config.json +88 -14
- package/src/components/popover/popover-menu.django.html +13 -2
- package/src/components/popover/popover.django-snapshot.html +229 -7
- package/src/components/popover/popover.django.html +3 -2
- package/src/components/popover/popover.react-snapshot.html +127 -4
- package/src/components/process-list/config.json +41 -3
- package/src/components/quote/Quote.tsx +9 -2
- package/src/components/search/Search.tsx +1 -1
- package/src/components/search/config.json +3 -4
- package/src/components/search/search.django-snapshot.html +262 -1684
- package/src/components/search/search.django.html +1 -20
- package/src/components/select/select.django-snapshot.html +7 -7
- package/src/components/select/select.react-snapshot.html +7 -7
- package/src/components/summary/Summary.tsx +4 -2
- package/src/components/summary/config.json +4 -0
- package/src/components/summary/summary.django.html +4 -4
- package/src/components/table/Table.tsx +58 -25
- package/src/components/table/config.json +61 -13
- package/src/components/tag/Tag.tsx +40 -7
- package/src/components/tag/config.json +18 -2
- package/src/components/tag/tag.django-snapshot.html +16 -1
- package/src/components/tag/tag.django.html +12 -6
- package/src/components/tag/tag.html +4 -0
- package/src/components/tag/tag.react-snapshot.html +16 -1
- package/src/components/tag-group/TagGroup.tsx +6 -9
- package/src/components/tag-group/config.json +4 -0
- package/src/components/tag-group/tag-group.django.html +1 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chat-directory",
|
|
3
|
+
"template": "chat-directory/chat-directory.django.html",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"default": {
|
|
6
|
+
"view": "inbox",
|
|
7
|
+
"conversations": []
|
|
8
|
+
},
|
|
9
|
+
"props": {
|
|
10
|
+
"conversations": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"description": "Optional inbox rows. A row may supply messages for client-side selection or href for server navigation.",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"description": "One conversation.",
|
|
16
|
+
"properties": {
|
|
17
|
+
"id": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Stable conversation ID."
|
|
20
|
+
},
|
|
21
|
+
"title": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Conversation title."
|
|
24
|
+
},
|
|
25
|
+
"participantIds": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"description": "Member IDs for this conversation. The current user is omitted from the inbox avatar cluster when present.",
|
|
28
|
+
"items": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Participant ID."
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"isGroup": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"description": "Keep group inbox treatment even when only one other member remains. Multiple other members also imply a group."
|
|
36
|
+
},
|
|
37
|
+
"avatarProps": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"component": "avatar",
|
|
40
|
+
"description": "Optional group Avatar, such as an icon or image, in place of member avatars."
|
|
41
|
+
},
|
|
42
|
+
"preview": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Last message preview."
|
|
45
|
+
},
|
|
46
|
+
"previewSenderId": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Optional sender ID prefixed to a group conversation preview. Useful when only inbox summaries are loaded."
|
|
49
|
+
},
|
|
50
|
+
"timeLabel": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Last activity label."
|
|
53
|
+
},
|
|
54
|
+
"unreadCount": {
|
|
55
|
+
"type": "number",
|
|
56
|
+
"description": "Unread message count shown with Tag."
|
|
57
|
+
},
|
|
58
|
+
"firstUnreadMessageId": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "Stable ID of the first unread message in this conversation's supplied history. Required for an accurate unread divider."
|
|
61
|
+
},
|
|
62
|
+
"href": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Optional server-rendered conversation URL."
|
|
65
|
+
},
|
|
66
|
+
"context": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"description": "Optional subject of this conversation, using the same fields as Chat.context. Its title appears in the inbox and its details above the transcript."
|
|
69
|
+
},
|
|
70
|
+
"messages": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"description": "History to show when this conversation is selected.",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"description": "One message."
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"olderHistory": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"description": "Optional older-page state for this conversation, using the same fields as Chat.olderHistory."
|
|
81
|
+
},
|
|
82
|
+
"allowAttachments": {
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"description": "Override whether this conversation accepts new file uploads."
|
|
85
|
+
},
|
|
86
|
+
"actions": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"description": "Optional host-defined directory actions. Omit or pass [] to hide the menu. Actions dispatch usx:chat-directory-action; the host controls availability and effects.",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"description": "One message action.",
|
|
92
|
+
"properties": {
|
|
93
|
+
"id": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"description": "Action identifier."
|
|
96
|
+
},
|
|
97
|
+
"label": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "Visible action label."
|
|
100
|
+
},
|
|
101
|
+
"disabled": {
|
|
102
|
+
"type": "boolean",
|
|
103
|
+
"description": "Disable this action."
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"default": []
|
|
111
|
+
},
|
|
112
|
+
"contacts": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"description": "Optional people available for a new conversation.",
|
|
115
|
+
"items": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"description": "One contact.",
|
|
118
|
+
"properties": {
|
|
119
|
+
"participantId": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"description": "ID from participants."
|
|
122
|
+
},
|
|
123
|
+
"description": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "Supporting text."
|
|
126
|
+
},
|
|
127
|
+
"conversationId": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"description": "Existing conversation ID, if any."
|
|
130
|
+
},
|
|
131
|
+
"href": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"description": "Optional server-rendered contact URL in a non-selectable ChatDirectory. The new-message picker selects recipients instead of following contact links."
|
|
134
|
+
},
|
|
135
|
+
"allowAttachments": {
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"description": "Override whether a new conversation with this contact accepts uploads."
|
|
138
|
+
},
|
|
139
|
+
"actions": {
|
|
140
|
+
"type": "array",
|
|
141
|
+
"description": "Optional host-defined directory actions. Omit or pass [] to hide the menu. Actions dispatch usx:chat-directory-action; the host controls availability and effects.",
|
|
142
|
+
"items": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"description": "One message action.",
|
|
145
|
+
"properties": {
|
|
146
|
+
"id": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"description": "Action identifier."
|
|
149
|
+
},
|
|
150
|
+
"label": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"description": "Visible action label."
|
|
153
|
+
},
|
|
154
|
+
"disabled": {
|
|
155
|
+
"type": "boolean",
|
|
156
|
+
"description": "Disable this action."
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"default": []
|
|
164
|
+
},
|
|
165
|
+
"participants": {
|
|
166
|
+
"type": "array",
|
|
167
|
+
"description": "Participants, including the current user, agents, and bots. Message sender IDs should match participant IDs.",
|
|
168
|
+
"items": {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"description": "One chat participant.",
|
|
171
|
+
"properties": {
|
|
172
|
+
"id": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"description": "Stable participant ID."
|
|
175
|
+
},
|
|
176
|
+
"name": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"description": "Visible sender name and transcript label."
|
|
179
|
+
},
|
|
180
|
+
"avatarProps": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"component": "avatar",
|
|
183
|
+
"description": "Avatar props. Chat renders avatars without links."
|
|
184
|
+
},
|
|
185
|
+
"presence": {
|
|
186
|
+
"type": "select",
|
|
187
|
+
"options": [
|
|
188
|
+
"online",
|
|
189
|
+
"away"
|
|
190
|
+
],
|
|
191
|
+
"description": "Optional current presence in inbox and contact lists. The host must keep it current; it is not a response-time promise."
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"default": []
|
|
196
|
+
},
|
|
197
|
+
"currentUserId": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"description": "Participant ID whose messages align to the outgoing side.",
|
|
200
|
+
"default": "user"
|
|
201
|
+
},
|
|
202
|
+
"view": {
|
|
203
|
+
"type": "select",
|
|
204
|
+
"description": "Directory to render.",
|
|
205
|
+
"options": [
|
|
206
|
+
"inbox",
|
|
207
|
+
"contacts",
|
|
208
|
+
"conversation",
|
|
209
|
+
"thread"
|
|
210
|
+
],
|
|
211
|
+
"default": "inbox"
|
|
212
|
+
},
|
|
213
|
+
"recipientIds": {
|
|
214
|
+
"type": "array",
|
|
215
|
+
"description": "Initially selected participant IDs in the new-message recipient picker.",
|
|
216
|
+
"default": [],
|
|
217
|
+
"items": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"description": "Recipient participant ID."
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"id": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"description": "Unique prefix for directory action menus. Supply a distinct value for each directory on a page.",
|
|
225
|
+
"default": "chat-directory"
|
|
226
|
+
},
|
|
227
|
+
"selectable": {
|
|
228
|
+
"type": "boolean",
|
|
229
|
+
"description": "Render contacts as multi-select recipient rows using USX/USWDS Checkbox classes, with an Avatar inside each label, instead of navigation links or buttons.",
|
|
230
|
+
"default": false
|
|
231
|
+
},
|
|
232
|
+
"formId": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"description": "Composer form ID associated with the recipient checkboxes, usually <chat-id>-composer."
|
|
235
|
+
},
|
|
236
|
+
"disabled": {
|
|
237
|
+
"type": "boolean",
|
|
238
|
+
"description": "Disable recipient selection.",
|
|
239
|
+
"default": false
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ClassNames from 'classnames/dedupe';
|
|
3
|
+
import Avatar from '../avatar/Avatar';
|
|
4
|
+
import AvatarGroup, { type AvatarGroupAvatar } from '../avatar-group/AvatarGroup';
|
|
5
|
+
import Clickable from '../clickable/Clickable';
|
|
6
|
+
import Icon from '../icon/Icon';
|
|
7
|
+
import Popover from '../popover/Popover';
|
|
8
|
+
import Tag from '../tag/Tag';
|
|
9
|
+
import type { ChatAction } from '../chat/Chat';
|
|
10
|
+
|
|
11
|
+
export interface ChatDirectoryItemProps {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
subtitle?: string;
|
|
15
|
+
preview?: string;
|
|
16
|
+
avatarProps?: AvatarGroupAvatar[];
|
|
17
|
+
timeLabel?: string;
|
|
18
|
+
unreadCount?: number;
|
|
19
|
+
href?: string;
|
|
20
|
+
conversationId?: string;
|
|
21
|
+
participantId?: string;
|
|
22
|
+
actions?: ChatAction[];
|
|
23
|
+
selectable?: boolean;
|
|
24
|
+
selected?: boolean;
|
|
25
|
+
formId?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function ChatDirectoryItem({
|
|
30
|
+
id,
|
|
31
|
+
title,
|
|
32
|
+
subtitle,
|
|
33
|
+
preview,
|
|
34
|
+
avatarProps = [],
|
|
35
|
+
timeLabel,
|
|
36
|
+
unreadCount = 0,
|
|
37
|
+
href,
|
|
38
|
+
conversationId,
|
|
39
|
+
participantId,
|
|
40
|
+
actions = [],
|
|
41
|
+
selectable = false,
|
|
42
|
+
selected = false,
|
|
43
|
+
formId,
|
|
44
|
+
disabled = false,
|
|
45
|
+
}: ChatDirectoryItemProps) {
|
|
46
|
+
const avatars = avatarProps.map((avatar) => ({
|
|
47
|
+
...avatar,
|
|
48
|
+
className: ClassNames('usx-chat__avatar', avatar.className),
|
|
49
|
+
}));
|
|
50
|
+
const content = (
|
|
51
|
+
<>
|
|
52
|
+
{avatars.length > 1 ? (
|
|
53
|
+
<AvatarGroup overlap className="usx-chat__directory-avatars" avatarProps={avatars} />
|
|
54
|
+
) : avatars.length === 1 ? (
|
|
55
|
+
<Avatar {...avatars[0]} />
|
|
56
|
+
) : null}
|
|
57
|
+
<span className="usx-chat__directory-copy">
|
|
58
|
+
<span className="usx-chat__directory-title">{title}</span>
|
|
59
|
+
{subtitle && (
|
|
60
|
+
<span
|
|
61
|
+
className="usx-chat__directory-subtitle"
|
|
62
|
+
id={selectable ? `${id}-description` : undefined}
|
|
63
|
+
>
|
|
64
|
+
{subtitle}
|
|
65
|
+
</span>
|
|
66
|
+
)}
|
|
67
|
+
{preview && <span className="usx-chat__directory-preview">{preview}</span>}
|
|
68
|
+
</span>
|
|
69
|
+
{(timeLabel || Boolean(unreadCount)) && (
|
|
70
|
+
<span className="usx-chat__directory-meta">
|
|
71
|
+
{timeLabel && <small>{timeLabel}</small>}
|
|
72
|
+
{Boolean(unreadCount) && (
|
|
73
|
+
<>
|
|
74
|
+
<span aria-hidden="true">
|
|
75
|
+
<Tag color="info" className="usx-rounded-md" value={String(unreadCount)} />
|
|
76
|
+
</span>
|
|
77
|
+
<span className="usa-sr-only">{unreadCount} unread messages</span>
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
80
|
+
</span>
|
|
81
|
+
)}
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<li className={actions.length ? 'usx-chat__directory-row' : undefined}>
|
|
87
|
+
{selectable ? (
|
|
88
|
+
<div className="usa-checkbox usx-checkbox usx-chat__directory-item usx-chat__recipient">
|
|
89
|
+
<input
|
|
90
|
+
id={id}
|
|
91
|
+
className="usa-checkbox__input"
|
|
92
|
+
type="checkbox"
|
|
93
|
+
name="recipientIds"
|
|
94
|
+
value={participantId ?? ''}
|
|
95
|
+
form={formId}
|
|
96
|
+
defaultChecked={selected}
|
|
97
|
+
disabled={disabled}
|
|
98
|
+
aria-label={title}
|
|
99
|
+
aria-describedby={subtitle ? `${id}-description` : undefined}
|
|
100
|
+
data-usx-chat-recipient=""
|
|
101
|
+
/>
|
|
102
|
+
<label className="usa-checkbox__label usx-chat__recipient-label" htmlFor={id}>
|
|
103
|
+
{content}
|
|
104
|
+
</label>
|
|
105
|
+
</div>
|
|
106
|
+
) : (
|
|
107
|
+
<Clickable
|
|
108
|
+
href={href || undefined}
|
|
109
|
+
className="usx-chat__directory-item"
|
|
110
|
+
extraAttributes={
|
|
111
|
+
href
|
|
112
|
+
? undefined
|
|
113
|
+
: participantId !== undefined
|
|
114
|
+
? { 'data-usx-chat-contact': participantId }
|
|
115
|
+
: conversationId !== undefined
|
|
116
|
+
? { 'data-usx-chat-conversation': conversationId }
|
|
117
|
+
: undefined
|
|
118
|
+
}
|
|
119
|
+
>
|
|
120
|
+
{content}
|
|
121
|
+
</Clickable>
|
|
122
|
+
)}
|
|
123
|
+
{actions.length > 0 && (
|
|
124
|
+
<Popover
|
|
125
|
+
id={`${id}-actions`}
|
|
126
|
+
side="bottom"
|
|
127
|
+
align="end"
|
|
128
|
+
panelShape="square"
|
|
129
|
+
className="usx-chat__directory-actions"
|
|
130
|
+
summaryProps={{
|
|
131
|
+
ariaLabel: `Actions for ${title}`,
|
|
132
|
+
className: 'usa-button usx-button usa-button--unstyled',
|
|
133
|
+
children: <Icon name="more_vert" />,
|
|
134
|
+
}}
|
|
135
|
+
menuItems={actions.map((action) => ({
|
|
136
|
+
id: action.id,
|
|
137
|
+
type: 'button',
|
|
138
|
+
text: action.label,
|
|
139
|
+
disabled: action.disabled,
|
|
140
|
+
extraAttributes: {
|
|
141
|
+
'data-usx-chat-directory-action': action.id,
|
|
142
|
+
...(conversationId ? { 'data-usx-chat-conversation-id': conversationId } : {}),
|
|
143
|
+
...(participantId ? { 'data-usx-chat-participant-id': participantId } : {}),
|
|
144
|
+
},
|
|
145
|
+
}))}
|
|
146
|
+
/>
|
|
147
|
+
)}
|
|
148
|
+
</li>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<h3 class="site-preview-heading">Default</h3>
|
|
2
|
+
<div>
|
|
3
|
+
<section id="django-example-directory-item-default" class="usx-chat" style="max-width: 20rem">
|
|
4
|
+
<div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
|
|
5
|
+
<span class="usx-chat__copy-status usa-sr-only" role="status"></span>
|
|
6
|
+
<div class="usx-chat__directory">
|
|
7
|
+
<ul class="usx-chat__directory-list">
|
|
8
|
+
<li class="usx-chat__directory-row">
|
|
9
|
+
<button
|
|
10
|
+
type="button"
|
|
11
|
+
class="usx-clickable usx-chat__directory-item"
|
|
12
|
+
data-usx-chat-conversation="books"
|
|
13
|
+
>
|
|
14
|
+
<span class="usx-avatar usx-chat__avatar" aria-label="Jordan Lee">
|
|
15
|
+
<span class="usx-avatar__content usx-circle">JL</span>
|
|
16
|
+
</span>
|
|
17
|
+
|
|
18
|
+
<span class="usx-chat__directory-copy">
|
|
19
|
+
<span class="usx-chat__directory-title">Jordan Lee</span>
|
|
20
|
+
<span class="usx-chat__directory-subtitle">Three design books</span>
|
|
21
|
+
<span class="usx-chat__directory-preview">I can bundle all three.</span>
|
|
22
|
+
</span>
|
|
23
|
+
|
|
24
|
+
<span class="usx-chat__directory-meta">
|
|
25
|
+
<small>Yesterday</small>
|
|
26
|
+
|
|
27
|
+
<span aria-hidden="true">
|
|
28
|
+
<span class="usa-tag usx-tag bg-info usx-rounded-md"> 2 </span>
|
|
29
|
+
</span>
|
|
30
|
+
<span class="usa-sr-only">2 unread messages</span>
|
|
31
|
+
</span>
|
|
32
|
+
</button>
|
|
33
|
+
|
|
34
|
+
<!-- prettier-ignore -->
|
|
35
|
+
<details
|
|
36
|
+
|
|
37
|
+
class="usx-popover usx-chat__directory-actions"
|
|
38
|
+
data-side="bottom"
|
|
39
|
+
data-align="end"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
<summary class="usa-button usx-button usa-button--unstyled" aria-label="Actions for Jordan Lee">
|
|
46
|
+
|
|
47
|
+
<svg
|
|
48
|
+
class="
|
|
49
|
+
usa-icon usx-icon
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
"
|
|
54
|
+
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
focusable="false"
|
|
57
|
+
role="img"
|
|
58
|
+
>
|
|
59
|
+
|
|
60
|
+
<use href="img/sprite.svg#more_vert"></use>
|
|
61
|
+
|
|
62
|
+
</svg></summary>
|
|
63
|
+
|
|
64
|
+
<div
|
|
65
|
+
id="django-directory-item-actions"
|
|
66
|
+
class="usx-popover__panel usx-popover__panel--square"
|
|
67
|
+
><ul class="usx-popover__menu"><li><button
|
|
68
|
+
type="button"
|
|
69
|
+
class="usx-popover__menu-item"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
data-usx-chat-directory-action="delete-history"data-usx-chat-conversation-id="books"
|
|
73
|
+
>
|
|
74
|
+
|
|
75
|
+
Delete chat history
|
|
76
|
+
</button></li></ul>
|
|
77
|
+
</div></details>
|
|
78
|
+
</li>
|
|
79
|
+
</ul>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</section>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<h3 class="site-preview-heading">Contact</h3>
|
|
86
|
+
<div>
|
|
87
|
+
<section id="django-example-directory-item-contact" class="usx-chat" style="max-width: 20rem">
|
|
88
|
+
<div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
|
|
89
|
+
<span class="usx-chat__copy-status usa-sr-only" role="status"></span>
|
|
90
|
+
<div class="usx-chat__directory">
|
|
91
|
+
<ul class="usx-chat__directory-list">
|
|
92
|
+
<li>
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
class="usx-clickable usx-chat__directory-item"
|
|
96
|
+
data-usx-chat-contact="avery"
|
|
97
|
+
>
|
|
98
|
+
<span class="usx-avatar usx-chat__avatar" aria-label="Avery Patel">
|
|
99
|
+
<span class="usx-avatar__content usx-circle">AP</span>
|
|
100
|
+
</span>
|
|
101
|
+
|
|
102
|
+
<span class="usx-chat__directory-copy">
|
|
103
|
+
<span class="usx-chat__directory-title">Avery Patel</span>
|
|
104
|
+
<span class="usx-chat__directory-subtitle">Application support</span>
|
|
105
|
+
</span>
|
|
106
|
+
</button>
|
|
107
|
+
</li>
|
|
108
|
+
</ul>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</section>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<h3 class="site-preview-heading">Linked Contact</h3>
|
|
115
|
+
<div>
|
|
116
|
+
<section
|
|
117
|
+
id="django-example-directory-item-linkedcontact"
|
|
118
|
+
class="usx-chat"
|
|
119
|
+
style="max-width: 20rem"
|
|
120
|
+
>
|
|
121
|
+
<div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
|
|
122
|
+
<span class="usx-chat__copy-status usa-sr-only" role="status"></span>
|
|
123
|
+
<div class="usx-chat__directory">
|
|
124
|
+
<ul class="usx-chat__directory-list">
|
|
125
|
+
<li>
|
|
126
|
+
<a class="usx-clickable usx-chat__directory-item" href="#morgan">
|
|
127
|
+
<span class="usx-chat__directory-copy">
|
|
128
|
+
<span class="usx-chat__directory-title">Morgan Chen</span>
|
|
129
|
+
<span class="usx-chat__directory-subtitle">Eligibility specialist</span>
|
|
130
|
+
</span>
|
|
131
|
+
</a>
|
|
132
|
+
</li>
|
|
133
|
+
</ul>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</section>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<h3 class="site-preview-heading">Recipient</h3>
|
|
140
|
+
<div>
|
|
141
|
+
<section id="django-example-directory-item-recipient" class="usx-chat" style="max-width: 20rem">
|
|
142
|
+
<div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
|
|
143
|
+
<span class="usx-chat__copy-status usa-sr-only" role="status"></span>
|
|
144
|
+
<div class="usx-chat__directory">
|
|
145
|
+
<ul class="usx-chat__directory-list">
|
|
146
|
+
<li>
|
|
147
|
+
<div class="usa-checkbox usx-checkbox usx-chat__directory-item usx-chat__recipient">
|
|
148
|
+
<input
|
|
149
|
+
id="django-recipient-avery"
|
|
150
|
+
class="usa-checkbox__input"
|
|
151
|
+
type="checkbox"
|
|
152
|
+
name="recipientIds"
|
|
153
|
+
value="avery"
|
|
154
|
+
form="django-example-directory-item-recipient-composer"
|
|
155
|
+
checked
|
|
156
|
+
aria-label="Avery Patel"
|
|
157
|
+
aria-describedby="django-recipient-avery-description"
|
|
158
|
+
data-usx-chat-recipient=""
|
|
159
|
+
/>
|
|
160
|
+
<label
|
|
161
|
+
class="usa-checkbox__label usx-chat__recipient-label"
|
|
162
|
+
for="django-recipient-avery"
|
|
163
|
+
>
|
|
164
|
+
<span class="usx-avatar usx-chat__avatar" aria-label="Avery Patel">
|
|
165
|
+
<span class="usx-avatar__content usx-circle">AP</span>
|
|
166
|
+
</span>
|
|
167
|
+
|
|
168
|
+
<span class="usx-chat__directory-copy">
|
|
169
|
+
<span class="usx-chat__directory-title">Avery Patel</span>
|
|
170
|
+
<span class="usx-chat__directory-subtitle" id="django-recipient-avery-description"
|
|
171
|
+
>Application support</span
|
|
172
|
+
>
|
|
173
|
+
</span>
|
|
174
|
+
</label>
|
|
175
|
+
</div>
|
|
176
|
+
</li>
|
|
177
|
+
</ul>
|
|
178
|
+
<form
|
|
179
|
+
id="django-example-directory-item-recipient-composer"
|
|
180
|
+
data-usx-chat-require-recipients="true"
|
|
181
|
+
class="usx-chat-composer usx-chat__composer"
|
|
182
|
+
method="post"
|
|
183
|
+
>
|
|
184
|
+
<label
|
|
185
|
+
class="usa-label usx-label usa-sr-only"
|
|
186
|
+
for="django-example-directory-item-recipient-message"
|
|
187
|
+
>Message</label
|
|
188
|
+
><textarea
|
|
189
|
+
id="django-example-directory-item-recipient-message"
|
|
190
|
+
class="usa-textarea usx-textarea"
|
|
191
|
+
placeholder="Write a message"
|
|
192
|
+
name="message"
|
|
193
|
+
rows="2"
|
|
194
|
+
></textarea>
|
|
195
|
+
<div class="usx-chat__composer-actions">
|
|
196
|
+
<div class="usx-chat__attach"></div>
|
|
197
|
+
<button
|
|
198
|
+
type="submit"
|
|
199
|
+
class="usa-button usx-button usa-button--primary usx-chat__send"
|
|
200
|
+
disabled=""
|
|
201
|
+
aria-disabled="true"
|
|
202
|
+
>
|
|
203
|
+
<svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
|
|
204
|
+
<use href="/img/sprite.svg#send"></use></svg
|
|
205
|
+
>Send
|
|
206
|
+
</button>
|
|
207
|
+
</div>
|
|
208
|
+
</form>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
</section>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<h3 class="site-preview-heading">Group</h3>
|
|
215
|
+
<div>
|
|
216
|
+
<section id="django-example-directory-item-group" class="usx-chat" style="max-width: 20rem">
|
|
217
|
+
<div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
|
|
218
|
+
<span class="usx-chat__copy-status usa-sr-only" role="status"></span>
|
|
219
|
+
<div class="usx-chat__directory">
|
|
220
|
+
<ul class="usx-chat__directory-list">
|
|
221
|
+
<li>
|
|
222
|
+
<button
|
|
223
|
+
type="button"
|
|
224
|
+
class="usx-clickable usx-chat__directory-item"
|
|
225
|
+
data-usx-chat-conversation="review"
|
|
226
|
+
>
|
|
227
|
+
<div class="usx-avatar-group usx-avatar-group--overlap usx-chat__directory-avatars">
|
|
228
|
+
<span class="usx-avatar usx-chat__avatar" aria-label="Avery Patel">
|
|
229
|
+
<span class="usx-avatar__content usx-circle">AP</span>
|
|
230
|
+
</span>
|
|
231
|
+
|
|
232
|
+
<span class="usx-avatar usx-chat__avatar" aria-label="Morgan Chen">
|
|
233
|
+
<span class="usx-avatar__content usx-circle">MC</span>
|
|
234
|
+
</span>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<span class="usx-chat__directory-copy">
|
|
238
|
+
<span class="usx-chat__directory-title">Review team</span>
|
|
239
|
+
|
|
240
|
+
<span class="usx-chat__directory-preview">Morgan: Ready for review.</span>
|
|
241
|
+
</span>
|
|
242
|
+
</button>
|
|
243
|
+
</li>
|
|
244
|
+
</ul>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</section>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<h3 class="site-preview-heading">Long Text</h3>
|
|
251
|
+
<div>
|
|
252
|
+
<section id="django-example-directory-item-longtext" class="usx-chat" style="max-width: 20rem">
|
|
253
|
+
<div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
|
|
254
|
+
<span class="usx-chat__copy-status usa-sr-only" role="status"></span>
|
|
255
|
+
<div class="usx-chat__directory">
|
|
256
|
+
<ul class="usx-chat__directory-list">
|
|
257
|
+
<li>
|
|
258
|
+
<button
|
|
259
|
+
type="button"
|
|
260
|
+
class="usx-clickable usx-chat__directory-item"
|
|
261
|
+
data-usx-chat-conversation="accessibility"
|
|
262
|
+
>
|
|
263
|
+
<span class="usx-chat__directory-copy">
|
|
264
|
+
<span class="usx-chat__directory-title"
|
|
265
|
+
>Neighborhood accessibility improvement working group</span
|
|
266
|
+
>
|
|
267
|
+
<span class="usx-chat__directory-subtitle"
|
|
268
|
+
>The application for accessible entrances at the community center</span
|
|
269
|
+
>
|
|
270
|
+
<span class="usx-chat__directory-preview"
|
|
271
|
+
>We have finished reviewing the plans and are ready to discuss the next steps
|
|
272
|
+
together.</span
|
|
273
|
+
>
|
|
274
|
+
</span>
|
|
275
|
+
</button>
|
|
276
|
+
</li>
|
|
277
|
+
</ul>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
</section>
|
|
281
|
+
</div>
|