@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
@@ -1,107 +1,23 @@
1
1
  <h3 id="back-to-top" class="site-preview-heading">Back to top</h3>
2
- <div class="display-flex flex-column flex-justify"
3
- style="height: 2000px; background-color: #8b8b8b; margin-bottom: 1rem;">
4
- <p style="padding: 1rem; color: white;">Scroll down to see the back to top button.</p>
5
- <hr style="width: 100%; color: white;" />
6
- <p style="padding: 1rem; color: white;">Keep scrolling...</p>
7
- <hr style="width: 100%; color: white;" />
8
- <p style="padding: 1rem; color: white;">Almost there...</p>
9
- <hr style="width: 100%; color: white;" />
10
- <p style="padding: 1rem; color: white;">You made it!</p>
11
- </div>
12
- <div class="display-flex flex-wrap">
13
- <div class="display-flex flex-column flex-justify-start flex-align-self-start">
14
- <button class="usa-button usx-button usx-button--ghost" onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
15
- Back to top
16
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
17
- <use href="./img/sprite.svg#arrow_upward"></use>
18
- </svg>
19
- </button>
20
- <button class="usa-button usx-button usa-button--primary usx-button--ghost"
21
- onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
22
- Back to top
23
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
24
- <use href="./img/sprite.svg#arrow_upward"></use>
25
- </svg>
26
- </button>
27
- <button class="usa-button usx-button usa-button--primary usx-button--ghost width-6"
28
- onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
29
- <svg class="usa-icon usa-icon--size-3" aria-hidden="true" focusable="false" role="img">
30
- <use href="./img/sprite.svg#arrow_upward"></use>
31
- </svg>
32
- </button>
33
- <button class="usa-button usx-button usa-button--primary usx-button--ghost width-7"
34
- onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
35
- <svg class="usa-icon usa-icon--size-4" aria-hidden="true" focusable="false" role="img">
36
- <use href="./img/sprite.svg#arrow_upward"></use>
37
- </svg>
38
- </button>
39
- <a class="usx-link usx-no-visited" tabindex="0"
40
- href="#back-to-top"
41
- onclick="document.getElementById('back-to-top').scrollIntoView({ behavior: 'smooth' });"
42
- >
43
- Back to top
44
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
45
- <use href="./img/sprite.svg#arrow_upward"></use>
46
- </svg>
47
- </a>
48
- <div class="bg-primary-darkest padding-1 margin-top-2">
49
- <a class="usx-link text-white hover:text-accent-cool usx-no-visited" tabindex="0"
50
- href="#back-to-top"
51
- onclick="document.getElementById('back-to-top').scrollIntoView({ behavior: 'smooth' });"
52
- >
53
- Back to top
54
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
55
- <use href="./img/sprite.svg#arrow_upward"></use>
56
- </svg>
57
- </a>
58
- </div>
59
- </div>
60
- <div class="display-flex flex-column flex-align-end margin-left-auto">
61
- <button class="usa-button usx-button usx-button--ghost" onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
62
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
63
- <use href="./img/sprite.svg#arrow_upward"></use>
64
- </svg>
65
- Back to top
66
- </button>
67
- <button class="usa-button usx-button usa-button--primary usx-button--ghost"
68
- onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
69
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
70
- <use href="./img/sprite.svg#arrow_upward"></use>
71
- </svg>
72
- Back to top
73
- </button>
74
- <button class="usa-button usx-button usa-button--primary usx-button--ghost width-6"
75
- onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
76
- <svg class="usa-icon usa-icon--size-3" aria-hidden="true" focusable="false" role="img">
77
- <use href="./img/sprite.svg#arrow_upward"></use>
78
- </svg>
79
- </button>
80
- <button class="usa-button usx-button usa-button--primary usx-button--ghost width-7"
81
- onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
82
- <svg class="usa-icon usa-icon--size-4" aria-hidden="true" focusable="false" role="img">
83
- <use href="./img/sprite.svg#arrow_upward"></use>
84
- </svg>
85
- </button>
86
- <a class="usx-link usx-no-visited" tabindex="0"
87
- href="#back-to-top"
88
- onclick="document.getElementById('back-to-top').scrollIntoView({ behavior: 'smooth' });"
89
- >
90
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
91
- <use href="./img/sprite.svg#arrow_upward"></use>
92
- </svg>
93
- Back to top
94
- </a>
95
- <div class="bg-primary-darkest padding-1 margin-top-2">
96
- <a class="usx-link text-white hover:text-accent-cool usx-no-visited" tabindex="0"
97
- href="#back-to-top"
98
- onclick="document.getElementById('back-to-top').scrollIntoView({ behavior: 'smooth' });"
99
- >
100
- <svg class="usa-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
101
- <use href="./img/sprite.svg#arrow_upward"></use>
102
- </svg>
103
- Back to top
104
- </a>
105
- </div>
106
- </div>
107
- </div>
2
+ <a class="usa-button usx-button usa-button--primary usx-button--ghost" href="#top">
3
+ Back to top
4
+ <svg class="usa-icon usx-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
5
+ <use href="./img/sprite.svg#arrow_upward"></use>
6
+ </svg>
7
+ </a>
8
+
9
+ <!-- Optional custom destination. -->
10
+ <a class="usa-button usx-button usa-button--unstyled" href="#back-to-top">
11
+ Back to this section
12
+ <svg class="usa-icon usx-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
13
+ <use href="./img/sprite.svg#arrow_upward"></use>
14
+ </svg>
15
+ </a>
16
+
17
+ <!-- Optional button: the host supplies its click handler. -->
18
+ <button type="button" class="usa-button usx-button usa-button--primary usx-button--ghost">
19
+ Back to top
20
+ <svg class="usa-icon usx-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
21
+ <use href="./img/sprite.svg#arrow_upward"></use>
22
+ </svg>
23
+ </button>
@@ -1,121 +1,77 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
- <button type="button" class="usa-button usx-button usx-button--ghost">
3
- Back to top<svg
4
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
2
+ <a class="usa-button usx-button usa-button--primary usx-button--ghost" href="#top"
3
+ >Back to top<svg
4
+ class="usa-icon usx-icon usa-icon--size-2"
5
5
  aria-hidden="true"
