@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
package/dist/index.js CHANGED
@@ -1,77 +1,12 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { useState, createContext, useContext, useId, useRef, createElement } from "react";
3
- function getDefaultExportFromCjs(x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
- }
6
- var classnames = { exports: {} };
7
- /*!
8
- Copyright (c) 2018 Jed Watson.
9
- Licensed under the MIT License (MIT), see
10
- http://jedwatson.github.io/classnames
11
- */
12
- var hasRequiredClassnames;
13
- function requireClassnames() {
14
- if (hasRequiredClassnames) return classnames.exports;
15
- hasRequiredClassnames = 1;
16
- (function(module) {
17
- (function() {
18
- var hasOwn = {}.hasOwnProperty;
19
- function classNames() {
20
- var classes = "";
21
- for (var i = 0; i < arguments.length; i++) {
22
- var arg = arguments[i];
23
- if (arg) {
24
- classes = appendClass(classes, parseValue(arg));
25
- }
26
- }
27
- return classes;
28
- }
29
- function parseValue(arg) {
30
- if (typeof arg === "string" || typeof arg === "number") {
31
- return arg;
32
- }
33
- if (typeof arg !== "object") {
34
- return "";
35
- }
36
- if (Array.isArray(arg)) {
37
- return classNames.apply(null, arg);
38
- }
39
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
40
- return arg.toString();
41
- }
42
- var classes = "";
43
- for (var key in arg) {
44
- if (hasOwn.call(arg, key) && arg[key]) {
45
- classes = appendClass(classes, key);
46
- }
47
- }
48
- return classes;
49
- }
50
- function appendClass(value, newClass) {
51
- if (!newClass) {
52
- return value;
53
- }
54
- if (value) {
55
- return value + " " + newClass;
56
- }
57
- return value + newClass;
58
- }
59
- if (module.exports) {
60
- classNames.default = classNames;
61
- module.exports = classNames;
62
- } else {
63
- window.classNames = classNames;
64
- }
65
- })();
66
- })(classnames);
67
- return classnames.exports;
68
- }
69
- var classnamesExports = requireClassnames();
70
- const ClassNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { C as ClassNames, A as Avatar, B as Button, g as getAssetUrl, I as Icon, a as Image, T as Tag, b as ButtonGroup, F as FormGroup, L as Label, H as Hint, E as ErrorMessage, c as TextArea, R as Required, d as Tooltip, S as Summary, e as TagGroup, f as Link, h as Callout, i as Alert, j as Clickable, P as Popover } from "./Popover-CqHczzNE.js";
3
+ import { k, l } from "./Popover-CqHczzNE.js";
4
+ import React, { createContext, useContext, useId, useRef, useState, createElement } from "react";
71
5
  function AccordionItem({
72
6
  title,
73
7
  id,
74
8
  content,
9
+ children,
75
10
  expanded = false,
76
11
  headingClassName,
77
12
  contentClassName,
@@ -79,11 +14,7 @@ function AccordionItem({
79
14
  handleToggle
80
15
  }) {
81
16
  const headingClasses = ClassNames("usa-accordion__heading", headingClassName);
82
- const contentClasses = ClassNames(
83
- "usa-accordion__content",
84
- "usa-prose",
85
- contentClassName
86
- );
17
+ const contentClasses = ClassNames("usa-accordion__content", "usa-prose", contentClassName);
87
18
  const Heading = headingAs;
88
19
  return /* @__PURE__ */ jsxs(Fragment, { children: [
89
20
  /* @__PURE__ */ jsx(Heading, { id: `${id}-heading`, className: headingClasses, children: /* @__PURE__ */ jsx(
@@ -104,7 +35,7 @@ function AccordionItem({
104
35
  "aria-labelledby": `${id}-heading`,
105
36
  className: contentClasses,
106
37
  hidden: !expanded,
107
- children: content
38
+ children: children ?? content
108
39
  }
109
40
  )
110
41
  ] });
@@ -137,163 +68,20 @@ function Accordion({
137
68
  "data-allow-multiple": multiselectable ? true : void 0,
138
69
  ...props2,
139
70
  ...extraAttributes,
140
- children: items.map((item) => /* @__PURE__ */ jsx(
71
+ children: items.map((item, index) => /* @__PURE__ */ jsx(
141
72
  AccordionItem,
142
73
  {
143
74
  ...item,
75
+ id: item.id || `${id ?? ""}-${index}`,
144
76
  headingAs,
145
77
  headingClassName,
146
78
  contentClassName
147
79
  },
148
- item.id
80
+ item.id || `${id ?? ""}-${index}`
149
81
  ))
150
82
  }
151
83
  );
152
84
  }
153
- function getAssetUrl(assetPath, staticBaseUrl) {
154
- if (/^[a-z][a-z\d+.-]*:/i.test(assetPath)) return assetPath;
155
- const base = staticBaseUrl || typeof window !== "undefined" && window.usxBaseUrl || "/";
156
- return `${base.replace(/\/+$/, "")}/${assetPath.replace(/^\/+/, "")}`;
157
- }
158
- function getAssetSrcSet(srcSet, staticBaseUrl) {
159
- return srcSet.replace(/(^\s*|,\s*)(\S*[^,\s])(?=,?(?:\s|$))/g, (_match, separator, url) => `${separator}${getAssetUrl(url, staticBaseUrl)}`);
160
- }
161
- function Icon({
162
- name,
163
- source = "uswds",
164
- size,
165
- color,
166
- alt,
167
- staticBaseUrl,
168
- staticUrlPrefix,
169
- className = "",
170
- ...props2
171
- }) {
172
- const spritePrefix = staticUrlPrefix ?? getAssetUrl(`img/${source === "usx" ? "usx-sprite.svg" : "sprite.svg"}#`, staticBaseUrl);
173
- const classes = ClassNames(
174
- "usa-icon",
175
- "usx-icon",
176
- size ? size === 1 ? "usx-icon--size-1" : "usa-icon--size-" + size : "",
177
- color ? "text-" + color : "",
178
- className
179
- );
180
- return /* @__PURE__ */ jsx(
181
- "svg",
182
- {
183
- className: classes,
184
- "aria-hidden": alt ? void 0 : "true",
185
- "aria-label": alt || void 0,
186
- focusable: "false",
187
- role: "img",
188
- ...props2,
189
- children: /* @__PURE__ */ jsx("use", { href: spritePrefix + name })
190
- }
191
- );
192
- }
193
- function Alert({
194
- heading,
195
- text,
196
- variant,
197
- slim = false,
198
- noIcon = false,
199
- className = "",
200
- role,
201
- ariaLabel,
202
- ariaLabelledby,
203
- onDismiss = void 0,
204
- staticBaseUrl,
205
- children = null,
206
- ...props2
207
- }) {
208
- const normalizedVariant = variant && ["info", "warning", "success", "error", "emergency"].includes(variant) ? variant : null;
209
- const classes = ClassNames(
210
- "usa-alert",
211
- "usx-alert",
212
- normalizedVariant ? `usa-alert--${normalizedVariant}` : "",
213
- slim ? "usa-alert--slim" : "",
214
- noIcon ? "usa-alert--no-icon" : "",
215
- className
216
- );
217
- const resolvedRole = role || (normalizedVariant === "error" || normalizedVariant === "emergency" ? "alert" : normalizedVariant === "success" ? "status" : "region");
218
- const accessibilityProps = {
219
- role: resolvedRole
220
- };
221
- if (ariaLabelledby) {
222
- accessibilityProps["aria-labelledby"] = ariaLabelledby;
223
- } else if (ariaLabel) {
224
- accessibilityProps["aria-label"] = ariaLabel;
225
- } else if (resolvedRole === "region") {
226
- const label = heading || (normalizedVariant ? `${normalizedVariant} alert` : void 0);
227
- if (label) accessibilityProps["aria-label"] = label;
228
- }
229
- return /* @__PURE__ */ jsx("div", { className: classes, ...accessibilityProps, ...props2, children: /* @__PURE__ */ jsxs("div", { className: "usa-alert__body", children: [
230
- !slim && heading ? /* @__PURE__ */ jsx("h4", { className: "usa-alert__heading", children: heading }) : null,
231
- children ? /* @__PURE__ */ jsx("div", { className: "usa-alert__text", children }) : text ? /* @__PURE__ */ jsx("p", { className: "usa-alert__text", children: text }) : null,
232
- onDismiss && /* @__PURE__ */ jsx("button", { className: "usx-alert__dismiss", "aria-label": "Dismiss alert", onClick: onDismiss, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 3, staticBaseUrl }) })
233
- ] }) });
234
- }
235
- const Tooltip = ({
236
- label,
237
- position = "right",
238
- children,
239
- className = "",
240
- bodyClassName = "",
241
- ...props2
242
- }) => {
243
- const validPositions = ["top", "bottom", "left", "right"];
244
- const normalizedPosition = validPositions.includes(position) ? position : "right";
245
- return /* @__PURE__ */ jsxs("span", { className: ClassNames("usx-tooltip", className), ...props2, children: [
246
- children,
247
- /* @__PURE__ */ jsx(
248
- "span",
249
- {
250
- className: ClassNames("usa-tooltip__body", `usa-tooltip__body--${normalizedPosition}`, bodyClassName),
251
- role: "tooltip",
252
- children: label
253
- }
254
- )
255
- ] });
256
- };
257
- const shapeClassMap = {
258
- circle: "usx-circle",
259
- "rounded-sm": "usx-rounded-sm",
260
- "rounded-md": "usx-rounded-md",
261
- "rounded-lg": "usx-rounded-lg",
262
- "rounded-xl": "usx-rounded-xl"
263
- };
264
- function Avatar({
265
- href = "#",
266
- src = null,
267
- alt = null,
268
- variant = "image",
269
- value = null,
270
- shape = null,
271
- tooltipProps = null,
272
- className = "",
273
- imageClassName = "",
274
- contentClassName = "",
275
- ...props2
276
- }) {
277
- const isInitialsVariant = variant === "initials";
278
- const isIconVariant = variant === "icon";
279
- const wrapperClasses = ClassNames(
280
- "usx-avatar",
281
- className
282
- );
283
- const imgClasses = ClassNames(
284
- "usx-avatar__img",
285
- shape ? shapeClassMap[shape] : null,
286
- imageClassName
287
- );
288
- const contentClasses = ClassNames(
289
- "usx-avatar__content",
290
- shape ? shapeClassMap[shape] : "usx-circle",
291
- contentClassName
292
- );
293
- const avatarContent = isInitialsVariant ? /* @__PURE__ */ jsx("span", { className: contentClasses, children: value }) : isIconVariant ? /* @__PURE__ */ jsx("span", { className: contentClasses, children: /* @__PURE__ */ jsx(Icon, { name: value, alt: alt ? void 0 : `${value} icon` }) }) : /* @__PURE__ */ jsx("img", { className: imgClasses, src: src || void 0, alt: alt || void 0, role: "img", ...props2 });
294
- const avatar = /* @__PURE__ */ jsx("a", { href, className: wrapperClasses, "aria-label": isInitialsVariant || isIconVariant ? alt || void 0 : void 0, children: avatarContent });
295
- return tooltipProps ? /* @__PURE__ */ jsx(Tooltip, { ...tooltipProps, children: avatar }) : avatar;
296
- }
297
85
  function Attribution({
298
86
  avatarProps = null,
299
87
  media = null,
@@ -314,77 +102,30 @@ function Attribution({
314
102
  ] });
315
103
  return /* @__PURE__ */ jsx("div", { className: classes, ...props2, children: content });
316
104
  }
317
- function AvatarGroup({ avatarProps = [], overlap = false, stacked = false, className = "", ...props2 }) {
318
- const classes = ClassNames(
319
- "usx-avatar-group",
320
- overlap && "usx-avatar-group--overlap",
321
- stacked && "usx-avatar-group--stacked",
322
- className
323
- );
324
- return /* @__PURE__ */ jsx("div", { className: classes, ...props2, children: avatarProps.map((avatar, index) => /* @__PURE__ */ jsx(
325
- Avatar,
326
- {
327
- href: avatar.href,
328
- src: avatar.src,
329
- alt: avatar.alt,
330
- value: avatar.initials,
331
- shape: avatar.shape,
332
- tooltipProps: avatar.tooltipProps,
333
- className: avatar.className,
334
- imageClassName: avatar.imageClassName,
335
- contentClassName: avatar.initialsClassName
336
- },
337
- `${avatar.src || avatar.initials || "avatar"}-${index}`
338
- )) });
339
- }
340
105
  function BackToTop({
341
106
  label = "Back to top",
342
107
  ariaLabel = "Back to top",
343
- href = void 0,
344
- variant = null,
108
+ href = "#top",
109
+ variant = "primary",
110
+ ghost = true,
111
+ inverse = false,
345
112
  iconPosition = "right",
346
113
  iconSize = 2,
347
114
  className = "",
348
- onClick = void 0,
349
- ...props2
115
+ onClick = void 0
350
116
  }) {
351
- const accessibleName = label ? void 0 : ariaLabel;
352
- const icon = /* @__PURE__ */ jsx(Icon, { name: "arrow_upward", size: iconSize, className: ClassNames(
353
- iconPosition === "left" ? "margin-right-05" : "margin-left-05"
354
- ) });
355
- if (href) {
356
- const linkClasses = ClassNames(
357
- "usx-link",
358
- "usx-no-visited",
359
- "flex-align-center",
360
- className
361
- );
362
- return /* @__PURE__ */ jsxs("a", { className: linkClasses, href, "aria-label": accessibleName, ...props2, children: [
363
- iconPosition === "left" && icon,
364
- label,
365
- iconPosition === "right" && icon
366
- ] });
367
- }
368
- const buttonClasses = ClassNames(
369
- "usa-button",
370
- "usx-button",
371
- variant === "primary" && "usa-button--primary",
372
- "usx-button--ghost",
373
- className
374
- );
375
- return /* @__PURE__ */ jsxs(
376
- "button",
117
+ return /* @__PURE__ */ jsx(
118
+ Button,
377
119
  {
378
- type: "button",
379
- className: buttonClasses,
380
- "aria-label": accessibleName,
381
- onClick: onClick || (() => window.scrollTo({ top: 0, behavior: "smooth" })),
382
- ...props2,
383
- children: [
384
- iconPosition === "left" && icon,
385
- label,
386
- iconPosition === "right" && icon
387
- ]
120
+ href: onClick ? void 0 : href || "#top",
121
+ onClick: typeof onClick === "function" ? onClick : void 0,
122
+ label: label ?? void 0,
123
+ "aria-label": label ? void 0 : ariaLabel,
124
+ variant: variant ?? "primary",
125
+ ghost,
126
+ inverse,
127
+ iconProps: [{ name: "arrow_upward", position: iconPosition, size: iconSize }],
128
+ className
388
129
  }
389
130
  );
390
131
  }
@@ -552,177 +293,6 @@ function Breadcrumb({
552
293
  }
553
294
  ) });
554
295
  }
555
- const Required = ({
556
- title = "Required",
557
- children = null,
558
- className = "",
559
- ...props2
560
- }) => {
561
- const classes = ClassNames("usx-required", className);
562
- return /* @__PURE__ */ jsxs(Fragment, { children: [
563
- /* @__PURE__ */ jsx("abbr", { title, className: classes, ...props2, children: "*" }),
564
- " ",
565
- children ? children : ""
566
- ] });
567
- };
568
- function Label({
569
- id,
570
- htmlFor,
571
- required = false,
572
- error = false,
573
- children = null,
574
- screenReaderOnly = false,
575
- className = "",
576
- classOverride = false,
577
- ...props2
578
- }) {
579
- const classes = ClassNames(
580
- "usa-label",
581
- "usx-label",
582
- { "usa-sr-only": screenReaderOnly, "usa-label--error": !!error },
583
- className
584
- );
585
- return /* @__PURE__ */ jsxs(
586
- "label",
587
- {
588
- id: id || void 0,
589
- className: classOverride ? className : classes,
590
- htmlFor: htmlFor || void 0,
591
- ...props2,
592
- children: [
593
- required && /* @__PURE__ */ jsx(Required, {}),
594
- children
595
- ]
596
- }
597
- );
598
- }
599
- const Spinner = ({
600
- size = 3,
601
- color,
602
- label = null,
603
- screenReaderLabel = null,
604
- staticUrlPrefix,
605
- staticBaseUrl,
606
- className = "",
607
- ...props2
608
- }) => {
609
- return /* @__PURE__ */ jsxs("span", { role: "status", "aria-live": "polite", className: `usx-spinner ${className}`, ...props2, children: [
610
- /* @__PURE__ */ jsx(
611
- Icon,
612
- {
613
- name: "spinner",
614
- source: "usx",
615
- size,
616
- color,
617
- staticBaseUrl,
618
- staticUrlPrefix
619
- }
620
- ),
621
- screenReaderLabel && /* @__PURE__ */ jsx(Label, { screenReaderOnly: true, children: screenReaderLabel }),
622
- label && /* @__PURE__ */ jsx(Label, { children: label })
623
- ] });
624
- };
625
- function Button({
626
- label,
627
- variant,
628
- type = "button",
629
- disabled = false,
630
- onClick,
631
- href,
632
- isExternal = false,
633
- big = false,
634
- inverse = false,
635
- ghost = false,
636
- loading = false,
637
- iconProps = [],
638
- className = "",
639
- children = "",
640
- extraAttributes = {},
641
- ...props2
642
- }) {
643
- const leftIcons = iconProps.filter((icon) => (icon.position ?? "left") === "left");
644
- const rightIcons = iconProps.filter((icon) => icon.position === "right");
645
- const renderIcon = (icon, index) => {
646
- const { position, ...iconRest } = icon;
647
- return /* @__PURE__ */ jsx(Icon, { ...iconRest }, index);
648
- };
649
- const spinner = loading && /* @__PURE__ */ jsx(Spinner, { size: 2 });
650
- const variantClasses = {
651
- primary: "usa-button--primary",
652
- secondary: "usa-button--secondary",
653
- "accent-cool": "usa-button--accent-cool",
654
- "accent-warm": "usa-button--accent-warm",
655
- base: "usa-button--base",
656
- outline: "usa-button--outline",
657
- unstyled: "usa-button--unstyled"
658
- };
659
- const classes = ClassNames(
660
- "usa-button",
661
- "usx-button",
662
- variant && variantClasses[variant],
663
- big && "usa-button--big",
664
- inverse && "usa-button--inverse",
665
- ghost && "usx-button--ghost",
666
- className
667
- );
668
- if (href) {
669
- const {
670
- // Remove unused variables
671
- ...anchorProps
672
- } = props2;
673
- return /* @__PURE__ */ jsxs(
674
- "a",
675
- {
676
- className: classes,
677
- href,
678
- ...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {},
679
- ...anchorProps,
680
- ...extraAttributes,
681
- children: [
682
- spinner,
683
- leftIcons.map(renderIcon),
684
- children || label,
685
- rightIcons.map(renderIcon)
686
- ]
687
- }
688
- );
689
- }
690
- const {
691
- // Remove unused variables
692
- ...buttonProps
693
- } = props2;
694
- return /* @__PURE__ */ jsxs(
695
- "button",
696
- {
697
- type,
698
- className: classes,
699
- disabled,
700
- "aria-disabled": disabled ? "true" : void 0,
701
- ...onClick ? { onClick } : {},
702
- ...buttonProps,
703
- ...extraAttributes,
704
- children: [
705
- spinner,
706
- leftIcons.map(renderIcon),
707
- children || label,
708
- rightIcons.map(renderIcon)
709
- ]
710
- }
711
- );
712
- }
713
- function ButtonGroup({
714
- buttonProps = [],
715
- segmented = false,
716
- className = "",
717
- ...props2
718
- }) {
719
- const classes = ClassNames(
720
- "usa-button-group usx-button-group",
721
- segmented && "usa-button-group--segmented",
722
- className
723
- );
724
- return /* @__PURE__ */ jsx("ul", { className: classes, ...props2, children: buttonProps.map(({ itemClassName, ...item }, index) => /* @__PURE__ */ jsx("li", { className: ClassNames("usa-button-group__item", itemClassName), children: /* @__PURE__ */ jsx(Button, { ...item, children: item.children }) }, index)) });
725
- }
726
296
  function CalendarDate({
727
297
  datetime,
728
298
  underCollection = false
@@ -747,155 +317,6 @@ function CalendarDate({
747
317
  /* @__PURE__ */ jsx("span", { className: dayClasses, children: day })
748
318
  ] }) });
749
319
  }
750
- function Callout({
751
- className,
752
- strokeColor,
753
- indent,
754
- dedent,
755
- big,
756
- orientation = "horizontal",
757
- children,
758
- content,
759
- backgroundColor,
760
- textColor,
761
- as: Element = "div",
762
- ...props2
763
- }) {
764
- return /* @__PURE__ */ jsx(
765
- Element,
766
- {
767
- className: ClassNames(
768
- "usx-callout",
769
- orientation === "vertical" && "usx-callout--vertical",
770
- strokeColor && `border-${strokeColor}`,
771
- indent && `usx-callout--indent-${indent}`,
772
- dedent && "usx-callout--dedent",
773
- (big ?? orientation === "horizontal") && "usx-callout--big",
774
- backgroundColor && `bg-${backgroundColor}`,
775
- textColor && `text-${textColor}`,
776
- className
777
- ),
778
- ...props2,
779
- children: children ?? content
780
- }
781
- );
782
- }
783
- const Tag = ({
784
- id,
785
- big = false,
786
- value,
787
- color = null,
788
- outline = false,
789
- icon = null,
790
- dismissible = false,
791
- isDismissed = false,
792
- onDismiss = () => {
793
- },
794
- className = "",
795
- children,
796
- ...props2
797
- }) => {
798
- const [isVisible, setIsVisible] = useState(!isDismissed);
799
- const classes = ClassNames(
800
- "usa-tag",
801
- "usx-tag",
802
- { "usa-tag--big": big },
803
- { [`bg-${color}`]: color && !outline },
804
- { [`text-${color}`]: color && outline },
805
- { "usx-tag--outline": outline },
806
- className
807
- );
808
- const handleDismiss = (e) => {
809
- e.preventDefault();
810
- if (onDismiss) {
811
- onDismiss(e);
812
- }
813
- setIsVisible(false);
814
- };
815
- if (!isVisible) {
816
- return null;
817
- }
818
- return /* @__PURE__ */ jsxs("span", { id, className: classes, ...props2, children: [
819
- icon && /* @__PURE__ */ jsx(Icon, { name: icon, size: big ? 3 : 2 }),
820
- " ",
821
- children || value,
822
- dismissible && /* @__PURE__ */ jsx(
823
- "button",
824
- {
825
- type: "button",
826
- className: "usx-tag__dismiss",
827
- "aria-label": "Dismiss tag",
828
- onClick: handleDismiss,
829
- children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 2 })
830
- }
831
- )
832
- ] });
833
- };
834
- function Image({
835
- src,
836
- alt,
837
- href,
838
- rounded = false,
839
- circular = false,
840
- caption,
841
- hideCaption = false,
842
- objectFit = "",
843
- maxWidth,
844
- maxHeight,
845
- staticBaseUrl,
846
- srcSet,
847
- className = "",
848
- ...props2
849
- }) {
850
- const classes = ClassNames(
851
- "usx-image",
852
- {
853
- "usx-image--rounded": rounded,
854
- "usx-image--circular": circular,
855
- [`usx-object-fit-${objectFit}`]: objectFit
856
- },
857
- className
858
- );
859
- const style = {};
860
- if (maxWidth) style.maxWidth = maxWidth;
861
- if (maxHeight) style.maxHeight = maxHeight;
862
- if (maxHeight && !maxWidth) style.width = "auto";
863
- if (maxWidth && !maxHeight) style.height = "auto";
864
- const captionClasses = ClassNames(
865
- "usx-image--caption",
866
- { "usa-sr-only": hideCaption }
867
- );
868
- const isResponsive = src && typeof src === "object";
869
- const imgElement = !src ? "Image" : isResponsive ? /* @__PURE__ */ jsxs("picture", { children: [
870
- src.sources.map((source, i) => /* @__PURE__ */ jsx(
871
- "source",
872
- {
873
- ...source.media ? { media: source.media } : {},
874
- srcSet: getAssetSrcSet(source.srcSet, staticBaseUrl),
875
- ...source.type ? { type: source.type } : {},
876
- ...source.sizes ? { sizes: source.sizes } : {}
877
- },
878
- i
879
- )),
880
- /* @__PURE__ */ jsx("img", { src: getAssetUrl(src.fallback, staticBaseUrl), srcSet: srcSet ? getAssetSrcSet(srcSet, staticBaseUrl) : void 0, alt, style, ...props2 })
881
- ] }) : /* @__PURE__ */ jsx("img", { src: getAssetUrl(src, staticBaseUrl), srcSet: srcSet ? getAssetSrcSet(srcSet, staticBaseUrl) : void 0, alt, style, ...props2 });
882
- if (caption) {
883
- return /* @__PURE__ */ jsxs("figure", { className: classes, style, children: [
884
- href ? /* @__PURE__ */ jsx("a", { href, children: imgElement }) : imgElement,
885
- /* @__PURE__ */ jsx("figcaption", { className: captionClasses, children: caption })
886
- ] });
887
- }
888
- const Element = href ? "a" : "div";
889
- return /* @__PURE__ */ jsx(
890
- Element,
891
- {
892
- ...href ? { href } : {},
893
- className: classes,
894
- style,
895
- children: imgElement
896
- }
897
- );
898
- }
899
320
  function flattenChildren(children) {
900
321
  return React.Children.toArray(children).flatMap(
901
322
  (child) => React.isValidElement(child) && child.type === React.Fragment ? flattenChildren(child.props.children) : [child]
@@ -1010,35 +431,6 @@ function CardGroup({ cardProps = [], className = "", ...props2 }) {
1010
431
  );
1011
432
  return /* @__PURE__ */ jsx("ul", { className: classes, ...props2, children: cardProps.map((card, index) => /* @__PURE__ */ jsx(Card, { ...card, as: "li" }, index)) });
1012
433
  }
1013
- function Hint({
1014
- id,
1015
- children = null,
1016
- className = "",
1017
- ...props2
1018
- }) {
1019
- const classes = ClassNames("usa-hint", "usx-hint", className);
1020
- return /* @__PURE__ */ jsx("span", { className: classes, ...id ? { id } : {}, ...props2, children });
1021
- }
1022
- function ErrorMessage({
1023
- id,
1024
- children = null,
1025
- className = "",
1026
- ...props2
1027
- }) {
1028
- const classes = ClassNames("usa-error-message", "usx-error-message", className);
1029
- return /* @__PURE__ */ jsx("span", { className: classes, role: "alert", ...id ? { id } : {}, ...props2, children });
1030
- }
1031
- function FormGroup({ children = null, className = "", error = false, ...props2 }) {
1032
- const classes = ClassNames(
1033
- "usa-form-group",
1034
- "usx-form-group",
1035
- {
1036
- "usa-form-group--error": error
1037
- },
1038
- className
1039
- );
1040
- return /* @__PURE__ */ jsx("div", { className: classes, ...props2, children });
1041
- }
1042
434
  function Input({
1043
435
  label,
1044
436
  id,
@@ -1078,7 +470,7 @@ function Input({
1078
470
  required,
1079
471
  "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
1080
472
  "aria-invalid": hasError ? true : void 0,
1081
- ...value !== void 0 ? { value } : { defaultValue },
473
+ ...value != null ? { value } : { defaultValue },
1082
474
  ...props2
1083
475
  };
1084
476
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1089,56 +481,6 @@ function Input({
1089
481
  ] });
1090
482
  return formGroup ? /* @__PURE__ */ jsx(FormGroup, { error: hasError, children: content }) : content;
1091
483
  }
1092
- const TextArea = ({
1093
- label = null,
1094
- id,
1095
- placeholder = "",
1096
- disabled = false,
1097
- required = false,
1098
- defaultValue = "",
1099
- value,
1100
- hint = null,
1101
- screenReaderOnlyLabel = false,
1102
- error = null,
1103
- success = null,
1104
- formGroup = true,
1105
- className = "",
1106
- ...props2
1107
- }) => {
1108
- const textAreaId = id || `textarea-${Math.random().toString(36).substr(2, 9)}`;
1109
- const hasError = !!error;
1110
- const hasSuccess = !!success;
1111
- const classes = ClassNames(
1112
- "usa-textarea",
1113
- "usx-textarea",
1114
- hasError ? "usa-input--error" : hasSuccess ? "usa-input--success" : null,
1115
- className
1116
- );
1117
- const hintId = hint ? `${textAreaId}-hint` : void 0;
1118
- const describedByParts = [];
1119
- if (hintId) describedByParts.push(hintId);
1120
- if (hasError && typeof error === "string") describedByParts.push(`${textAreaId}-error`);
1121
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
1122
- label && /* @__PURE__ */ jsx(Label, { htmlFor: textAreaId, required, screenReaderOnly: screenReaderOnlyLabel, error: hasError, children: label }),
1123
- hint && /* @__PURE__ */ jsx(Hint, { id: hintId, children: hint }),
1124
- hasError && typeof error === "string" && /* @__PURE__ */ jsx(ErrorMessage, { id: `${textAreaId}-error`, children: error }),
1125
- /* @__PURE__ */ jsx(
1126
- "textarea",
1127
- {
1128
- id: textAreaId,
1129
- className: classes,
1130
- placeholder,
1131
- disabled,
1132
- ...value !== void 0 ? { value } : { defaultValue },
1133
- ...required ? { required: true } : {},
1134
- "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
1135
- "aria-invalid": hasError ? "true" : void 0,
1136
- ...props2
1137
- }
1138
- )
1139
- ] });
1140
- return formGroup ? /* @__PURE__ */ jsx(FormGroup, { error: hasError, children: content }) : content;
1141
- };
1142
484
  function CharacterCount({
1143
485
  id,
1144
486
  label = null,
@@ -1153,6 +495,7 @@ function CharacterCount({
1153
495
  textArea = false,
1154
496
  className = "",
1155
497
  extraAttributes,
498
+ defaultValue = "",
1156
499
  ...props2
1157
500
  }) {
1158
501
  const fieldId = id || `character-count-${Math.random().toString(36).substr(2, 9)}`;
@@ -1174,6 +517,7 @@ function CharacterCount({
1174
517
  formGroup: true,
1175
518
  className: "usa-character-count__field",
1176
519
  "aria-describedby": [infoId, hintId, errorId].filter(Boolean).join(" "),
520
+ defaultValue,
1177
521
  ...props2,
1178
522
  ...extraAttributes
1179
523
  };
@@ -1333,43 +677,6 @@ const CheckboxGroup = ({
1333
677
  );
1334
678
  }) }) });
