@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.
Files changed (181) 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 +4428 -5290
  7. package/dist/index.js +58 -917
  8. package/package.json +7 -3
  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 +25 -18
  123. package/src/components/code/code.react-snapshot.html +41 -4
  124. package/src/components/copy-to-clipboard/CopyToClipboard.tsx +2 -7
  125. package/src/components/copy-to-clipboard/copy-to-clipboard.django-snapshot.html +6 -4
  126. package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +3 -2
  127. package/src/components/copy-to-clipboard/copy-to-clipboard.react-snapshot.html +14 -2
  128. package/src/components/file-list/FileList.tsx +3 -2
  129. package/src/components/file-list/config.json +5 -0
  130. package/src/components/file-list/file-list.django-snapshot.html +63 -0
  131. package/src/components/file-list/file-list.django.html +1 -1
  132. package/src/components/file-list/file-list.react-snapshot.html +53 -0
  133. package/src/components/footer/footer.django-snapshot.html +0 -3
  134. package/src/components/header/header.django-snapshot.html +0 -160
  135. package/src/components/header/header.django.html +2 -2
  136. package/src/components/hero/hero.django-snapshot.html +0 -20
  137. package/src/components/hero/hero.django.html +3 -3
  138. package/src/components/image/image.django.html +4 -4
  139. package/src/components/input/Input.tsx +1 -1
  140. package/src/components/input/config.json +2 -3
  141. package/src/components/input/input.django-snapshot.html +4 -21
  142. package/src/components/input/input.django.html +2 -2
  143. package/src/components/link/Link.tsx +7 -4
  144. package/src/components/link/config.json +2 -3
  145. package/src/components/link/link.django-snapshot.html +8 -0
  146. package/src/components/link/link.django.html +2 -2
  147. package/src/components/link/link.html +4 -1
  148. package/src/components/link/link.react-snapshot.html +8 -0
  149. package/src/components/memorable-date/memorable-date.django-snapshot.html +0 -8
  150. package/src/components/memorable-date/memorable-date.django.html +2 -2
  151. package/src/components/misc-banner/misc-banner.django-snapshot.html +12 -12
  152. package/src/components/misc-banner/misc-banner.django.html +4 -2
  153. package/src/components/popover/Popover.tsx +60 -9
  154. package/src/components/popover/PopoverMenu.tsx +33 -15
  155. package/src/components/popover/config.json +88 -14
  156. package/src/components/popover/popover-menu.django.html +13 -2
  157. package/src/components/popover/popover.django-snapshot.html +229 -7
  158. package/src/components/popover/popover.django.html +3 -2
  159. package/src/components/popover/popover.react-snapshot.html +127 -4
  160. package/src/components/process-list/config.json +41 -3
  161. package/src/components/quote/Quote.tsx +9 -2
  162. package/src/components/search/Search.tsx +1 -1
  163. package/src/components/search/config.json +3 -4
  164. package/src/components/search/search.django-snapshot.html +262 -1684
  165. package/src/components/search/search.django.html +1 -20
  166. package/src/components/select/select.django-snapshot.html +7 -7
  167. package/src/components/select/select.react-snapshot.html +7 -7
  168. package/src/components/summary/Summary.tsx +4 -2
  169. package/src/components/summary/config.json +4 -0
  170. package/src/components/summary/summary.django.html +4 -4
  171. package/src/components/table/Table.tsx +58 -25
  172. package/src/components/table/config.json +61 -13
  173. package/src/components/tag/Tag.tsx +40 -7
  174. package/src/components/tag/config.json +18 -2
  175. package/src/components/tag/tag.django-snapshot.html +16 -1
  176. package/src/components/tag/tag.django.html +12 -6
  177. package/src/components/tag/tag.html +4 -0
  178. package/src/components/tag/tag.react-snapshot.html +16 -1
  179. package/src/components/tag-group/TagGroup.tsx +6 -9
  180. package/src/components/tag-group/config.json +4 -0
  181. package/src/components/tag-group/tag-group.django.html +1 -1
