@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solexllc/usx-react",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "React component library for USX.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,6 +18,10 @@
18
18
  ".": {
19
19
  "import": "./dist/index.js",
20
20
  "require": "./dist/index.cjs"
21
+ },
22
+ "./chat": {
23
+ "import": "./dist/chat.js",
24
+ "require": "./dist/chat.cjs"
21
25
  }
22
26
  },
23
27
  "files": [
@@ -25,7 +29,7 @@
25
29
  "dist"
26
30
  ],
27
31
  "dependencies": {
28
- "@solexllc/usx": "0.13.0",
32
+ "@solexllc/usx": "0.14.0",
29
33
  "@solexllc/usx-theme": "0.11.2",
30
34
  "@solexllc/usx-uswds-fixes": "0.1.17",
31
35
  "classnames": "^2.5.1",
@@ -44,6 +48,6 @@
44
48
  },
45
49
  "scripts": {
46
50
  "build": "vite build",
47
- "test": "pnpm build && node test/toggle-check.mjs && node test/quote-check.mjs && node test/composition-check.mjs && node test/asset-url-check.mjs && node test/container-check.mjs && node test/error-page-check.mjs"
51
+ "test": "pnpm build && node test/entry-points-check.mjs && node test/toggle-check.mjs && node test/quote-check.mjs && node test/composition-check.mjs && node test/asset-url-check.mjs && node test/container-check.mjs && node test/error-page-check.mjs && node test/chat-contract-check.mjs"
48
52
  }
49
53
  }
package/src/chat.js ADDED
@@ -0,0 +1,15 @@
1
+ // Auto-generated by scripts/generate-exports.js — do not edit by hand.
2
+ // Run: pnpm generate:exports
3
+ export { default as Chat } from './components/chat/Chat.tsx';
4
+ export { default as ChatAttachment } from './components/chat-attachment/ChatAttachment.tsx';
5
+ export { default as ChatAttachments } from './components/chat-attachments/ChatAttachments.tsx';
6
+ export { default as ChatBubble } from './components/chat-bubble/ChatBubble.tsx';
7
+ export { default as ChatComposer } from './components/chat-composer/ChatComposer.tsx';
8
+ export { default as ChatContext } from './components/chat-context/ChatContext.tsx';
9
+ export { default as ChatControls } from './components/chat-controls/ChatControls.tsx';
10
+ export { default as ChatDirectory } from './components/chat-directory/ChatDirectory.tsx';
11
+ export { default as ChatDirectoryItem } from './components/chat-directory-item/ChatDirectoryItem.tsx';
12
+ export { default as ChatHistory } from './components/chat-history/ChatHistory.tsx';
13
+ export { default as ChatMessage } from './components/chat-message/ChatMessage.tsx';
14
+ export { default as ChatMessageActions } from './components/chat-message-actions/ChatMessageActions.tsx';
15
+ export { default as ChatWindow } from './components/chat-window/ChatWindow.tsx';
@@ -12,13 +12,20 @@ const shapeClassMap = {
12
12
  'rounded-xl': 'usx-rounded-xl',
13
13
  };
14
14
 