1335
679
  };
1336
- function ClickableLink({
1337
- children,
1338
- className,
1339
- as: Tag2 = "span",
1340
- colorChange = false,
1341
- bgColorChange = false,
1342
- ...rest
1343
- }) {
1344
- const classes = ClassNames(
1345
- "usx-clickable__link",
1346
- colorChange && "usx-clickable__color-on-hover",
1347
- bgColorChange && "usx-clickable__bg-color-on-hover",
1348
- className
1349
- );
1350
- return /* @__PURE__ */ jsx(Tag2, { className: classes, ...rest, children });
1351
- }
1352
- function ClickableColorChange({ children, className, as: Tag2 = "span", ...rest }) {
1353
- return /* @__PURE__ */ jsx(Tag2, { className: ClassNames("usx-clickable__color-on-hover", className), ...rest, children });
1354
- }
1355
- function ClickableBgColorChange({ children, className, as: Tag2 = "span", ...rest }) {
1356
- return /* @__PURE__ */ jsx(Tag2, { className: ClassNames("usx-clickable__bg-color-on-hover", className), ...rest, children });
1357
- }
1358
- function Clickable({ className, children, ...rest }) {
1359
- const classes = ClassNames("usx-clickable", className);
1360
- if ("href" in rest && rest.href !== void 0) {
1361
- return /* @__PURE__ */ jsx("a", { className: classes, ...rest, children });
1362
- }
1363
- return /* @__PURE__ */ jsx("button", { type: "button", className: classes, ...rest, children });
1364
- }
1365
- Clickable.Link = ClickableLink;
1366
- Clickable.ColorChange = ClickableColorChange;
1367
- Clickable.BgColorChange = ClickableBgColorChange;
1368
- function copyTextToClipboard(text) {
1369
- if (window.navigator.clipboard) {
1370
- return window.navigator.clipboard.writeText(text);
1371
- }
1372
- }
1373
680
  function CopyToClipboard({
1374
681
  copyText = "",
1375
682
  label = null,
@@ -1382,7 +689,8 @@ function CopyToClipboard({
1382
689
  {
1383
690
  ghost: true,
1384
691
  className: ClassNames("usx-copy", className),
1385
- onClick: () => copyTextToClipboard(copyText),
692
+ extraAttributes: { "data-usx-copy": copyText },
693
+ "aria-label": label ? void 0 : "Copy to clipboard",
1386
694
  type: "button",
1387
695
  children: [
1388
696
  /* @__PURE__ */ jsx(Icon, { name: "content_copy", className: "usx-copy__copy", staticBaseUrl }),
@@ -2145,6 +1453,7 @@ function TableCell({
2145
1453
  function getPageItems(currentPage, totalPages) {
2146
1454
  const page = (p) => ({ type: "page", page: p });
2147
1455
  const ellipsis = (key) => ({ type: "ellipsis", key });
1456
+ if (totalPages <= 1) return [];
2148
1457
  if (totalPages <= 7) {
2149
1458
  return Array.from({ length: totalPages }, (_, i) => page(i + 1));
2150
1459
  }
@@ -2202,6 +1511,7 @@ function PaginationNavigation({
2202
1511
  onPageChange
2203
1512
  }) {
2204
1513
  const unbounded = totalPages === void 0 || totalPages === null;
1514
+ if (!unbounded && totalPages <= 1) return null;
2205
1515
  const items = unbounded ? getUnboundedPageItems(currentPage) : getPageItems(currentPage, totalPages);
2206
1516
  const isFirstPage = currentPage === 1;
2207
1517
  const isLastPage = !unbounded && currentPage === totalPages;
@@ -2426,7 +1736,7 @@ function PaginationSummary({
2426
1736
  itemLabel = "items",
2427
1737
  className = ""
2428
1738
  }) {
2429
- const firstItem = (currentPage - 1) * pageSize + 1;
1739
+ const firstItem = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
2430
1740
  const lastItem = Math.min(currentPage * pageSize, totalItems);
2431
1741
  const classes = ClassNames(
2432
1742
  "usa-label",
@@ -2846,35 +2156,6 @@ function DateRangePicker({
2846
2156
  }
2847
2157
  );
2848
2158
  }
2849
- function Summary({
2850
- label = "Details",
2851
- children,
2852
- ariaLabel,
2853
- className = "",
2854
- textClassName = "",
2855
- markerColor = void 0,
2856
- underlineColor = void 0,
2857
- noUnderline = false,
2858
- noMarker = false,
2859
- unstyled = false
2860
- }) {
2861
- if (unstyled) {
2862
- return /* @__PURE__ */ jsx("summary", { className: className || void 0, "aria-label": ariaLabel, children: children ?? label });
2863
- }
2864
- const summaryClassNames = ClassNames(
2865
- "usx-summary",
2866
- { [`marker-${markerColor}`]: markerColor && !noMarker },
2867
- { "usx-summary--no-marker": noMarker },
2868
- { "usx-summary--no-underline": noUnderline },
2869
- className
2870
- );
2871
- const summaryTextClassNames = ClassNames(
2872
- "usx-summary-text",
2873
- { [`underline-${underlineColor}`]: !noUnderline && underlineColor },
2874
- textClassName
2875
- );
2876
- return /* @__PURE__ */ jsx("summary", { className: summaryClassNames, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx("span", { className: summaryTextClassNames, children: children ?? (label || "Details") }) });
2877
- }
2878
2159
  function Details({
2879
2160
  summaryProps = {},
2880
2161
  text = "",
@@ -2978,53 +2259,9 @@ function Drawer({
2978
2259
  )
2979
2260
  ] });
2980
2261
  }
2981
- function Link({
2982
- href = "javascript:void(0);",
2983
- text,
2984
- children,
2985
- visited = false,
2986
- external = false,
2987
- alt = false,
2988
- newTab = false,
2989
- className = "",
2990
- ...props2
2991
- }) {
2992
- const classes = ClassNames(
2993
- "usa-link",
2994
- "usx-link",
2995
- visited && "usx-link--visited",
2996
- external && "usa-link--external",
2997
- alt && "usa-link--alt",
2998
- className
2999
- );
3000
- return /* @__PURE__ */ jsx(
3001
- "a",
3002
- {
3003
- href,
3004
- className: classes,
3005
- target: newTab || external ? "_blank" : void 0,
3006
- rel: newTab || external ? "noreferrer noopener" : void 0,
3007
- ...props2,
3008
- children: children ?? text
3009
- }
3010
- );
3011
- }
3012
- const TagGroup = ({
3013
- tagProps = null,
3014
- children = null,
3015
- className = "",
3016
- ...props2
3017
- }) => {
3018
- const classes = ClassNames(
3019
- "usx-tag-group",
3020
- className
3021
- );
3022
- const content = children ? children : Array.isArray(tagProps) ? tagProps.map((t, i) => /* @__PURE__ */ jsx(Tag, { ...t }, t.id || t.value || i)) : null;
3023
- return /* @__PURE__ */ jsx("div", { className: classes, ...props2, children: content });
3024
- };
3025
2262
  function Page({
3026
2263
  id = void 0,
3027
- title = "Page title",
2264
+ title,
3028
2265
  titleId = void 0,
3029
2266
  eyebrow = null,
3030
2267
  subtitle = void 0,
@@ -3041,7 +2278,8 @@ function Page({
3041
2278
  const hasSummary = Boolean(subtitle || description || (tagProps == null ? void 0 : tagProps.length));
3042
2279
  const classes = ClassNames("usx-page", className);
3043
2280
  const pageContent = children || content;
3044
- const labelledBy = ariaLabelledby || titleId || void 0;
2281
+ const hasTitle = Boolean(title) && typeof title !== "boolean" || title === 0;
2282
+ const labelledBy = ariaLabelledby || (hasTitle ? titleId : void 0);
3045
2283
  return /* @__PURE__ */ jsxs(
3046
2284
  Element,
3047
2285
  {
@@ -3051,8 +2289,8 @@ function Page({
3051
2289
  "aria-labelledby": labelledBy,
3052
2290
  ...props2,
3053
2291
  children: [
3054
- /* @__PURE__ */ jsxs("h1", { id: titleId, className: "usx-page__title", children: [
3055
- eyebrow ? /* @__PURE__ */ jsx("span", { className: "usx-eyebrow", children: eyebrow }) : null,
2292
+ hasTitle && /* @__PURE__ */ jsxs("h1", { id: titleId, className: "usx-page__title", children: [
2293
+ eyebrow && typeof eyebrow !== "boolean" ? /* @__PURE__ */ jsx("span", { className: "usx-eyebrow", children: eyebrow }) : null,
3056
2294
  title
3057
2295
  ] }),
3058
2296
  hasSummary && /* @__PURE__ */ jsxs("div", { className: "usx-page__summary", children: [
@@ -3189,10 +2427,10 @@ function getEntryDisplay(entry) {
3189
2427
  if (entry.file) return { name: entry.file.name, size: entry.file.size, url: entry.url };
3190
2428
  return { name: entry.name, size: entry.size, url: entry.url };
3191
2429
  }
3192
- function FileList({ files, hint = "Selected files", onRemove = null, disabled = false, className = "" }) {
2430
+ function FileList({ files, hint = "Selected files", onRemove = null, disabled = false, slim = false, className = "" }) {
3193
2431
  if (!files || files.length === 0) return null;
3194
2432
  const lastEntry = getEntryDisplay(files[files.length - 1]);
3195
- return /* @__PURE__ */ jsxs("div", { className: ClassNames("usx-file-input__list", "margin-top-1", className), children: [
2433
+ return /* @__PURE__ */ jsxs("div", { className: ClassNames("usx-file-input__list", "margin-top-1", slim && "usx-file-list--slim", className), children: [
3196
2434
  /* @__PURE__ */ jsx("span", { className: "usa-sr-only", "aria-live": "polite", children: `You have selected the file: ${lastEntry.name}.` }),
3197
2435
  hint && /* @__PURE__ */ jsx("span", { className: "usa-hint usx-hint usx-file-input__list-heading", children: hint }),
3198
2436
  /* @__PURE__ */ jsx("ul", { className: "usx-file-input__file-list", children: files.map((entry) => {
@@ -3592,7 +2830,7 @@ function Search({
3592
2830
  label,
3593
2831
  screenReaderOnlyLabel: true,
3594
2832
  placeholder: placeholder ?? "",
3595
- ...value !== void 0 ? { value } : { defaultValue },
2833
+ ...value != null ? { value } : { defaultValue },
3596
2834
  onChange,
3597
2835
  type: "search",
3598
2836
  name: searchKey,
@@ -4516,7 +3754,7 @@ function Modal({
4516
3754
  description,
4517
3755
  actionProps = [
4518
3756
  { children: "Continue", variant: "primary", extraAttributes: { "data-close-modal": true } },
4519
- { children: "Go back", variant: "unstyled", className: "padding-105 text-center", extraAttributes: { "data-close-modal": true } }
3757
+ { children: "Go back", variant: "unstyled", tighten: true, className: "text-center", extraAttributes: { "data-close-modal": true } }
4520
3758
  ],
4521
3759
  size = "default",
4522
3760
  forceAction = false,
@@ -4529,6 +3767,7 @@ function Modal({
4529
3767
  "usa-modal--lg": size === "lg",
4530
3768
  "usx-modal--lg-collapsed": size === "lg-collapsed"
4531
3769
  }, className);
3770
+ const hasChildren = children != null;
4532
3771
  return /* @__PURE__ */ jsx(
4533
3772
  "div",
4534
3773
  {
@@ -4542,7 +3781,7 @@ function Modal({
4542
3781
  children: /* @__PURE__ */ jsxs("div", { className: "usa-modal__content", children: [
4543
3782
  /* @__PURE__ */ jsxs("div", { className: "usa-modal__main", children: [
4544
3783
  /* @__PURE__ */ jsx("h2", { className: "usa-modal__heading", id: `${id}-heading`, children: heading }),
4545
- /* @__PURE__ */ jsx(Prose, { children: /* @__PURE__ */ jsx("p", { id: `${id}-description`, children: children ?? description }) }),
3784
+ /* @__PURE__ */ jsx(Prose, { id: hasChildren ? `${id}-description` : void 0, children: hasChildren ? /* @__PURE__ */ jsx(Fragment, { children }) : /* @__PURE__ */ jsx("p", { id: `${id}-description`, children: description }) }),
4546
3785
  /* @__PURE__ */ jsx("div", { className: "usa-modal__footer", children: /* @__PURE__ */ jsx(ButtonGroup, { buttonProps: actionProps }) })
4547
3786
  ] }),
4548
3787
  !forceAction && /* @__PURE__ */ jsx(
@@ -4559,109 +3798,6 @@ function Modal({
4559
3798
  }
4560
3799
  );
4561
3800
  }
4562
- function PopoverMenu({ items, prefix, panelShape, className, ...props2 }) {
4563
- const generatedPrefix = React.useId();
4564
- const base = prefix ?? generatedPrefix;
4565
- return /* @__PURE__ */ jsx("ul", { ...props2, className: ClassNames("usx-popover__menu", className), children: items.map((item, index) => {
4566
- const id = item.id ?? `${base}-${index}`;
4567
- return /* @__PURE__ */ jsxs("li", { children: [
4568
- item.type === "details" && /* @__PURE__ */ jsx(
4569
- Popover,
4570
- {
4571
- id,
4572
- summaryProps: {
4573
- ...item.summaryProps,
4574
- className: ClassNames(item.summaryProps.className, "usx-popover__menu-item")
4575
- },
4576
- name: base,
4577
- side: "right",
4578
- panelShape,
4579
- menuItems: item.items
4580
- }
4581
- ),
4582
- item.type === "link" && /* @__PURE__ */ jsx(
4583
- Link,
4584
- {
4585
- href: item.href,
4586
- text: item.text,
4587
- className: "usx-no-visited usx-popover__menu-item"
4588
- }
4589
- ),
4590
- item.type === "text" && /* @__PURE__ */ jsx("span", { className: "usx-popover__menu-item", children: item.text })
4591
- ] }, id);
4592
- }) });
4593
- }
4594
- function Popover({
4595
- id,
4596
- side = "bottom",
4597
- align = "start",
4598
- panelShape = "rounded",
4599
- defaultOpen = false,
4600
- menuItems,
4601
- showClose = false,
4602
- closeLabel = "Close",
4603
- panelHeading,
4604
- headingAs = "h2",
4605
- scrollable = false,
4606
- className,
4607
- summaryProps,
4608
- panelClassName,
4609
- contentClassName,
4610
- extraAttributes,
4611
- children,
4612
- ...props2
4613
- }) {
4614
- const [initiallyOpen] = React.useState(defaultOpen);
4615
- const composedSummaryProps = { ...summaryProps, label: (summaryProps == null ? void 0 : summaryProps.label) ?? "Open panel" };
4616
- const Heading = headingAs;
4617
- return /* @__PURE__ */ jsxs(
4618
- "details",
4619
- {
4620
- ...props2,
4621
- className: ClassNames("usx-popover", className),
4622
- open: initiallyOpen || void 0,
4623
- "data-side": side,
4624
- "data-align": align,
4625
- ...extraAttributes,
4626
- children: [
4627
- /* @__PURE__ */ jsx(Summary, { unstyled: true, ...composedSummaryProps }),
4628
- /* @__PURE__ */ jsxs(
4629
- "div",
4630
- {
4631
- id,
4632
- className: ClassNames("usx-popover__panel", {
4633
- "usx-popover__panel--square": panelShape === "square"
4634
- }, panelClassName),
4635
- children: [
4636
- panelHeading && /* @__PURE__ */ jsx(Heading, { className: "usx-popover__panel-heading", children: panelHeading }),
4637
- menuItems && /* @__PURE__ */ jsx(PopoverMenu, { items: menuItems, prefix: id, panelShape }),
4638
- children && /* @__PURE__ */ jsx(
4639
- "div",
4640
- {
4641
- className: ClassNames(
4642
- "usx-popover__panel-content",
4643
- { "usx-popover__scroll": scrollable },
4644
- contentClassName
4645
- ),
4646
- children
4647
- }
4648
- ),
4649
- showClose && /* @__PURE__ */ jsx(
4650
- Button,
4651
- {
4652
- variant: "unstyled",
4653
- className: "usx-popover__panel-close",
4654
- "data-usx-popover-close": id,
4655
- children: closeLabel
4656
- }
4657
- )
4658
- ]
4659
- }
4660
- )
4661
- ]
4662
- }
4663
- );
4664
- }
4665
3801
  const ProcessList = ({ items = [], className = "", ...props2 }) => {
4666
3802
  const classes = ClassNames("usa-process-list", "usx-process-list", className);
4667
3803
  return /* @__PURE__ */ jsx("ol", { className: classes, ...props2, children: items.map((item, index) => {
@@ -4684,27 +3820,34 @@ function Quote({
4684
3820
  ...props2
4685
3821
  }) {
4686
3822
  const isVertical = (calloutProps == null ? void 0 : calloutProps.orientation) === "vertical";
4687
- return /* @__PURE__ */ jsxs("div", { className: ClassNames("usx-quote", isVertical && "usx-quote--vertical", className), ...props2, children: [
4688
- !isVertical && /* @__PURE__ */ jsx(Icon, { name: "format_quote", size: 4, className: "usx-quote__icon" }),
4689
- /* @__PURE__ */ jsx(Callout, { ...calloutProps, as: "div", children: /* @__PURE__ */ jsxs("figure", { className: "usx-quote__body", children: [
4690
- /* @__PURE__ */ jsxs(
4691
- "blockquote",
4692
- {
4693
- className: ClassNames("usx-quote__content", blockquoteClassName),
4694
- cite: sourceLinkProps == null ? void 0 : sourceLinkProps.href,
4695
- children: [
4696
- isVertical && "❝",
4697
- children ?? content,
4698
- isVertical && "❞"
4699
- ]
4700
- }
4701
- ),
4702
- (attributionProps || sourceTitle) && /* @__PURE__ */ jsxs("figcaption", { className: "usx-quote__attribution", children: [
4703
- attributionProps && /* @__PURE__ */ jsx(Attribution, { ...attributionProps }),
4704
- sourceTitle && /* @__PURE__ */ jsx("cite", { children: sourceLinkProps ? /* @__PURE__ */ jsx(Link, { ...sourceLinkProps, children: sourceTitle }) : sourceTitle })
4705
- ] })
4706
- ] }) })
4707
- ] });
3823
+ return /* @__PURE__ */ jsxs(
3824
+ "div",
3825
+ {
3826
+ className: ClassNames("usx-quote", isVertical && "usx-quote--vertical", className),
3827
+ ...props2,
3828
+ children: [
3829
+ !isVertical && /* @__PURE__ */ jsx(Icon, { name: "format_quote", size: 4, className: "usx-quote__icon" }),
3830
+ /* @__PURE__ */ jsx(Callout, { ...calloutProps, as: "div", children: /* @__PURE__ */ jsxs("figure", { className: "usx-quote__body", children: [
3831
+ /* @__PURE__ */ jsxs(
3832
+ "blockquote",
3833
+ {
3834
+ className: ClassNames("usx-quote__content", blockquoteClassName),
3835
+ cite: sourceLinkProps == null ? void 0 : sourceLinkProps.href,
3836
+ children: [
3837
+ isVertical && "❝",
3838
+ children ?? content,
3839
+ isVertical && "❞"
3840
+ ]
3841
+ }
3842
+ ),
3843
+ (attributionProps || sourceTitle) && /* @__PURE__ */ jsxs("figcaption", { className: "usx-quote__attribution", children: [
3844
+ attributionProps && /* @__PURE__ */ jsx(Attribution, { ...attributionProps }),
3845
+ sourceTitle && /* @__PURE__ */ jsx("cite", { children: (sourceLinkProps == null ? void 0 : sourceLinkProps.href) ? /* @__PURE__ */ jsx(Link, { ...sourceLinkProps, children: sourceTitle }) : sourceTitle })
3846
+ ] })
3847
+ ] }) })
3848
+ ]
3849
+ }
3850
+ );
4708
3851
  }
4709
3852
  function RangeSlider({
4710
3853
  id = "range-slider",
@@ -4981,6 +4124,10 @@ const Swap = ({
4981
4124
  children = null,
4982
4125
  className = "",
4983
4126
  variant = "default",
4127
+ as = "label",
4128
+ defaultPressed = false,
4129
+ ariaLabel,
4130
+ disabled = false,
4984
4131
  onContent = "ON",
4985
4132
  offContent = "OFF",
4986
4133
  includeInput = true,
@@ -4990,14 +4137,33 @@ const Swap = ({
4990
4137
  ...props2
4991
4138
  }) => {
4992
4139
  const variantClass = variant !== "default" ? `usx-swap--${variant}` : "";
4993
- const classes = ClassNames("usx-swap", variantClass, className);
4140
+ const classes = ClassNames(
4141
+ "usx-swap",
4142
+ variantClass,
4143
+ as === "button" && "usa-button usx-button usx-swap--button",
4144
+ className
4145
+ );
4994
4146
  const onClasses = ClassNames("usx-swap-on", onClassName);
4995
4147
  const offClasses = ClassNames("usx-swap-off", offClassName);
4996
4148
  const content = children || /* @__PURE__ */ jsxs(Fragment, { children: [
4997
- includeInput ? /* @__PURE__ */ jsx("input", { type: "checkbox", autoComplete: "off", ...inputProps }) : null,
4149
+ as === "label" && includeInput ? /* @__PURE__ */ jsx("input", { type: "checkbox", autoComplete: "off", ...inputProps }) : null,
4998
4150
  /* @__PURE__ */ jsx("span", { className: onClasses, children: onContent }),
4999
4151
  /* @__PURE__ */ jsx("span", { className: offClasses, children: offContent })
5000
4152
  ] });
4153
+ if (as === "button") {
4154
+ return /* @__PURE__ */ jsx(
4155
+ "button",
4156
+ {
4157
+ type: "button",
4158
+ className: classes,
4159
+ "aria-pressed": defaultPressed,
4160
+ "aria-label": ariaLabel,
4161
+ disabled,
4162
+ ...props2,
4163
+ children: content
4164
+ }
4165
+ );
4166
+ }
5001
4167
  return /* @__PURE__ */ jsx("label", { className: classes, ...props2, children: content });
5002
4168
  };
5003
4169
  function Switch({ className, labelClassName, color, ...props2 }) {
@@ -5092,34 +4258,24 @@ function ThemePicker({
5092
4258
  label = "Theme",
5093
4259
  themes = [],
5094
4260
  variant = "default",
4261
+ popoverAlign = "start",
5095
4262
  value,
5096
4263
  defaultValue,
5097
- onChange,
5098
4264
  className = "",
5099
4265
  extraAttributes
5100
4266
  }) {
5101
- var _a, _b, _c, _d, _e, _f;
5102
- const selectId = id || "theme-picker";
5103
- const [localValue, setLocalValue] = React.useState(defaultValue ?? ((_a = themes[0]) == null ? void 0 : _a.value) ?? "");
5104
- const selectedValue = value ?? localValue;
5105
- const selectedLabel = ((_b = themes.find((option) => option.value === selectedValue)) == null ? void 0 : _b.label) ?? label;
5106
- const choose = (next) => {
5107
- if (value === void 0) setLocalValue(next);
5108
- onChange == null ? void 0 : onChange(next);
5109
- };
5110
- const select = (hidden = false) => /* @__PURE__ */ jsxs(Fragment, { children: [
5111
- /* @__PURE__ */ jsx(Label, { htmlFor: selectId, screenReaderOnly: true, children: label }),
4267
+ var _a, _b, _c, _d, _e;
4268
+ const fieldId = id || "theme-picker";
4269
+ const selectedValue = value ?? defaultValue ?? ((_a = themes[0]) == null ? void 0 : _a.value) ?? "";
4270
+ const select = () => /* @__PURE__ */ jsxs(Fragment, { children: [
4271
+ /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, screenReaderOnly: true, children: label }),
5112
4272
  /* @__PURE__ */ jsx(
5113
4273
  "select",
5114
4274
  {
5115
- id: selectId,
4275
+ id: fieldId,
5116
4276
  name,
5117
- className: ClassNames(
5118
- "usa-select usx-select",
5119
- hidden && "usx-theme-picker__select--hidden"
5120
- ),
5121
- value: selectedValue,
5122
- onChange: (event) => choose(event.target.value),
4277
+ className: "usa-select usx-select",
4278
+ defaultValue: selectedValue,
5123
4279
  children: themes.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
5124
4280
  }
5125
4281
  )
@@ -5133,6 +4289,7 @@ function ThemePicker({
5133
4289
  className
5134
4290
  ),
5135
4291
  ...extraAttributes,
4292
+ hidden: true,
5136
4293
  children: [
5137
4294
  variant === "default" && /* @__PURE__ */ jsxs(Fragment, { children: [
5138
4295
  /* @__PURE__ */ jsx(
@@ -5142,11 +4299,11 @@ function ThemePicker({
5142
4299
  className: "usa-button usx-button usx-button--ghost usx-theme-picker__trigger",
5143
4300
  "aria-label": label,
5144
4301
  "aria-expanded": "false",
5145
- "aria-controls": `${selectId}-panel`,
4302
+ "aria-controls": `${fieldId}-panel`,
5146
4303
  children: /* @__PURE__ */ jsx(Icon, { name: "color_palette", source: "usx", className: "usx-theme-picker__icon" })
5147
4304
  }
5148
4305
  ),
5149
- /* @__PURE__ */ jsxs("div", { id: `${selectId}-panel`, className: "usx-theme-picker__panel", children: [
4306
+ /* @__PURE__ */ jsxs("div", { id: `${fieldId}-panel`, className: "usx-theme-picker__panel", children: [
5150
4307
  select(),
5151
4308
  /* @__PURE__ */ jsx(
5152
4309
  "button",
@@ -5163,33 +4320,43 @@ function ThemePicker({
5163
4320
  /* @__PURE__ */ jsx(
5164
4321
  Swap,
5165
4322
  {
5166
- className: "usx-theme-picker__swap usa-button usx-button usx-button--ghost",
4323
+ as: "button",
4324
+ className: "usx-theme-picker__swap usx-button--ghost usx-button--tight",
5167
4325
  variant: "rotate",
5168
- inputProps: {
5169
- checked: selectedValue === ((_c = themes[1]) == null ? void 0 : _c.value),
5170
- "aria-label": `${label}: ${selectedLabel}. Switch to ${selectedValue === ((_d = themes[1]) == null ? void 0 : _d.value) ? (_e = themes[0]) == null ? void 0 : _e.label : (_f = themes[1]) == null ? void 0 : _f.label}`,
5171
- onChange: (event) => {
5172
- var _a2;
5173
- event.stopPropagation();
5174
- choose(((_a2 = themes[event.target.checked ? 1 : 0]) == null ? void 0 : _a2.value) ?? "");
5175
- }
5176
- },
4326
+ defaultPressed: selectedValue === ((_b = themes[1]) == null ? void 0 : _b.value),
4327
+ ariaLabel: `${((_c = themes[1]) == null ? void 0 : _c.label) ?? ""} ${label}`.trim(),
4328
+ "data-usx-theme-off": (_d = themes[0]) == null ? void 0 : _d.value,
4329
+ "data-usx-theme-on": (_e = themes[1]) == null ? void 0 : _e.value,
5177
4330
  offContent: /* @__PURE__ */ jsx(Icon, { name: "sun", source: "usx", className: "usx-theme-picker__icon" }),
5178
4331
  onContent: /* @__PURE__ */ jsx(Icon, { name: "moon", source: "usx", className: "usx-theme-picker__icon" })
5179
4332
  }
5180
4333
  ),
5181
- /* @__PURE__ */ jsx("div", { className: "usx-theme-picker__fallback", children: select() })
4334
+ /* @__PURE__ */ jsx("input", { id: fieldId, type: "hidden", name, defaultValue: selectedValue })
5182
4335
  ] }),
5183
- variant === "ghost-select" && /* @__PURE__ */ jsxs("div", { className: "usx-theme-picker__ghost", children: [
4336
+ variant === "popover" && /* @__PURE__ */ jsxs(Fragment, { children: [
5184
4337
  /* @__PURE__ */ jsx(
5185
- "span",
4338
+ Popover,
5186
4339
  {
5187
- className: "usa-button usx-button usx-button--ghost usx-theme-picker__ghost-face",
5188
- "aria-hidden": "true",
5189
- children: /* @__PURE__ */ jsx(Icon, { name: "color_palette", source: "usx", className: "usx-theme-picker__icon" })
4340
+ id: `${fieldId}-panel`,
4341
+ className: "usx-theme-picker__popover",
4342
+ align: popoverAlign,
4343
+ panelShape: "square",
4344
+ summaryProps: {
4345
+ className: "usa-button usx-button usx-button--ghost usx-button--tight margin-0",
4346
+ ariaLabel: label,
4347
+ children: /* @__PURE__ */ jsx(Icon, { name: "color_palette", source: "usx", className: "usx-theme-picker__icon" })
4348
+ },
4349
+ menuItems: themes.map((theme) => ({
4350
+ type: "button",
4351
+ text: theme.label,
4352
+ extraAttributes: {
4353
+ "data-usx-theme-value": theme.value,
4354
+ "aria-pressed": theme.value === selectedValue
4355
+ }
4356
+ }))
5190
4357
  }
5191
4358
  ),
5192
- select(true)
4359
+ /* @__PURE__ */ jsx("input", { id: fieldId, type: "hidden", name, defaultValue: selectedValue })
5193
4360
  ] })
5194
4361
  ]
5195
4362
  }
@@ -5389,10 +4556,11 @@ const Villain = ({
5389
4556
  };
5390
4557
  export {
5391
4558
  Accordion,
4559
+ AccordionItem,
5392
4560
  Alert,
5393
4561
  Attribution,
5394
4562
  Avatar,
5395
- AvatarGroup,
4563
+ k as AvatarGroup,
5396
4564
  BackToTop,
5397
4565
  Banner,
5398
4566
  Breadcrumb,
@@ -5459,7 +4627,7 @@ export {
5459
4627
  SideNav,
5460
4628
  SiteAlert,
5461
4629
  Skipnav,
5462
- Spinner,
4630
+ l as Spinner,
5463
4631
  Status,
5464
4632
  StepIndicator,
5465
4633
  Summary,