@@ -0,0 +1,295 @@
1
+ <h3 class="site-preview-heading">Default</h3>
2
+ <div>
3
+ <section id="react-example-message-actions-default" class="usx-chat" style="max-width: 28rem">
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
+ <ol class="usx-chat__messages">
7
+ <li data-message-id="m1" data-sender-name="Avery">
8
+ <div class="usx-chat__bubble">
9
+ <p>Your appointment is confirmed.</p>
10
+ <div role="group" aria-label="Reactions" class="usx-tag-group usx-chat__reactions">
11
+ <button
12
+ type="button"
13
+ class="usa-button usx-button usa-button--unstyled usa-tag usx-tag usx-tag--outline usx-tag--interactive usa-link usx-link usx-no-visited usx-chat__reaction"
14
+ aria-pressed="true"
15
+ aria-label="Helpful, 2"
16
+ data-usx-chat-reaction="Helpful"
17
+ >
18
+ 👍 2
19
+ </button>
20
+ </div>
21
+ </div>
22
+ <div
23
+ class="usx-chat__message-tools"
24
+ role="group"
25
+ aria-label="Actions for message from Avery"
26
+ >
27
+ <details
28
+ class="usx-popover usx-chat__message-actions usx-chat__reaction-actions"
29
+ data-side="top"
30
+ data-align="end"
31
+ >
32
+ <summary
33
+ class="usa-button usx-button usa-button--unstyled"
34
+ aria-label="React to message from Avery"
35
+ title="Add reaction"
36
+ >
37
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
38
+ <use href="/img/sprite.svg#sentiment_satisfied"></use>
39
+ </svg>
40
+ </summary>
41
+ <div
42
+ id="react-tools-default-reactions-m1"
43
+ class="usx-popover__panel usx-popover__panel--square"
44
+ >
45
+ <ul class="usx-popover__menu">
46
+ <li>
47
+ <button
48
+ aria-label="Helpful"
49
+ title="Helpful"
50
+ aria-pressed="true"
51
+ data-usx-chat-reaction="Helpful"
52
+ type="button"
53
+ class="usx-popover__menu-item"
54
+ >
55
+ 👍
56
+ </button>
57
+ </li>
58
+ <li>
59
+ <button
60
+ aria-label="Thanks"
61
+ title="Thanks"
62
+ aria-pressed="false"
63
+ data-usx-chat-reaction="Thanks"
64
+ type="button"
65
+ class="usx-popover__menu-item"
66
+ >
67
+ ❤️
68
+ </button>
69
+ </li>
70
+ </ul>
71
+ </div>
72
+ </details>
73
+ <button
74
+ type="button"
75
+ class="usa-button usx-button usa-button--unstyled usx-chat__tool-button"
76
+ title="Reply in thread"
77
+ aria-label="Reply in thread to message from Avery"
78
+ data-usx-chat-thread="m1"
79
+ >
80
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
81
+ <use href="/img/sprite.svg#comment"></use>
82
+ </svg></button
83
+ ><button
84
+ type="button"
85
+ class="usa-button usx-button usa-button--unstyled usx-chat__tool-button"
86
+ title="Forward message"
87
+ aria-label="Forward message from Avery"
88
+ data-usx-chat-forward="m1"
89
+ >
90
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
91
+ <use href="/img/sprite.svg#arrow_forward"></use>
92
+ </svg>
93
+ </button>
94
+ <details
95
+ class="usx-popover usx-chat__message-actions usx-chat__overflow-actions"
96
+ data-side="top"
97
+ data-align="end"
98
+ >
99
+ <summary
100
+ class="usa-button usx-button usa-button--unstyled"
101
+ aria-label="More actions for message from Avery"
102
+ title="More actions"
103
+ >
104
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
105
+ <use href="/img/sprite.svg#more_horiz"></use>
106
+ </svg>
107
+ </summary>
108
+ <div
109
+ id="react-tools-default-actions-m1"
110
+ class="usx-popover__panel usx-popover__panel--square"
111
+ >
112
+ <ul class="usx-popover__menu">
113
+ <li>
114
+ <button
115
+ data-usx-chat-copy-message=""
116
+ type="button"
117
+ class="usx-popover__menu-item"
118
+ >
119
+ <svg
120
+ class="usa-icon usx-icon"
121
+ aria-hidden="true"
122
+ focusable="false"
123
+ role="img"
124
+ >
125
+ <use href="/img/sprite.svg#content_copy"></use></svg
126
+ >Copy message
127
+ </button>
128
+ </li>
129
+ <li>
130
+ <button
131
+ data-usx-chat-message-action="report"
132
+ type="button"
133
+ class="usx-popover__menu-item"
134
+ >
135
+ Report message
136
+ </button>
137
+ </li>
138
+ </ul>
139
+ </div>
140
+ </details>
141
+ </div>
142
+ </li>
143
+ </ol>
144
+ </div>
145
+ </section>
146
+ </div>
147
+
148
+ <h3 class="site-preview-heading">Host Actions</h3>
149
+ <div>
150
+ <section id="react-example-message-actions-hostactions" class="usx-chat" style="max-width: 28rem">
151
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
152
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
153
+ <ol class="usx-chat__messages">
154
+ <li data-message-id="m2" data-sender-name="You">
155
+ <div class="usx-chat__bubble"><p>Your appointment is confirmed.</p></div>
156
+ <div
157
+ class="usx-chat__message-tools"
158
+ role="group"
159
+ aria-label="Actions for message from You"
160
+ >
161
+ <details
162
+ class="usx-popover usx-chat__message-actions usx-chat__overflow-actions"
163
+ data-side="top"
164
+ data-align="end"
165
+ >
166
+ <summary
167
+ class="usa-button usx-button usa-button--unstyled"
168
+ aria-label="More actions for message from You"
169
+ title="More actions"
170
+ >
171
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
172
+ <use href="/img/sprite.svg#more_horiz"></use>
173
+ </svg>
174
+ </summary>
175
+ <div
176
+ id="react-tools-host-actions-m2"
177
+ class="usx-popover__panel usx-popover__panel--square"
178
+ >
179
+ <ul class="usx-popover__menu">
180
+ <li>
181
+ <button
182
+ data-usx-chat-message-action="recall"
183
+ type="button"
184
+ class="usx-popover__menu-item"
185
+ >
186
+ Recall message
187
+ </button>
188
+ </li>
189
+ <li>
190
+ <button
191
+ data-usx-chat-message-action="mark-unread"
192
+ type="button"
193
+ class="usx-popover__menu-item"
194
+ >
195
+ Mark unread
196
+ </button>
197
+ </li>
198
+ <li>
199
+ <button
200
+ data-usx-chat-message-action="edit"
201
+ type="button"
202
+ class="usx-popover__menu-item"
203
+ >
204
+ Edit message
205
+ </button>
206
+ </li>
207
+ <li>
208
+ <button
209
+ data-usx-chat-message-action="delete"
210
+ type="button"
211
+ class="usx-popover__menu-item"
212
+ disabled=""
213
+ >
214
+ Delete message
215
+ </button>
216
+ </li>
217
+ </ul>
218
+ </div>
219
+ </details>
220
+ </div>
221
+ </li>
222
+ </ol>
223
+ </div>
224
+ </section>
225
+ </div>
226
+
227
+ <h3 class="site-preview-heading">Reactions Only</h3>
228
+ <div>
229
+ <section
230
+ id="react-example-message-actions-reactionsonly"
231
+ class="usx-chat"
232
+ style="max-width: 28rem"
233
+ >
234
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
235
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
236
+ <ol class="usx-chat__messages">
237
+ <li data-message-id="m3" data-sender-name="Jordan">
238
+ <div class="usx-chat__bubble"><p>Your appointment is confirmed.</p></div>
239
+ <div
240
+ class="usx-chat__message-tools"
241
+ role="group"
242
+ aria-label="Actions for message from Jordan"
243
+ >
244
+ <details
245
+ class="usx-popover usx-chat__message-actions usx-chat__reaction-actions"
246
+ data-side="top"
247
+ data-align="end"
248
+ >
249
+ <summary
250
+ class="usa-button usx-button usa-button--unstyled"
251
+ aria-label="React to message from Jordan"
252
+ title="Add reaction"
253
+ >
254
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
255
+ <use href="/img/sprite.svg#sentiment_satisfied"></use>
256
+ </svg>
257
+ </summary>
258
+ <div
259
+ id="react-tools-reactions-reactions-m3"
260
+ class="usx-popover__panel usx-popover__panel--square"
261
+ >
262
+ <ul class="usx-popover__menu">
263
+ <li>
264
+ <button
265
+ aria-label="Helpful"
266
+ title="Helpful"
267
+ aria-pressed="false"
268
+ data-usx-chat-reaction="Helpful"
269
+ type="button"
270
+ class="usx-popover__menu-item"
271
+ >
272
+ 👍
273
+ </button>
274
+ </li>
275
+ <li>
276
+ <button
277
+ aria-label="Thanks"
278
+ title="Thanks"
279
+ aria-pressed="false"
280
+ data-usx-chat-reaction="Thanks"
281
+ type="button"
282
+ class="usx-popover__menu-item"
283
+ >
284
+ ❤️
285
+ </button>
286
+ </li>
287
+ </ul>
288
+ </div>
289
+ </details>
290
+ </div>
291
+ </li>
292
+ </ol>
293
+ </div>
294
+ </section>
295
+ </div>
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "chat-message-actions",
3
+ "template": "chat-message-actions/chat-message-actions.django.html",
4
+ "version": 1,
5
+ "default": {
6
+ "id": "message-tools",
7
+ "messageId": "message-1",
8
+ "senderName": "Avery",
9
+ "canCopy": true,
10
+ "canReply": true
11
+ },
12
+ "props": {
13
+ "id": {
14
+ "type": "string",
15
+ "description": "Chat instance ID, used to namespace menu IDs."
16
+ },
17
+ "messageId": {
18
+ "type": "string",
19
+ "description": "Message acted on."
20
+ },
21
+ "senderName": {
22
+ "type": "string",
23
+ "description": "Sender name for accessible action labels."
24
+ },
25
+ "reactions": {
26
+ "type": "array",
27
+ "description": "Current reactions, rendered as toggle buttons in supplied order. Keep an entry in place while its count remains positive.",
28
+ "items": {
29
+ "type": "object",
30
+ "description": "One reaction.",
31
+ "properties": {
32
+ "emoji": {
33
+ "type": "string",
34
+ "description": "Visible emoji."
35
+ },
36
+ "label": {
37
+ "type": "string",
38
+ "description": "Accessible reaction name and event value."
39
+ },
40
+ "count": {
41
+ "type": "number",
42
+ "description": "Number of reactions."
43
+ },
44
+ "selected": {
45
+ "type": "boolean",
46
+ "description": "Whether the current user selected this reaction."
47
+ }
48
+ }
49
+ }
50
+ },
51
+ "reactionOptions": {
52
+ "type": "array",
53
+ "description": "Emoji choices in each message’s Add reaction Popover. Defaults to emojiPack. Pass an empty array to disable adding reactions.",
54
+ "items": {
55
+ "type": "object",
56
+ "description": "A reaction choice.",
57
+ "properties": {
58
+ "emoji": {
59
+ "type": "string",
60
+ "description": "Visible emoji."
61
+ },
62
+ "label": {
63
+ "type": "string",
64
+ "description": "Accessible choice name and event value."
65
+ },
66
+ "name": {
67
+ "type": "string",
68
+ "description": "Optional shortcode name; used for the reaction menu tooltip."
69
+ },
70
+ "aliases": {
71
+ "type": "array",
72
+ "description": "Optional additional shortcodes.",
73
+ "items": {
74
+ "type": "string",
75
+ "description": "Shortcode alias."
76
+ }
77
+ }
78
+ }
79
+ },
80
+ "default": []
81
+ },
82
+ "actions": {
83
+ "type": "array",
84
+ "description": "Overflow menu items, such as Edit or Delete. The application handles the action.",
85
+ "items": {
86
+ "type": "object",
87
+ "description": "One message action.",
88
+ "properties": {
89
+ "id": {
90
+ "type": "string",
91
+ "description": "Action identifier."
92
+ },
93
+ "label": {
94
+ "type": "string",
95
+ "description": "Visible action label."
96
+ },
97
+ "disabled": {
98
+ "type": "boolean",
99
+ "description": "Disable this action."
100
+ }
101
+ }
102
+ },
103
+ "default": []
104
+ },
105
+ "canCopy": {
106
+ "type": "boolean",
107
+ "description": "Offer Copy message.",
108
+ "default": false
109
+ },
110
+ "canReply": {
111
+ "type": "boolean",
112
+ "description": "Offer Reply in thread.",
113
+ "default": false
114
+ },
115
+ "canForward": {
116
+ "type": "boolean",
117
+ "description": "Offer Forward message.",
118
+ "default": false
119
+ }
120
+ }
121
+ }
@@ -0,0 +1,133 @@
1
+ import type { SummaryProps } from '../summary/Summary';
2
+ import React from 'react';
3
+ import ClassNames from 'classnames';
4
+ import Button from '../button/Button';
5
+ import Icon from '../icon/Icon';
6
+ import Popover, { type PopoverSide, type PopoverAlign } from '../popover/Popover';
7
+ import type { ChatAction, ChatView } from '../chat/Chat';
8
+ export interface ChatWindowProps {
9
+ id: string;
10
+ title?: string;
11
+ view?: ChatView;
12
+ status?: string;
13
+ showBack?: boolean;
14
+ showNewMessage?: boolean;
15
+ showCopyAction?: boolean;
16
+ conversationId?: string;
17
+ conversationActions?: ChatAction[];
18
+ actions?: React.ReactNode;
19
+ children?: React.ReactNode;
20
+ summaryProps?: Omit<SummaryProps, 'unstyled'>;
21
+ side?: PopoverSide;
22
+ align?: PopoverAlign;
23
+ defaultOpen?: boolean;
24
+ className?: string;
25
+ }
26
+ export default function ChatWindow({
27
+ id,
28
+ title = 'Chat',
29
+ view = 'conversation',
30
+ status,
31
+ showBack = false,
32
+ showNewMessage = false,
33
+ showCopyAction = false,
34
+ conversationId,
35
+ conversationActions = [],
36
+ actions,
37
+ children,
38
+ summaryProps,
39
+ side = 'bottom',
40
+ align = 'start',
41
+ defaultOpen = false,
42
+ className,
43
+ }: ChatWindowProps) {
44
+ return (
45
+ <Popover
46
+ id={id}
47
+ side={side}
48
+ align={align}
49
+ panelShape="square"
50
+ defaultOpen={defaultOpen}
51
+ dismissOnOutside={false}
52
+ className={ClassNames('usx-chat', className)}
53
+ panelClassName="usx-chat__panel"
54
+ contentClassName="usx-chat__popover-content"
55
+ headerClassName="usx-chat__header"
56
+ panelHeading={title}
57
+ headingAs="h2"
58
+ panelHeadingId={`${id}-title`}
59
+ headerLeftActions={
60
+ showBack && (
61
+ <Button
62
+ variant="unstyled"
63
+ className="usx-popover__header-action"
64
+ aria-label={view === 'thread' ? 'Back to conversation' : 'Back'}
65
+ iconProps={[{ name: 'arrow_back' }]}
66
+ extraAttributes={{ 'data-usx-chat-back': '' }}
67
+ />
68
+ )
69
+ }
70
+ headerRightActions={
71
+ <>
72
+ {showNewMessage && (
73
+ <Button
74
+ variant="unstyled"
75
+ className="usx-popover__header-action"
76
+ aria-label="New message"
77
+ iconProps={[{ name: 'add' }]}
78
+ extraAttributes={{ 'data-usx-chat-new': '' }}
79
+ />
80
+ )}
81
+ {(showCopyAction || conversationActions.length > 0 || Boolean(actions)) && (
82
+ <Popover
83
+ id={`${id}-conversation-actions`}
84
+ className="usx-chat__actions"
85
+ side="bottom"
86
+ align="end"
87
+ panelShape="square"
88
+ panelClassName="usx-chat__actions-menu"
89
+ menuItems={[
90
+ ...(showCopyAction
91
+ ? [
92
+ {
93
+ text: 'Copy conversation',
94
+ type: 'button' as const,
95
+ icon: { name: 'content_copy' },
96
+ extraAttributes: { 'data-usx-chat-copy': '' },
97
+ },
98
+ ]
99
+ : []),
100
+ ...conversationActions.map((action) => ({
101
+ id: action.id,
102
+ type: 'button' as const,
103
+ text: action.label,
104
+ disabled: action.disabled,
105
+ extraAttributes: {
106
+ 'data-usx-chat-directory-action': action.id,
107
+ ...(conversationId ? { 'data-usx-chat-conversation-id': conversationId } : {}),
108
+ },
109
+ })),
110
+ ]}
111
+ summaryProps={{
112
+ ariaLabel: 'Conversation actions',
113
+ className: 'usa-button usx-button usa-button--unstyled usx-popover__header-action',
114
+ children: <Icon name="more_vert" />,
115
+ }}
116
+ >
117
+ {actions}
118
+ </Popover>
119
+ )}
120
+ </>
121
+ }
122
+ showCloseIcon
123
+ closeIconLabel="Close chat"
124
+ summaryProps={{ label: 'Open chat', ...summaryProps }}
125
+ >
126
+ <section className="usx-chat__window" aria-labelledby={`${id}-title`} data-chat-view={view}>
127
+ <span className="usx-chat__copy-status usa-sr-only" role="status" aria-live="polite"></span>
128
+ {status && <p className="usx-chat__status">{status}</p>}
129
+ {children}
130
+ </section>
131
+ </Popover>
132
+ );
133
+ }