@solexllc/usx-react 0.9.0 → 0.11.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 (145) hide show
  1. package/README.md +6 -5
  2. package/dist/index.cjs +245 -162
  3. package/dist/index.js +246 -163
  4. package/package.json +4 -4
  5. package/src/components/accordion/Accordion.tsx +4 -1
  6. package/src/components/accordion/accordion.django.html +1 -1
  7. package/src/components/accordion/config.json +1 -0
  8. package/src/components/banner/Banner.tsx +3 -1
  9. package/src/components/banner/banner.django.html +1 -1
  10. package/src/components/banner/config.json +1 -0
  11. package/src/components/carousel/carousel.django-snapshot.html +0 -40
  12. package/src/components/carousel/carousel.react-snapshot.html +0 -38
  13. package/src/components/character-count/CharacterCount.tsx +3 -0
  14. package/src/components/character-count/character-count.django-snapshot.html +43 -0
  15. package/src/components/character-count/character-count.django.html +2 -2
  16. package/src/components/character-count/character-count.react-snapshot.html +37 -0
  17. package/src/components/character-count/config.json +9 -0
  18. package/src/components/checkbox/Checkbox.tsx +16 -17
  19. package/src/components/checkbox/checkbox.django-snapshot.html +18 -0
  20. package/src/components/checkbox/checkbox.django.html +6 -4
  21. package/src/components/checkbox/checkbox.react-snapshot.html +14 -0
  22. package/src/components/checkbox/config.json +4 -4
  23. package/src/components/checkbox-group/checkbox-group.django-snapshot.html +54 -0
  24. package/src/components/checkbox-group/checkbox-group.react-snapshot.html +45 -0
  25. package/src/components/code/code.django-snapshot.html +4 -6
  26. package/src/components/code/code.html +2 -2
  27. package/src/components/code/code.react-snapshot.html +2 -4
  28. package/src/components/combobox/Combobox.tsx +6 -1
  29. package/src/components/combobox/combobox.django-snapshot.html +141 -0
  30. package/src/components/combobox/combobox.django.html +2 -2
  31. package/src/components/combobox/combobox.react-snapshot.html +76 -0
  32. package/src/components/combobox/config.json +9 -0
  33. package/src/components/data-table/DataTable.tsx +4 -1
  34. package/src/components/data-table/config.json +4 -0
  35. package/src/components/data-table/data-table.django.html +1 -1
  36. package/src/components/date-picker/DatePicker.tsx +6 -1
  37. package/src/components/date-picker/config.json +9 -0
  38. package/src/components/date-picker/date-picker.django-snapshot.html +23 -0
  39. package/src/components/date-picker/date-picker.django.html +4 -4
  40. package/src/components/date-picker/date-picker.react-snapshot.html +19 -0
  41. package/src/components/date-range-picker/DateRangePicker.tsx +11 -2
  42. package/src/components/date-range-picker/config.json +14 -0
  43. package/src/components/date-range-picker/date-range-picker.django-snapshot.html +47 -0
  44. package/src/components/date-range-picker/date-range-picker.django.html +5 -5
  45. package/src/components/date-range-picker/date-range-picker.react-snapshot.html +38 -0
  46. package/src/components/drawer/Drawer.tsx +3 -1
  47. package/src/components/drawer/config.json +4 -0
  48. package/src/components/drawer/drawer.django.html +1 -1
  49. package/src/components/file-input/FileInput.tsx +7 -2
  50. package/src/components/file-input/_contents.django.html +2 -1
  51. package/src/components/file-input/config.json +4 -0
  52. package/src/components/header/Header.tsx +15 -9
  53. package/src/components/header/config.json +1 -0
  54. package/src/components/header/header.django-snapshot.html +29 -7
  55. package/src/components/header/header.django.html +8 -4
  56. package/src/components/header/header.html +21 -11
  57. package/src/components/header/header.react-snapshot.html +23 -6
  58. package/src/components/icon-list/IconList.tsx +10 -2
  59. package/src/components/icon-list/config.json +5 -1
  60. package/src/components/icon-list/icon-list.django-snapshot.html +39 -0
  61. package/src/components/icon-list/icon-list.django.html +2 -0
  62. package/src/components/icon-list/icon-list.react-snapshot.html +31 -0
  63. package/src/components/in-page-nav/InPageNav.tsx +3 -0
  64. package/src/components/in-page-nav/config.json +1 -0
  65. package/src/components/in-page-nav/in-page-nav.django.html +1 -1
  66. package/src/components/input/Input.tsx +3 -0
  67. package/src/components/input/config.json +10 -0
  68. package/src/components/input/input.django-snapshot.html +24 -0
  69. package/src/components/input/input.django.html +4 -4
  70. package/src/components/input/input.react-snapshot.html +22 -0
  71. package/src/components/language-selector/LanguageSelector.tsx +10 -5
  72. package/src/components/language-selector/config.json +1 -0
  73. package/src/components/language-selector/language-selector.django.html +2 -2
  74. package/src/components/layout/Layout.tsx +3 -1
  75. package/src/components/layout/config.json +4 -0
  76. package/src/components/layout/layout.django.html +1 -1
  77. package/src/components/list/List.tsx +10 -2
  78. package/src/components/list/config.json +5 -1
  79. package/src/components/list/list.django-snapshot.html +26 -0
  80. package/src/components/list/list.django.html +2 -0
  81. package/src/components/list/list.html +20 -0
  82. package/src/components/list/list.react-snapshot.html +20 -0
  83. package/src/components/memorable-date/MemorableDate.tsx +18 -3
  84. package/src/components/memorable-date/config.json +15 -0
  85. package/src/components/memorable-date/memorable-date.django-snapshot.html +82 -0
  86. package/src/components/memorable-date/memorable-date.django.html +14 -14
  87. package/src/components/memorable-date/memorable-date.react-snapshot.html +70 -0
  88. package/src/components/modal/Modal.tsx +3 -0
  89. package/src/components/modal/config.json +1 -0
  90. package/src/components/modal/modal.django.html +1 -1
  91. package/src/components/page/Page.tsx +16 -0
  92. package/src/components/page/config.json +18 -1
  93. package/src/components/page/page.django-snapshot.html +74 -0
  94. package/src/components/page/page.django.html +8 -0
  95. package/src/components/page/page.html +60 -0
  96. package/src/components/page/page.react-snapshot.html +60 -0
  97. package/src/components/popover/Popover.tsx +3 -0
  98. package/src/components/popover/config.json +4 -0
  99. package/src/components/popover/popover.django-snapshot.html +30 -0
  100. package/src/components/popover/popover.django.html +1 -0
  101. package/src/components/radio-buttons/RadioButtons.tsx +5 -1
  102. package/src/components/radio-buttons/radio-buttons.django-snapshot.html +65 -0
  103. package/src/components/radio-buttons/radio-buttons.django.html +1 -1
  104. package/src/components/radio-buttons/radio-buttons.react-snapshot.html +53 -0
  105. package/src/components/range-slider/RangeSlider.tsx +4 -2
  106. package/src/components/range-slider/config.json +1 -0
  107. package/src/components/range-slider/range-slider.django-snapshot.html +17 -0
  108. package/src/components/range-slider/range-slider.django.html +4 -4
  109. package/src/components/range-slider/range-slider.react-snapshot.html +16 -0
  110. package/src/components/search/Search.tsx +6 -1
  111. package/src/components/search/config.json +5 -0
  112. package/src/components/search/search.django-snapshot.html +683 -563
  113. package/src/components/search/search.django.html +1 -1
  114. package/src/components/search/search.react-snapshot.html +25 -0
  115. package/src/components/select/Select.tsx +3 -1
  116. package/src/components/select/config.json +5 -0
  117. package/src/components/select/select.django-snapshot.html +15 -0
  118. package/src/components/select/select.django.html +2 -2
  119. package/src/components/select/select.react-snapshot.html +11 -0
  120. package/src/components/switch/Switch.tsx +13 -70
  121. package/src/components/switch/config.json +60 -23
  122. package/src/components/switch/switch.django-snapshot.html +507 -56
  123. package/src/components/switch/switch.django.html +23 -26
  124. package/src/components/switch/switch.html +425 -33
  125. package/src/components/switch/switch.react-snapshot.html +447 -58
  126. package/src/components/table/Table.tsx +3 -1
  127. package/src/components/table/config.json +1 -0
  128. package/src/components/table/table.django.html +1 -1
  129. package/src/components/text-area/TextArea.tsx +3 -1
  130. package/src/components/text-area/config.json +5 -0
  131. package/src/components/text-area/text-area.django-snapshot.html +18 -0
  132. package/src/components/text-area/text-area.django.html +4 -4
  133. package/src/components/text-area/text-area.react-snapshot.html +16 -0
  134. package/src/components/theme-picker/ThemePicker.tsx +97 -52
  135. package/src/components/theme-picker/config.json +21 -5
  136. package/src/components/theme-picker/theme-picker-select.django.html +7 -0
  137. package/src/components/theme-picker/theme-picker.django-snapshot.html +158 -14
  138. package/src/components/theme-picker/theme-picker.django.html +22 -24
  139. package/src/components/theme-picker/theme-picker.html +86 -56
  140. package/src/components/theme-picker/theme-picker.react-snapshot.html +120 -12
  141. package/src/components/time-picker/TimePicker.tsx +6 -1
  142. package/src/components/time-picker/config.json +9 -0
  143. package/src/components/time-picker/time-picker.django-snapshot.html +26 -0
  144. package/src/components/time-picker/time-picker.django.html +4 -4
  145. package/src/components/time-picker/time-picker.react-snapshot.html +22 -0