6
6
  focusable="false"
7
7
  role="img"
8
8
  >
9
- <use href="/img/sprite.svg#arrow_upward"></use>
10
- </svg>
11
- </button>
9
+ <use href="/img/sprite.svg#arrow_upward"></use></svg
10
+ ></a>
12
11
 
13
- <h3 class="site-preview-heading">Primary</h3>
14
- <button type="button" class="usa-button usx-button usa-button--primary usx-button--ghost">
15
- Back to top<svg
16
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
17
- aria-hidden="true"
18
- focusable="false"
19
- role="img"
20
- >
21
- <use href="/img/sprite.svg#arrow_upward"></use>
22
- </svg>
23
- </button>
12
+ <h3 class="site-preview-heading">Icon Left</h3>
13
+ <a class="usa-button usx-button usa-button--primary usx-button--ghost" href="#top"
14
+ ><svg class="usa-icon usx-icon usa-icon--size-2" aria-hidden="true" focusable="false" role="img">
15
+ <use href="/img/sprite.svg#arrow_upward"></use></svg
16
+ >Back to top</a
17
+ >
24
18
 
25
19
  <h3 class="site-preview-heading">Icon Only Small</h3>
26
- <button
27
- type="button"
28
- class="usa-button usx-button usa-button--primary usx-button--ghost width-6"
20
+ <a
21
+ class="usa-button usx-button usa-button--primary usx-button--ghost"
22
+ href="#top"
29
23
  aria-label="Back to top"
30
- >
31
- <svg
32
- class="usa-icon usx-icon usa-icon--size-3 margin-left-05"
33
- aria-hidden="true"
34
- focusable="false"
35
- role="img"
36
- >
37
- <use href="/img/sprite.svg#arrow_upward"></use>
38
- </svg>
39
- </button>
24
+ ><svg class="usa-icon usx-icon usa-icon--size-3" aria-hidden="true" focusable="false" role="img">
25
+ <use href="/img/sprite.svg#arrow_upward"></use></svg
26
+ ></a>
40
27
 
