@solexllc/usx-react 0.11.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/README.md +31 -0
  2. package/dist/Popover-Bg4-2-cU.cjs +987 -0
  3. package/dist/Popover-CqHczzNE.js +988 -0
  4. package/dist/chat.cjs +1396 -0
  5. package/dist/chat.js +1396 -0
  6. package/dist/index.cjs +4412 -5247
  7. package/dist/index.js +140 -972
  8. package/package.json +9 -5
  9. package/src/chat.js +15 -0
  10. package/src/components/accordion/Accordion.tsx +9 -57
  11. package/src/components/accordion/accordion.django.html +10 -20
  12. package/src/components/accordion/config.json +8 -2
  13. package/src/components/accordion-item/AccordionItem.tsx +54 -0
  14. package/src/components/accordion-item/accordion-item.django.html +19 -0
  15. package/src/components/accordion-item/accordion-item.html +8 -0
  16. package/src/components/accordion-item/config.json +55 -0
  17. package/src/components/alert/alert.django-snapshot.html +4 -4
  18. package/src/components/avatar/Avatar.tsx +54 -16
  19. package/src/components/avatar/avatar.django-snapshot.html +118 -2
  20. package/src/components/avatar/avatar.django.html +2 -2
  21. package/src/components/avatar/avatar.html +25 -0
  22. package/src/components/avatar/avatar.react-snapshot.html +110 -3
  23. package/src/components/avatar/config.json +17 -17
  24. package/src/components/avatar-group/AvatarGroup.tsx +17 -15
  25. package/src/components/avatar-group/avatar-group.django-snapshot.html +196 -174
  26. package/src/components/avatar-group/avatar-group.django.html +1 -1
  27. package/src/components/avatar-group/avatar-group.react-snapshot.html +216 -165
  28. package/src/components/avatar-group/config.json +14 -8
  29. package/src/components/back-to-top/BackToTop.tsx +21 -57
  30. package/src/components/back-to-top/back-to-top.django-snapshot.html +101 -202
  31. package/src/components/back-to-top/back-to-top.django.html +11 -38
  32. package/src/components/back-to-top/back-to-top.html +22 -106
  33. package/src/components/back-to-top/back-to-top.react-snapshot.html +94 -148
  34. package/src/components/back-to-top/config.json +41 -10
  35. package/src/components/banner/banner.django-snapshot.html +2 -2
  36. package/src/components/button/Button.tsx +15 -3
  37. package/src/components/button/button.django-snapshot.html +82 -0
  38. package/src/components/button/button.django.html +5 -2
  39. package/src/components/button/button.react-snapshot.html +80 -0
  40. package/src/components/button/config.json +17 -3
  41. package/src/components/callout/callout.django.html +1 -1
  42. package/src/components/callout/config.json +7 -16
  43. package/src/components/card/card.django-snapshot.html +43 -0
  44. package/src/components/card/card.react-snapshot.html +36 -0
  45. package/src/components/character-count/CharacterCount.tsx +2 -0
  46. package/src/components/character-count/character-count.react-snapshot.html +7 -0
  47. package/src/components/chat/Chat.tsx +575 -0
  48. package/src/components/chat/README.md +174 -0
  49. package/src/components/chat/avatarProps.ts +32 -0
  50. package/src/components/chat/chat.django-snapshot.html +23579 -0
  51. package/src/components/chat/chat.django.html +75 -0
  52. package/src/components/chat/chat.html +116 -0
  53. package/src/components/chat/chat.react-snapshot.html +16895 -0
  54. package/src/components/chat/config.json +1241 -0
  55. package/src/components/chat-attachment/ChatAttachment.tsx +39 -0
  56. package/src/components/chat-attachment/chat-attachment.django.html +24 -0
  57. package/src/components/chat-attachment/chat-attachment.html +10 -0
  58. package/src/components/chat-attachment/config.json +27 -0
  59. package/src/components/chat-attachments/ChatAttachments.tsx +17 -0
  60. package/src/components/chat-attachments/chat-attachments.django-snapshot.html +58 -0
  61. package/src/components/chat-attachments/chat-attachments.django.html +10 -0
  62. package/src/components/chat-attachments/chat-attachments.html +14 -0
  63. package/src/components/chat-attachments/chat-attachments.react-snapshot.html +46 -0
  64. package/src/components/chat-attachments/config.json +25 -0
  65. package/src/components/chat-bubble/ChatBubble.tsx +39 -0
  66. package/src/components/chat-bubble/ChatFormattedText.tsx +138 -0
  67. package/src/components/chat-bubble/chat-bubble.django-snapshot.html +128 -0
  68. package/src/components/chat-bubble/chat-bubble.django.html +19 -0
  69. package/src/components/chat-bubble/chat-bubble.html +1 -0
  70. package/src/components/chat-bubble/chat-bubble.react-snapshot.html +118 -0
  71. package/src/components/chat-bubble/config.json +70 -0
  72. package/src/components/chat-composer/ChatComposer.tsx +213 -0
  73. package/src/components/chat-composer/README.md +15 -0
  74. package/src/components/chat-composer/chat-composer.django-snapshot.html +575 -0
  75. package/src/components/chat-composer/chat-composer.django.html +77 -0
  76. package/src/components/chat-composer/chat-composer.html +44 -0
  77. package/src/components/chat-composer/chat-composer.react-snapshot.html +519 -0
  78. package/src/components/chat-composer/chat-formatting.django.html +59 -0
  79. package/src/components/chat-composer/config.json +137 -0
  80. package/src/components/chat-context/ChatContext.tsx +46 -0
  81. package/src/components/chat-context/chat-context.django-snapshot.html +35 -0
  82. package/src/components/chat-context/chat-context.django.html +20 -0
  83. package/src/components/chat-context/chat-context.html +9 -0
  84. package/src/components/chat-context/chat-context.react-snapshot.html +30 -0
  85. package/src/components/chat-context/config.json +36 -0
  86. package/src/components/chat-controls/ChatControls.tsx +67 -0
  87. package/src/components/chat-controls/chat-controls.django-snapshot.html +114 -0
  88. package/src/components/chat-controls/chat-controls.django.html +36 -0
  89. package/src/components/chat-controls/chat-controls.html +11 -0
  90. package/src/components/chat-controls/chat-controls.react-snapshot.html +107 -0
  91. package/src/components/chat-controls/config.json +67 -0
  92. package/src/components/chat-directory/ChatDirectory.tsx +168 -0
  93. package/src/components/chat-directory/chat-directory.django-snapshot.html +546 -0
  94. package/src/components/chat-directory/chat-directory.django.html +14 -0
  95. package/src/components/chat-directory/chat-directory.html +4 -0
  96. package/src/components/chat-directory/chat-directory.react-snapshot.html +471 -0
  97. package/src/components/chat-directory/config.json +242 -0
  98. package/src/components/chat-directory-item/ChatDirectoryItem.tsx +150 -0
  99. package/src/components/chat-directory-item/chat-directory-item.django-snapshot.html +281 -0
  100. package/src/components/chat-directory-item/chat-directory-item.django.html +38 -0
  101. package/src/components/chat-directory-item/chat-directory-item.html +9 -0
  102. package/src/components/chat-directory-item/chat-directory-item.react-snapshot.html +249 -0
  103. package/src/components/chat-directory-item/config.json +103 -0
  104. package/src/components/chat-history/ChatHistory.tsx +30 -0
  105. package/src/components/chat-history/chat-history.django-snapshot.html +113 -0
  106. package/src/components/chat-history/chat-history.django.html +20 -0
  107. package/src/components/chat-history/chat-history.html +9 -0
  108. package/src/components/chat-history/chat-history.react-snapshot.html +111 -0
  109. package/src/components/chat-history/config.json +24 -0
  110. package/src/components/chat-message/ChatMessage.tsx +148 -0
  111. package/src/components/chat-message/chat-message.django-snapshot.html +758 -0
  112. package/src/components/chat-message/chat-message.django.html +56 -0
  113. package/src/components/chat-message/chat-message.html +12 -0
  114. package/src/components/chat-message/chat-message.react-snapshot.html +627 -0
  115. package/src/components/chat-message/config.json +278 -0
  116. package/src/components/chat-message-actions/ChatMessageActions.tsx +133 -0
  117. package/src/components/chat-message-actions/chat-message-actions.django-snapshot.html +345 -0
  118. package/src/components/chat-message-actions/chat-message-actions.django.html +29 -0
  119. package/src/components/chat-message-actions/chat-message-actions.html +53 -0
  120. package/src/components/chat-message-actions/chat-message-actions.react-snapshot.html +295 -0
  121. package/src/components/chat-message-actions/config.json +121 -0
  122. package/src/components/chat-window/ChatWindow.tsx +135 -0
  123. package/src/components/chat-window/chat-window.django-snapshot.html +450 -0
  124. package/src/components/chat-window/chat-window.django.html +39 -0
  125. package/src/components/chat-window/chat-window.html +26 -0
  126. package/src/components/chat-window/chat-window.react-snapshot.html +286 -0
  127. package/src/components/chat-window/config.json +123 -0
  128. package/src/components/checkbox/checkbox.django-snapshot.html +2 -2
  129. package/src/components/clickable/Clickable.tsx +19 -5
  130. package/src/components/clickable/clickable.django-snapshot.html +11 -2
  131. package/src/components/clickable/clickable.django.html +2 -0
  132. package/src/components/clickable/clickable.react-snapshot.html +10 -2
  133. package/src/components/clickable/config.json +4 -0
  134. package/src/components/code/code.django-snapshot.html +25 -18
  135. package/src/components/code/code.react-snapshot.html +41 -4
  136. package/src/components/copy-to-clipboard/CopyToClipboard.tsx +2 -7
  137. package/src/components/copy-to-clipboard/copy-to-clipboard.django-snapshot.html +6 -4
  138. package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +3 -2
  139. package/src/components/copy-to-clipboard/copy-to-clipboard.react-snapshot.html +14 -2
  140. package/src/components/data-table/data-table.django-snapshot.html +4 -5
  141. package/src/components/data-table/data-table.react-snapshot.html +4 -4
  142. package/src/components/drawer/drawer.django-snapshot.html +53 -30
  143. package/src/components/error-page/error-page.django-snapshot.html +20 -7
  144. package/src/components/fieldset/fieldset.django-snapshot.html +1 -6
  145. package/src/components/file-list/FileList.tsx +3 -2
  146. package/src/components/file-list/config.json +5 -0
  147. package/src/components/file-list/file-list.django-snapshot.html +63 -0
  148. package/src/components/file-list/file-list.django.html +1 -1
  149. package/src/components/file-list/file-list.react-snapshot.html +53 -0
  150. package/src/components/footer/footer.django-snapshot.html +0 -3
  151. package/src/components/form-group/form-group.django-snapshot.html +0 -2
  152. package/src/components/header/header.django-snapshot.html +3 -163
  153. package/src/components/header/header.django.html +2 -2
  154. package/src/components/header/header.html +1 -1
  155. package/src/components/header/header.react-snapshot.html +3 -3
  156. package/src/components/hero/hero.django-snapshot.html +0 -20
  157. package/src/components/hero/hero.django.html +3 -3
  158. package/src/components/identifier/config.json +4 -2
  159. package/src/components/identifier/identifier.django-snapshot.html +13 -16
  160. package/src/components/identifier/identifier.react-snapshot.html +13 -15
  161. package/src/components/image/image.django-snapshot.html +6 -6
  162. package/src/components/image/image.django.html +4 -4
  163. package/src/components/input/Input.tsx +1 -1
  164. package/src/components/input/config.json +2 -3
  165. package/src/components/input/input.django-snapshot.html +4 -21
  166. package/src/components/input/input.django.html +2 -2
  167. package/src/components/layout/layout.django-snapshot.html +2 -0
  168. package/src/components/link/Link.tsx +7 -4
  169. package/src/components/link/config.json +2 -3
  170. package/src/components/link/link.django-snapshot.html +8 -0
  171. package/src/components/link/link.django.html +2 -2
  172. package/src/components/link/link.html +4 -1
  173. package/src/components/link/link.react-snapshot.html +8 -0
  174. package/src/components/memorable-date/memorable-date.django-snapshot.html +0 -8
  175. package/src/components/memorable-date/memorable-date.django.html +2 -2
  176. package/src/components/misc-banner/misc-banner.django-snapshot.html +12 -12
  177. package/src/components/misc-banner/misc-banner.django.html +4 -2
  178. package/src/components/modal/Modal.tsx +4 -3
  179. package/src/components/modal/config.json +3 -2
  180. package/src/components/modal/modal.django-snapshot.html +70 -14
  181. package/src/components/modal/modal.django.html +7 -9
  182. package/src/components/modal/modal.html +4 -4
  183. package/src/components/modal/modal.react-snapshot.html +64 -4
  184. package/src/components/page/Page.tsx +10 -7
  185. package/src/components/page/page.django-snapshot.html +5 -8
  186. package/src/components/page/page.django.html +2 -2
  187. package/src/components/page/page.html +1 -2
  188. package/src/components/page/page.react-snapshot.html +5 -8
  189. package/src/components/pagination/navigation/PaginationNavigation.tsx +2 -0
  190. package/src/components/pagination/navigation/pagination-navigation.django.html +2 -0
  191. package/src/components/pagination/pagination.django-snapshot.html +62 -0
  192. package/src/components/pagination/pagination.django.html +3 -1
  193. package/src/components/pagination/pagination.html +46 -0
  194. package/src/components/pagination/pagination.react-snapshot.html +48 -0
  195. package/src/components/pagination/summary/PaginationSummary.tsx +1 -1
  196. package/src/components/pagination/summary/pagination-summary.django.html +1 -1
  197. package/src/components/popover/Popover.tsx +61 -9
  198. package/src/components/popover/PopoverMenu.tsx +33 -15
  199. package/src/components/popover/config.json +88 -14
  200. package/src/components/popover/popover-menu.django.html +13 -2
  201. package/src/components/popover/popover.django-snapshot.html +265 -7
  202. package/src/components/popover/popover.django.html +3 -2
  203. package/src/components/popover/popover.react-snapshot.html +154 -4
  204. package/src/components/process-list/config.json +41 -3
  205. package/src/components/quote/Quote.tsx +9 -2
  206. package/src/components/search/Search.tsx +1 -1
  207. package/src/components/search/config.json +3 -4
  208. package/src/components/search/search.django-snapshot.html +262 -1684
  209. package/src/components/search/search.django.html +1 -20
  210. package/src/components/section/Section.tsx +3 -1
  211. package/src/components/select/select.django-snapshot.html +7 -7
  212. package/src/components/select/select.react-snapshot.html +7 -7
  213. package/src/components/site-alert/site-alert.django-snapshot.html +8 -8
  214. package/src/components/summary/Summary.tsx +4 -2
  215. package/src/components/summary/config.json +4 -0
  216. package/src/components/summary/summary.django.html +4 -4
  217. package/src/components/swap/Swap.tsx +35 -3
  218. package/src/components/swap/config.json +28 -1
  219. package/src/components/swap/swap.django-snapshot.html +29 -7
  220. package/src/components/swap/swap.django.html +15 -1
  221. package/src/components/swap/swap.react-snapshot.html +34 -4
  222. package/src/components/table/Table.tsx +58 -25
  223. package/src/components/table/config.json +61 -13
  224. package/src/components/tag/Tag.tsx +40 -7
  225. package/src/components/tag/config.json +18 -2
  226. package/src/components/tag/tag.django-snapshot.html +16 -1
  227. package/src/components/tag/tag.django.html +12 -6
  228. package/src/components/tag/tag.html +4 -0
  229. package/src/components/tag/tag.react-snapshot.html +16 -1
  230. package/src/components/tag-group/TagGroup.tsx +6 -9
  231. package/src/components/tag-group/config.json +4 -0
  232. package/src/components/tag-group/tag-group.django.html +1 -1
  233. package/src/components/theme-picker/ThemePicker.tsx +48 -42
  234. package/src/components/theme-picker/config.json +27 -29
  235. package/src/components/theme-picker/theme-picker-select.django.html +1 -1
  236. package/src/components/theme-picker/theme-picker.django-snapshot.html +283 -78
  237. package/src/components/theme-picker/theme-picker.django.html +24 -11
  238. package/src/components/theme-picker/theme-picker.html +155 -54
  239. package/src/components/theme-picker/theme-picker.react-snapshot.html +265 -67
  240. package/src/index.js +1 -0