package/dist/index.cjs CHANGED
@@ -121,6 +121,7 @@
121
121
  className = "",
122
122
  headingClassName = "",
123
123
  contentClassName = "",
124
+ extraAttributes,
124
125
  ...props2
125
126
  }) {
126
127
  const accordionClasses = ClassNames(
@@ -137,6 +138,7 @@
137
138
  className: accordionClasses,
138
139
  "data-allow-multiple": multiselectable ? true : void 0,
139
140
  ...props2,
141
+ ...extraAttributes,
140
142
  children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
141
143
  AccordionItem,
142
144
  {
@@ -411,6 +413,7 @@
411
413
  " website. Share sensitive information only on official, secure websites."
412
414
  ] }),
413
415
  className = "",
416
+ extraAttributes,
414
417
  ...props2
415
418
  }) {
416
419
  const classes = ClassNames(
@@ -418,7 +421,7 @@
418
421
  "usx-banner",
419
422
  className
420
423
  );
421
- return /* @__PURE__ */ jsxRuntime.jsx("section", { id, className: classes, "aria-label": ariaLabel, ...props2, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { id: `${id}-accordion`, className: "usa-accordion", children: [
424
+ return /* @__PURE__ */ jsxRuntime.jsx("section", { id, className: classes, "aria-label": ariaLabel, ...props2, ...extraAttributes, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { id: `${id}-accordion`, className: "usa-accordion", children: [
422
425
  /* @__PURE__ */ jsxRuntime.jsx("header", { className: "usa-banner__header", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-banner__inner", children: [
423
426
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
424
427
  "img",
@@ -1050,6 +1053,8 @@
1050
1053
  screenReaderOnlyLabel = false,
1051
1054
  formGroup = true,
1052
1055
  className = "",
1056
+ value,
1057
+ defaultValue,
1053
1058
  ...props2
1054
1059
  }) {
1055
1060
  const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
@@ -1075,6 +1080,7 @@
1075
1080
  required,
1076
1081
  "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
1077
1082
  "aria-invalid": hasError ? true : void 0,
1083
+ ...value !== void 0 ? { value } : { defaultValue },
1078
1084
  ...props2
1079
1085
  };
1080
1086
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -1092,6 +1098,7 @@
1092
1098
  disabled = false,
1093
1099
  required = false,
1094
1100
  defaultValue = "",
1101
+ value,
1095
1102
  hint = null,
1096
1103
  screenReaderOnlyLabel = false,
1097
1104
  error = null,
@@ -1124,7 +1131,7 @@
1124
1131
  className: classes,
1125
1132
  placeholder,
1126
1133
  disabled,
1127
- defaultValue: props2.value === void 0 ? defaultValue : void 0,
1134
+ ...value !== void 0 ? { value } : { defaultValue },
1128
1135
  ...required ? { required: true } : {},
1129
1136
  "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
1130
1137
  "aria-invalid": hasError ? "true" : void 0,
@@ -1147,6 +1154,7 @@
1147
1154
  placeholder = "",
1148
1155
  textArea = false,
1149
1156
  className = "",
1157
+ extraAttributes,
1150
1158
  ...props2
1151
1159
  }) {
1152
1160
  const fieldId = id || `character-count-${Math.random().toString(36).substr(2, 9)}`;
@@ -1168,7 +1176,8 @@
1168
1176
  formGroup: true,
1169
1177
  className: "usa-character-count__field",
1170
1178
  "aria-describedby": [infoId, hintId, errorId].filter(Boolean).join(" "),
1171
- ...props2
1179
+ ...props2,
1180
+ ...extraAttributes
1172
1181
  };
1173
1182
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: outerClasses, children: [
1174
1183
  textArea ? /* @__PURE__ */ jsxRuntime.jsx(TextArea, { ...fieldProps }) : /* @__PURE__ */ jsxRuntime.jsx(Input, { ...fieldProps }),
@@ -1186,7 +1195,7 @@
1186
1195
  label = "",
1187
1196
  ariaLabel = "",
1188
1197
  checked,
1189
- indeterminate = false,
1198
+ defaultChecked,
1190
1199
  disabled = false,
1191
1200
  description = "",
1192
1201
  tile = false,
@@ -1194,15 +1203,12 @@
1194
1203
  error,
1195
1204
  success,
1196
1205
  className = "",
1206
+ labelClassName = "",
1197
1207
  onChange,
1198
1208
  required = false,
1199
1209
  formGroup = true,
1200
1210
  ...props2
1201
1211
  }) {
1202
- const inputRef = React.useRef(null);
1203
- React.useEffect(() => {
1204
- if (inputRef.current) inputRef.current.indeterminate = indeterminate;
1205
- }, [indeterminate]);
1206
1212
  const hasError = !!error;
1207
1213
  const hasSuccess = !!success;
1208
1214
  const divClasses = ClassNames(
@@ -1211,32 +1217,37 @@
1211
1217
  { "usx-checkbox--small": small },
1212
1218
  className
1213
1219
  );
1214
- const inputClasses = ClassNames(
1215
- "usa-checkbox__input",
1216
- { "usa-checkbox__input--tile": tile }
1217
- );
1220
+ const inputClasses = ClassNames("usa-checkbox__input", { "usa-checkbox__input--tile": tile });
1218
1221
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1219
1222
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: divClasses, ...props2, children: [
1220
1223
  /* @__PURE__ */ jsxRuntime.jsx(
1221
1224
  "input",
1222
1225
  {
1223
- ref: inputRef,
1224
1226
  className: inputClasses,
1225
1227
  id,
1226
1228
  type: "checkbox",
1227
1229
  name,
1228
1230
  value,
1229
1231
  "aria-label": ariaLabel || void 0,
1230
- ...checked !== void 0 && onChange ? { checked } : { defaultChecked: checked },
1232
+ ...checked !== void 0 && onChange ? { checked } : { defaultChecked: checked ?? defaultChecked },
1231
1233
  disabled,
1232
1234
  required,
1233
1235
  ...onChange ? { onChange } : {}
1234
1236
  }
1235
1237
  ),
1236
- /* @__PURE__ */ jsxRuntime.jsxs(Label, { className: "usa-checkbox__label", classOverride: true, htmlFor: id, required, children: [
1237
- label,
1238
- description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-checkbox__label-description", children: description })
1239
- ] })
1238
+ /* @__PURE__ */ jsxRuntime.jsxs(
1239
+ Label,
1240
+ {
1241
+ className: ClassNames("usa-checkbox__label", labelClassName),
1242
+ classOverride: true,
1243
+ htmlFor: id,
1244
+ required,
1245
+ children: [
1246
+ label,
1247
+ description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-checkbox__label-description", children: description })
1248
+ ]
1249
+ }
1250
+ )
1240
1251
  ] }),
1241
1252
  hasError ? /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage, { children: error }) : hasSuccess ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-success-message text-success", role: "status", children: success }) : null
1242
1253
  ] });
@@ -1453,12 +1464,14 @@
1453
1464
  hint = null,
1454
1465
  placeholder,
1455
1466
  defaultValue = null,
1467
+ value,
1456
1468
  error = null,
1457
1469
  options = [],
1458
1470
  onSearch,
1459
1471
  onSelect,
1460
1472
  formGroup = true,
1461
1473
  className = "",
1474
+ extraAttributes,
1462
1475
  ...props2
1463
1476
  }) {
1464
1477
  const labelId = `${id}-label`;
@@ -1480,6 +1493,7 @@
1480
1493
  /* @__PURE__ */ jsxRuntime.jsx(
1481
1494
  "div",
1482
1495
  {
1496
+ ...extraAttributes,
1483
1497
  className: ClassNames(
1484
1498
  "usa-combo-box",
1485
1499
  "usx-combo-box",
@@ -1487,7 +1501,7 @@
1487
1501
  className
1488
1502
  ),
1489
1503
  ...placeholder ? { "data-placeholder": placeholder } : {},
1490
- ...defaultValue ? { "data-default-value": defaultValue } : {},
1504
+ ...value ?? defaultValue ? { "data-default-value": value ?? defaultValue } : {},
1491
1505
  ...onSearch ? { onInput: handleInput } : {},
1492
1506
  children: /* @__PURE__ */ jsxRuntime.jsx(
1493
1507
  "select",
@@ -1895,7 +1909,7 @@
1895
1909
  name,
1896
1910
  value: opt.value,
1897
1911
  "aria-label": opt.ariaLabel,
1898
- ...value !== void 0 && onChange ? { checked: value === opt.value } : { defaultChecked: defaultValue === opt.value || !!opt.checked },
1912
+ ...value !== void 0 && onChange ? { checked: value === opt.value } : { defaultChecked: (value ?? defaultValue) !== void 0 ? (value ?? defaultValue) === opt.value : !!opt.checked },
1899
1913
  onChange,
1900
1914
  disabled: !!opt.disabled
1901
1915
  }
@@ -2331,6 +2345,7 @@
2331
2345
  name,
2332
2346
  options = [],
2333
2347
  defaultValue,
2348
+ value,
2334
2349
  placeholder = "Select an option",
2335
2350
  error,
2336
2351
  success,
@@ -2364,7 +2379,7 @@
2364
2379
  className: combinedSelectClasses,
2365
2380
  disabled,
2366
2381
  required: required || void 0,
2367
- defaultValue,
2382
+ ...value !== void 0 ? { value } : { defaultValue },
2368
2383
  "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
2369
2384
  "aria-invalid": hasError ? true : void 0,
2370
2385
  ...props2
@@ -2561,6 +2576,7 @@
2561
2576
  placeholder = "No rows to display",
2562
2577
  className = "",
2563
2578
  children,
2579
+ extraAttributes,
2564
2580
  ...props2
2565
2581
  }) {
2566
2582
  const generatedId = React.useId();
@@ -2644,6 +2660,7 @@
2644
2660
  "data-initial-sort-direction": (initialSort == null ? void 0 : initialSort.direction) || void 0,
2645
2661
  "data-total-count": pageConfig.totalCount,
2646
2662
  "data-infinite": infinite || void 0,
2663
+ ...extraAttributes,
2647
2664
  children: [
2648
2665
  searchable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-data-table__toolbar", children: /* @__PURE__ */ jsxRuntime.jsx(Input, { id: `${id}-search`, label: "Search", formGroup: false, placeholder: searchPlaceholder }) }),
2649
2666
  scrollable || height ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -2691,11 +2708,13 @@
2691
2708
  disabled = false,
2692
2709
  required = false,
2693
2710
  defaultValue = null,
2711
+ value,
2694
2712
  minDate = null,
2695
2713
  maxDate = null,
2696
2714
  rangeDate = null,
2697
2715
  formGroup = true,
2698
2716
  className = "",
2717
+ extraAttributes,
2699
2718
  ...props2
2700
2719
  }) {
2701
2720
  const labelId = `${id}-label`;
@@ -2709,8 +2728,9 @@
2709
2728
  /* @__PURE__ */ jsxRuntime.jsx(
2710
2729
  "div",
2711
2730
  {
2731
+ ...extraAttributes,
2712
2732
  className: ClassNames("usa-date-picker", "usx-date-picker", className),
2713
- ...defaultValue ? { "data-default-value": defaultValue } : {},
2733
+ ...value ?? defaultValue ? { "data-default-value": value ?? defaultValue } : {},
2714
2734
  ...minDate ? { "data-min-date": minDate } : {},
2715
2735
  ...maxDate ? { "data-max-date": maxDate } : {},
2716
2736
  ...rangeDate ? { "data-range-date": rangeDate } : {},
@@ -2751,9 +2771,12 @@
2751
2771
  required = false,
2752
2772
  defaultStartDate = null,
2753
2773
  defaultEndDate = null,
2774
+ startDate,
2775
+ endDate,
2754
2776
  minDate = null,
2755
2777
  maxDate = null,
2756
- className = ""
2778
+ className = "",
2779
+ extraAttributes
2757
2780
  }) {
2758
2781
  const startLabelId = `${startId}-label`;
2759
2782
  const startHintId = startHint ? `${startId}-hint` : void 0;
@@ -2766,6 +2789,7 @@
2766
2789
  return /* @__PURE__ */ jsxRuntime.jsxs(
2767
2790
  "div",
2768
2791
  {
2792
+ ...extraAttributes,
2769
2793
  className: ClassNames("usa-date-range-picker", "usx-date-range-picker", className),
2770
2794
  ...minDate ? { "data-min-date": minDate } : {},
2771
2795
  ...maxDate ? { "data-max-date": maxDate } : {},
@@ -2777,8 +2801,9 @@
2777
2801
  /* @__PURE__ */ jsxRuntime.jsx(
2778
2802
  "div",
2779
2803
  {
2804
+ "data-enhanced": (extraAttributes == null ? void 0 : extraAttributes["data-enhanced"]) === "true" ? "true" : void 0,
2780
2805
  className: "usa-date-picker usx-date-picker",
2781
- ...defaultStartDate ? { "data-default-value": defaultStartDate } : {},
2806
+ ...startDate ?? defaultStartDate ? { "data-default-value": startDate ?? defaultStartDate } : {},
2782
2807
  children: /* @__PURE__ */ jsxRuntime.jsx(
2783
2808
  "input",
2784
2809
  {
@@ -2801,8 +2826,9 @@
2801
2826
  /* @__PURE__ */ jsxRuntime.jsx(
2802
2827
  "div",
2803
2828
  {
2829
+ "data-enhanced": (extraAttributes == null ? void 0 : extraAttributes["data-enhanced"]) === "true" ? "true" : void 0,
2804
2830
  className: "usa-date-picker usx-date-picker",
2805
- ...defaultEndDate ? { "data-default-value": defaultEndDate } : {},
2831
+ ...endDate ?? defaultEndDate ? { "data-default-value": endDate ?? defaultEndDate } : {},
2806
2832
  children: /* @__PURE__ */ jsxRuntime.jsx(
2807
2833
  "input",
2808
2834
  {
@@ -2896,6 +2922,7 @@
2896
2922
  className,
2897
2923
  triggerClassName,
2898
2924
  panelClassName,
2925
+ extraAttributes,
2899
2926
  ...props2
2900
2927
  }) {
2901
2928
  const opener = { commandfor: id, command: "show-modal" };
@@ -2903,7 +2930,7 @@
2903
2930
  const dismissal = {
2904
2931
  closedby: actionRequired ? "none" : void 0
2905
2932
  };
2906
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props2, className: ClassNames("usx-drawer", className), children: [
2933
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props2, className: ClassNames("usx-drawer", className), ...extraAttributes, children: [
2907
2934
  /* @__PURE__ */ jsxRuntime.jsx(
2908
2935
  "button",
2909
2936
  {
@@ -2984,11 +3011,27 @@
2984
3011
  }
2985
3012
  );
2986
3013
  }
3014
+ const TagGroup = ({
3015
+ tagProps = null,
3016
+ children = null,
3017
+ className = "",
3018
+ ...props2
3019
+ }) => {
3020
+ const classes = ClassNames(
3021
+ "usx-tag-group",
3022
+ className
3023
+ );
3024
+ const content = children ? children : Array.isArray(tagProps) ? tagProps.map((t, i) => /* @__PURE__ */ jsxRuntime.jsx(Tag, { ...t }, t.id || t.value || i)) : null;
3025
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...props2, children: content });
3026
+ };
2987
3027
  function Page({
2988
3028
  id = void 0,
2989
3029
  title = "Page title",
2990
3030
  titleId = void 0,
2991
3031
  eyebrow = null,
3032
+ subtitle = void 0,
3033
+ description = void 0,
3034
+ tagProps = void 0,
2992
3035
  as: Element = "main",
2993
3036
  children = null,
2994
3037
  content = null,
@@ -2997,6 +3040,7 @@
2997
3040
  className = "",
2998
3041
  ...props2
2999
3042
  }) {
3043
+ const hasSummary = Boolean(subtitle || description || (tagProps == null ? void 0 : tagProps.length));
3000
3044
  const classes = ClassNames("usx-page", className);
3001
3045
  const pageContent = children || content;
3002
3046
  const labelledBy = ariaLabelledby || titleId || void 0;
@@ -3013,6 +3057,11 @@
3013
3057
  eyebrow ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usx-eyebrow", children: eyebrow }) : null,
3014
3058
  title
3015
3059
  ] }),
3060
+ hasSummary && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usx-page__summary", children: [
3061
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "usx-page__subtitle", children: subtitle }),
3062
+ (tagProps == null ? void 0 : tagProps.length) ? /* @__PURE__ */ jsxRuntime.jsx(TagGroup, { className: "usx-page__tags", tagProps }) : null,
3063
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "usx-page__description", children: description })
3064
+ ] }),
3016
3065
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-page__content", children: pageContent })
3017
3066
  ]
3018
3067
  }