41
28
  <h3 class="site-preview-heading">Icon Only Large</h3>
42
- <button
43
- type="button"
44
- class="usa-button usx-button usa-button--primary usx-button--ghost width-7"
29
+ <a
30
+ class="usa-button usx-button usa-button--primary usx-button--ghost"
31
+ href="#top"
45
32
  aria-label="Back to top"
46
- >
47
- <svg
48
- class="usa-icon usx-icon usa-icon--size-4 margin-left-05"
49
- aria-hidden="true"
50
- focusable="false"
51
- role="img"
52
- >
53
- <use href="/img/sprite.svg#arrow_upward"></use>
54
- </svg>
55
- </button>
56
-
57
- <h3 class="site-preview-heading">Link Default</h3>
58
- <a class="usx-link usx-no-visited flex-align-center" href="#back-to-top"
59
- >Back to top<svg
60
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
61
- aria-hidden="true"
62
- focusable="false"
63
- role="img"
64
- >
33
+ ><svg class="usa-icon usx-icon usa-icon--size-4" aria-hidden="true" focusable="false" role="img">
65
34
  <use href="/img/sprite.svg#arrow_upward"></use></svg
66
35
  ></a>
67
36
 
68
- <h3 class="site-preview-heading">Default Icon Left</h3>
69
- <button type="button" class="usa-button usx-button usx-button--ghost">
70
- <svg
71
- class="usa-icon usx-icon usa-icon--size-2 margin-right-05"
37
+ <h3 class="site-preview-heading">Link On Dark</h3>
38
+ <div class="bg-surface-inverse padding-1">
39
+ <a
40
+ class="usa-button usx-button usa-button--primary usa-button--inverse usx-button--ghost"
41
+ href="#top"
42
+ >Back to top<svg
43
+ class="usa-icon usx-icon usa-icon--size-2"
44
+ aria-hidden="true"
45
+ focusable="false"
46
+ role="img"
47
+ >
48
+ <use href="/img/sprite.svg#arrow_upward"></use></svg
49
+ ></a>
50
+ </div>
51
+
52
+ <h3 class="site-preview-heading">Custom Href</h3>
53
+ <a class="usa-button usx-button usa-button--primary usx-button--ghost" href="#storybook-root"
54
+ >Back to preview<svg
55
+ class="usa-icon usx-icon usa-icon--size-2"
72
56
  aria-hidden="true"
73
57
  focusable="false"
74
58
  role="img"
75
59
  >
76
60
  <use href="/img/sprite.svg#arrow_upward"></use></svg
77
- >Back to top
78
- </button>
61
+ ></a>
79
62
 
80
- <h3 class="site-preview-heading">Primary Icon Left</h3>
63
+ <h3 class="site-preview-heading">With On Click</h3>
81
64
  <button type="button" class="usa-button usx-button usa-button--primary usx-button--ghost">
82
- <svg
83
- class="usa-icon usx-icon usa-icon--size-2 margin-right-05"
65
+ Back to top<svg
66
+ class="usa-icon usx-icon usa-icon--size-2"
84
67
  aria-hidden="true"
85
68
  focusable="false"
86
69
  role="img"
87
70
  >
88
- <use href="/img/sprite.svg#arrow_upward"></use></svg
89
- >Back to top
71
+ <use href="/img/sprite.svg#arrow_upward"></use>
72
+ </svg>
90
73
  </button>
91
74
 