15
- export interface AvatarProps extends React.HTMLAttributes<HTMLAnchorElement> {
15
+ export interface AvatarProps extends Omit<
16
+ React.ImgHTMLAttributes<HTMLImageElement>,
17
+ 'src' | 'alt' | 'onClick'
18
+ > {
16
19
  href?: string;
17
20
  src?: string | null;
18
21
  alt?: string | null;
19
22
  variant?: 'image' | 'initials' | 'icon';
20
23
  value?: string | null;
21
24
  shape?: null | 'circle' | 'rounded-sm' | 'rounded-md' | 'rounded-lg' | 'rounded-xl';
25
+ /** Existing border utility color name used for the 4px status ring. */
26
+ statusRingColor?: string | null;
27
+ /** Host-supplied status text appended to the accessible name. */
28
+ statusLabel?: string | null;
22
29
  tooltipProps?: Omit<TooltipProps, 'children'> | null;
23
30
  className?: string;
24
31
  imageClassName?: string;
@@ -26,12 +33,14 @@ export interface AvatarProps extends React.HTMLAttributes<HTMLAnchorElement> {
26
33
  }
27
34
 
28
35
  export default function Avatar({
29
- href = '#',
36
+ href,
30
37
  src = null,
31
38
  alt = null,
32
39
  variant = 'image',
33
40
  value = null,
34
41
  shape = null,
42
+ statusRingColor = null,
43
+ statusLabel = null,
35
44
  tooltipProps = null,
36
45
  className = '',
37
46
  imageClassName = '',
@@ -40,36 +49,65 @@ export default function Avatar({
40
49
  }: AvatarProps) {
41
50
  const isInitialsVariant = variant === 'initials';
42
51
  const isIconVariant = variant === 'icon';
52
+ const ringColor = statusRingColor?.trim();
53
+ const label = statusLabel?.trim();
54
+ const accessibleLabel = label ? [alt, label].filter(Boolean).join(', ') : alt || undefined;
43
55
 
44
56
  const wrapperClasses = classNames(
45
57
  'usx-avatar',
46
- className,
58
+ ringColor && 'border-05',
59
+ ringColor && `border-${ringColor}`,
60
+ ringColor &&
61
+ (shape ? shapeClassMap[shape] : isInitialsVariant || isIconVariant ? 'usx-circle' : null),
62
+ className
47
63
  );
48
64
  const imgClasses = classNames(
49
65
  'usx-avatar__img',
50
66
  shape ? shapeClassMap[shape] : null,
51
- imageClassName,
67
+ imageClassName
52
68
  );
53
69
  const contentClasses = classNames(
54
70
  'usx-avatar__content',
55
71
  shape ? shapeClassMap[shape] : 'usx-circle',
56
- contentClassName,
72
+ contentClassName
57
73
  );
58
74
 
59
- const avatarContent = isInitialsVariant
60
- ? <span className={contentClasses}>{value}</span>
61
- : isIconVariant
62
- ? (
63
- <span className={contentClasses}>
64
- <Icon name={value as string} alt={alt ? undefined : `${value} icon`} />
65
- </span>
66
- )
67
- : <img className={imgClasses} src={src || undefined} alt={alt || undefined} role="img" {...props} />;
75
+ const avatarContent = isInitialsVariant ? (
76
+ <span className={contentClasses}>{value}</span>
77
+ ) : isIconVariant ? (
78
+ <span className={contentClasses}>
79
+ <Icon name={value as string} alt={alt ? undefined : `${value} icon`} />
80
+ </span>
81
+ ) : (
82
+ <img
83
+ className={imgClasses}
84
+ src={src || undefined}
85
+ alt={alt || undefined}
86
+ role="img"
87
+ {...props}
88
+ />
89
+ );
68
90
 
69
- const avatar = (
70
- <a href={href} className={wrapperClasses} aria-label={(isInitialsVariant || isIconVariant) ? alt || undefined : undefined}>
91
+ const avatar = href ? (
92
+ <a
93
+ href={href}
94
+ className={wrapperClasses}
95
+ aria-label={
96
+ label ? accessibleLabel : isInitialsVariant || isIconVariant ? alt || undefined : undefined
97
+ }
98
+ >
71
99
  {avatarContent}
72
100
  </a>
101
+ ) : (
102
+ <span
103
+ className={wrapperClasses}
104
+ role={label ? 'img' : undefined}
105
+ aria-label={
106
+ label ? accessibleLabel : isInitialsVariant || isIconVariant ? alt || undefined : undefined
107
+ }
108
+ >
109
+ {avatarContent}
110
+ </span>
73
111
  );
74
112
 
75
113
  return tooltipProps ? <Tooltip {...tooltipProps}>{avatar}</Tooltip> : avatar;
@@ -63,6 +63,11 @@
63
63
  <span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">AB</span>
64
64
  </a>
65
65
 
66
+ <h3 class="site-preview-heading">Non Interactive</h3>
67
+ <span class="usx-avatar" aria-label="Morgan">
68
+ <span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">MO</span>
69
+ </span>
70
+
66
71
  <h3 class="site-preview-heading">Initials Avatar Small</h3>
67
72
  <a href="#" class="usx-avatar usx-avatar--size-sm" aria-label="George Washington">
68
73
  <span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">GW</span>
@@ -129,3 +134,110 @@
129
134
  <use href="img/sprite.svg#person"></use></svg
130
135
  ></span>
131
136
  </a>
137
+
138
+ <h3 class="site-preview-heading">Status Success</h3>
139
+ <span class="usx-tooltip">
140
+ <a
141
+ href="https://google.com/search?q=Statue+of+Liberty"
142
+ class="usx-avatar border-05 border-success usx-circle"
143
+ aria-label="Statue of Liberty, Online"
144
+ >
145
+ <img
146
+ class="usx-avatar__img usx-circle"
147
+ src="./lady_liberty.png"
148
+ alt="Statue of Liberty"
149
+ role="img"
150
+ />
151
+ </a>
152
+
153
+ <span class="usa-tooltip__body usa-tooltip__body--right" role="tooltip">Online</span>
154
+ </span>
155
+
156
+ <h3 class="site-preview-heading">Status Caution</h3>
157
+ <span
158
+ class="usx-avatar border-05 border-warning usx-circle"
159
+ role="img"
160
+ aria-label="Alex Brown, Pending review"
161
+ >
162
+ <span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">AB</span>
163
+ </span>
164
+
165
+ <h3 class="site-preview-heading">Status Danger</h3>
166
+ <span
167
+ class="usx-avatar border-05 border-error usx-circle"
168
+ role="img"
169
+ aria-label="Account owner, Do not disturb"
170
+ >
171
+ <span class="usx-avatar__content usx-circle bg-primary-lighter text-base-darkest">
172
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
173
+ <use href="img/sprite.svg#person"></use></svg
174
+ ></span>
175
+ </span>
176
+
177
+ <h3 class="site-preview-heading">Status Neutral</h3>
178
+ <a
179
+ href="https://google.com/search?q=Statue+of+Liberty"
180
+ class="usx-avatar border-05 border-base usx-rounded-md"
181
+ aria-label="Statue of Liberty, Offline"
182
+ >
183
+ <img
184
+ class="usx-avatar__img usx-rounded-md"
185
+ src="./lady_liberty.png"
186
+ alt="Statue of Liberty"
187
+ role="img"
188
+ />
189
+ </a>
190
+
191
+ <h3 class="site-preview-heading">Status Info</h3>
192
+ <a
193
+ href="https://google.com/search?q=Statue+of+Liberty"
194
+ class="usx-avatar border-05 border-info usx-circle"
195
+ aria-label="Statue of Liberty, Verified"
196
+ >
197
+ <img
198
+ class="usx-avatar__img usx-circle"
199
+ src="./lady_liberty.png"
200
+ alt="Statue of Liberty"
201
+ role="img"
202
+ />
203
+ </a>
204
+
205
+ <h3 class="site-preview-heading">Status Special</h3>
206
+ <span
207
+ class="usx-avatar border-05 border-accent-cool usx-circle"
208
+ role="img"
209
+ aria-label="Site administrator, Elevated privileges"
210
+ >
211
+ <span class="usx-avatar__content usx-circle bg-primary-lighter text-base-darkest">
212
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
213
+ <use href="img/sprite.svg#person"></use></svg
214
+ ></span>
215
+ </span>
216
+
217
+ <h3 class="site-preview-heading">Status Warning</h3>
218
+ <span
219
+ class="usx-avatar border-05 border-accent-warm usx-circle usx-avatar--size-sm"
220
+ role="img"
221
+ aria-label="Alex Brown, Requires action"
222
+ >
223
+ <span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">AB</span>
224
+ </span>
225
+
226
+ <h3 class="site-preview-heading">Status Secondary Color</h3>
227
+ <a
228
+ href="https://google.com/search?q=Statue+of+Liberty"
229
+ class="usx-avatar border-05 border-secondary usx-circle"
230
+ aria-label="Statue of Liberty, Premium member"
231
+ >
232
+ <img
233
+ class="usx-avatar__img usx-circle"
234
+ src="./lady_liberty.png"
235
+ alt="Statue of Liberty"
236
+ role="img"
237
+ />
238
+ </a>
239
+
240
+ <h3 class="site-preview-heading">Status Label Only</h3>
241
+ <span class="usx-avatar" role="img" aria-label="Alex Brown, Available by appointment">
242
+ <span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">AB</span>
243
+ </span>
@@ -3,7 +3,7 @@
3
3
  {% load usx_components %}
4
4
 
5
5
  {% fragment as avatarLink %}
6
- <a href="{% if href is None %}#{% else %}{{ href }}{% endif %}" class="usx-avatar{% if className %} {{ className }}{% endif %}"{% if variant == 'initials' or variant == 'icon' %}{% if alt %} aria-label="{{ alt }}"{% endif %}{% endif %}>
6
+ <{% if href %}a href="{{ href }}"{% else %}span{% endif %} class="usx-avatar{% if statusRingColor %} border-05 border-{{ statusRingColor }}{% if shape == 'circle' %} usx-circle{% elif shape == 'rounded-sm' %} usx-rounded-sm{% elif shape == 'rounded-md' %} usx-rounded-md{% elif shape == 'rounded-lg' %} usx-rounded-lg{% elif shape == 'rounded-xl' %} usx-rounded-xl{% elif variant == 'initials' or variant == 'icon' %} usx-circle{% endif %}{% endif %}{% if className %} {{ className }}{% endif %}"{% if not href and statusLabel %} role="img"{% endif %}{% if statusLabel %} aria-label="{% if alt %}{{ alt }}, {% endif %}{{ statusLabel }}"{% elif variant == 'initials' or variant == 'icon' %}{% if alt %} aria-label="{{ alt }}"{% endif %}{% endif %}>
7
7
  {% if variant == 'initials' %}
8
8
  <span class="usx-avatar__content{% if shape == 'circle' %} usx-circle{% elif shape == 'rounded-sm' %} usx-rounded-sm{% elif shape == 'rounded-md' %} usx-rounded-md{% elif shape == 'rounded-lg' %} usx-rounded-lg{% elif shape == 'rounded-xl' %} usx-rounded-xl{% else %} usx-circle{% endif %}{% if contentClassName %} {{ contentClassName }}{% endif %}">{{ value }}</span>
9
9
  {% elif variant == 'icon' %}
@@ -16,7 +16,7 @@
16
16
  role="img"
17
17
  />
18
18
  {% endif %}
19
- </a>
19
+ {% if href %}</a>{% else %}</span>{% endif %}
20
20
  {% endfragment %}
21
21
 
22
22
  {% if tooltipProps %}
@@ -96,6 +96,31 @@
96
96
  <use href="/img/sprite.svg#person"></use></svg></span
97
97
  ></a>
98
98
 
99
+ <h3 class="site-preview-heading">Online Avatar</h3>
100
+ <span class="usx-tooltip"
101
+ ><span
102
+ class="usx-avatar border-05 border-success usx-circle"
103
+ role="img"
104
+ aria-label="Statue of Liberty, Online"
105
+ ><img
106
+ class="usx-avatar__img usx-circle"
107
+ src="./lady_liberty.png"
108
+ alt="Statue of Liberty"
109
+ role="img"
110
+ /></span>
111
+ <span class="usa-tooltip__body usa-tooltip__body--right" role="tooltip">Online</span></span
112
+ >
113
+
114
+ <h3 class="site-preview-heading">Pending Review Avatar</h3>
115
+ <span
116
+ class="usx-avatar border-05 border-warning usx-circle"
117
+ role="img"
118
+ aria-label="Alex Brown, Pending review"
119
+ ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker"
120
+ >AB</span
121
+ ></span
122
+ >
123
+
99
124
  <h3 class="site-preview-heading">Icon Avatar Support Agent</h3>
100
125
  <a href="#" class="usx-avatar" aria-label="Support Agent"
101
126
  ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker"
@@ -57,6 +57,13 @@
57
57
  ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">AB</span></a
58
58
  >
59
59
 
60
+ <h3 class="site-preview-heading">Non Interactive</h3>
61
+ <span class="usx-avatar" aria-label="Morgan"
62
+ ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker"
63
+ >MO</span
64
+ ></span
65
+ >
66
+
60
67
  <h3 class="site-preview-heading">Initials Avatar Small</h3>
61
68
  <a href="#" class="usx-avatar usx-avatar--size-sm" aria-label="George Washington"
62
69
  ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker">GW</span></a
@@ -119,3 +126,100 @@
119
126
  ><svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
120
127
  <use href="/img/sprite.svg#person"></use></svg></span
121
128
  ></a>
129
+
130
+ <h3 class="site-preview-heading">Status Success</h3>
131
+ <span class="usx-tooltip"
132
+ ><a
133
+ href="https://google.com/search?q=Statue+of+Liberty"
134
+ class="usx-avatar border-05 border-success usx-circle"
135
+ aria-label="Statue of Liberty, Online"
136
+ ><img
137
+ class="usx-avatar__img usx-circle"
138
+ src="./lady_liberty.png"
139
+ alt="Statue of Liberty"
140
+ role="img" /></a
141
+ ><span class="usa-tooltip__body usa-tooltip__body--right" role="tooltip">Online</span></span
142
+ >
143
+
144
+ <h3 class="site-preview-heading">Status Caution</h3>
145
+ <span
146
+ class="usx-avatar border-05 border-warning usx-circle"
147
+ role="img"
148
+ aria-label="Alex Brown, Pending review"
149
+ ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker"
150
+ >AB</span
151
+ ></span
152
+ >
153
+
154
+ <h3 class="site-preview-heading">Status Danger</h3>
155
+ <span
156
+ class="usx-avatar border-05 border-error usx-circle"
157
+ role="img"
158
+ aria-label="Account owner, Do not disturb"
159
+ ><span class="usx-avatar__content usx-circle bg-primary-lighter text-base-darkest"
160
+ ><svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
161
+ <use href="/img/sprite.svg#person"></use></svg></span
162
+ ></span>
163
+
164
+ <h3 class="site-preview-heading">Status Neutral</h3>
165
+ <a
166
+ href="https://google.com/search?q=Statue+of+Liberty"
167
+ class="usx-avatar border-05 border-base usx-rounded-md"
168
+ aria-label="Statue of Liberty, Offline"
169
+ ><img
170
+ class="usx-avatar__img usx-rounded-md"
171
+ src="./lady_liberty.png"
172
+ alt="Statue of Liberty"
173
+ role="img"
174
+ /></a>
175
+
176
+ <h3 class="site-preview-heading">Status Info</h3>
177
+ <a
178
+ href="https://google.com/search?q=Statue+of+Liberty"
179
+ class="usx-avatar border-05 border-info usx-circle"
180
+ aria-label="Statue of Liberty, Verified"
181
+ ><img
182
+ class="usx-avatar__img usx-circle"
183
+ src="./lady_liberty.png"
184
+ alt="Statue of Liberty"
185
+ role="img"
186
+ /></a>
187
+
188
+ <h3 class="site-preview-heading">Status Special</h3>
189
+ <span
190
+ class="usx-avatar border-05 border-accent-cool usx-circle"
191
+ role="img"
192
+ aria-label="Site administrator, Elevated privileges"
193
+ ><span class="usx-avatar__content usx-circle bg-primary-lighter text-base-darkest"
194
+ ><svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
195
+ <use href="/img/sprite.svg#person"></use></svg></span
196
+ ></span>
197
+
198
+ <h3 class="site-preview-heading">Status Warning</h3>
199
+ <span
200
+ class="usx-avatar border-05 border-accent-warm usx-circle usx-avatar--size-sm"
201
+ role="img"
202
+ aria-label="Alex Brown, Requires action"
203
+ ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker"
204
+ >AB</span
205
+ ></span
206
+ >
207
+
208
+ <h3 class="site-preview-heading">Status Secondary Color</h3>
209
+ <a
210
+ href="https://google.com/search?q=Statue+of+Liberty"
211
+ class="usx-avatar border-05 border-secondary usx-circle"
212
+ aria-label="Statue of Liberty, Premium member"
213
+ ><img
214
+ class="usx-avatar__img usx-circle"
215
+ src="./lady_liberty.png"
216
+ alt="Statue of Liberty"
217
+ role="img"
218
+ /></a>
219
+
220
+ <h3 class="site-preview-heading">Status Label Only</h3>
221
+ <span class="usx-avatar" role="img" aria-label="Alex Brown, Available by appointment"
222
+ ><span class="usx-avatar__content usx-circle bg-primary-lighter text-primary-darker"
223
+ >AB</span
224
+ ></span
225
+ >
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "avatar",
3
3
  "template": "avatar/avatar.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "href": "https://google.com/search?q=Statue+of+Liberty",
7
7
  "src": "./lady_liberty.png",
@@ -10,7 +10,7 @@
10
10
  "props": {
11
11
  "href": {
12
12
  "type": "string",
13
- "description": "Link target for the avatar image."
13
+ "description": "Optional link target. When absent, Avatar renders a noninteractive span."
14
14
  },
15
15
  "src": {
16
16
  "type": "string",
@@ -22,11 +22,7 @@
22
22
  },
23
23
  "variant": {
24
24
  "type": "select",
25
- "options": [
26
- "image",
27
- "initials",
28
- "icon"
29
- ],
25
+ "options": ["image", "initials", "icon"],
30
26
  "description": "Avatar content mode."
31
27
  },
32
28
  "value": {
@@ -35,15 +31,17 @@
35
31
  },
36
32
  "shape": {
37
33
  "type": "select",
38
- "options": [
39
- "circle",
40
- "rounded-sm",
41
- "rounded-md",
42
- "rounded-lg",
43
- "rounded-xl"
44
- ],
34
+ "options": ["circle", "rounded-sm", "rounded-md", "rounded-lg", "rounded-xl"],
45
35
  "description": "Optional shape utility for avatar image or initials."
46
36
  },
37
+ "statusRingColor": {
38
+ "type": "string",
39
+ "description": "Existing border utility color name for the 4px ring, such as success, warning, error, info, primary, or accent-cool. Omit to hide the ring."
40
+ },
41
+ "statusLabel": {
42
+ "type": "string",
43
+ "description": "Host-supplied status text appended to the accessible name. Supply it whenever the ring conveys a meaningful state; pass the same text to tooltipProps to show it visually on hover."
44
+ },
47
45
  "tooltipProps": {
48
46
  "type": "object",
49
47
  "component": "tooltip",
@@ -52,7 +50,7 @@
52
50
  },
53
51
  "className": {
54
52
  "type": "string",
55
- "description": "Additional classes for the avatar link element."
53
+ "description": "Additional classes for the avatar wrapper."
56
54
  },
57
55
  "imageClassName": {
58
56
  "type": "string",
@@ -2,40 +2,42 @@ import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import Avatar, { AvatarProps } from '../avatar/Avatar';
4
4
 
5
- export interface AvatarGroupAvatar extends Omit<AvatarProps, 'variant'> {
5
+ export interface AvatarGroupAvatar extends AvatarProps {
6
6
  initials?: string;
7
7
  initialsClassName?: string;
8
8
  }
9
9
 
10
- export interface AvatarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ export interface AvatarGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
11
11
  avatarProps?: AvatarGroupAvatar[];
12
12
  overlap?: boolean;
13
13
  stacked?: boolean;
14
14
  className?: string;
15
+ children?: never;
15
16
  }
16
17
 
17
- export default function AvatarGroup({ avatarProps = [], overlap = false, stacked = false, className = '', ...props }: AvatarGroupProps) {
18
+ export default function AvatarGroup({
19
+ avatarProps = [],
20
+ overlap = false,
21
+ stacked = false,
22
+ className = '',
23
+ ...props
24
+ }: AvatarGroupProps) {
18
25
  const classes = classNames(
19
26
  'usx-avatar-group',
20
27
  overlap && 'usx-avatar-group--overlap',
21
28
  stacked && 'usx-avatar-group--stacked',
22
- className,
29
+ className
23
30
  );
24
31
 
25
32
  return (
26
33
  <div className={classes} {...props}>
27
- {avatarProps.map((avatar, index) => (
34
+ {avatarProps.map(({ initials, initialsClassName, ...avatar }, index) => (
28
35
  <Avatar
29
- key={`${avatar.src || avatar.initials || 'avatar'}-${index}`}
30
- href={avatar.href}
31
- src={avatar.src}
32
- alt={avatar.alt}
33
- value={avatar.initials}
34
- shape={avatar.shape}
35
- tooltipProps={avatar.tooltipProps}
36
- className={avatar.className}
37
- imageClassName={avatar.imageClassName}
38
- contentClassName={avatar.initialsClassName}
36
+ key={`${avatar.src || avatar.value || initials || 'avatar'}-${index}`}
37
+ {...avatar}
38
+ variant={avatar.variant ?? (avatar.src ? 'image' : 'initials')}
39
+ value={avatar.value ?? initials}
40
+ contentClassName={avatar.contentClassName ?? initialsClassName}
39
41
  />
40
42
  ))}
41
43
  </div>
@@ -276,3 +276,25 @@
276
276
  <span class="usa-tooltip__body usa-tooltip__body--right" role="tooltip">Benjamin Franklin</span>
277
277
  </span>
278
278
  </div>
279
+
280
+ <h3 class="site-preview-heading">Mixed avatars</h3>
281
+ <div class="usx-avatar-group usx-avatar-group--overlap">
282
+ <span class="usx-avatar" aria-label="Morgan">
283
+ <span class="usx-avatar__content usx-circle">MO</span>
284
+ </span>
285
+
286
+ <span class="usx-avatar">
287
+ <img class="usx-avatar__img usx-circle" src="/chat-avatar-avery.webp" alt="Avery" role="img" />
288
+ </span>
289
+
290
+ <span
291
+ class="usx-avatar border-05 border-info usx-circle"
292
+ role="img"
293
+ aria-label="Support bot, Automated assistant"
294
+ >
295
+ <span class="usx-avatar__content usx-circle">
296
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
297
+ <use href="img/sprite.svg#support_agent"></use></svg
298
+ ></span>
299
+ </span>
300
+ </div>
@@ -3,6 +3,6 @@
3
3
 
4
4
  <div class="usx-avatar-group{% if stacked %} usx-avatar-group--stacked{% endif %}{% if overlap %} usx-avatar-group--overlap{% endif %}{% if className %} {{ className }}{% endif %}">
5
5
  {% for avatar in avatarProps %}
6
- {% avatar href=avatar.href src=avatar.src alt=avatar.alt initials=avatar.initials shape=avatar.shape tooltipProps=avatar.tooltipProps className=avatar.className imageClassName=avatar.imageClassName initialsClassName=avatar.initialsClassName %}{% endavatar %}
6
+ {% avatar props=avatar|avatar_group_props %}{% endavatar %}
7
7
  {% endfor %}
8
8
  </div>
@@ -224,3 +224,23 @@
224
224
  ></span
225
225
  >
226
226
  </div>
227
+
228
+ <h3 class="site-preview-heading">Mixed avatars</h3>
229
+ <div class="usx-avatar-group usx-avatar-group--overlap">
230
+ <span class="usx-avatar" aria-label="Morgan"
231
+ ><span class="usx-avatar__content usx-circle">MO</span></span
232
+ ><span class="usx-avatar"
233
+ ><img
234
+ class="usx-avatar__img usx-circle"
235
+ src="/chat-avatar-avery.webp"
236
+ alt="Avery"
237
+ role="img" /></span
238
+ ><span
239
+ class="usx-avatar border-05 border-info usx-circle"
240
+ role="img"
241
+ aria-label="Support bot, Automated assistant"
242
+ ><span class="usx-avatar__content usx-circle"
243
+ ><svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
244
+ <use href="/img/sprite.svg#support_agent"></use></svg></span
245
+ ></span>
246
+ </div>
@@ -27,9 +27,9 @@
27
27
  "description": "Array of avatars rendered by the group.",
28
28
  "items": {
29
29
  "type": "object",
30
- "description": "Avatar item. Mirrors the avatar component's props, using initials/initialsClassName in place of value/contentClassName, with no variant (auto-detected).",
30
+ "description": "Avatar item. Accepts Avatar props, including variant, value, and status. The initials and initialsClassName aliases remain available; variant defaults to image when src is present and initials otherwise.",
31
31
  "component": "avatar",
32
- "omit": ["variant", "value", "contentClassName"],
32
+ "omit": [],
33
33
  "properties": {
34
34
  "initials": {
35
35
  "type": "string",