@solexllc/usx-react 0.10.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.
Files changed (208) hide show
  1. package/README.md +16 -0
  2. package/dist/Popover-BzDCTuQM.cjs +984 -0
  3. package/dist/Popover-LToVWsWc.js +985 -0
  4. package/dist/chat.cjs +1391 -0
  5. package/dist/chat.js +1391 -0
  6. package/dist/index.cjs +4426 -5231
  7. package/dist/index.js +168 -970
  8. package/package.json +9 -5
  9. package/src/chat.js +15 -0
  10. package/src/components/avatar/Avatar.tsx +54 -16
  11. package/src/components/avatar/avatar.django-snapshot.html +112 -0
  12. package/src/components/avatar/avatar.django.html +2 -2
  13. package/src/components/avatar/avatar.html +25 -0
  14. package/src/components/avatar/avatar.react-snapshot.html +104 -0
  15. package/src/components/avatar/config.json +13 -15
  16. package/src/components/avatar-group/AvatarGroup.tsx +17 -15
  17. package/src/components/avatar-group/avatar-group.django-snapshot.html +22 -0
  18. package/src/components/avatar-group/avatar-group.django.html +1 -1
  19. package/src/components/avatar-group/avatar-group.react-snapshot.html +20 -0
  20. package/src/components/avatar-group/config.json +2 -2
  21. package/src/components/back-to-top/BackToTop.tsx +21 -57
  22. package/src/components/back-to-top/back-to-top.django-snapshot.html +101 -202
  23. package/src/components/back-to-top/back-to-top.django.html +11 -38
  24. package/src/components/back-to-top/back-to-top.html +22 -106
  25. package/src/components/back-to-top/back-to-top.react-snapshot.html +94 -148
  26. package/src/components/back-to-top/config.json +41 -10
  27. package/src/components/button/Button.tsx +12 -3
  28. package/src/components/button/button.django-snapshot.html +18 -0
  29. package/src/components/button/button.django.html +3 -2
  30. package/src/components/button/button.react-snapshot.html +16 -0
  31. package/src/components/button/config.json +11 -2
  32. package/src/components/callout/callout.django.html +1 -1
  33. package/src/components/callout/config.json +7 -16
  34. package/src/components/character-count/CharacterCount.tsx +2 -0
  35. package/src/components/character-count/character-count.react-snapshot.html +7 -0
  36. package/src/components/chat/Chat.tsx +575 -0
  37. package/src/components/chat/README.md +174 -0
  38. package/src/components/chat/avatarProps.ts +32 -0
  39. package/src/components/chat/chat.django-snapshot.html +23515 -0
  40. package/src/components/chat/chat.django.html +75 -0
  41. package/src/components/chat/chat.html +116 -0
  42. package/src/components/chat/chat.react-snapshot.html +16895 -0
  43. package/src/components/chat/config.json +1241 -0
  44. package/src/components/chat-attachment/ChatAttachment.tsx +39 -0
  45. package/src/components/chat-attachment/chat-attachment.django.html +24 -0
  46. package/src/components/chat-attachment/chat-attachment.html +10 -0
  47. package/src/components/chat-attachment/config.json +27 -0
  48. package/src/components/chat-attachments/ChatAttachments.tsx +17 -0
  49. package/src/components/chat-attachments/chat-attachments.django-snapshot.html +58 -0
  50. package/src/components/chat-attachments/chat-attachments.django.html +10 -0
  51. package/src/components/chat-attachments/chat-attachments.html +14 -0
  52. package/src/components/chat-attachments/chat-attachments.react-snapshot.html +46 -0
  53. package/src/components/chat-attachments/config.json +25 -0
  54. package/src/components/chat-bubble/ChatBubble.tsx +39 -0
  55. package/src/components/chat-bubble/ChatFormattedText.tsx +138 -0
  56. package/src/components/chat-bubble/chat-bubble.django-snapshot.html +128 -0
  57. package/src/components/chat-bubble/chat-bubble.django.html +19 -0
  58. package/src/components/chat-bubble/chat-bubble.html +1 -0
  59. package/src/components/chat-bubble/chat-bubble.react-snapshot.html +118 -0
  60. package/src/components/chat-bubble/config.json +70 -0
  61. package/src/components/chat-composer/ChatComposer.tsx +210 -0
  62. package/src/components/chat-composer/README.md +15 -0
  63. package/src/components/chat-composer/chat-composer.django-snapshot.html +575 -0
  64. package/src/components/chat-composer/chat-composer.django.html +77 -0
  65. package/src/components/chat-composer/chat-composer.html +44 -0
  66. package/src/components/chat-composer/chat-composer.react-snapshot.html +519 -0
  67. package/src/components/chat-composer/chat-formatting.django.html +59 -0
  68. package/src/components/chat-composer/config.json +137 -0
  69. package/src/components/chat-context/ChatContext.tsx +46 -0
  70. package/src/components/chat-context/chat-context.django-snapshot.html +35 -0
  71. package/src/components/chat-context/chat-context.django.html +20 -0
  72. package/src/components/chat-context/chat-context.html +9 -0
  73. package/src/components/chat-context/chat-context.react-snapshot.html +30 -0
  74. package/src/components/chat-context/config.json +36 -0
  75. package/src/components/chat-controls/ChatControls.tsx +67 -0
  76. package/src/components/chat-controls/chat-controls.django-snapshot.html +114 -0
  77. package/src/components/chat-controls/chat-controls.django.html +36 -0
  78. package/src/components/chat-controls/chat-controls.html +11 -0
  79. package/src/components/chat-controls/chat-controls.react-snapshot.html +107 -0
  80. package/src/components/chat-controls/config.json +67 -0
  81. package/src/components/chat-directory/ChatDirectory.tsx +168 -0
  82. package/src/components/chat-directory/chat-directory.django-snapshot.html +546 -0
  83. package/src/components/chat-directory/chat-directory.django.html +14 -0
  84. package/src/components/chat-directory/chat-directory.html +4 -0
  85. package/src/components/chat-directory/chat-directory.react-snapshot.html +471 -0
  86. package/src/components/chat-directory/config.json +242 -0
  87. package/src/components/chat-directory-item/ChatDirectoryItem.tsx +150 -0
  88. package/src/components/chat-directory-item/chat-directory-item.django-snapshot.html +281 -0
  89. package/src/components/chat-directory-item/chat-directory-item.django.html +38 -0
  90. package/src/components/chat-directory-item/chat-directory-item.html +9 -0
  91. package/src/components/chat-directory-item/chat-directory-item.react-snapshot.html +249 -0
  92. package/src/components/chat-directory-item/config.json +103 -0
  93. package/src/components/chat-history/ChatHistory.tsx +30 -0
  94. package/src/components/chat-history/chat-history.django-snapshot.html +113 -0
  95. package/src/components/chat-history/chat-history.django.html +20 -0
  96. package/src/components/chat-history/chat-history.html +9 -0
  97. package/src/components/chat-history/chat-history.react-snapshot.html +111 -0
  98. package/src/components/chat-history/config.json +24 -0
  99. package/src/components/chat-message/ChatMessage.tsx +148 -0
  100. package/src/components/chat-message/chat-message.django-snapshot.html +758 -0
  101. package/src/components/chat-message/chat-message.django.html +56 -0
  102. package/src/components/chat-message/chat-message.html +12 -0
  103. package/src/components/chat-message/chat-message.react-snapshot.html +627 -0
  104. package/src/components/chat-message/config.json +278 -0
  105. package/src/components/chat-message-actions/ChatMessageActions.tsx +133 -0
  106. package/src/components/chat-message-actions/chat-message-actions.django-snapshot.html +345 -0
  107. package/src/components/chat-message-actions/chat-message-actions.django.html +29 -0
  108. package/src/components/chat-message-actions/chat-message-actions.html +53 -0
  109. package/src/components/chat-message-actions/chat-message-actions.react-snapshot.html +295 -0
  110. package/src/components/chat-message-actions/config.json +121 -0
  111. package/src/components/chat-window/ChatWindow.tsx +133 -0
  112. package/src/components/chat-window/chat-window.django-snapshot.html +448 -0
  113. package/src/components/chat-window/chat-window.django.html +39 -0
  114. package/src/components/chat-window/chat-window.html +26 -0
  115. package/src/components/chat-window/chat-window.react-snapshot.html +286 -0
  116. package/src/components/chat-window/config.json +123 -0
  117. package/src/components/clickable/Clickable.tsx +19 -5
  118. package/src/components/clickable/clickable.django-snapshot.html +11 -2
  119. package/src/components/clickable/clickable.django.html +2 -0
  120. package/src/components/clickable/clickable.react-snapshot.html +10 -2
  121. package/src/components/clickable/config.json +4 -0
  122. package/src/components/code/code.django-snapshot.html +27 -22
  123. package/src/components/code/code.html +2 -2
  124. package/src/components/code/code.react-snapshot.html +43 -8
  125. package/src/components/copy-to-clipboard/CopyToClipboard.tsx +2 -7
  126. package/src/components/copy-to-clipboard/copy-to-clipboard.django-snapshot.html +6 -4
  127. package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +3 -2
  128. package/src/components/copy-to-clipboard/copy-to-clipboard.react-snapshot.html +14 -2
  129. package/src/components/file-list/FileList.tsx +3 -2
  130. package/src/components/file-list/config.json +5 -0
  131. package/src/components/file-list/file-list.django-snapshot.html +63 -0
  132. package/src/components/file-list/file-list.django.html +1 -1
  133. package/src/components/file-list/file-list.react-snapshot.html +53 -0
  134. package/src/components/footer/footer.django-snapshot.html +0 -3
  135. package/src/components/header/header.django-snapshot.html +5 -167
  136. package/src/components/header/header.django.html +2 -2
  137. package/src/components/header/header.html +1 -11
  138. package/src/components/header/header.react-snapshot.html +3 -6
  139. package/src/components/hero/hero.django-snapshot.html +0 -20
  140. package/src/components/hero/hero.django.html +3 -3
  141. package/src/components/icon-list/IconList.tsx +10 -2
  142. package/src/components/icon-list/config.json +5 -1
  143. package/src/components/icon-list/icon-list.django-snapshot.html +39 -0
  144. package/src/components/icon-list/icon-list.django.html +2 -0
  145. package/src/components/icon-list/icon-list.react-snapshot.html +31 -0
  146. package/src/components/image/image.django.html +4 -4
  147. package/src/components/input/Input.tsx +1 -1
  148. package/src/components/input/config.json +2 -3
  149. package/src/components/input/input.django-snapshot.html +4 -21
  150. package/src/components/input/input.django.html +2 -2
  151. package/src/components/link/Link.tsx +7 -4
  152. package/src/components/link/config.json +2 -3
  153. package/src/components/link/link.django-snapshot.html +8 -0
  154. package/src/components/link/link.django.html +2 -2
  155. package/src/components/link/link.html +4 -1
  156. package/src/components/link/link.react-snapshot.html +8 -0
  157. package/src/components/list/List.tsx +10 -2
  158. package/src/components/list/config.json +5 -1
  159. package/src/components/list/list.django-snapshot.html +26 -0
  160. package/src/components/list/list.django.html +2 -0
  161. package/src/components/list/list.html +20 -0
  162. package/src/components/list/list.react-snapshot.html +20 -0
  163. package/src/components/memorable-date/memorable-date.django-snapshot.html +0 -8
  164. package/src/components/memorable-date/memorable-date.django.html +2 -2
  165. package/src/components/misc-banner/misc-banner.django-snapshot.html +12 -12
  166. package/src/components/misc-banner/misc-banner.django.html +4 -2
  167. package/src/components/page/Page.tsx +16 -0
  168. package/src/components/page/config.json +18 -1
  169. package/src/components/page/page.django-snapshot.html +74 -0
  170. package/src/components/page/page.django.html +8 -0
  171. package/src/components/page/page.html +60 -0
  172. package/src/components/page/page.react-snapshot.html +60 -0
  173. package/src/components/popover/Popover.tsx +60 -9
  174. package/src/components/popover/PopoverMenu.tsx +33 -15
  175. package/src/components/popover/config.json +88 -14
  176. package/src/components/popover/popover-menu.django.html +13 -2
  177. package/src/components/popover/popover.django-snapshot.html +229 -7
  178. package/src/components/popover/popover.django.html +3 -2
  179. package/src/components/popover/popover.react-snapshot.html +127 -4
  180. package/src/components/process-list/config.json +41 -3
  181. package/src/components/quote/Quote.tsx +9 -2
  182. package/src/components/search/Search.tsx +1 -1
  183. package/src/components/search/config.json +3 -4
  184. package/src/components/search/search.django-snapshot.html +262 -1684
  185. package/src/components/search/search.django.html +1 -20
  186. package/src/components/select/select.django-snapshot.html +7 -7
  187. package/src/components/select/select.react-snapshot.html +7 -7
  188. package/src/components/summary/Summary.tsx +4 -2
  189. package/src/components/summary/config.json +4 -0
  190. package/src/components/summary/summary.django.html +4 -4
  191. package/src/components/table/Table.tsx +58 -25
  192. package/src/components/table/config.json +61 -13
  193. package/src/components/tag/Tag.tsx +40 -7
  194. package/src/components/tag/config.json +18 -2
  195. package/src/components/tag/tag.django-snapshot.html +16 -1
  196. package/src/components/tag/tag.django.html +12 -6
  197. package/src/components/tag/tag.html +4 -0
  198. package/src/components/tag/tag.react-snapshot.html +16 -1
  199. package/src/components/tag-group/TagGroup.tsx +6 -9
  200. package/src/components/tag-group/config.json +4 -0
  201. package/src/components/tag-group/tag-group.django.html +1 -1
  202. package/src/components/theme-picker/ThemePicker.tsx +95 -52
  203. package/src/components/theme-picker/config.json +7 -4
  204. package/src/components/theme-picker/theme-picker-select.django.html +7 -0
  205. package/src/components/theme-picker/theme-picker.django-snapshot.html +101 -21
  206. package/src/components/theme-picker/theme-picker.django.html +22 -24
  207. package/src/components/theme-picker/theme-picker.html +86 -56
  208. package/src/components/theme-picker/theme-picker.react-snapshot.html +74 -18
