@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,137 @@
1
+ {
2
+ "name": "chat-composer",
3
+ "template": "chat-composer/chat-composer.django.html",
4
+ "version": 1,
5
+ "required": [
6
+ "id"
7
+ ],
8
+ "default": {
9
+ "id": "chat-composer-default",
10
+ "value": "",
11
+ "emojiPack": [
12
+ {
13
+ "emoji": "👍",
14
+ "name": "thumbs_up",
15
+ "label": "Thumbs up"
16
+ },
17
+ {
18
+ "emoji": "😊",
19
+ "name": "smile",
20
+ "label": "Smile"
21
+ },
22
+ {
23
+ "emoji": "🎉",
24
+ "name": "celebrate",
25
+ "label": "Celebrate"
26
+ }
27
+ ]
28
+ },
29
+ "props": {
30
+ "id": {
31
+ "type": "string",
32
+ "description": "Unique prefix for the textarea, formatting panel, and emoji picker IDs."
33
+ },
34
+ "value": {
35
+ "type": "string",
36
+ "default": "",
37
+ "description": "Initial message text."
38
+ },
39
+ "formAction": {
40
+ "type": "string",
41
+ "description": "Native form submission URL for HTML and Django."
42
+ },
43
+ "disabled": {
44
+ "type": "boolean",
45
+ "default": false,
46
+ "description": "Disables text entry and composer actions."
47
+ },
48
+ "allowAttachments": {
49
+ "type": "boolean",
50
+ "default": false,
51
+ "description": "Shows the attachment button, file input, and slim FileList for files staged to send. Each picker selection adds files until the user removes them."
52
+ },
53
+ "allowFormatting": {
54
+ "type": "boolean",
55
+ "default": false,
56
+ "description": "Shows the formatting toggle and panel and enables formatting shortcuts."
57
+ },
58
+ "accept": {
59
+ "type": "string",
60
+ "description": "Accepted file types for the attachment input."
61
+ },
62
+ "emojiPack": {
63
+ "type": "array",
64
+ "description": "Emoji choices for the picker and typed shortcodes. An empty array hides the picker.",
65
+ "items": {
66
+ "type": "object",
67
+ "description": "One emoji choice.",
68
+ "properties": {
69
+ "emoji": {
70
+ "type": "string",
71
+ "description": "Visible emoji character."
72
+ },
73
+ "name": {
74
+ "type": "string",
75
+ "description": "Shortcode name."
76
+ },
77
+ "label": {
78
+ "type": "string",
79
+ "description": "Accessible emoji name."
80
+ },
81
+ "aliases": {
82
+ "type": "array",
83
+ "description": "Additional shortcode names."
84
+ }
85
+ }
86
+ },
87
+ "default": [
88
+ {
89
+ "emoji": "👍",
90
+ "name": "thumbs_up",
91
+ "label": "Thumbs up"
92
+ },
93
+ {
94
+ "emoji": "😊",
95
+ "name": "smile",
96
+ "label": "Smile"
97
+ },
98
+ {
99
+ "emoji": "🎉",
100
+ "name": "celebrate",
101
+ "label": "Celebrate"
102
+ }
103
+ ]
104
+ },
105
+ "isThread": {
106
+ "type": "boolean",
107
+ "default": false,
108
+ "description": "Uses reply labels and includes threadRootId when supplied."
109
+ },
110
+ "conversationId": {
111
+ "type": "string",
112
+ "description": "Hidden conversation ID sent with the form."
113
+ },
114
+ "recipientId": {
115
+ "type": "string",
116
+ "description": "Hidden recipient ID when no conversation exists."
117
+ },
118
+ "threadRootId": {
119
+ "type": "string",
120
+ "description": "Hidden thread root ID for replies."
121
+ },
122
+ "recipientIds": {
123
+ "type": "array",
124
+ "description": "Recipient IDs submitted as repeated recipientIds fields for a new conversation. Existing conversationId takes precedence.",
125
+ "default": [],
126
+ "items": {
127
+ "type": "string",
128
+ "description": "Recipient participant ID."
129
+ }
130
+ },
131
+ "requireRecipients": {
132
+ "type": "boolean",
133
+ "description": "Require at least one recipient before sending, including associated external recipient checkboxes. Enable in a new-message flow.",
134
+ "default": false
135
+ }
136
+ }
137
+ }
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import Callout from '../callout/Callout';
3
+ import Image from '../image/Image';
4
+ import Link from '../link/Link';
5
+ export interface ChatContextProps {
6
+ label: string;
7
+ title: string;
8
+ description?: string;
9
+ imageUrl?: string;
10
+ imageAlt?: string;
11
+ href?: string;
12
+ }
13
+ export default function ChatContext({
14
+ label,
15
+ title,
16
+ description,
17
+ imageUrl,
18
+ imageAlt,
19
+ href,
20
+ }: ChatContextProps) {
21
+ return (
22
+ <Callout
23
+ as="aside"
24
+ big={false}
25
+ strokeColor="primary"
26
+ backgroundColor="surface-2"
27
+ textColor="ink"
28
+ className="usx-chat__context"
29
+ aria-label={label}
30
+ >
31
+ {imageUrl && (
32
+ <Image
33
+ className="usx-chat__context-image"
34
+ objectFit="cover"
35
+ src={imageUrl}
36
+ alt={imageAlt ?? ''}
37
+ />
38
+ )}
39
+ <div className="usx-chat__context-copy">
40
+ <span className="usx-chat__context-label">{label}</span>
41
+ {href ? <Link href={href}>{title}</Link> : <strong>{title}</strong>}
42
+ {description && <span>{description}</span>}
43
+ </div>
44
+ </Callout>
45
+ );
46
+ }
@@ -0,0 +1,35 @@
1
+ <h3 class="site-preview-heading">Default</h3>
2
+ <aside
3
+ class="usx-callout border-primary bg-surface-2 text-ink usx-chat__context"
4
+ aria-label="Listing"
5
+ >
6
+ <div class="usx-chat__context-copy">
7
+ <span class="usx-chat__context-label">Listing</span>
8
+
9
+ <strong>Bicycle</strong>
10
+
11
+ <span>Available for pickup</span>
12
+ </div>
13
+ </aside>
14
+
15
+ <h3 class="site-preview-heading">Linked</h3>
16
+ <div>
17
+ <aside
18
+ class="usx-callout border-primary bg-surface-2 text-ink usx-chat__context"
19
+ aria-label="Request"
20
+ >
21
+ <div class="usx-chat__context-copy">
22
+ <span class="usx-chat__context-label">Request</span>
23
+
24
+ <a href="#django-example-access-request" class="usa-link usx-link"> Access request </a>
25
+ </div>
26
+ </aside>
27
+
28
+ <section id="django-example-access-request" tabindex="-1">
29
+ <h3>Access request</h3>
30
+ <p>
31
+ Your request is awaiting approval from the project owner. No additional documents are
32
+ required.
33
+ </p>
34
+ </section>
35
+ </div>
@@ -0,0 +1,20 @@
1
+ {% load usx_components %}
2
+ {% dict aria_label=label as attrs %}
3
+ {% callout as='aside' big=False strokeColor='primary' backgroundColor='surface-2' textColor='ink' className='usx-chat__context' extraAttributes=attrs %}
4
+ {% if imageUrl %}
5
+ {% image src=imageUrl alt=imageAlt|default:'' objectFit='cover' className='usx-chat__context-image' %}{% endimage %}
6
+ {% endif %}
7
+ <div class="usx-chat__context-copy">
8
+ <span class="usx-chat__context-label">{{ label }}</span>
9
+ {% if href %}
10
+ {% link href=href %}
11
+ {{ title }}
12
+ {% endlink %}
13
+ {% else %}
14
+ <strong>{{ title }}</strong>
15
+ {% endif %}
16
+ {% if description %}
17
+ <span>{{ description }}</span>
18
+ {% endif %}
19
+ </div>
20
+ {% endcallout %}
@@ -0,0 +1,9 @@
1
+ <aside
2
+ class="usx-callout border-primary bg-surface-2 text-ink usx-chat__context"
3
+ aria-label="Listing"
4
+ >
5
+ <div class="usx-chat__context-copy">
6
+ <span class="usx-chat__context-label">Listing</span><strong>Bicycle</strong
7
+ ><span>Available for pickup</span>
8
+ </div>
9
+ </aside>
@@ -0,0 +1,30 @@
1
+ <h3 class="site-preview-heading">Default</h3>
2
+ <aside
3
+ class="usx-callout border-primary bg-surface-2 text-ink usx-chat__context"
4
+ aria-label="Listing"
5
+ >
6
+ <div class="usx-chat__context-copy">
7
+ <span class="usx-chat__context-label">Listing</span><strong>Bicycle</strong
8
+ ><span>Available for pickup</span>
9
+ </div>
10
+ </aside>
11
+
12
+ <h3 class="site-preview-heading">Linked</h3>
13
+ <div>
14
+ <aside
15
+ class="usx-callout border-primary bg-surface-2 text-ink usx-chat__context"
16
+ aria-label="Request"
17
+ >
18
+ <div class="usx-chat__context-copy">
19
+ <span class="usx-chat__context-label">Request</span
20
+ ><a href="#react-example-access-request" class="usa-link usx-link">Access request</a>
21
+ </div>
22
+ </aside>
23
+ <section id="react-example-access-request" tabindex="-1">
24
+ <h3>Access request</h3>
25
+ <p>
26
+ Your request is awaiting approval from the project owner. No additional documents are
27
+ required.
28
+ </p>
29
+ </section>
30
+ </div>
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "chat-context",
3
+ "template": "chat-context/chat-context.django.html",
4
+ "version": 1,
5
+ "default": {
6
+ "label": "Listing",
7
+ "title": "Bicycle",
8
+ "description": "Available for pickup"
9
+ },
10
+ "props": {
11
+ "label": {
12
+ "type": "string",
13
+ "description": "Short subject category, such as Marketplace listing or Access request."
14
+ },
15
+ "title": {
16
+ "type": "string",
17
+ "description": "Name of the item or record being discussed."
18
+ },
19
+ "description": {
20
+ "type": "string",
21
+ "description": "Optional price, status, or other concise detail."
22
+ },
23
+ "imageUrl": {
24
+ "type": "string",
25
+ "description": "Optional subject thumbnail rendered through Image."
26
+ },
27
+ "imageAlt": {
28
+ "type": "string",
29
+ "description": "Thumbnail description; empty when decorative."
30
+ },
31
+ "href": {
32
+ "type": "string",
33
+ "description": "Optional link to the underlying item or record."
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import Button from '../button/Button';
3
+ import TagGroup from '../tag-group/TagGroup';
4
+ import type { ChatOption } from '../chat/Chat';
5
+ export interface ChatControlsProps {
6
+ suggestedQuestions?: ChatOption[];
7
+ choices?: ChatOption[];
8
+ choicePrompt?: string;
9
+ disabled?: boolean;
10
+ children?: React.ReactNode;
11
+ }
12
+ export default function ChatControls({
13
+ suggestedQuestions = [],
14
+ choices = [],
15
+ choicePrompt = 'Choose an answer',
16
+ disabled = false,
17
+ children,
18
+ }: ChatControlsProps) {
19
+ return (
20
+ <>
21
+ {' '}
22
+ {(suggestedQuestions.length > 0 || choices.length > 0 || Boolean(children)) && (
23
+ <li className="usx-chat__controls" role="presentation">
24
+ {suggestedQuestions.length > 0 && (
25
+ <TagGroup
26
+ className="usx-chat__quick-replies"
27
+ extraAttributes={{ role: 'group', 'aria-label': 'Suggested questions' }}
28
+ >
29
+ <p>Suggested questions</p>
30
+ {suggestedQuestions.map((option) => (
31
+ <Button
32
+ key={option.value}
33
+ variant="unstyled"
34
+ className="usa-tag usx-tag usx-tag--outline usx-tag--interactive usa-link usx-link usx-no-visited"
35
+ extraAttributes={{ 'data-usx-chat-suggestion': option.value }}
36
+ disabled={disabled}
37
+ >
38
+ {option.label}
39
+ </Button>
40
+ ))}
41
+ </TagGroup>
42
+ )}
43
+ {choices.length > 0 && (
44
+ <TagGroup
45
+ className="usx-chat__choices"
46
+ extraAttributes={{ role: 'group', 'aria-label': choicePrompt }}
47
+ >
48
+ <p>{choicePrompt}</p>
49
+ {choices.map((option) => (
50
+ <Button
51
+ key={option.value}
52
+ variant="unstyled"
53
+ className="usa-tag usx-tag usx-tag--outline usx-tag--interactive usa-link usx-link usx-no-visited"
54
+ extraAttributes={{ 'data-usx-chat-choice': option.value }}
55
+ disabled={disabled}
56
+ >
57
+ {option.label}
58
+ </Button>
59
+ ))}
60
+ </TagGroup>
61
+ )}
62
+ {children}
63
+ </li>
64
+ )}
65
+ </>
66
+ );
67
+ }
@@ -0,0 +1,114 @@
1
+ <h3 class="site-preview-heading">Default</h3>
2
+ <div>
3
+ <section id="django-example-controls-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 class="usx-chat__controls" role="presentation">
8
+ <div
9
+ class="usx-tag-group usx-chat__quick-replies"
10
+ role="group"
11
+ aria-label="Suggested questions"
12
+ >
13
+ <p>Suggested questions</p>
14
+
15
+ <button
16
+ type="button"
17
+ 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"
18
+ data-usx-chat-suggestion="next"
19
+ >
20
+ What happens next?
21
+ </button>
22
+
23
+ <button
24
+ type="button"
25
+ 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"
26
+ data-usx-chat-suggestion="documents"
27
+ >
28
+ Which documents do I need?
29
+ </button>
30
+ </div>
31
+ </li>
32
+ </ol>
33
+ </div>
34
+ </section>
35
+ </div>
36
+
37
+ <h3 class="site-preview-heading">Custom Controls</h3>
38
+ <div>
39
+ <section id="django-example-controls-custom" class="usx-chat" style="max-width: 28rem">
40
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
41
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
42
+ <ol class="usx-chat__messages">
43
+ <li class="usx-chat__controls" role="presentation">
44
+ <a class="usa-link usx-link" href="/liberty-island-notes.txt" download=""
45
+ >Download example notes</a
46
+ >
47
+ </li>
48
+ </ol>
49
+ </div>
50
+ </section>
51
+ </div>
52
+
53
+ <h3 class="site-preview-heading">Choices</h3>
54
+ <div>
55
+ <section id="django-example-controls-choices" class="usx-chat" style="max-width: 28rem">
56
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
57
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
58
+ <ol class="usx-chat__messages">
59
+ <li class="usx-chat__controls" role="presentation">
60
+ <div
61
+ class="usx-tag-group usx-chat__choices"
62
+ role="group"
63
+ aria-label="Which appointment works for you?"
64
+ >
65
+ <p>Which appointment works for you?</p>
66
+
67
+ <button
68
+ type="button"
69
+ 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"
70
+ data-usx-chat-choice="tuesday"
71
+ >
72
+ Tuesday morning
73
+ </button>
74
+
75
+ <button
76
+ type="button"
77
+ 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"
78
+ data-usx-chat-choice="thursday"
79
+ >
80
+ Thursday afternoon
81
+ </button>
82
+ </div>
83
+ </li>
84
+ </ol>
85
+ </div>
86
+ </section>
87
+ </div>
88
+
89
+ <h3 class="site-preview-heading">Disabled</h3>
90
+ <div>
91
+ <section id="django-example-controls-disabled" class="usx-chat" style="max-width: 28rem">
92
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
93
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
94
+ <ol class="usx-chat__messages">
95
+ <li class="usx-chat__controls" role="presentation">
96
+ <div class="usx-tag-group usx-chat__choices" role="group" aria-label="Choose an answer">
97
+ <p>Choose an answer</p>
98
+
99
+ <button
100
+ type="button"
101
+ 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"
102
+ disabled
103
+ aria-disabled="true"
104
+ data-usx-chat-choice="confirm"
105
+ >
106
+ Confirm appointment
107
+ </button>
108
+ </div>
109
+ </li>
110
+ </ol>
111
+ </div>
112
+ </section>
113
+ <button type="button" class="usa-button usx-button margin-top-2">Enable choices</button>
114
+ </div>
@@ -0,0 +1,36 @@
1
+ {% load usx_components %}
2
+ {% if suggestedQuestions or choices or children %}
3
+ <li class="usx-chat__controls" role="presentation">
4
+ {% if suggestedQuestions %}
5
+ {% dict role='group' aria_label='Suggested questions' as suggestionGroupAttrs %}
6
+ {% tag_group className='usx-chat__quick-replies' extraAttributes=suggestionGroupAttrs %}
7
+ <p>
8
+ Suggested questions
9
+ </p>
10
+ {% for option in suggestedQuestions %}
11
+ {% dict data_usx_chat_suggestion=option.value as optionAttrs %}
12
+ {% button variant='unstyled' disabled=disabled className='usa-tag usx-tag usx-tag--outline usx-tag--interactive usa-link usx-link usx-no-visited' extraAttributes=optionAttrs %}
13
+ {{ option.label }}
14
+ {% endbutton %}
15
+ {% endfor %}
16
+ {% endtag_group %}
17
+ {% endif %}
18
+ {% if choices %}
19
+ {% dict role='group' aria_label=choicePrompt as choiceGroupAttrs %}
20
+ {% tag_group className='usx-chat__choices' extraAttributes=choiceGroupAttrs %}
21
+ <p>
22
+ {{ choicePrompt }}
23
+ </p>
24
+ {% for option in choices %}
25
+ {% dict data_usx_chat_choice=option.value as optionAttrs %}
26
+ {% button variant='unstyled' disabled=disabled className='usa-tag usx-tag usx-tag--outline usx-tag--interactive usa-link usx-link usx-no-visited' extraAttributes=optionAttrs %}
27
+ {{ option.label }}
28
+ {% endbutton %}
29
+ {% endfor %}
30
+ {% endtag_group %}
31
+ {% endif %}
32
+ {% if children != None and children is not True and children is not False %}
33
+ {{ children|safe }}
34
+ {% endif %}
35
+ </li>
36
+ {% endif %}
@@ -0,0 +1,11 @@
1
+ <ol class="usx-chat__messages" style="max-width: 28rem">
2
+ <li class="usx-chat__controls" role="presentation">
3
+ <div role="group" aria-label="Suggested questions" class="usx-tag-group usx-chat__quick-replies">
4
+ <p>Suggested questions</p>
5
+ <button type="button" 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" data-usx-chat-suggestion="next">
6
+ What happens next?</button><button type="button" 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" data-usx-chat-suggestion="documents">
7
+ Which documents do I need?
8
+ </button>
9
+ </div>
10
+ </li>
11
+ </ol>
@@ -0,0 +1,107 @@
1
+ <h3 class="site-preview-heading">Default</h3>
2
+ <div>
3
+ <section id="react-example-controls-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 class="usx-chat__controls" role="presentation">
8
+ <div
9
+ role="group"
10
+ aria-label="Suggested questions"
11
+ class="usx-tag-group usx-chat__quick-replies"
12
+ >
13
+ <p>Suggested questions</p>
14
+ <button
15
+ type="button"
16
+ 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"
17
+ data-usx-chat-suggestion="next"
18
+ >
19
+ What happens next?</button
20
+ ><button
21
+ type="button"
22
+ 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"
23
+ data-usx-chat-suggestion="documents"
24
+ >
25
+ Which documents do I need?
26
+ </button>
27
+ </div>
28
+ </li>
29
+ </ol>
30
+ </div>
31
+ </section>
32
+ </div>
33
+
34
+ <h3 class="site-preview-heading">Custom Controls</h3>
35
+ <div>
36
+ <section id="react-example-controls-custom" class="usx-chat" style="max-width: 28rem">
37
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
38
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
39
+ <ol class="usx-chat__messages">
40
+ <li class="usx-chat__controls" role="presentation">
41
+ <a class="usa-link usx-link" href="/liberty-island-notes.txt" download=""
42
+ >Download example notes</a
43
+ >
44
+ </li>
45
+ </ol>
46
+ </div>
47
+ </section>
48
+ </div>
49
+
50
+ <h3 class="site-preview-heading">Choices</h3>
51
+ <div>
52
+ <section id="react-example-controls-choices" class="usx-chat" style="max-width: 28rem">
53
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
54
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
55
+ <ol class="usx-chat__messages">
56
+ <li class="usx-chat__controls" role="presentation">
57
+ <div
58
+ role="group"
59
+ aria-label="Which appointment works for you?"
60
+ class="usx-tag-group usx-chat__choices"
61
+ >
62
+ <p>Which appointment works for you?</p>
63
+ <button
64
+ type="button"
65
+ 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"
66
+ data-usx-chat-choice="tuesday"
67
+ >
68
+ Tuesday morning</button
69
+ ><button
70
+ type="button"
71
+ 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"
72
+ data-usx-chat-choice="thursday"
73
+ >
74
+ Thursday afternoon
75
+ </button>
76
+ </div>
77
+ </li>
78
+ </ol>
79
+ </div>
80
+ </section>
81
+ </div>
82
+
83
+ <h3 class="site-preview-heading">Disabled</h3>
84
+ <div>
85
+ <section id="react-example-controls-disabled" class="usx-chat" style="max-width: 28rem">
86
+ <div data-chat-view="conversation" class="usx-chat__window" style="height: auto">
87
+ <span class="usx-chat__copy-status usa-sr-only" role="status"></span>
88
+ <ol class="usx-chat__messages">
89
+ <li class="usx-chat__controls" role="presentation">
90
+ <div role="group" aria-label="Choose an answer" class="usx-tag-group usx-chat__choices">
91
+ <p>Choose an answer</p>
92
+ <button
93
+ type="button"
94
+ 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"
95
+ disabled=""
96
+ aria-disabled="true"
97
+ data-usx-chat-choice="confirm"
98
+ >
99
+ Confirm appointment
100
+ </button>
101
+ </div>
102
+ </li>
103
+ </ol>
104
+ </div>
105
+ </section>
106
+ <button type="button" class="usa-button usx-button margin-top-2">Enable choices</button>
107
+ </div>