@@ -3198,12 +3247,14 @@
3198
3247
  onFilesChange = null,
3199
3248
  defaultFiles = [],
3200
3249
  formGroup = true,
3250
+ extraAttributes,
3201
3251
  ...props2
3202
3252
  }) {
3203
3253
  const hintId = hint ? `${id}-hint` : void 0;
3204
3254
  const errorId = error ? `${id}-error` : void 0;
3205
3255
  const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
3206
3256
  const isManagedMultiple = multiple && manageIndividualFiles;
3257
+ const usxManagedDisabled = (extraAttributes == null ? void 0 : extraAttributes["usx-data-enhanced"]) === "true";
3207
3258
  const nextFileId = React.useRef(0);
3208
3259
  const [managedFiles, setManagedFiles] = React.useState(
3209
3260
  () => defaultFiles.map((entry) => ({ key: nextFileId.current++, file: null, ...entry }))
@@ -3248,7 +3299,8 @@
3248
3299
  disabled,
3249
3300
  required,
3250
3301
  ...invalidFileTypeMessage ? { "data-errormessage": invalidFileTypeMessage } : {},
3251
- ...props2
3302
+ ...props2,
3303
+ ...extraAttributes
3252
3304
  }
3253
3305
  )
3254
3306
  ] });
@@ -3258,7 +3310,7 @@
3258
3310
  commonLabel,