92
- <h3 class="site-preview-heading">Link Icon Left</h3>
93
- <a class="usx-link usx-no-visited flex-align-center" href="#back-to-top"
94
- ><svg
95
- class="usa-icon usx-icon usa-icon--size-2 margin-right-05"
96
- aria-hidden="true"
97
- focusable="false"
98
- role="img"
99
- >
100
- <use href="/img/sprite.svg#arrow_upward"></use></svg
101
- >Back to top</a
102
- >
103
-
104
- <h3 class="site-preview-heading">Link On Dark</h3>
105
- <div class="bg-primary-darkest padding-1">
106
- <a
107
- class="usx-link usx-no-visited flex-align-center text-white hover:text-accent-cool"
108
- href="#back-to-top"
109
- >Back to top<svg
110
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
111
- aria-hidden="true"
112
- focusable="false"
113
- role="img"
114
- >
115
- <use href="/img/sprite.svg#arrow_upward"></use></svg
116
- ></a>
117
- </div>
118
-
119
75
  <h3 class="site-preview-heading">All Variants</h3>
120
76
  <div class="display-flex flex-wrap" style="gap: 2rem">
121
77
  <div
@@ -123,65 +79,59 @@
123
79
  style="gap: 0.5rem"
124
80
  >
125
81
  <h4>Button (icon right)</h4>
126
- <button type="button" class="usa-button usx-button usx-button--ghost">
127
- Back to top<svg
128
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
82
+ <a class="usa-button usx-button usa-button--primary usx-button--ghost" href="#top"
83
+ >Back to top<svg
84
+ class="usa-icon usx-icon usa-icon--size-2"
129
85
  aria-hidden="true"
130
86
  focusable="false"
131
87
  role="img"
132
88
  >
133
- <use href="/img/sprite.svg#arrow_upward"></use>
134
- </svg></button
135
- ><button type="button" class="usa-button usx-button usa-button--primary usx-button--ghost">
136
- Back to top<svg
137
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
89
+ <use href="/img/sprite.svg#arrow_upward"></use></svg></a
90
+ ><a class="usa-button usx-button usa-button--primary" href="#top"
91
+ >Back to top<svg
92
+ class="usa-icon usx-icon usa-icon--size-2"
138
93
  aria-hidden="true"
139
94
  focusable="false"
140
95
  role="img"
141
96
  >
142
- <use href="/img/sprite.svg#arrow_upward"></use>
143
- </svg></button
144
- ><button
145
- type="button"
97
+ <use href="/img/sprite.svg#arrow_upward"></use></svg></a
98
+ ><a
146
99
  class="usa-button usx-button usa-button--primary usx-button--ghost width-6"
100
+ href="#top"
147
101
  aria-label="Back to top"
148
- >
149
- <svg
150
- class="usa-icon usx-icon usa-icon--size-3 margin-left-05"
102
+ ><svg
103
+ class="usa-icon usx-icon usa-icon--size-3"
151
104
  aria-hidden="true"
152
105
  focusable="false"
153
106
  role="img"
154
107
  >
155
- <use href="/img/sprite.svg#arrow_upward"></use>
156
- </svg></button
157
- ><button
158
- type="button"
108
+ <use href="/img/sprite.svg#arrow_upward"></use></svg></a
109
+ ><a
159
110
  class="usa-button usx-button usa-button--primary usx-button--ghost width-7"
111
+ href="#top"
160
112
  aria-label="Back to top"
161
- >
162
- <svg
163
- class="usa-icon usx-icon usa-icon--size-4 margin-left-05"
113
+ ><svg
114
+ class="usa-icon usx-icon usa-icon--size-4"
164
115
  aria-hidden="true"
165
116
  focusable="false"
166
117
  role="img"
167
118
  >
168
- <use href="/img/sprite.svg#arrow_upward"></use>
169
- </svg></button
170
- ><a class="usx-link usx-no-visited flex-align-center" href="#back-to-top"
119
+ <use href="/img/sprite.svg#arrow_upward"></use></svg></a
120
+ ><a class="usa-button usx-button usa-button--unstyled" href="#storybook-root"
171
121
  >Back to top<svg
172
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
122
+ class="usa-icon usx-icon usa-icon--size-2"
173
123
  aria-hidden="true"
174
124
  focusable="false"
175
125
  role="img"
176
126
  >
177
127
  <use href="/img/sprite.svg#arrow_upward"></use></svg
178
128
  ></a>