@@ -1,63 +1,63 @@
1
1
  {
2
2
  "name": "theme-picker",
3
3
  "template": "theme-picker/theme-picker.django.html",
4
- "version": 2,
4
+ "version": 6,
5
5
  "required": ["themes"],
6
6
  "default": {
7
7
  "id": "theme-picker-1",
8
8
  "label": "Theme",
9
9
  "themes": [
10
10
  {
11
- "value": "Default",
11
+ "value": "default",
12
12
  "label": "Default"
13
13
  },
14
14
  {
15
- "value": "Forest",
15
+ "value": "forest",
16
16
  "label": "Forest"
17
17
  },
18
18
  {
19
- "value": "Sunset",
19
+ "value": "sunset",
20
20
  "label": "Sunset"
21
21
  },
22
22
  {
23
- "value": "Ocean",
23
+ "value": "ocean",
24
24
  "label": "Ocean"
25
25
  },
26
26
  {
27
- "value": "Aurora",
27
+ "value": "aurora",
28
28
  "label": "Aurora"
29
29
  },
30
30
  {
31
- "value": "Borealis",
31
+ "value": "borealis",
32
32
  "label": "Borealis"
33
33
  },
34
34
  {
35
- "value": "Midnight",
35
+ "value": "midnight",
36
36
  "label": "Midnight"
37
37
  },
38
38
  {
39
- "value": "Carbon",
39
+ "value": "carbon",
40
40
  "label": "Carbon"
41
41
  },
42
42
  {
43
- "value": "VADS",
43
+ "value": "vads",
44
44
  "label": "VADS"
45
45
  },
46
46
  {
47
- "value": "GOV.UK",
47
+ "value": "gov-uk",
48
48
  "label": "GOV.UK"
49
49
  },
50
50
  {
51
- "value": "NASA",
51
+ "value": "nasa",
52
52
  "label": "NASA"
53
53
  }
54
54
  ],
55
- "defaultValue": "Default"
55
+ "defaultValue": "default"
56
56
  },
57
57
  "props": {
58
58
  "id": {
59
59
  "type": "string",
60
- "description": "Element id for the select"
60
+ "description": "Element id for the value field"
61
61
  },
62
62
  "name": {
63
63
  "type": "string",
@@ -66,29 +66,20 @@
66
66
  "label": {
67
67
  "type": "string",
68
68
  "default": "Theme",
69
- "description": "Label displayed above the select"
69
+ "description": "Accessible picker label"
70
70
  },
71
71
  "themes": {
72
72
  "type": "array",
73
- "description": "Array of { value, label } theme options."
73
+ "description": "Theme choices with a label and a value written verbatim to <html data-usx-theme>."
74
74
  },
75
75
  "defaultValue": {
76
76
  "type": "string",
77
- "description": "Initial selected value for uncontrolled usage"
77
+ "description": "Initial theme value when value is omitted"
78
78
  },
79
79
  "value": {
80
80
  "type": "string",
81
81
  "default": null,
82
- "description": "Current theme selection. Takes precedence over defaultValue."
83
- },
84
- "onChange": {
85
- "type": "function",
86
- "description": "React callback for a selected theme. Django consumers can listen for the select's native change event; applying the theme remains the application's responsibility.",
87
- "renderers": {
88
- "django": {
89
- "supported": false
90
- }
91
- }
82
+ "description": "Initial selected theme. Takes precedence over defaultValue."
92
83
  },
93
84
  "className": {
94
85
  "type": "string",
@@ -99,9 +90,16 @@
99
90
  "description": "Additional HTML attributes on the theme picker root."
100
91
  },
101
92
  "variant": {
102
- "type": "string",
93
+ "type": "select",
94
+ "options": ["default", "popover", "swap"],
103
95
  "default": "default",
104
- "description": "Picker presentation: default, ghost-select, or swap. Swap uses two themes: first light, second dark."
96
+ "description": "Picker presentation: default, popover, or swap. All variants stay hidden until enhanced. ThemePicker enhancement applies the selected theme and connects Swap's button behavior. Swap uses two themes."
97
+ },
98
+ "popoverAlign": {
99
+ "type": "select",
100
+ "options": ["start", "center", "end"],
101
+ "default": "start",
102
+ "description": "Alignment of the popover panel relative to its trigger. Only used by the popover variant."
105
103
  }
106
104
  }
107
105
  }
@@ -1,6 +1,6 @@
1
1
  {% load usx_components %}
2
2
  {% label htmlFor=field_id screenReaderOnly=True only %}{{ label|default:'Theme' }}{% endlabel %}
3
- <select id="{{ field_id }}" class="usa-select usx-select{% if hidden %} usx-theme-picker__select--hidden{% endif %}"{% if name %} name="{{ name }}"{% endif %}>
3
+ <select id="{{ field_id }}" class="usa-select usx-select"{% if name %} name="{{ name }}"{% endif %}>
4
4
  {% for theme in themes %}
5
5
  <option value="{{ theme.value }}"{% if theme.value == selected_value %} selected{% endif %}>{{ theme.label }}</option>
6
6
  {% endfor %}
@@ -1,5 +1,5 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
- <div class="usx-theme-picker">
2
+ <div class="usx-theme-picker" hidden>
3
3
  <button
4
4
  type="button"
5
5
  class="usa-button usx-button usx-button--ghost usx-theme-picker__trigger"
@@ -20,27 +20,91 @@
20
20
  <label class="usa-label usx-label usa-sr-only" for="django-theme-picker-1"> Theme </label>
21
21
 
22
22
  <select id="django-theme-picker-1" class="usa-select usx-select">
23
- <option value="Default" selected>Default</option>
23
+ <option value="default" selected>Default</option>
24
24
 
25
- <option value="Forest">Forest</option>
25
+ <option value="forest">Forest</option>
26
26
 
27
- <option value="Sunset">Sunset</option>
27
+ <option value="sunset">Sunset</option>
28
28
 
29
- <option value="Ocean">Ocean</option>
29
+ <option value="ocean">Ocean</option>
30
30
 
31
- <option value="Aurora">Aurora</option>
31
+ <option value="aurora">Aurora</option>
32
32
 
33
- <option value="Borealis">Borealis</option>
33
+ <option value="borealis">Borealis</option>
34
34
 
35
- <option value="Midnight">Midnight</option>
35
+ <option value="midnight">Midnight</option>
36
36
 
37
- <option value="Carbon">Carbon</option>
37
+ <option value="carbon">Carbon</option>
38
38
 
39
- <option value="VADS">VADS</option>
39
+ <option value="vads">VADS</option>
40
40
 
41
- <option value="GOV.UK">GOV.UK</option>
41
+ <option value="gov-uk">GOV.UK</option>
42
42
 
43
- <option value="NASA">NASA</option>
43
+ <option value="nasa">NASA</option>
44
+ </select>
45
+
46
+ <button
47
+ type="button"
48
+ class="usa-button usx-button usa-button--primary usx-theme-picker__toggle"
49
+ aria-label="Confirm theme"
50
+ >
51
+ <svg
52
+ class="usa-icon usx-icon usx-theme-picker__icon"
53
+ aria-hidden="true"
54
+ focusable="false"
55
+ role="img"
56
+ >
57
+ <use href="img/sprite.svg#close"></use>
58
+ </svg>
59
+ </button>
60
+ </div>
61
+ </div>
62
+
63
+ <h3 class="site-preview-heading">Unenhanced</h3>
64
+ <div class="usx-theme-picker" usx-data-enhanced="true" hidden>
65
+ <button
66
+ type="button"
67
+ class="usa-button usx-button usx-button--ghost usx-theme-picker__trigger"
68
+ aria-label="Theme"
69
+ aria-expanded="false"
70
+ aria-controls="django-theme-picker-unenhanced-panel"
71
+ >
72
+ <svg
73
+ class="usa-icon usx-icon usx-theme-picker__icon"
74
+ aria-hidden="true"
75
+ focusable="false"
76
+ role="img"
77
+ >
78
+ <use href="img/usx-sprite.svg#color_palette"></use>
79
+ </svg>
80
+ </button>
81
+ <div id="django-theme-picker-unenhanced-panel" class="usx-theme-picker__panel">
82
+ <label class="usa-label usx-label usa-sr-only" for="django-theme-picker-unenhanced">
83
+ Theme
84
+ </label>
85
+
86
+ <select id="django-theme-picker-unenhanced" class="usa-select usx-select">
87
+ <option value="default" selected>Default</option>
88
+
89
+ <option value="forest">Forest</option>
90
+
91
+ <option value="sunset">Sunset</option>
92
+
93
+ <option value="ocean">Ocean</option>
94
+
95
+ <option value="aurora">Aurora</option>
96
+
97
+ <option value="borealis">Borealis</option>
98
+
99
+ <option value="midnight">Midnight</option>
100
+
101
+ <option value="carbon">Carbon</option>
102
+
103
+ <option value="vads">VADS</option>
104
+
105
+ <option value="gov-uk">GOV.UK</option>
106
+
107
+ <option value="nasa">NASA</option>
44
108
  </select>
45
109
 
46
110
  <button
@@ -61,7 +125,7 @@
61
125
  </div>
62
126
 
63
127
  <h3 class="site-preview-heading">Light Dark</h3>
64
- <div class="usx-theme-picker">
128
+ <div class="usx-theme-picker" hidden>
65
129
  <button
66
130
  type="button"
67
131
  class="usa-button usx-button usx-button--ghost usx-theme-picker__trigger"
@@ -82,9 +146,9 @@
82
146
  <label class="usa-label usx-label usa-sr-only" for="django-theme-picker-2"> Theme </label>
83
147
 
84
148
  <select id="django-theme-picker-2" class="usa-select usx-select">
85
- <option value="Aurora" selected>Light</option>
149
+ <option value="aurora" selected>Light</option>
86
150
 
87
- <option value="Borealis">Dark</option>
151
+ <option value="borealis">Dark</option>
88
152
  </select>
89
153
 
90
154
  <button
@@ -104,12 +168,12 @@
104
168
  </div>
105
169
  </div>
106
170
 
107
- <h3 class="site-preview-heading">Ghost Select</h3>
108
- <div class="usx-theme-picker usx-theme-picker--ghost-select">
109
- <div class="usx-theme-picker__ghost">
110
- <span
111
- class="usa-button usx-button usx-button--ghost usx-theme-picker__ghost-face"
112
- aria-hidden="true"
171
+ <h3 class="site-preview-heading">Popover</h3>
172
+ <div class="usx-theme-picker usx-theme-picker--popover" hidden>
173
+ <details class="usx-popover usx-theme-picker__popover" data-side="bottom" data-align="start">
174
+ <summary
175
+ class="usa-button usx-button usx-button--ghost usx-button--tight margin-0"
176
+ aria-label="Theme"
113
177
  >
114
178
  <svg
115
179
  class="usa-icon usx-icon usx-theme-picker__icon"
@@ -119,47 +183,196 @@
119
183
  >
120
184
  <use href="img/usx-sprite.svg#color_palette"></use>
121
185
  </svg>
122
- </span>
123
-
124
- <label class="usa-label usx-label usa-sr-only" for="django-theme-picker-ghost-select">
125
- Theme
126
- </label>
127
-
128
- <select
129
- id="django-theme-picker-ghost-select"
130
- class="usa-select usx-select usx-theme-picker__select--hidden"
186
+ </summary>
187
+ <div
188
+ id="django-theme-picker-popover-panel"
189
+ class="usx-popover__panel usx-popover__panel--square"
131
190
  >
132
- <option value="Default" selected>Default</option>
133
-
134
- <option value="Forest">Forest</option>
135
-
136
- <option value="Sunset">Sunset</option>
137
-
138
- <option value="Ocean">Ocean</option>
139
-
140
- <option value="Aurora">Aurora</option>
141
-
142
- <option value="Borealis">Borealis</option>
143
-
144
- <option value="Midnight">Midnight</option>
145
-
146
- <option value="Carbon">Carbon</option>
147
-
148
- <option value="VADS">VADS</option>
149
-
150
- <option value="GOV.UK">GOV.UK</option>
191
+ <ul class="usx-popover__menu">
192
+ <li>
193
+ <button
194
+ type="button"
195
+ class="usx-popover__menu-item"
196
+ data-usx-theme-value="default"
197
+ aria-pressed="true"
198
+ >
199
+ Default
200
+ </button>
201
+ </li>
202
+
203
+ <li>
204
+ <button
205
+ type="button"
206
+ class="usx-popover__menu-item"
207
+ data-usx-theme-value="forest"
208
+ aria-pressed="false"
209
+ >
210
+ Forest
211
+ </button>
212
+ </li>
213
+
214
+ <li>
215
+ <button
216
+ type="button"
217
+ class="usx-popover__menu-item"
218
+ data-usx-theme-value="sunset"
219
+ aria-pressed="false"
220
+ >
221
+ Sunset
222
+ </button>
223
+ </li>
224
+
225
+ <li>
226
+ <button
227
+ type="button"
228
+ class="usx-popover__menu-item"
229
+ data-usx-theme-value="ocean"
230
+ aria-pressed="false"
231
+ >
232
+ Ocean
233
+ </button>
234
+ </li>
235
+
236
+ <li>
237
+ <button
238
+ type="button"
239
+ class="usx-popover__menu-item"
240
+ data-usx-theme-value="aurora"
241
+ aria-pressed="false"
242
+ >
243
+ Aurora
244
+ </button>
245
+ </li>
246
+
247
+ <li>
248
+ <button
249
+ type="button"
250
+ class="usx-popover__menu-item"
251
+ data-usx-theme-value="borealis"
252
+ aria-pressed="false"
253
+ >
254
+ Borealis
255
+ </button>
256
+ </li>
257
+
258
+ <li>
259
+ <button
260
+ type="button"
261
+ class="usx-popover__menu-item"
262
+ data-usx-theme-value="midnight"
263
+ aria-pressed="false"
264
+ >
265
+ Midnight
266
+ </button>
267
+ </li>
268
+
269
+ <li>
270
+ <button
271
+ type="button"
272
+ class="usx-popover__menu-item"
273
+ data-usx-theme-value="carbon"
274
+ aria-pressed="false"
275
+ >
276
+ Carbon
277
+ </button>
278
+ </li>
279
+
280
+ <li>
281
+ <button
282
+ type="button"
283
+ class="usx-popover__menu-item"
284
+ data-usx-theme-value="vads"
285
+ aria-pressed="false"
286
+ >
287
+ VADS
288
+ </button>
289
+ </li>
290
+
291
+ <li>
292
+ <button
293
+ type="button"
294
+ class="usx-popover__menu-item"
295
+ data-usx-theme-value="gov-uk"
296
+ aria-pressed="false"
297
+ >
298
+ GOV.UK
299
+ </button>
300
+ </li>
301
+
302
+ <li>
303
+ <button
304
+ type="button"
305
+ class="usx-popover__menu-item"
306
+ data-usx-theme-value="nasa"
307
+ aria-pressed="false"
308
+ >
309
+ NASA
310
+ </button>
311
+ </li>
312
+ </ul>
313
+ </div>
314
+ </details>
315
+ <input id="django-theme-picker-popover" type="hidden" value="default" name="theme" />
316
+ </div>
151
317
 
152
- <option value="NASA">NASA</option>
153
- </select>
154
- </div>
318
+ <h3 class="site-preview-heading">Popover End</h3>
319
+ <div class="usx-theme-picker usx-theme-picker--popover margin-left-15" hidden>
320
+ <details class="usx-popover usx-theme-picker__popover" data-side="bottom" data-align="end">
321
+ <summary
322
+ class="usa-button usx-button usx-button--ghost usx-button--tight margin-0"
323
+ aria-label="Theme"
324
+ >
325
+ <svg
326
+ class="usa-icon usx-icon usx-theme-picker__icon"
327
+ aria-hidden="true"
328
+ focusable="false"
329
+ role="img"
330
+ >
331
+ <use href="img/usx-sprite.svg#color_palette"></use>
332
+ </svg>
333
+ </summary>
334
+ <div
335
+ id="django-theme-picker-popover-end-panel"
336
+ class="usx-popover__panel usx-popover__panel--square"
337
+ >
338
+ <ul class="usx-popover__menu">
339
+ <li>
340
+ <button
341
+ type="button"
342
+ class="usx-popover__menu-item"
343
+ data-usx-theme-value="aurora"
344
+ aria-pressed="true"
345
+ >
346
+ Light
347
+ </button>
348
+ </li>
349
+
350
+ <li>
351
+ <button
352
+ type="button"
353
+ class="usx-popover__menu-item"
354
+ data-usx-theme-value="borealis"
355
+ aria-pressed="false"
356
+ >
357
+ Dark
358
+ </button>
359
+ </li>
360
+ </ul>
361
+ </div>
362
+ </details>
363
+ <input id="django-theme-picker-popover-end" type="hidden" value="aurora" name="theme" />
155
364
  </div>
156
365
 
157
366
  <h3 class="site-preview-heading">Swap</h3>
158
- <div class="usx-theme-picker usx-theme-picker--swap">
159
- <label
160
- class="usx-swap usx-swap--rotate usx-theme-picker__swap usa-button usx-button usx-button--ghost"
367
+ <div class="usx-theme-picker usx-theme-picker--swap" hidden>
368
+ <button
369
+ type="button"
370
+ class="usx-swap usx-swap--rotate usa-button usx-button usx-swap--button usx-theme-picker__swap usx-button--ghost usx-button--tight"
371
+ aria-pressed="false"
372
+ aria-label="Dark Theme"
373
+ data-usx-theme-off="aurora"
374
+ data-usx-theme-on="borealis"
161
375
  >
162
- <input type="checkbox" autocomplete="off" aria-label="Theme: Light. Switch to Dark" />
163
376
  <span class="usx-swap-on">
164
377
  <svg
165
378
  class="usa-icon usx-icon usx-theme-picker__icon"
@@ -178,20 +391,12 @@
178
391
  >
179
392
  <use href="img/usx-sprite.svg#sun"></use></svg
180
393
  ></span>
181
- </label>
182
- <div class="usx-theme-picker__fallback">
183
- <label class="usa-label usx-label usa-sr-only" for="django-theme-picker-swap"> Theme </label>
184
-
185
- <select id="django-theme-picker-swap" class="usa-select usx-select">
186
- <option value="Aurora" selected>Light</option>
187
-
188
- <option value="Borealis">Dark</option>
189
- </select>
190
- </div>
394
+ </button>
395
+ <input id="django-theme-picker-swap" type="hidden" value="aurora" />
191
396
  </div>
192
397
 
193
398
  <h3 class="site-preview-heading">With Value</h3>
194
- <div class="usx-theme-picker">
399
+ <div class="usx-theme-picker" hidden>
195
400
  <button
196
401
  type="button"
197
402
  class="usa-button usx-button usx-button--ghost usx-theme-picker__trigger"
@@ -212,27 +417,27 @@
212
417
  <label class="usa-label usx-label usa-sr-only" for="django-theme-picker-value"> Theme </label>
213
418
 
214
419
  <select id="django-theme-picker-value" class="usa-select usx-select">
215
- <option value="Default">Default</option>
420
+ <option value="default">Default</option>
216
421
 
217
- <option value="Forest" selected>Forest</option>
422
+ <option value="forest" selected>Forest</option>
218
423
 
219
- <option value="Sunset">Sunset</option>
424
+ <option value="sunset">Sunset</option>
220
425
 
221
- <option value="Ocean">Ocean</option>
426
+ <option value="ocean">Ocean</option>
222
427
 
223
- <option value="Aurora">Aurora</option>
428
+ <option value="aurora">Aurora</option>
224
429
 
225
- <option value="Borealis">Borealis</option>
430
+ <option value="borealis">Borealis</option>
226
431
 
227
- <option value="Midnight">Midnight</option>
432
+ <option value="midnight">Midnight</option>
228
433
 
229
- <option value="Carbon">Carbon</option>
434
+ <option value="carbon">Carbon</option>
230
435
 
231
- <option value="VADS">VADS</option>
436
+ <option value="vads">VADS</option>
232
437
 
233
- <option value="GOV.UK">GOV.UK</option>
438
+ <option value="gov-uk">GOV.UK</option>
234
439
 
235
- <option value="NASA">NASA</option>
440
+ <option value="nasa">NASA</option>
236
441
  </select>
237
442
 
238
443
  <button
@@ -1,21 +1,34 @@
1
1
  {% load usx_components %}
2
2
  {% firstof id "theme-picker" as field_id %}
3
3
  {% firstof value defaultValue themes.0.value as selected_value %}
4
- <div class="usx-theme-picker{% if variant and variant != 'default' %} usx-theme-picker--{{ variant }}{% endif %}{% if className %} {{ className }}{% endif %}"{% if extraAttributes %}{% for attr, attr_value in extraAttributes.items %} {{ attr }}="{% if attr_value is True %}true{% elif attr_value is False %}false{% else %}{{ attr_value }}{% endif %}"{% endfor %}{% endif %}>
4
+ <div class="usx-theme-picker{% if variant and variant != 'default' %} usx-theme-picker--{{ variant }}{% endif %}{% if className %} {{ className }}{% endif %}"{% if extraAttributes %}{% for attr, attr_value in extraAttributes.items %} {{ attr }}="{% if attr_value is True %}true{% elif attr_value is False %}false{% else %}{{ attr_value }}{% endif %}"{% endfor %}{% endif %} hidden>
5
5
  {% if variant == 'swap' %}
6
- <label class="usx-swap usx-swap--rotate usx-theme-picker__swap usa-button usx-button usx-button--ghost">
7
- <input type="checkbox" autocomplete="off" aria-label="{{ label|default:'Theme' }}: {% for theme in themes %}{% if theme.value == selected_value %}{{ theme.label }}{% endif %}{% endfor %}. Switch to {% if themes.1.value == selected_value %}{{ themes.0.label }}{% else %}{{ themes.1.label }}{% endif %}"{% if themes.1.value == selected_value %} checked{% endif %}>
6
+ <button
7
+ type="button"
8
+ class="usx-swap usx-swap--rotate usa-button usx-button usx-swap--button usx-theme-picker__swap usx-button--ghost usx-button--tight"
9
+ aria-pressed="{% if themes.1.value == selected_value %}true{% else %}false{% endif %}"
10
+ aria-label="{{ themes.1.label }} {{ label|default:'Theme' }}"
11
+ data-usx-theme-off="{{ themes.0.value }}"
12
+ data-usx-theme-on="{{ themes.1.value }}"
13
+ >
8
14
  <span class="usx-swap-on">{% icon name="moon" source="usx" className="usx-theme-picker__icon" %}{% endicon %}</span>
9
15
  <span class="usx-swap-off">{% icon name="sun" source="usx" className="usx-theme-picker__icon" %}{% endicon %}</span>
10
- </label>
11
- <div class="usx-theme-picker__fallback">{% include "theme-picker/theme-picker-select.django.html" %}</div>
12
- {% elif variant == 'ghost-select' %}
13
- <div class="usx-theme-picker__ghost">
14
- <span class="usa-button usx-button usx-button--ghost usx-theme-picker__ghost-face" aria-hidden="true">
16
+ </button>
17
+ <input id="{{ field_id }}" type="hidden" value="{{ selected_value }}"{% if name %} name="{{ name }}"{% endif %}>
18
+ {% elif variant == 'popover' %}
19
+ <details class="usx-popover usx-theme-picker__popover" data-side="bottom" data-align="{{ popoverAlign|default:'start' }}">
20
+ <summary class="usa-button usx-button usx-button--ghost usx-button--tight margin-0" aria-label="{{ label|default:'Theme' }}">
15
21
  {% icon name="color_palette" source="usx" className="usx-theme-picker__icon" %}{% endicon %}
16
- </span>
17
- {% include "theme-picker/theme-picker-select.django.html" with hidden=True %}
18
- </div>
22
+ </summary>
23
+ <div id="{{ field_id }}-panel" class="usx-popover__panel usx-popover__panel--square">
24
+ <ul class="usx-popover__menu">
25
+ {% for theme in themes %}
26
+ <li><button type="button" class="usx-popover__menu-item" data-usx-theme-value="{{ theme.value }}" aria-pressed="{% if theme.value == selected_value %}true{% else %}false{% endif %}">{{ theme.label|force_escape }}</button></li>
27
+ {% endfor %}
28
+ </ul>
29
+ </div>
30
+ </details>
31
+ <input id="{{ field_id }}" type="hidden" value="{{ selected_value }}"{% if name %} name="{{ name }}"{% endif %}>
19
32
  {% else %}
20
33
  <button type="button" class="usa-button usx-button usx-button--ghost usx-theme-picker__trigger" aria-label="{{ label|default:'Theme' }}" aria-expanded="false" aria-controls="{{ field_id }}-panel">
21
34
  {% icon name="color_palette" source="usx" className="usx-theme-picker__icon" %}{% endicon %}