3259
3311
  commonHint,
3260
3312
  commonError,
3261
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-file-input__add-only", "data-usx-file-list-hint": typeof fileListHint === "string" && fileListHint ? fileListHint : "Selected files", children: /* @__PURE__ */ jsxRuntime.jsx(
3313
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-file-input__add-only", ...usxManagedDisabled ? { "usx-data-enhanced": "true" } : {}, "data-usx-file-list-hint": typeof fileListHint === "string" && fileListHint ? fileListHint : "Selected files", children: /* @__PURE__ */ jsxRuntime.jsx(
3262
3314
  "input",
3263
3315
  {
3264
3316
  ref: (node) => {
@@ -3275,7 +3327,8 @@
3275
3327
  required: required && managedFiles.length === 0,
3276
3328
  ...invalidFileTypeMessage ? { "data-errormessage": invalidFileTypeMessage } : {},
3277
3329
  ...props2,
3278
- onChange: addFiles
3330
+ ...extraAttributes,
3331
+ onChange: usxManagedDisabled ? void 0 : addFiles
3279
3332
  }
3280
3333
  ) }),
3281
3334
  /* @__PURE__ */ jsxRuntime.jsx(FileList, { files: managedFiles, hint: fileListHint, onRemove: removeFile, disabled })
@@ -3500,6 +3553,8 @@
3500
3553
  placeholder,