179
- <div class="bg-primary-darkest padding-1">
129
+ <div class="bg-surface-inverse padding-1">
180
130
  <a
181
- class="usx-link usx-no-visited flex-align-center text-white hover:text-accent-cool"
182
- href="#back-to-top"
131
+ class="usa-button usx-button usa-button--primary usa-button--inverse usx-button--ghost"
132
+ href="#top"
183
133
  >Back to top<svg
184
- class="usa-icon usx-icon usa-icon--size-2 margin-left-05"
134
+ class="usa-icon usx-icon usa-icon--size-2"
185
135
  aria-hidden="true"
186
136
  focusable="false"
187
137
  role="img"
@@ -192,53 +142,49 @@
192
142
  </div>
193
143
  <div class="display-flex flex-column flex-align-end margin-left-auto" style="gap: 0.5rem">
194
144
  <h4>Button (icon left)</h4>
195
- <button type="button" class="usa-button usx-button usx-button--ghost">
196
- <svg
197
- class="usa-icon usx-icon usa-icon--size-2 margin-right-05"
145
+ <a class="usa-button usx-button usa-button--primary usx-button--ghost" href="#top"
146
+ ><svg
147
+ class="usa-icon usx-icon usa-icon--size-2"
198
148
  aria-hidden="true"
199
149
  focusable="false"
200
150
  role="img"
201
151
  >
202
152
  <use href="/img/sprite.svg#arrow_upward"></use></svg
203
- >Back to top</button
204
- ><button type="button" class="usa-button usx-button usa-button--primary usx-button--ghost">
205
- <svg
206
- class="usa-icon usx-icon usa-icon--size-2 margin-right-05"
153
+ >Back to top</a
154
+ ><a class="usa-button usx-button usa-button--primary" href="#top"
155
+ ><svg
156
+ class="usa-icon usx-icon usa-icon--size-2"
207
157
  aria-hidden="true"
208
158
  focusable="false"
209
159
  role="img"
210
160
  >
211
161
  <use href="/img/sprite.svg#arrow_upward"></use></svg
212
- >Back to top</button
213
- ><button
214
- type="button"
162
+ >Back to top</a
163
+ ><a
215
164
  class="usa-button usx-button usa-button--primary usx-button--ghost width-6"
165
+ href="#top"
216
166
  aria-label="Back to top"
217
- >
218
- <svg
219
- class="usa-icon usx-icon usa-icon--size-3 margin-left-05"
167
+ ><svg
168
+ class="usa-icon usx-icon usa-icon--size-3"
220
169
  aria-hidden="true"
221
170
  focusable="false"
222
171
  role="img"
223
172
  >
224
- <use href="/img/sprite.svg#arrow_upward"></use>
225
- </svg></button
226
- ><button
227
- type="button"
173
+ <use href="/img/sprite.svg#arrow_upward"></use></svg></a
174
+ ><a
228
175
  class="usa-button usx-button usa-button--primary usx-button--ghost width-7"
176
+ href="#top"
229
177
  aria-label="Back to top"
230
- >
231
- <svg
232
- class="usa-icon usx-icon usa-icon--size-4 margin-left-05"
178
+ ><svg
179
+ class="usa-icon usx-icon usa-icon--size-4"
233
180
  aria-hidden="true"
234
181
  focusable="false"
235
182
  role="img"
236
183
  >
237
- <use href="/img/sprite.svg#arrow_upward"></use>
238
- </svg></button
239
- ><a class="usx-link usx-no-visited flex-align-center" href="#back-to-top"
184
+ <use href="/img/sprite.svg#arrow_upward"></use></svg></a
185
+ ><a class="usa-button usx-button usa-button--unstyled" href="#storybook-root"
240
186
  ><svg
241
- class="usa-icon usx-icon usa-icon--size-2 margin-right-05"
187
+ class="usa-icon usx-icon usa-icon--size-2"
242
188
  aria-hidden="true"
243
189
  focusable="false"
244
190
  role="img"
@@ -246,12 +192,12 @@
246
192
  <use href="/img/sprite.svg#arrow_upward"></use></svg