@@ -0,0 +1,278 @@
1
+ {
2
+ "name": "chat-message",
3
+ "template": "chat-message/chat-message.django.html",
4
+ "version": 1,
5
+ "default": {
6
+ "id": "message-example",
7
+ "message": {
8
+ "id": "m1",
9
+ "senderId": "avery",
10
+ "text": "Your appointment is confirmed.",
11
+ "timeLabel": "10:30 AM"
12
+ },
13
+ "participant": {
14
+ "id": "avery",
15
+ "name": "Avery"
16
+ }
17
+ },
18
+ "props": {
19
+ "id": {
20
+ "type": "string",
21
+ "description": "Chat instance ID for action menus."
22
+ },
23
+ "message": {
24
+ "type": "object",
25
+ "description": "One message in the transcript.",
26
+ "properties": {
27
+ "id": {
28
+ "type": "string",
29
+ "description": "Stable message ID."
30
+ },
31
+ "senderId": {
32
+ "type": "string",
33
+ "description": "ID of the sender in participants."
34
+ },
35
+ "text": {
36
+ "type": "string",
37
+ "description": "Message text. Chat safely renders **bold**, *italic*, <u>underline</u>, ~~strike~~, numbered and bulleted lines, > quotes, and fenced code blocks. Use content for other rich content."
38
+ },
39
+ "content": {
40
+ "type": "slot",
41
+ "description": "Optional rich message content. Sanitize HTML before passing it to Django; supply exportText for copied transcripts."
42
+ },
43
+ "exportText": {
44
+ "type": "string",
45
+ "description": "Plain text or Markdown used by Copy conversation for rich messages."
46
+ },
47
+ "sentAt": {
48
+ "type": "string",
49
+ "description": "ISO calendar timestamp (YYYY-MM-DDTHH:mm[:ss[.fraction]], optionally followed by Z or ±HH:mm). Grouping treats a missing timezone as UTC and truncates fractions to milliseconds; invalid dates remain ungrouped. Rendered datetime attributes and timeLabel strings are unchanged."
50
+ },
51
+ "timeLabel": {
52
+ "type": "string",
53
+ "description": "Localized timestamp label. Visible on the last message in a close group; retained for screen readers on earlier messages."
54
+ },
55
+ "groupPosition": {
56
+ "type": "select",
57
+ "options": ["single", "first", "middle", "last"],
58
+ "description": "Optional explicit grouping position. Both renderers derive it from adjacent sender IDs and sentAt values when omitted."
59
+ },
60
+ "attachments": {
61
+ "type": "array",
62
+ "description": "Files and images included with the message.",
63
+ "items": {
64
+ "type": "object",
65
+ "description": "One file or image attachment.",
66
+ "properties": {
67
+ "name": {
68
+ "type": "string",
69
+ "description": "Accessible file name."
70
+ },
71
+ "url": {
72
+ "type": "string",
73
+ "description": "Download URL, if available."
74
+ },
75
+ "imageUrl": {
76
+ "type": "string",
77
+ "description": "Optional image preview URL rendered through Image."
78
+ },
79
+ "alt": {
80
+ "type": "string",
81
+ "description": "Description of the preview image. Defaults to the file name."
82
+ }
83
+ }
84
+ }
85
+ },
86
+ "replies": {
87
+ "type": "array",
88
+ "description": "Messages displayed in this message's thread.",
89
+ "items": {
90
+ "type": "object",
91
+ "description": "One thread reply."
92
+ }
93
+ },
94
+ "olderReplies": {
95
+ "type": "object",
96
+ "description": "Optional older-page state for this message's thread, using the same fields as olderHistory."
97
+ },
98
+ "replyCount": {
99
+ "type": "number",
100
+ "description": "Visible count of replies to this message; a positive count adds a persistent thread link beside message metadata."
101
+ },
102
+ "edited": {
103
+ "type": "boolean",
104
+ "description": "Show an Edited marker."
105
+ },
106
+ "layout": {
107
+ "type": "select",
108
+ "options": ["bubble", "panel"],
109
+ "description": "Use panel for host-supplied editing or confirmation content. It expands to the available row width and uses a neutral surface instead of the sender's bubble color."
110
+ },
111
+ "deliveryStatus": {
112
+ "type": "string",
113
+ "description": "Delivery or read status supplied by the application."
114
+ },
115
+ "actions": {
116
+ "type": "array",
117
+ "description": "Overflow menu items, such as Edit or Delete. The application handles the action.",
118
+ "items": {
119
+ "type": "object",
120
+ "description": "One message action.",
121
+ "properties": {
122
+ "id": {
123
+ "type": "string",
124
+ "description": "Action identifier."
125
+ },
126
+ "label": {
127
+ "type": "string",
128
+ "description": "Visible action label."
129
+ },
130
+ "disabled": {
131
+ "type": "boolean",
132
+ "description": "Disable this action."
133
+ }
134
+ }
135
+ }
136
+ },
137
+ "reactions": {
138
+ "type": "array",
139
+ "description": "Current reactions, rendered as toggle buttons in supplied order. Keep an entry in place while its count remains positive.",
140
+ "items": {
141
+ "type": "object",
142
+ "description": "One reaction.",
143
+ "properties": {
144
+ "emoji": {
145
+ "type": "string",
146
+ "description": "Visible emoji."
147
+ },
148
+ "label": {
149
+ "type": "string",
150
+ "description": "Accessible reaction name and event value."
151
+ },
152
+ "count": {
153
+ "type": "number",
154
+ "description": "Number of reactions."
155
+ },
156
+ "selected": {
157
+ "type": "boolean",
158
+ "description": "Whether the current user selected this reaction."
159
+ }
160
+ }
161
+ }
162
+ },
163
+ "reactionOptions": {
164
+ "type": "array",
165
+ "description": "Emoji choices for adding a reaction to this message; overrides the Chat-level list. An empty array disables new reactions.",
166
+ "items": {
167
+ "type": "object",
168
+ "description": "A reaction choice.",
169
+ "properties": {
170
+ "emoji": {
171
+ "type": "string",
172
+ "description": "Visible emoji."
173
+ },
174
+ "label": {
175
+ "type": "string",
176
+ "description": "Accessible choice name and event value."
177
+ }
178
+ }
179
+ }
180
+ },
181
+ "clientMessageId": {
182
+ "type": "string",
183
+ "description": "Host-supplied correlation ID for a submitted message."
184
+ },
185
+ "deliveryState": {
186
+ "type": "select",
187
+ "options": ["sending", "failed"],
188
+ "description": "Host-supplied sending or failed state. Failed messages expose a Retry control that emits usx:chat-retry."
189
+ }
190
+ }
191
+ },
192
+ "participant": {
193
+ "type": "object",
194
+ "description": "One chat participant.",
195
+ "properties": {
196
+ "id": {
197
+ "type": "string",
198
+ "description": "Stable participant ID."
199
+ },
200
+ "name": {
201
+ "type": "string",
202
+ "description": "Visible sender name and transcript label."
203
+ },
204
+ "avatarProps": {
205
+ "type": "object",
206
+ "component": "avatar",
207
+ "description": "Avatar props. Chat renders avatars without links."
208
+ },
209
+ "presence": {
210
+ "type": "select",
211
+ "options": ["online", "away"],
212
+ "description": "Optional current presence in inbox and contact lists. The host must keep it current; it is not a response-time promise."
213
+ }
214
+ }
215
+ },
216
+ "own": {
217
+ "type": "boolean",
218
+ "description": "Align as an outgoing message.",
219
+ "default": false
220
+ },
221
+ "isThread": {
222
+ "type": "boolean",
223
+ "description": "Suppress navigation into another thread.",
224
+ "default": false
225
+ },
226
+ "allowForward": {
227
+ "type": "boolean",
228
+ "description": "Offer forwarding to contacts.",
229
+ "default": false
230
+ },
231
+ "showCopyMessageAction": {
232
+ "type": "boolean",
233
+ "default": true,
234
+ "description": "Show Copy message in each message's More menu when the message has exportable content."
235
+ },
236
+ "reactionOptions": {
237
+ "type": "array",
238
+ "description": "Emoji choices in each message\u2019s Add reaction Popover. Defaults to emojiPack. Pass an empty array to disable adding reactions.",
239
+ "items": {
240
+ "type": "object",
241
+ "description": "A reaction choice.",
242
+ "properties": {
243
+ "emoji": {
244
+ "type": "string",
245
+ "description": "Visible emoji."
246
+ },
247
+ "label": {
248
+ "type": "string",
249
+ "description": "Accessible choice name and event value."
250
+ },
251
+ "name": {
252
+ "type": "string",
253
+ "description": "Optional shortcode name; used for the reaction menu tooltip."
254
+ },
255
+ "aliases": {
256
+ "type": "array",
257
+ "description": "Optional additional shortcodes.",
258
+ "items": {
259
+ "type": "string",
260
+ "description": "Shortcode alias."
261
+ }
262
+ }
263
+ }
264
+ },
265
+ "default": []
266
+ },
267
+ "disabled": {
268
+ "type": "boolean",
269
+ "default": false,
270
+ "description": "Disable composing and response controls."
271
+ },
272
+ "allowThreads": {
273
+ "type": "boolean",
274
+ "default": false,
275
+ "description": "Whether the containing conversation enables threads. Thread views do not offer nested threads."
276
+ }
277
+ }
278
+ }
@@ -0,0 +1,133 @@
1
+ import React from 'react';
2
+ import Button from '../button/Button';
3
+ import Icon from '../icon/Icon';
4
+ import Popover from '../popover/Popover';
5
+ import type { PopoverMenuItem } from '../popover/PopoverMenu';
6
+ import type { ChatMessageAction, ChatReaction, ChatReactionOption } from '../chat/Chat';
7
+ export interface ChatMessageActionsProps {
8
+ id: string;
9
+ messageId: string;
10
+ senderName: string;
11
+ reactions?: ChatReaction[];
12
+ reactionOptions?: ChatReactionOption[];
13
+ actions?: ChatMessageAction[];
14
+ canCopy?: boolean;
15
+ canReply?: boolean;
16
+ canForward?: boolean;
17
+ }
18
+ export default function ChatMessageActions({
19
+ id,
20
+ messageId,
21
+ senderName,
22
+ reactions,
23
+ reactionOptions = [],
24
+ actions = [],
25
+ canCopy = false,
26
+ canReply = false,
27
+ canForward = false,
28
+ }: ChatMessageActionsProps) {
29
+ const hasOverflow = canCopy || actions.length > 0;
30
+ const hasMessageTools = reactionOptions.length > 0 || canReply || canForward || hasOverflow;
31
+ return (
32
+ <>
33
+ {' '}
34
+ {hasMessageTools && (
35
+ <div
36
+ className="usx-chat__message-tools"
37
+ role="group"
38
+ aria-label={`Actions for message from ${senderName}`}
39
+ >
40
+ {reactionOptions.length > 0 && (
41
+ <Popover
42
+ id={`${id}-reactions-${messageId}`}
43
+ side="top"
44
+ align="end"
45
+ panelShape="square"
46
+ className="usx-chat__message-actions usx-chat__reaction-actions"
47
+ menuItems={reactionOptions.map((option): PopoverMenuItem => {
48
+ const current = reactions?.find((reaction) => reaction.label === option.label);
49
+ return {
50
+ id: option.label,
51
+ type: 'button',
52
+ text: option.emoji,
53
+ extraAttributes: {
54
+ 'aria-label': option.label,
55
+ title: 'name' in option && option.name ? `:${option.name}:` : option.label,
56
+ 'aria-pressed': Boolean(current?.selected),
57
+ 'data-usx-chat-reaction': option.label,
58
+ },
59
+ };
60
+ })}
61
+ summaryProps={{
62
+ ariaLabel: `React to message from ${senderName}`,
63
+ title: 'Add reaction',
64
+ className: 'usa-button usx-button usa-button--unstyled',
65
+ children: <Icon name="sentiment_satisfied" />,
66
+ }}
67
+ />
68
+ )}
69
+ {canReply && (
70
+ <Button
71
+ variant="unstyled"
72
+ className="usx-chat__tool-button"
73
+ title="Reply in thread"
74
+ aria-label={`Reply in thread to message from ${senderName}`}
75
+ data-usx-chat-thread={messageId}
76
+ >
77
+ <Icon name="comment" />
78
+ </Button>
79
+ )}
80
+ {canForward && (
81
+ <Button
82
+ variant="unstyled"
83
+ className="usx-chat__tool-button"
84
+ title="Forward message"
85
+ aria-label={`Forward message from ${senderName}`}
86
+ data-usx-chat-forward={messageId}
87
+ >
88
+ <Icon name="arrow_forward" />
89
+ </Button>
90
+ )}
91
+ {hasOverflow && (
92
+ <Popover
93
+ id={`${id}-actions-${messageId}`}
94
+ side="top"
95
+ align="end"
96
+ panelShape="square"
97
+ className="usx-chat__message-actions usx-chat__overflow-actions"
98
+ menuItems={[
99
+ ...(canCopy
100
+ ? [
101
+ {
102
+ text: 'Copy message',
103
+ type: 'button' as const,
104
+ icon: { name: 'content_copy' },
105
+ extraAttributes: { 'data-usx-chat-copy-message': '' },
106
+ },
107
+ ]
108
+ : []),
109
+ ...(actions ?? []).map(
110
+ (action): PopoverMenuItem => ({
111
+ id: action.id,
112
+ type: 'button',
113
+ text: action.label,
114
+ disabled: action.disabled,
115
+ extraAttributes: {
116
+ 'data-usx-chat-message-action': action.id,
117
+ },
118
+ })
119
+ ),
120
+ ]}
121
+ summaryProps={{
122
+ ariaLabel: `More actions for message from ${senderName}`,
123
+ title: 'More actions',
124
+ className: 'usa-button usx-button usa-button--unstyled',
125
+ children: <Icon name="more_horiz" />,
126
+ }}
127
+ />
128
+ )}
129
+ </div>
130
+ )}
131
+ </>
132
+ );
133
+ }