3501
3554
  action,
3502
3555
  defaultValue,
3556
+ value,
3557
+ onChange,
3503
3558
  onSubmit,
3504
3559
  className = ""
3505
3560
  }) {
@@ -3539,7 +3594,8 @@
3539
3594
  label,
3540
3595
  screenReaderOnlyLabel: true,
3541
3596
  placeholder: placeholder ?? "",
3542
- defaultValue,
3597
+ ...value !== void 0 ? { value } : { defaultValue },
3598
+ onChange,
3543
3599
  type: "search",
3544
3600
  name: searchKey,
3545
3601
  formGroup: false
@@ -3656,6 +3712,7 @@
3656
3712
  className = "",
3657
3713
  utilityContent = null,
3658
3714
  navEndContent = null,
3715
+ extraAttributes,
3659
3716
  ...props2
3660
3717
  }) {
3661
3718
  const headerClasses = ClassNames(
@@ -3671,14 +3728,15 @@
3671
3728
  "usx-nav",
3672
3729
  { "usx-nav--sticky": stickyNav }
3673
3730
  );
3731
+ const hasNavigation = navSections.length > 0 || Boolean(searchProps || utilityContent || extended && (secondaryLinks.length > 0 || navEndContent));
3674
3732
  const navbar = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-navbar", children: [
3675
3733
  /* @__PURE__ */ jsxRuntime.jsx(Branding, { branding, projectUrl, staticBaseUrl }),
3676
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "usa-menu-btn align-center", children: useMenuIcon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", size: 3 }) : "Menu" })
3734
+ hasNavigation && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "usa-menu-btn align-center", children: useMenuIcon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", size: 3 }) : "Menu" })
3677
3735
  ] });
3678
3736
  if (extended) {
3679
3737
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3680
- /* @__PURE__ */ jsxRuntime.jsx("header", { id, className: headerClasses, ...props2, children: navbar }),
3681
- /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-nav__inner", children: [
3738
+ /* @__PURE__ */ jsxRuntime.jsx("header", { id, className: headerClasses, ...props2, ...extraAttributes, children: navbar }),
3739
+ hasNavigation && /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "Primary navigation", className: navClasses, ...(extraAttributes == null ? void 0 : extraAttributes["data-enhanced"]) === "true" ? { "data-enhanced": "true" } : {}, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-nav__inner", children: [
3682
3740
  /* @__PURE__ */ jsxRuntime.jsx(
3683
3741
  PrimaryNav,
3684
3742
  {
@@ -3709,9 +3767,9 @@
3709
3767
  ] }) })
3710
3768
  ] });
3711
3769
  }
3712
- return /* @__PURE__ */ jsxRuntime.jsx("header", { id, className: headerClasses, ...props2, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-nav-container", children: [
3770
+ return /* @__PURE__ */ jsxRuntime.jsx("header", { id, className: headerClasses, ...props2, ...extraAttributes, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-nav-container", children: [
3713
3771
  navbar,
3714
- /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
3772
+ hasNavigation && /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
3715
3773
  PrimaryNav,
3716
3774
  {
3717
3775
  navSections,
@@ -3787,7 +3845,7 @@
3787
3845
  }
3788
3846
  return content;
3789
3847
  }
3790
- function IconList({ items = [], primary = false, size = null, className = "", ...props2 }) {
3848
+ function IconList({ items = [], caption, primary = false, size = null, className = "", ...props2 }) {
3791
3849
  const classes = ClassNames(
3792
3850
  "usa-icon-list",
3793
3851
  "usx-icon-list",
@@ -3795,7 +3853,7 @@
3795
3853
  size === "lg" && "usa-icon-list--size-lg",
3796
3854
  className
3797
3855
  );
3798
- return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: classes, ...props2, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: ClassNames("usa-icon-list__item", item.itemClassName), children: [
3856
+ const list = /* @__PURE__ */ jsxRuntime.jsx("ul", { className: classes, ...props2, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: ClassNames("usa-icon-list__item", item.itemClassName), children: [
3799
3857
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: ClassNames("usa-icon-list__icon", item.iconColor && `text-${item.iconColor}`, item.iconClassName), children: /* @__PURE__ */ jsxRuntime.jsx(
3800
3858
  Icon,
3801
3859
  {
@@ -3810,6 +3868,10 @@
3810
3868
  renderContent(item.content)
3811
3869
  ] })
3812
3870
  ] }, index)) });
3871
+ return caption ? /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "usx-list-figure", children: [
3872
+ /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "usx-list-figure__caption", children: caption }),
3873
+ list
3874
+ ] }) : list;
3813
3875
  }
3814
3876
  const defaultRequiredLinks = {
3815
3877
  en: [
@@ -3944,6 +4006,7 @@
3944
4006
  children = null,
3945
4007
  className = "",
3946
4008
  contentClassName = "",
4009
+ extraAttributes,
3947
4010
  ...props2
3948
4011
  }) {
3949
4012
  const contentId = `${id}-content`;
@@ -3962,7 +4025,8 @@
3962
4025
  "data-root-margin": rootMargin,
3963
4026
  "data-threshold": threshold,
3964
4027
  "data-minimum-heading-count": minimumHeadingCount,
3965
- ...props2
4028
+ ...props2,
4029
+ ...extraAttributes
3966
4030
  }
3967
4031
  ),
3968
4032
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4000,14 +4064,14 @@
4000
4064
  description ? ` (${description})` : null
4001
4065
  ] });
4002
4066
  }