247
193
  >Back to top</a
248
194
  >
249
- <div class="bg-primary-darkest padding-1">
195
+ <div class="bg-surface-inverse padding-1">
250
196
  <a
251
- class="usx-link usx-no-visited flex-align-center text-white hover:text-accent-cool"
252
- href="#back-to-top"
197
+ class="usa-button usx-button usa-button--primary usa-button--inverse usx-button--ghost"
198
+ href="#top"
253
199
  ><svg
254
- class="usa-icon usx-icon usa-icon--size-2 margin-right-05"
200
+ class="usa-icon usx-icon usa-icon--size-2"
255
201
  aria-hidden="true"
256
202
  focusable="false"
257
203
  role="img"
@@ -1,32 +1,44 @@
1
1
  {
2
2
  "name": "back-to-top",
3
3
  "template": "back-to-top/back-to-top.django.html",
4
- "version": 1,
4
+ "version": 3,
5
5
  "default": {
6
6
  "label": "Back to top",
7
7
  "iconPosition": "right",
8
- "iconSize": 2
8
+ "iconSize": 2,
9
+ "href": "#top",
10
+ "variant": "primary",
11
+ "ghost": true
9
12
  },
10
13
  "props": {
11
14
  "label": {
12
15
  "type": "string",
13
- "description": "The visible text label. Defaults to 'Back to top'. Omit or pass null for icon-only display."
16
+ "description": "The visible text label. Defaults to 'Back to top'. Pass null or an empty string for icon-only display.",
17
+ "default": "Back to top"
14
18
  },
15
19
  "ariaLabel": {
16
20
  "type": "string",
17
- "description": "Accessible name used when there is no visible label (icon-only display). Defaults to 'Back to top'."
21
+ "description": "Accessible name used when there is no visible label (icon-only display). Defaults to 'Back to top'.",
22
+ "default": "Back to top"
18
23
  },
19
24
  "href": {
20
25
  "type": "string",
21
- "description": "If provided, renders as an anchor link (<a>) targeting the given href. Otherwise renders as a <button>."
26
+ "description": "Destination of the anchor. Defaults to #top when omitted or empty. Ignored when onClick selects a button.",
27
+ "default": "#top"
22
28
  },
23
29
  "variant": {
24
30
  "type": "select",
25
31
  "options": [
26
- "",
27
- "primary"
32
+ "primary",
33
+ "secondary",
34
+ "accent-cool",
35
+ "accent-warm",
36
+ "base",
37
+ "outline",
38
+ "unstyled"
28
39
  ],
29
- "description": "Visual style for the button variant. Use 'primary' to add the primary color scheme."
40
+ "description": "Shared Button visual variant. Defaults to primary for both anchors and host-controlled buttons.",
41
+ "default": "primary"
30
42
  },
31
43
  "iconPosition": {
32
44
  "type": "select",
@@ -34,7 +46,8 @@
34
46
  "right",
35
47
  "left"
36
48
  ],
37
- "description": "Position of the arrow icon relative to the label text. Defaults to 'right'."
49
+ "description": "Position of the arrow icon relative to the label text. Defaults to 'right'.",
50
+ "default": "right"
38
51
  },
39
52
  "iconSize": {
40
53
  "type": "select",
@@ -43,11 +56,29 @@
43
56
  "3",
44
57
  "4"
45
58
  ],
46
- "description": "Size of the arrow icon. Corresponds to USWDS icon size utilities. Defaults to '2'."
59
+ "description": "Size of the arrow icon. Corresponds to USWDS icon size utilities. Defaults to '2'.",
60
+ "default": "2"
47
61
  },
