@solexllc/usx-react 0.11.0 → 1.0.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 +31 -0
- package/dist/Popover-Bg4-2-cU.cjs +987 -0
- package/dist/Popover-CqHczzNE.js +988 -0
- package/dist/chat.cjs +1396 -0
- package/dist/chat.js +1396 -0
- package/dist/index.cjs +4412 -5247
- package/dist/index.js +140 -972
- package/package.json +9 -5
- package/src/chat.js +15 -0
- package/src/components/accordion/Accordion.tsx +9 -57
- package/src/components/accordion/accordion.django.html +10 -20
- package/src/components/accordion/config.json +8 -2
- package/src/components/accordion-item/AccordionItem.tsx +54 -0
- package/src/components/accordion-item/accordion-item.django.html +19 -0
- package/src/components/accordion-item/accordion-item.html +8 -0
- package/src/components/accordion-item/config.json +55 -0
- package/src/components/alert/alert.django-snapshot.html +4 -4
- package/src/components/avatar/Avatar.tsx +54 -16
- package/src/components/avatar/avatar.django-snapshot.html +118 -2
- 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 +110 -3
- package/src/components/avatar/config.json +17 -17
- package/src/components/avatar-group/AvatarGroup.tsx +17 -15
- package/src/components/avatar-group/avatar-group.django-snapshot.html +196 -174
- package/src/components/avatar-group/avatar-group.django.html +1 -1
- package/src/components/avatar-group/avatar-group.react-snapshot.html +216 -165
- package/src/components/avatar-group/config.json +14 -8
- 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/banner/banner.django-snapshot.html +2 -2
- package/src/components/button/Button.tsx +15 -3
- package/src/components/button/button.django-snapshot.html +82 -0
- package/src/components/button/button.django.html +5 -2
- package/src/components/button/button.react-snapshot.html +80 -0
- package/src/components/button/config.json +17 -3
- package/src/components/callout/callout.django.html +1 -1
- package/src/components/callout/config.json +7 -16
- package/src/components/card/card.django-snapshot.html +43 -0
- package/src/components/card/card.react-snapshot.html +36 -0
- 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 +23579 -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 +213 -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 +135 -0
- package/src/components/chat-window/chat-window.django-snapshot.html +450 -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/checkbox/checkbox.django-snapshot.html +2 -2
- 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/data-table/data-table.django-snapshot.html +4 -5
- package/src/components/data-table/data-table.react-snapshot.html +4 -4
- package/src/components/drawer/drawer.django-snapshot.html +53 -30
- package/src/components/error-page/error-page.django-snapshot.html +20 -7
- package/src/components/fieldset/fieldset.django-snapshot.html +1 -6
- 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/form-group/form-group.django-snapshot.html +0 -2
- package/src/components/header/header.django-snapshot.html +3 -163
- package/src/components/header/header.django.html +2 -2
- package/src/components/header/header.html +1 -1
- package/src/components/header/header.react-snapshot.html +3 -3
- package/src/components/hero/hero.django-snapshot.html +0 -20
- package/src/components/hero/hero.django.html +3 -3
- package/src/components/identifier/config.json +4 -2
- package/src/components/identifier/identifier.django-snapshot.html +13 -16
- package/src/components/identifier/identifier.react-snapshot.html +13 -15
- package/src/components/image/image.django-snapshot.html +6 -6
- 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/layout/layout.django-snapshot.html +2 -0
- 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/modal/Modal.tsx +4 -3
- package/src/components/modal/config.json +3 -2
- package/src/components/modal/modal.django-snapshot.html +70 -14
- package/src/components/modal/modal.django.html +7 -9
- package/src/components/modal/modal.html +4 -4
- package/src/components/modal/modal.react-snapshot.html +64 -4
- package/src/components/page/Page.tsx +10 -7
- package/src/components/page/page.django-snapshot.html +5 -8
- package/src/components/page/page.django.html +2 -2
- package/src/components/page/page.html +1 -2
- package/src/components/page/page.react-snapshot.html +5 -8
- package/src/components/pagination/navigation/PaginationNavigation.tsx +2 -0
- package/src/components/pagination/navigation/pagination-navigation.django.html +2 -0
- package/src/components/pagination/pagination.django-snapshot.html +62 -0
- package/src/components/pagination/pagination.django.html +3 -1
- package/src/components/pagination/pagination.html +46 -0
- package/src/components/pagination/pagination.react-snapshot.html +48 -0
- package/src/components/pagination/summary/PaginationSummary.tsx +1 -1
- package/src/components/pagination/summary/pagination-summary.django.html +1 -1
- package/src/components/popover/Popover.tsx +61 -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 +265 -7
- package/src/components/popover/popover.django.html +3 -2
- package/src/components/popover/popover.react-snapshot.html +154 -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/section/Section.tsx +3 -1
- package/src/components/select/select.django-snapshot.html +7 -7
- package/src/components/select/select.react-snapshot.html +7 -7
- package/src/components/site-alert/site-alert.django-snapshot.html +8 -8
- 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/swap/Swap.tsx +35 -3
- package/src/components/swap/config.json +28 -1
- package/src/components/swap/swap.django-snapshot.html +29 -7
- package/src/components/swap/swap.django.html +15 -1
- package/src/components/swap/swap.react-snapshot.html +34 -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
- package/src/components/theme-picker/ThemePicker.tsx +48 -42
- package/src/components/theme-picker/config.json +27 -29
- package/src/components/theme-picker/theme-picker-select.django.html +1 -1
- package/src/components/theme-picker/theme-picker.django-snapshot.html +283 -78
- package/src/components/theme-picker/theme-picker.django.html +24 -11
- package/src/components/theme-picker/theme-picker.html +155 -54
- package/src/components/theme-picker/theme-picker.react-snapshot.html +265 -67
- package/src/index.js +1 -0
|
@@ -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,135 @@
|
|
|
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
|
+
tighten
|
|
64
|
+
className="usx-popover__header-action"
|
|
65
|
+
aria-label={view === 'thread' ? 'Back to conversation' : 'Back'}
|
|
66
|
+
iconProps={[{ name: 'arrow_back' }]}
|
|
67
|
+
extraAttributes={{ 'data-usx-chat-back': '' }}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
headerRightActions={
|
|
72
|
+
<>
|
|
73
|
+
{showNewMessage && (
|
|
74
|
+
<Button
|
|
75
|
+
variant="unstyled"
|
|
76
|
+
tighten
|
|
77
|
+
className="usx-popover__header-action"
|
|
78
|
+
aria-label="New message"
|
|
79
|
+
iconProps={[{ name: 'add' }]}
|
|
80
|
+
extraAttributes={{ 'data-usx-chat-new': '' }}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
{(showCopyAction || conversationActions.length > 0 || Boolean(actions)) && (
|
|
84
|
+
<Popover
|
|
85
|
+
id={`${id}-conversation-actions`}
|
|
86
|
+
className="usx-chat__actions"
|
|
87
|
+
side="bottom"
|
|
88
|
+
align="end"
|
|
89
|
+
panelShape="square"
|
|
90
|
+
panelClassName="usx-chat__actions-menu"
|
|
91
|
+
menuItems={[
|
|
92
|
+
...(showCopyAction
|
|
93
|
+
? [
|
|
94
|
+
{
|
|
95
|
+
text: 'Copy conversation',
|
|
96
|
+
type: 'button' as const,
|
|
97
|
+
icon: { name: 'content_copy' },
|
|
98
|
+
extraAttributes: { 'data-usx-chat-copy': '' },
|
|
99
|
+
},
|
|
100
|
+
]
|
|
101
|
+
: []),
|
|
102
|
+
...conversationActions.map((action) => ({
|
|
103
|
+
id: action.id,
|
|
104
|
+
type: 'button' as const,
|
|
105
|
+
text: action.label,
|
|
106
|
+
disabled: action.disabled,
|
|
107
|
+
extraAttributes: {
|
|
108
|
+
'data-usx-chat-directory-action': action.id,
|
|
109
|
+
...(conversationId ? { 'data-usx-chat-conversation-id': conversationId } : {}),
|
|
110
|
+
},
|
|
111
|
+
})),
|
|
112
|
+
]}
|
|
113
|
+
summaryProps={{
|
|
114
|
+
ariaLabel: 'Conversation actions',
|
|
115
|
+
className: 'usa-button usx-button usa-button--unstyled usx-button--tight usx-popover__header-action',
|
|
116
|
+
children: <Icon name="more_vert" />,
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{actions}
|
|
120
|
+
</Popover>
|
|
121
|
+
)}
|
|
122
|
+
</>
|
|
123
|
+
}
|
|
124
|
+
showCloseIcon
|
|
125
|
+
closeIconLabel="Close chat"
|
|
126
|
+
summaryProps={{ label: 'Open chat', ...summaryProps }}
|
|
127
|
+
>
|
|
128
|
+
<section className="usx-chat__window" aria-labelledby={`${id}-title`} data-chat-view={view}>
|
|
129
|
+
<span className="usx-chat__copy-status usa-sr-only" role="status" aria-live="polite"></span>
|
|
130
|
+
{status && <p className="usx-chat__status">{status}</p>}
|
|
131
|
+
{children}
|
|
132
|
+
</section>
|
|
133
|
+
</Popover>
|
|
134
|
+
);
|
|
135
|
+
}
|