4003
- function TwoLanguageSelector({ target, onSelect, className, navAriaLabel }) {
4067
+ function TwoLanguageSelector({ target, onSelect, className, navAriaLabel, extraAttributes }) {
4004
4068
  const handleClick = (event) => {
4005
4069
  if (onSelect) onSelect(target, event);
4006
4070
  if (!target.href) event.preventDefault();
4007
4071
  };
4008
4072
  const Tag2 = target.href ? "a" : "button";
4009
4073
  const tagProps = target.href ? { href: target.href } : { type: "button" };
4010
- return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": navAriaLabel, className, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-language-container", children: /* @__PURE__ */ jsxRuntime.jsx(Tag2, { className: "usa-button usx-button usa-button--primary", onClick: handleClick, ...tagProps, children: /* @__PURE__ */ jsxRuntime.jsx(LanguageLabel, { code: target.code, label: target.label }) }) }) });
4074
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": navAriaLabel, className, ...extraAttributes, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-language-container", children: /* @__PURE__ */ jsxRuntime.jsx(Tag2, { className: "usa-button usx-button usa-button--primary", onClick: handleClick, ...tagProps, children: /* @__PURE__ */ jsxRuntime.jsx(LanguageLabel, { code: target.code, label: target.label }) }) }) });
4011
4075
  }
4012
4076
  function MenuLanguageSelector({
4013
4077
  languages,
@@ -4017,7 +4081,8 @@
4017
4081
  id,
4018
4082
  onSelect,
4019
4083
  className,
4020
- navAriaLabel
4084
+ navAriaLabel,
4085
+ extraAttributes
4021
4086
  }) {
4022
4087
  const containerClasses = ClassNames(
4023
4088
  "usa-language-container",
@@ -4029,7 +4094,7 @@
4029
4094
  unstyled ? "usa-button--unstyled" : "usa-button--primary",
4030
4095
  "usa-language__link"
4031
4096
  );
4032
- return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": navAriaLabel, className, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClasses, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-language__primary usa-accordion", children: /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "usa-language__primary-item", children: [
4097
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": navAriaLabel, className, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClasses, ...extraAttributes, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-language__primary usa-accordion", children: /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "usa-language__primary-item", children: [
4033
4098
  /* @__PURE__ */ jsxRuntime.jsx(
4034
4099
  "button",
4035
4100
  {
@@ -4064,12 +4129,13 @@
4064
4129
  navAriaLabel = "Language selection",
4065
4130
  className = "",
4066
4131
  onSelect = null,
4132
+ extraAttributes,
4067
4133
  ...props2
4068
4134
  }) {
4069
4135
  const resolvedVariant = variant || (languages.length > 2 ? "menu" : "two");
4070
4136
  const classes = ClassNames("usx-language-selector", className);
4071
4137
  if (!languages || languages.length === 0) {
4072
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, children: "LanguageSelector" });
4138
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...extraAttributes, children: "LanguageSelector" });
4073
4139
  }
4074
4140
  if (resolvedVariant === "two") {
4075
4141
  const target = languages.find((lang) => !lang.current) || languages[1] || languages[0];
@@ -4080,6 +4146,7 @@
4080
4146
  onSelect,
4081
4147
  className: classes,
4082
4148
  navAriaLabel,
4149
+ extraAttributes,
4083
4150
  ...props2
4084
4151
  }
4085
4152
  );
@@ -4095,6 +4162,7 @@
4095
4162
  onSelect,
4096
4163
  className: classes,
4097
4164
  navAriaLabel,
4165
+ extraAttributes,
4098
4166
  ...props2
4099
4167
  }
4100
4168
  );
@@ -4160,6 +4228,7 @@
4160
4228
  expandable = false,
4161
4229
  onToggleExpanded,
4162
4230
  className = "",
4231
+ extraAttributes,
4163
4232
  ...props2
4164
4233
  }) {
4165
4234
  const [expanded, setExpanded] = React.useState(false);
@@ -4190,7 +4259,7 @@
4190
4259
  ]
4191
4260
  }
4192
4261
  ) : null;
4193
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...props2, children: variant === "single-column" ? /* @__PURE__ */ jsxRuntime.jsx(SingleColumnLayout, { expandButton, children: children || content }) : variant === "grid" ? /* @__PURE__ */ jsxRuntime.jsx(
4262
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...props2, ...extraAttributes, children: variant === "single-column" ? /* @__PURE__ */ jsxRuntime.jsx(SingleColumnLayout, { expandButton, children: children || content }) : variant === "grid" ? /* @__PURE__ */ jsxRuntime.jsx(
4194
4263
  GridLayout,
4195
4264
  {
4196
4265
  leftSidebar,
@@ -4229,7 +4298,7 @@
4229
4298
  ] }, index);
4230
4299
  });
4231
4300
  }
4232
- function List({ items = [], ordered = false, unstyled = false, className = "", ...props2 }) {
4301
+ function List({ items = [], caption, ordered = false, unstyled = false, className = "", ...props2 }) {
4233
4302
  const classes = ClassNames(
4234
4303
  "usa-list",
4235
4304
  "usx-list",
@@ -4237,7 +4306,11 @@
4237
4306
  className
4238
4307
  );
4239
4308
  const Tag2 = ordered ? "ol" : "ul";
4240
- return /* @__PURE__ */ jsxRuntime.jsx(Tag2, { className: classes, ...props2, children: renderItems(items, { ordered, unstyled }) });
4309
+ const list = /* @__PURE__ */ jsxRuntime.jsx(Tag2, { className: classes, ...props2, children: renderItems(items, { ordered, unstyled }) });
4310
+ return caption ? /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "usx-list-figure", children: [
4311
+ /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "usx-list-figure__caption", children: caption }),
4312
+ list
4313
+ ] }) : list;
4241
4314
  }