48
62
  "className": {
49
63
  "type": "string",
50
64
  "description": "Additional CSS classes to apply to the component."
65
+ },
66
+ "onClick": {
67
+ "type": [
68
+ "function",
69
+ "boolean"
70
+ ],
71
+ "description": "A host-provided React click handler renders a button instead of an anchor. Pass true to render the same button markup and attach a listener from the host (including Django). No scrolling behavior or inline JavaScript is supplied. Takes precedence over href."
72
+ },
73
+ "inverse": {
74
+ "type": "boolean",
75
+ "description": "A boolean that determines whether the button should be displayed with an inverse color scheme, which can be used to create contrast against a darker background.",
76
+ "default": false
77
+ },
78
+ "ghost": {
79
+ "type": "boolean",
80
+ "default": true,
81
+ "description": "Shared Button ghost styling. Enabled by default; set false for a filled or unstyled Button."
51
82
  }
52
83
  }
53
84
  }
@@ -10,7 +10,14 @@ export interface ButtonIcon extends IconProps {
10
10
 
11
11
  type ButtonBaseProps = {
12
12
  label?: string;
13
- variant?: 'primary' | 'secondary' | 'accent-cool' | 'accent-warm' | 'base' | 'outline' | 'unstyled';
13
+ variant?:
14
+ | 'primary'
15
+ | 'secondary'
16
+ | 'accent-cool'
17
+ | 'accent-warm'
18
+ | 'base'
19
+ | 'outline'
20
+ | 'unstyled';
14
21
  type?: 'button' | 'submit' | 'reset';
15
22
  disabled?: boolean;
16
23
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
@@ -27,8 +34,10 @@ type ButtonBaseProps = {
27
34
  extraAttributes?: Record<string, unknown>;
28
35
  };
29
36
 
30
- type AnchorButtonProps = ButtonBaseProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & { href: string };
31
- type NativeButtonProps = ButtonBaseProps & React.ButtonHTMLAttributes<HTMLButtonElement> & { href?: undefined };
37
+ type AnchorButtonProps = ButtonBaseProps &
38
+ React.AnchorHTMLAttributes<HTMLAnchorElement> & { href: string };
39
+ export type NativeButtonProps = ButtonBaseProps &
40
+ React.ButtonHTMLAttributes<HTMLButtonElement> & { href?: undefined };
32
41
  export type ButtonProps = AnchorButtonProps | NativeButtonProps;
33
42
 
34
43
  export default function Button({
@@ -1,6 +1,24 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
2
  <button type="button" class="usa-button usx-button usa-button--primary">Default</button>
3
3
 
4
+ <h3 class="site-preview-heading">Download action</h3>
5
+ <a
6
+ href="/liberty-island-notes.txt"
7
+ download="Liberty Island notes.txt"
8
+ class="usa-button usx-button usa-button--unstyled"
9
+ >
10
+ Download island notes
11
+ </a>
12
+
13
+ <h3 class="site-preview-heading">Button styled as a tag</h3>
14
+ <button
15
+ type="button"
16
+ class="usa-button usx-button usa-button--unstyled usa-tag usx-tag usx-tag--outline usx-tag--interactive"
17
+ onclick="window.alert(&#x27;Topic selected&#x27;)"
18
+ >
19
+ Choose topic
20
+ </button>
21
+
4
22
  <h3 class="site-preview-heading">Default Hover</h3>
5
23
  <button type="button" class="usa-button usx-button usa-button--hover">Hover</button>
6
24
 
@@ -3,6 +3,7 @@
3
3
  {% if href %}
4
4
  <a
5
5
  href="{{ href }}"
6
+ {% if download != None and download is not False %}{% if download is True %}download{% else %}download="{{ download }}"{% endif %}{% endif %}
6
7
  class="
7
8
  usa-button usx-button
8
9
  {% if variant %} usa-button--{{ variant }}{% endif %}
@@ -28,7 +29,7 @@
28
29
  {% if ghost == True %} usx-button--ghost{% endif %}
29
30
  {% if className %} {{ className }}{% endif %}
30
31
  "
31
- {% if disabled == True %} disabled aria-disabled="true" {% endif %}
32
+ {% if disabled == True %} disabled aria-disabled="true"{% endif %}
32
33
  {% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
33
34
  >
34
35
  {% endif %}
@@ -55,4 +56,4 @@
55
56
  </a>
56
57
  {% else %}
57
58
  </button>
58
- {% endif %}
59
+ {% endif %}