4242
4315
  const MONTH_OPTIONS = [
4243
4316
  { value: "1", label: "January" },
@@ -4269,6 +4342,12 @@
4269
4342
  defaultMonth,
4270
4343
  defaultDay,
4271
4344
  defaultYear,
4345
+ month,
4346
+ day,
4347
+ year,
4348
+ onMonthChange,
4349
+ onDayChange,
4350
+ onYearChange,
4272
4351
  disabled = false,
4273
4352
  ariaDisabled = false,
4274
4353
  required = false,
@@ -4298,7 +4377,8 @@
4298
4377
  label: monthLabel,
4299
4378
  options: MONTH_OPTIONS,
4300
4379
  placeholder: "- Select -",
4301
- defaultValue: defaultMonth,
4380
+ ...month !== void 0 ? { value: month } : { defaultValue: defaultMonth },
4381
+ onChange: onMonthChange,
4302
4382
  required,
4303
4383
  "aria-describedby": describedBy(monthHintId),
4304
4384
  "aria-invalid": hasError || void 0,
@@ -4317,7 +4397,8 @@
4317
4397
  name: dayName || dayId,
4318
4398
  label: dayLabel,
4319
4399
  placeholder: "",
4320
- defaultValue: defaultDay,
4400
+ ...day !== void 0 ? { value: day } : { defaultValue: defaultDay },
4401
+ onChange: onDayChange,
4321
4402
  maxLength: 2,
4322
4403
  pattern: "[0-9]*",
4323
4404
  inputMode: "numeric",
@@ -4338,7 +4419,8 @@
4338
4419
  name: yearName || yearId,
4339
4420
  label: yearLabel,
4340
4421
  placeholder: "",
4341
- defaultValue: defaultYear,
4422
+ ...year !== void 0 ? { value: year } : { defaultValue: defaultYear },
4423
+ onChange: onYearChange,
4342
4424
  minLength: 4,
4343
4425
  maxLength: 4,
4344
4426
  pattern: "[0-9]*",
@@ -4442,6 +4524,7 @@
4442
4524
  forceAction = false,
4443
4525
  className = "",
4444
4526
  children,
4527
+ extraAttributes,
4445
4528
  ...props2
4446
4529
  }) {
4447
4530
  const classes = ClassNames("usa-modal", "usx-modal", {
@@ -4457,6 +4540,7 @@
4457
4540
  "aria-describedby": `${id}-description`,
4458
4541
  ...forceAction ? { "data-force-action": true } : {},
4459
4542
  ...props2,
4543
+ ...extraAttributes,
4460
4544
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-modal__content", children: [
4461
4545
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-modal__main", children: [
4462
4546
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "usa-modal__heading", id: `${id}-heading`, children: heading }),
@@ -4525,6 +4609,7 @@
4525
4609
  summaryProps,
4526
4610
  panelClassName,
4527
4611
  contentClassName,
4612
+ extraAttributes,
4528
4613
  children,
4529
4614
  ...props2
4530
4615
  }) {
@@ -4539,6 +4624,7 @@
4539
4624
  open: initiallyOpen || void 0,
4540
4625
  "data-side": side,
4541
4626
  "data-align": align,
4627
+ ...extraAttributes,
4542
4628
  children: [
4543
4629
  /* @__PURE__ */ jsxRuntime.jsx(Summary, { unstyled: true, ...composedSummaryProps }),
4544
4630
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4639,6 +4725,7 @@
4639
4725
  textPreposition = "of",
4640
4726
  formGroup = true,
4641
4727
  className = "",
4728
+ extraAttributes,
4642
4729
  ...props2
4643
4730
  }) {
4644
4731
  const hintId = hint ? `${id}-hint` : void 0;
@@ -4658,14 +4745,14 @@
4658
4745
  min,
4659
4746
  max,
4660
4747
  step,
4661
- value: typeof value !== "undefined" ? value : void 0,
4662
- defaultValue,
4748
+ ...value !== void 0 ? { value } : { defaultValue },
4663
4749
  disabled,
4664
4750
  required,
4665
4751
  "aria-describedby": describedBy,
4666
4752
  ...textUnit ? { "data-text-unit": textUnit } : {},
4667
4753
  ...textPreposition ? { "data-text-preposition": textPreposition } : {},
4668
- ...props2
4754
+ ...props2,
4755
+ ...extraAttributes
4669
4756
  }
4670
4757
  )
4671
4758
  ] });
@@ -4915,53 +5002,16 @@
4915
5002
  ] });
4916
5003
  return /* @__PURE__ */ jsxRuntime.jsx("label", { className: classes, ...props2, children: content });
4917
5004
  };
4918
- const Switch = ({
4919
- id,
4920
- name,
4921
- checked,
4922
- defaultChecked,
4923
- disabled = false,
4924
- onChange,
4925
- size = "md",
4926
- variant = "",
4927
- className = "",
4928
- label,
4929
- indeterminate = false,
4930
- ...props2
4931
- }) => {
4932
- const classes = ClassNames(
4933
- "usx-switch",
4934
- size && `usx-toggle-${size}`,
4935
- variant && `text-${variant}`,
4936
- className
4937
- );
4938
- const ref = React.useRef(null);
4939
- React.useEffect(() => {
4940
- if (ref.current) {
4941
- ref.current.indeterminate = Boolean(indeterminate);
5005
+ function Switch({ className, labelClassName, color, ...props2 }) {
5006
+ return /* @__PURE__ */ jsxRuntime.jsx(
5007
+ Checkbox,
5008
+ {
5009
+ ...props2,
5010
+ className: ClassNames("usx-switch", className),
5011
+ labelClassName: ClassNames(labelClassName, color && `before-${color}`)
4942
5012
  }
4943
- }, [indeterminate]);
4944
- const inputProps = {
4945
- id,
4946
- name,
4947
- type: "checkbox",
4948
- className: classes,
4949
- checked: typeof checked === "boolean" ? checked : void 0,
4950
- defaultChecked,
4951
- disabled,
4952
- "aria-checked": indeterminate ? "mixed" : typeof checked === "boolean" ? checked : void 0,
4953
- onChange,
4954
- ...props2
4955
- };
4956
- const input = /* @__PURE__ */ jsxRuntime.jsx("input", { ref, ...inputProps });
4957
- if (label) {
4958
- return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "usa-label usx-switch__label", children: [
4959
- input,
4960
- label
4961
- ] });
4962
- }
4963
- return input;
4964
- };
5013
+ );
5014
+ }
4965
5015
  function Table({
4966
5016
  columns = [],
4967
5017
  data = [],
@@ -4975,6 +5025,7 @@
4975
5025
  responsive = false,
4976
5026
  className,
4977
5027
  children,
5028
+ extraAttributes,
4978
5029
  ...props2
4979
5030
  }) {
4980
5031
  const hasSorting = !children && columns.some((column) => column.sortable);
@@ -4983,6 +5034,7 @@
4983
5034
  "table",
4984
5035
  {
4985
5036
  ...props2,
5037
+ ...extraAttributes,
4986
5038
  className: ClassNames(
4987
5039
  "usa-table",
4988
5040
  "usx-table",
@@ -5025,19 +5077,6 @@
5025
5077
  }
5026
5078
  ) : table;
5027
5079
  }
5028
- const TagGroup = ({
5029
- tagProps = null,
5030
- children = null,
5031
- className = "",
5032
- ...props2
5033
- }) => {
5034
- const classes = ClassNames(
5035
- "usx-tag-group",
5036
- className
5037
- );
5038
- const content = children ? children : Array.isArray(tagProps) ? tagProps.map((t, i) => /* @__PURE__ */ jsxRuntime.jsx(Tag, { ...t }, t.id || t.value || i)) : null;
5039
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...props2, children: content });
5040
- };
5041
5080
  function TaskList({ tasks = [], className }) {
5042
5081
  return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: ClassNames("usx-task-list", className), children: tasks == null ? void 0 : tasks.map((task, i) => {
5043
5082
  return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(Clickable, { href: task.href, className: "usx-task-list__item", children: [
@@ -5054,66 +5093,107 @@
5054
5093
  name,
5055
5094
  label = "Theme",
5056
5095
  themes = [],
5096
+ variant = "default",
5057
5097
  value,
5058
5098
  defaultValue,
5059
5099
  onChange,
5060
- className = ""
5100
+ className = "",
5101
+ extraAttributes
5061
5102
  }) {
5062
- var _a;
5103
+ var _a, _b, _c, _d, _e, _f;
5063
5104
  const selectId = id || "theme-picker";
5064
- const selection = value !== void 0 ? { value } : { defaultValue: defaultValue ?? ((_a = themes[0]) == null ? void 0 : _a.value) };
5065
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ClassNames("usx-theme-picker", className), children: [
5105
+ const [localValue, setLocalValue] = React.useState(defaultValue ?? ((_a = themes[0]) == null ? void 0 : _a.value) ?? "");
5106
+ const selectedValue = value ?? localValue;
5107
+ const selectedLabel = ((_b = themes.find((option) => option.value === selectedValue)) == null ? void 0 : _b.label) ?? label;
5108
+ const choose = (next) => {
5109
+ if (value === void 0) setLocalValue(next);
5110
+ onChange == null ? void 0 : onChange(next);
5111
+ };
5112
+ const select = (hidden = false) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5113
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: selectId, screenReaderOnly: true, children: label }),
5066
5114
  /* @__PURE__ */ jsxRuntime.jsx(
5067
- "button",
5115
+ "select",
5068
5116
  {
5069
- type: "button",
5070
- className: "usa-button usx-button usx-button--ghost usx-theme-picker__trigger",
5071
- "aria-label": label,
5072
- "aria-expanded": "false",
5073
- "aria-controls": `${selectId}-panel`,
5074
- children: /* @__PURE__ */ jsxRuntime.jsx(PaletteIcon, {})
5117
+ id: selectId,
5118
+ name,
5119
+ className: ClassNames(
5120
+ "usa-select usx-select",
5121
+ hidden && "usx-theme-picker__select--hidden"
5122
+ ),
5123
+ value: selectedValue,
5124
+ onChange: (event) => choose(event.target.value),
5125
+ children: themes.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
5075
5126
  }
5076
- ),
5077
- /* @__PURE__ */ jsxRuntime.jsxs("div", { id: `${selectId}-panel`, className: "usx-theme-picker__panel", children: [
5078
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: selectId, screenReaderOnly: true, children: label }),
5079
- /* @__PURE__ */ jsxRuntime.jsx(
5080
- "select",
5081
- {
5082
- id: selectId,
5083
- name,
5084
- className: "usa-select usx-select",
5085
- ...selection,
5086
- onChange: (event) => onChange == null ? void 0 : onChange(event.target.value),
5087
- children: themes.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
5088
- }
5089
- ),
5090
- /* @__PURE__ */ jsxRuntime.jsx(
5091
- "button",
5092
- {
5093
- type: "button",
5094
- className: "usa-button usx-button usa-button--primary usx-theme-picker__toggle",
5095
- "aria-label": "Confirm theme",
5096
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "close", className: "usx-theme-picker__icon" })
5097
- }
5098
- )
5099
- ] })
5127
+ )
5100
5128
  ] });
5101
- }
5102
- function PaletteIcon() {
5103
- return /* @__PURE__ */ jsxRuntime.jsx(
5104
- "svg",
5129
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5130
+ "div",
5105
5131
  {
5106
- className: "usa-icon usx-theme-picker__icon",
5107
- "aria-hidden": "true",
5108
- focusable: "false",
5109
- viewBox: "0 0 24 24",
5110
- children: /* @__PURE__ */ jsxRuntime.jsx(
5111
- "path",
5112
- {
5113
- fill: "currentColor",
5114
- d: "M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"
5115
- }
5116
- )
5132
+ className: ClassNames(
5133
+ "usx-theme-picker",
5134
+ variant !== "default" && `usx-theme-picker--${variant}`,
5135
+ className
5136
+ ),
5137
+ ...extraAttributes,
5138
+ children: [
5139
+ variant === "default" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5140
+ /* @__PURE__ */ jsxRuntime.jsx(
5141
+ "button",
5142
+ {
5143
+ type: "button",
5144
+ className: "usa-button usx-button usx-button--ghost usx-theme-picker__trigger",
5145
+ "aria-label": label,
5146
+ "aria-expanded": "false",
5147
+ "aria-controls": `${selectId}-panel`,
5148
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "color_palette", source: "usx", className: "usx-theme-picker__icon" })
5149
+ }
5150
+ ),
5151
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { id: `${selectId}-panel`, className: "usx-theme-picker__panel", children: [
5152
+ select(),
5153
+ /* @__PURE__ */ jsxRuntime.jsx(
5154
+ "button",
5155
+ {
5156
+ type: "button",
5157
+ className: "usa-button usx-button usa-button--primary usx-theme-picker__toggle",
5158
+ "aria-label": "Confirm theme",
5159
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "close", className: "usx-theme-picker__icon" })
5160
+ }
5161
+ )
5162
+ ] })
5163
+ ] }),
5164
+ variant === "swap" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5165
+ /* @__PURE__ */ jsxRuntime.jsx(
5166
+ Swap,
5167
+ {
5168
+ className: "usx-theme-picker__swap usa-button usx-button usx-button--ghost",
5169
+ variant: "rotate",
5170
+ inputProps: {
5171
+ checked: selectedValue === ((_c = themes[1]) == null ? void 0 : _c.value),
5172
+ "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}`,
5173
+ onChange: (event) => {
5174
+ var _a2;
5175
+ event.stopPropagation();
5176
+ choose(((_a2 = themes[event.target.checked ? 1 : 0]) == null ? void 0 : _a2.value) ?? "");
5177
+ }
5178
+ },
5179
+ offContent: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "sun", source: "usx", className: "usx-theme-picker__icon" }),
5180
+ onContent: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "moon", source: "usx", className: "usx-theme-picker__icon" })
5181
+ }
5182
+ ),
5183
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-theme-picker__fallback", children: select() })
5184
+ ] }),
5185
+ variant === "ghost-select" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usx-theme-picker__ghost", children: [
5186
+ /* @__PURE__ */ jsxRuntime.jsx(
5187
+ "span",
5188
+ {
5189
+ className: "usa-button usx-button usx-button--ghost usx-theme-picker__ghost-face",
5190
+ "aria-hidden": "true",
5191
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "color_palette", source: "usx", className: "usx-theme-picker__icon" })
5192
+ }
5193
+ ),
5194
+ select(true)
5195
+ ] })
5196
+ ]
5117
5197
  }
5118
5198
  );
5119
5199
  }
@@ -5127,11 +5207,13 @@
5127
5207
  ariaDisabled = false,
5128
5208
  required = false,
5129
5209
  defaultValue = null,
5210
+ value,
5130
5211
  minTime = null,
5131
5212
  maxTime = null,
5132
5213
  step = null,
5133
5214
  formGroup = true,
5134
5215
  className = "",
5216
+ extraAttributes,
5135
5217
  ...props2
5136
5218
  }) {
5137
5219
  const labelId = `${id}-label`;
@@ -5156,6 +5238,7 @@
5156
5238
  /* @__PURE__ */ jsxRuntime.jsx(
5157
5239
  "div",
5158
5240
  {
5241
+ ...extraAttributes,
5159
5242
  className: containerClasses,
5160
5243
  ...minTime ? { "data-min-time": minTime } : {},
5161
5244
  ...maxTime ? { "data-max-time": maxTime } : {},
@@ -5168,7 +5251,7 @@
5168
5251
  name: name || id,
5169
5252
  type: "text",
5170
5253
  "aria-describedby": describedBy,
5171
- defaultValue: defaultValue || void 0,
5254
+ ...value !== void 0 ? { value } : { defaultValue: defaultValue || void 0 },
5172
5255
  disabled,
5173
5256
  "aria-disabled": !disabled && ariaDisabled ? "true" : void 0,
5174
5257
  required,