@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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { useState, useRef, useEffect, createContext, useContext, useId, createElement } from "react";
2
+ import React, { useState, createContext, useContext, useId, useRef, createElement } from "react";
3
3
  function getDefaultExportFromCjs(x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
5
  }
@@ -119,6 +119,7 @@ function Accordion({
119
119
  className = "",
120
120
  headingClassName = "",
121
121
  contentClassName = "",
122
+ extraAttributes,
122
123
  ...props2
123
124
  }) {
124
125
  const accordionClasses = ClassNames(
@@ -135,6 +136,7 @@ function Accordion({
135
136
  className: accordionClasses,
136
137
  "data-allow-multiple": multiselectable ? true : void 0,
137
138
  ...props2,
139
+ ...extraAttributes,
138
140
  children: items.map((item) => /* @__PURE__ */ jsx(
139
141
  AccordionItem,
140
142
  {
@@ -409,6 +411,7 @@ function Banner({
409
411
  " website. Share sensitive information only on official, secure websites."
410
412
  ] }),
411
413
  className = "",
414
+ extraAttributes,
412
415
  ...props2
413
416
  }) {
414
417
  const classes = ClassNames(
@@ -416,7 +419,7 @@ function Banner({
416
419
  "usx-banner",
417
420
  className
418
421
  );
419
- return /* @__PURE__ */ jsx("section", { id, className: classes, "aria-label": ariaLabel, ...props2, children: /* @__PURE__ */ jsxs("div", { id: `${id}-accordion`, className: "usa-accordion", children: [
422
+ return /* @__PURE__ */ jsx("section", { id, className: classes, "aria-label": ariaLabel, ...props2, ...extraAttributes, children: /* @__PURE__ */ jsxs("div", { id: `${id}-accordion`, className: "usa-accordion", children: [
420
423
  /* @__PURE__ */ jsx("header", { className: "usa-banner__header", children: /* @__PURE__ */ jsxs("div", { className: "usa-banner__inner", children: [
421
424
  /* @__PURE__ */ jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsx(
422
425
  "img",
@@ -1048,6 +1051,8 @@ function Input({
1048
1051
  screenReaderOnlyLabel = false,
1049
1052
  formGroup = true,
1050
1053
  className = "",
1054
+ value,
1055
+ defaultValue,
1051
1056
  ...props2
1052
1057
  }) {
1053
1058
  const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
@@ -1073,6 +1078,7 @@ function Input({
1073
1078
  required,
1074
1079
  "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
1075
1080
  "aria-invalid": hasError ? true : void 0,
1081
+ ...value !== void 0 ? { value } : { defaultValue },
1076
1082
  ...props2
1077
1083
  };
1078
1084
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1090,6 +1096,7 @@ const TextArea = ({
1090
1096
  disabled = false,
1091
1097
  required = false,
1092
1098
  defaultValue = "",
1099
+ value,
1093
1100
  hint = null,
1094
1101
  screenReaderOnlyLabel = false,
1095
1102
  error = null,
@@ -1122,7 +1129,7 @@ const TextArea = ({
1122
1129
  className: classes,
1123
1130
  placeholder,
1124
1131
  disabled,
1125
- defaultValue: props2.value === void 0 ? defaultValue : void 0,
1132
+ ...value !== void 0 ? { value } : { defaultValue },
1126
1133
  ...required ? { required: true } : {},
1127
1134
  "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
1128
1135
  "aria-invalid": hasError ? "true" : void 0,
@@ -1145,6 +1152,7 @@ function CharacterCount({
1145
1152
  placeholder = "",
1146
1153
  textArea = false,
1147
1154
  className = "",
1155
+ extraAttributes,
1148
1156
  ...props2
1149
1157
  }) {
1150
1158
  const fieldId = id || `character-count-${Math.random().toString(36).substr(2, 9)}`;
@@ -1166,7 +1174,8 @@ function CharacterCount({
1166
1174
  formGroup: true,
1167
1175
  className: "usa-character-count__field",
1168
1176
  "aria-describedby": [infoId, hintId, errorId].filter(Boolean).join(" "),
1169
- ...props2
1177
+ ...props2,
1178
+ ...extraAttributes
1170
1179
  };
1171
1180
  return /* @__PURE__ */ jsxs("div", { className: outerClasses, children: [
1172
1181
  textArea ? /* @__PURE__ */ jsx(TextArea, { ...fieldProps }) : /* @__PURE__ */ jsx(Input, { ...fieldProps }),
@@ -1184,7 +1193,7 @@ function Checkbox({
1184
1193
  label = "",
1185
1194
  ariaLabel = "",
1186
1195
  checked,
1187
- indeterminate = false,
1196
+ defaultChecked,
1188
1197
  disabled = false,
1189
1198
  description = "",
1190
1199
  tile = false,
@@ -1192,15 +1201,12 @@ function Checkbox({
1192
1201
  error,
1193
1202
  success,
1194
1203
  className = "",
1204
+ labelClassName = "",
1195
1205
  onChange,
1196
1206
  required = false,
1197
1207
  formGroup = true,
1198
1208
  ...props2
1199
1209
  }) {
1200
- const inputRef = useRef(null);
1201
- useEffect(() => {
1202
- if (inputRef.current) inputRef.current.indeterminate = indeterminate;
1203
- }, [indeterminate]);
1204
1210
  const hasError = !!error;
1205
1211
  const hasSuccess = !!success;
1206
1212
  const divClasses = ClassNames(
@@ -1209,32 +1215,37 @@ function Checkbox({
1209
1215
  { "usx-checkbox--small": small },
1210
1216
  className
1211
1217
  );
1212
- const inputClasses = ClassNames(
1213
- "usa-checkbox__input",
1214
- { "usa-checkbox__input--tile": tile }
1215
- );
1218
+ const inputClasses = ClassNames("usa-checkbox__input", { "usa-checkbox__input--tile": tile });
1216
1219
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
1217
1220
  /* @__PURE__ */ jsxs("div", { className: divClasses, ...props2, children: [
1218
1221
  /* @__PURE__ */ jsx(
1219
1222
  "input",
1220
1223
  {
1221
- ref: inputRef,
1222
1224
  className: inputClasses,
1223
1225
  id,
1224
1226
  type: "checkbox",
1225
1227
  name,
1226
1228
  value,
1227
1229
  "aria-label": ariaLabel || void 0,
1228
- ...checked !== void 0 && onChange ? { checked } : { defaultChecked: checked },
1230
+ ...checked !== void 0 && onChange ? { checked } : { defaultChecked: checked ?? defaultChecked },
1229
1231
  disabled,
1230
1232
  required,
1231
1233
  ...onChange ? { onChange } : {}
1232
1234
  }
1233
1235
  ),
1234
- /* @__PURE__ */ jsxs(Label, { className: "usa-checkbox__label", classOverride: true, htmlFor: id, required, children: [
1235
- label,
1236
- description && /* @__PURE__ */ jsx("span", { className: "usa-checkbox__label-description", children: description })
1237
- ] })
1236
+ /* @__PURE__ */ jsxs(
1237
+ Label,
1238
+ {
1239
+ className: ClassNames("usa-checkbox__label", labelClassName),
1240
+ classOverride: true,
1241
+ htmlFor: id,
1242
+ required,
1243
+ children: [
1244
+ label,
1245
+ description && /* @__PURE__ */ jsx("span", { className: "usa-checkbox__label-description", children: description })
1246
+ ]
1247
+ }
1248
+ )
1238
1249
  ] }),
1239
1250
  hasError ? /* @__PURE__ */ jsx(ErrorMessage, { children: error }) : hasSuccess ? /* @__PURE__ */ jsx("span", { className: "usa-success-message text-success", role: "status", children: success }) : null
1240
1251
  ] });
@@ -1451,12 +1462,14 @@ function Combobox({
1451
1462
  hint = null,
1452
1463
  placeholder,
1453
1464
  defaultValue = null,
1465
+ value,
1454
1466
  error = null,
1455
1467
  options = [],
1456
1468
  onSearch,
1457
1469
  onSelect,
1458
1470
  formGroup = true,
1459
1471
  className = "",
1472
+ extraAttributes,
1460
1473
  ...props2
1461
1474
  }) {
1462
1475
  const labelId = `${id}-label`;
@@ -1478,6 +1491,7 @@ function Combobox({
1478
1491
  /* @__PURE__ */ jsx(
1479
1492
  "div",
1480
1493
  {
1494
+ ...extraAttributes,
1481
1495
  className: ClassNames(
1482
1496
  "usa-combo-box",
1483
1497
  "usx-combo-box",
@@ -1485,7 +1499,7 @@ function Combobox({
1485
1499
  className
1486
1500
  ),
1487
1501
  ...placeholder ? { "data-placeholder": placeholder } : {},
1488
- ...defaultValue ? { "data-default-value": defaultValue } : {},
1502
+ ...value ?? defaultValue ? { "data-default-value": value ?? defaultValue } : {},
1489
1503
  ...onSearch ? { onInput: handleInput } : {},
1490
1504
  children: /* @__PURE__ */ jsx(
1491
1505
  "select",
@@ -1893,7 +1907,7 @@ const RadioButtons = ({
1893
1907
  name,
1894
1908
  value: opt.value,
1895
1909
  "aria-label": opt.ariaLabel,
1896
- ...value !== void 0 && onChange ? { checked: value === opt.value } : { defaultChecked: defaultValue === opt.value || !!opt.checked },
1910
+ ...value !== void 0 && onChange ? { checked: value === opt.value } : { defaultChecked: (value ?? defaultValue) !== void 0 ? (value ?? defaultValue) === opt.value : !!opt.checked },
1897
1911
  onChange,
1898
1912
  disabled: !!opt.disabled
1899
1913
  }
@@ -2329,6 +2343,7 @@ function Select({
2329
2343
  name,
2330
2344
  options = [],
2331
2345
  defaultValue,
2346
+ value,
2332
2347
  placeholder = "Select an option",
2333
2348
  error,
2334
2349
  success,
@@ -2362,7 +2377,7 @@ function Select({
2362
2377
  className: combinedSelectClasses,
2363
2378
  disabled,
2364
2379
  required: required || void 0,
2365
- defaultValue,
2380
+ ...value !== void 0 ? { value } : { defaultValue },
2366
2381
  "aria-describedby": describedByParts.length ? describedByParts.join(" ") : void 0,
2367
2382
  "aria-invalid": hasError ? true : void 0,
2368
2383
  ...props2
@@ -2559,6 +2574,7 @@ function DataTable({
2559
2574
  placeholder = "No rows to display",
2560
2575
  className = "",
2561
2576
  children,
2577
+ extraAttributes,
2562
2578
  ...props2
2563
2579
  }) {
2564
2580
  const generatedId = useId();
@@ -2642,6 +2658,7 @@ function DataTable({
2642
2658
  "data-initial-sort-direction": (initialSort == null ? void 0 : initialSort.direction) || void 0,
2643
2659
  "data-total-count": pageConfig.totalCount,
2644
2660
  "data-infinite": infinite || void 0,
2661
+ ...extraAttributes,
2645
2662
  children: [
2646
2663
  searchable && /* @__PURE__ */ jsx("div", { className: "usx-data-table__toolbar", children: /* @__PURE__ */ jsx(Input, { id: `${id}-search`, label: "Search", formGroup: false, placeholder: searchPlaceholder }) }),
2647
2664
  scrollable || height ? /* @__PURE__ */ jsx(
@@ -2689,11 +2706,13 @@ function DatePicker({
2689
2706
  disabled = false,
2690
2707
  required = false,
2691
2708
  defaultValue = null,
2709
+ value,
2692
2710
  minDate = null,
2693
2711
  maxDate = null,
2694
2712
  rangeDate = null,
2695
2713
  formGroup = true,
2696
2714
  className = "",
2715
+ extraAttributes,
2697
2716
  ...props2
2698
2717
  }) {
2699
2718
  const labelId = `${id}-label`;
@@ -2707,8 +2726,9 @@ function DatePicker({
2707
2726
  /* @__PURE__ */ jsx(
2708
2727
  "div",
2709
2728
  {
2729
+ ...extraAttributes,
2710
2730
  className: ClassNames("usa-date-picker", "usx-date-picker", className),
2711
- ...defaultValue ? { "data-default-value": defaultValue } : {},
2731
+ ...value ?? defaultValue ? { "data-default-value": value ?? defaultValue } : {},
2712
2732
  ...minDate ? { "data-min-date": minDate } : {},
2713
2733
  ...maxDate ? { "data-max-date": maxDate } : {},
2714
2734
  ...rangeDate ? { "data-range-date": rangeDate } : {},
@@ -2749,9 +2769,12 @@ function DateRangePicker({
2749
2769
  required = false,
2750
2770
  defaultStartDate = null,
2751
2771
  defaultEndDate = null,
2772
+ startDate,
2773
+ endDate,
2752
2774
  minDate = null,
2753
2775
  maxDate = null,
2754
- className = ""
2776
+ className = "",
2777
+ extraAttributes
2755
2778
  }) {
2756
2779
  const startLabelId = `${startId}-label`;
2757
2780
  const startHintId = startHint ? `${startId}-hint` : void 0;
@@ -2764,6 +2787,7 @@ function DateRangePicker({
2764
2787
  return /* @__PURE__ */ jsxs(
2765
2788
  "div",
2766
2789
  {
2790
+ ...extraAttributes,
2767
2791
  className: ClassNames("usa-date-range-picker", "usx-date-range-picker", className),
2768
2792
  ...minDate ? { "data-min-date": minDate } : {},
2769
2793
  ...maxDate ? { "data-max-date": maxDate } : {},
@@ -2775,8 +2799,9 @@ function DateRangePicker({
2775
2799
  /* @__PURE__ */ jsx(
2776
2800
  "div",
2777
2801
  {
2802
+ "data-enhanced": (extraAttributes == null ? void 0 : extraAttributes["data-enhanced"]) === "true" ? "true" : void 0,
2778
2803
  className: "usa-date-picker usx-date-picker",
2779
- ...defaultStartDate ? { "data-default-value": defaultStartDate } : {},
2804
+ ...startDate ?? defaultStartDate ? { "data-default-value": startDate ?? defaultStartDate } : {},
2780
2805
  children: /* @__PURE__ */ jsx(
2781
2806
  "input",
2782
2807
  {
@@ -2799,8 +2824,9 @@ function DateRangePicker({
2799
2824
  /* @__PURE__ */ jsx(
2800
2825
  "div",
2801
2826
  {
2827
+ "data-enhanced": (extraAttributes == null ? void 0 : extraAttributes["data-enhanced"]) === "true" ? "true" : void 0,
2802
2828
  className: "usa-date-picker usx-date-picker",
2803
- ...defaultEndDate ? { "data-default-value": defaultEndDate } : {},
2829
+ ...endDate ?? defaultEndDate ? { "data-default-value": endDate ?? defaultEndDate } : {},
2804
2830
  children: /* @__PURE__ */ jsx(
2805
2831
  "input",
2806
2832
  {
@@ -2894,6 +2920,7 @@ function Drawer({
2894
2920
  className,
2895
2921
  triggerClassName,
2896
2922
  panelClassName,
2923
+ extraAttributes,
2897
2924
  ...props2
2898
2925
  }) {
2899
2926
  const opener = { commandfor: id, command: "show-modal" };
@@ -2901,7 +2928,7 @@ function Drawer({
2901
2928
  const dismissal = {
2902
2929
  closedby: actionRequired ? "none" : void 0
2903
2930
  };
2904
- return /* @__PURE__ */ jsxs("div", { ...props2, className: ClassNames("usx-drawer", className), children: [
2931
+ return /* @__PURE__ */ jsxs("div", { ...props2, className: ClassNames("usx-drawer", className), ...extraAttributes, children: [
2905
2932
  /* @__PURE__ */ jsx(
2906
2933
  "button",
2907
2934
  {
@@ -2982,11 +3009,27 @@ function Link({
2982
3009
  }
2983
3010
  );
2984
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
+ };
2985
3025
  function Page({
2986
3026
  id = void 0,
2987
3027
  title = "Page title",
2988
3028
  titleId = void 0,
2989
3029
  eyebrow = null,
3030
+ subtitle = void 0,
3031
+ description = void 0,
3032
+ tagProps = void 0,
2990
3033
  as: Element = "main",
2991
3034
  children = null,
2992
3035
  content = null,
@@ -2995,6 +3038,7 @@ function Page({
2995
3038
  className = "",
2996
3039
  ...props2
2997
3040
  }) {
3041
+ const hasSummary = Boolean(subtitle || description || (tagProps == null ? void 0 : tagProps.length));
2998
3042
  const classes = ClassNames("usx-page", className);
2999
3043
  const pageContent = children || content;
3000
3044
  const labelledBy = ariaLabelledby || titleId || void 0;
@@ -3011,6 +3055,11 @@ function Page({
3011
3055
  eyebrow ? /* @__PURE__ */ jsx("span", { className: "usx-eyebrow", children: eyebrow }) : null,
3012
3056
  title
3013
3057
  ] }),
3058
+ hasSummary && /* @__PURE__ */ jsxs("div", { className: "usx-page__summary", children: [
3059
+ subtitle && /* @__PURE__ */ jsx("p", { className: "usx-page__subtitle", children: subtitle }),
3060
+ (tagProps == null ? void 0 : tagProps.length) ? /* @__PURE__ */ jsx(TagGroup, { className: "usx-page__tags", tagProps }) : null,
3061
+ description && /* @__PURE__ */ jsx("p", { className: "usx-page__description", children: description })
3062
+ ] }),
3014
3063
  /* @__PURE__ */ jsx("div", { className: "usx-page__content", children: pageContent })
3015
3064
  ]
3016
3065
  }
@@ -3196,12 +3245,14 @@ function FileInput({
3196
3245
  onFilesChange = null,
3197
3246
  defaultFiles = [],
3198
3247
  formGroup = true,
3248
+ extraAttributes,
3199
3249
  ...props2
3200
3250
  }) {
3201
3251
  const hintId = hint ? `${id}-hint` : void 0;
3202
3252
  const errorId = error ? `${id}-error` : void 0;
3203
3253
  const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
3204
3254
  const isManagedMultiple = multiple && manageIndividualFiles;
3255
+ const usxManagedDisabled = (extraAttributes == null ? void 0 : extraAttributes["usx-data-enhanced"]) === "true";
3205
3256
  const nextFileId = useRef(0);
3206
3257
  const [managedFiles, setManagedFiles] = useState(
3207
3258
  () => defaultFiles.map((entry) => ({ key: nextFileId.current++, file: null, ...entry }))
@@ -3246,7 +3297,8 @@ function FileInput({
3246
3297
  disabled,
3247
3298
  required,
3248
3299
  ...invalidFileTypeMessage ? { "data-errormessage": invalidFileTypeMessage } : {},
3249
- ...props2
3300
+ ...props2,
3301
+ ...extraAttributes
3250
3302
  }
3251
3303
  )
3252
3304
  ] });
@@ -3256,7 +3308,7 @@ function FileInput({
3256
3308
  commonLabel,
3257
3309
  commonHint,
3258
3310
  commonError,
3259
- /* @__PURE__ */ jsx("div", { className: "usx-file-input__add-only", "data-usx-file-list-hint": typeof fileListHint === "string" && fileListHint ? fileListHint : "Selected files", children: /* @__PURE__ */ jsx(
3311
+ /* @__PURE__ */ 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__ */ jsx(
3260
3312
  "input",
3261
3313
  {
3262
3314
  ref: (node) => {
@@ -3273,7 +3325,8 @@ function FileInput({
3273
3325
  required: required && managedFiles.length === 0,
3274
3326
  ...invalidFileTypeMessage ? { "data-errormessage": invalidFileTypeMessage } : {},
3275
3327
  ...props2,
3276
- onChange: addFiles
3328
+ ...extraAttributes,
3329
+ onChange: usxManagedDisabled ? void 0 : addFiles
3277
3330
  }
3278
3331
  ) }),
3279
3332
  /* @__PURE__ */ jsx(FileList, { files: managedFiles, hint: fileListHint, onRemove: removeFile, disabled })
@@ -3498,6 +3551,8 @@ function Search({
3498
3551
  placeholder,
3499
3552
  action,
3500
3553
  defaultValue,
3554
+ value,
3555
+ onChange,
3501
3556
  onSubmit,
3502
3557
  className = ""
3503
3558
  }) {
@@ -3537,7 +3592,8 @@ function Search({
3537
3592
  label,
3538
3593
  screenReaderOnlyLabel: true,
3539
3594
  placeholder: placeholder ?? "",
3540
- defaultValue,
3595
+ ...value !== void 0 ? { value } : { defaultValue },
3596
+ onChange,
3541
3597
  type: "search",
3542
3598
  name: searchKey,
3543
3599
  formGroup: false
@@ -3654,6 +3710,7 @@ function Header({
3654
3710
  className = "",
3655
3711
  utilityContent = null,
3656
3712
  navEndContent = null,
3713
+ extraAttributes,
3657
3714
  ...props2
3658
3715
  }) {
3659
3716
  const headerClasses = ClassNames(
@@ -3669,14 +3726,15 @@ function Header({
3669
3726
  "usx-nav",
3670
3727
  { "usx-nav--sticky": stickyNav }
3671
3728
  );
3729
+ const hasNavigation = navSections.length > 0 || Boolean(searchProps || utilityContent || extended && (secondaryLinks.length > 0 || navEndContent));
3672
3730
  const navbar = /* @__PURE__ */ jsxs("div", { className: "usa-navbar", children: [
3673
3731
  /* @__PURE__ */ jsx(Branding, { branding, projectUrl, staticBaseUrl }),
3674
- /* @__PURE__ */ jsx("button", { type: "button", className: "usa-menu-btn align-center", children: useMenuIcon ? /* @__PURE__ */ jsx(Icon, { name: "menu", size: 3 }) : "Menu" })
3732
+ hasNavigation && /* @__PURE__ */ jsx("button", { type: "button", className: "usa-menu-btn align-center", children: useMenuIcon ? /* @__PURE__ */ jsx(Icon, { name: "menu", size: 3 }) : "Menu" })
3675
3733
  ] });
3676
3734
  if (extended) {
3677
3735
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3678
- /* @__PURE__ */ jsx("header", { id, className: headerClasses, ...props2, children: navbar }),
3679
- /* @__PURE__ */ jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsxs("div", { className: "usa-nav__inner", children: [
3736
+ /* @__PURE__ */ jsx("header", { id, className: headerClasses, ...props2, ...extraAttributes, children: navbar }),
3737
+ hasNavigation && /* @__PURE__ */ jsx("nav", { "aria-label": "Primary navigation", className: navClasses, ...(extraAttributes == null ? void 0 : extraAttributes["data-enhanced"]) === "true" ? { "data-enhanced": "true" } : {}, children: /* @__PURE__ */ jsxs("div", { className: "usa-nav__inner", children: [
3680
3738
  /* @__PURE__ */ jsx(
3681
3739
  PrimaryNav,
3682
3740
  {
@@ -3707,9 +3765,9 @@ function Header({
3707
3765
  ] }) })
3708
3766
  ] });
3709
3767
  }
3710
- return /* @__PURE__ */ jsx("header", { id, className: headerClasses, ...props2, children: /* @__PURE__ */ jsxs("div", { className: "usa-nav-container", children: [
3768
+ return /* @__PURE__ */ jsx("header", { id, className: headerClasses, ...props2, ...extraAttributes, children: /* @__PURE__ */ jsxs("div", { className: "usa-nav-container", children: [
3711
3769
  navbar,
3712
- /* @__PURE__ */ jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsx(
3770
+ hasNavigation && /* @__PURE__ */ jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsx(
3713
3771
  PrimaryNav,
3714
3772
  {
3715
3773
  navSections,
@@ -3785,7 +3843,7 @@ function renderContent(content) {
3785
3843
  }
3786
3844
  return content;
3787
3845
  }
3788
- function IconList({ items = [], primary = false, size = null, className = "", ...props2 }) {
3846
+ function IconList({ items = [], caption, primary = false, size = null, className = "", ...props2 }) {
3789
3847
  const classes = ClassNames(
3790
3848
  "usa-icon-list",
3791
3849
  "usx-icon-list",
@@ -3793,7 +3851,7 @@ function IconList({ items = [], primary = false, size = null, className = "", ..
3793
3851
  size === "lg" && "usa-icon-list--size-lg",
3794
3852
  className
3795
3853
  );
3796
- return /* @__PURE__ */ jsx("ul", { className: classes, ...props2, children: items.map((item, index) => /* @__PURE__ */ jsxs("li", { className: ClassNames("usa-icon-list__item", item.itemClassName), children: [
3854
+ const list = /* @__PURE__ */ jsx("ul", { className: classes, ...props2, children: items.map((item, index) => /* @__PURE__ */ jsxs("li", { className: ClassNames("usa-icon-list__item", item.itemClassName), children: [
3797
3855
  /* @__PURE__ */ jsx("div", { className: ClassNames("usa-icon-list__icon", item.iconColor && `text-${item.iconColor}`, item.iconClassName), children: /* @__PURE__ */ jsx(
3798
3856
  Icon,
3799
3857
  {
@@ -3808,6 +3866,10 @@ function IconList({ items = [], primary = false, size = null, className = "", ..
3808
3866
  renderContent(item.content)
3809
3867
  ] })
3810
3868
  ] }, index)) });
3869
+ return caption ? /* @__PURE__ */ jsxs("figure", { className: "usx-list-figure", children: [
3870
+ /* @__PURE__ */ jsx("figcaption", { className: "usx-list-figure__caption", children: caption }),
3871
+ list
3872
+ ] }) : list;
3811
3873
  }
3812
3874
  const defaultRequiredLinks = {
3813
3875
  en: [
@@ -3942,6 +4004,7 @@ function InPageNav({
3942
4004
  children = null,
3943
4005
  className = "",
3944
4006
  contentClassName = "",
4007
+ extraAttributes,
3945
4008
  ...props2
3946
4009
  }) {
3947
4010
  const contentId = `${id}-content`;
@@ -3960,7 +4023,8 @@ function InPageNav({
3960
4023
  "data-root-margin": rootMargin,
3961
4024
  "data-threshold": threshold,
3962
4025
  "data-minimum-heading-count": minimumHeadingCount,
3963
- ...props2
4026
+ ...props2,
4027
+ ...extraAttributes
3964
4028
  }
3965
4029
  ),
3966
4030
  /* @__PURE__ */ jsx(
@@ -3998,14 +4062,14 @@ function LanguageLabel({ code, label, description }) {
3998
4062
  description ? ` (${description})` : null
3999
4063
  ] });
4000
4064
  }
4001
- function TwoLanguageSelector({ target, onSelect, className, navAriaLabel }) {
4065
+ function TwoLanguageSelector({ target, onSelect, className, navAriaLabel, extraAttributes }) {
4002
4066
  const handleClick = (event) => {
4003
4067
  if (onSelect) onSelect(target, event);
4004
4068
  if (!target.href) event.preventDefault();
4005
4069
  };
4006
4070
  const Tag2 = target.href ? "a" : "button";
4007
4071
  const tagProps = target.href ? { href: target.href } : { type: "button" };
4008
- return /* @__PURE__ */ jsx("nav", { "aria-label": navAriaLabel, className, children: /* @__PURE__ */ jsx("div", { className: "usa-language-container", children: /* @__PURE__ */ jsx(Tag2, { className: "usa-button usx-button usa-button--primary", onClick: handleClick, ...tagProps, children: /* @__PURE__ */ jsx(LanguageLabel, { code: target.code, label: target.label }) }) }) });
4072
+ return /* @__PURE__ */ jsx("nav", { "aria-label": navAriaLabel, className, ...extraAttributes, children: /* @__PURE__ */ jsx("div", { className: "usa-language-container", children: /* @__PURE__ */ jsx(Tag2, { className: "usa-button usx-button usa-button--primary", onClick: handleClick, ...tagProps, children: /* @__PURE__ */ jsx(LanguageLabel, { code: target.code, label: target.label }) }) }) });
4009
4073
  }
4010
4074
  function MenuLanguageSelector({
4011
4075
  languages,
@@ -4015,7 +4079,8 @@ function MenuLanguageSelector({
4015
4079
  id,
4016
4080
  onSelect,
4017
4081
  className,
4018
- navAriaLabel
4082
+ navAriaLabel,
4083
+ extraAttributes
4019
4084
  }) {
4020
4085
  const containerClasses = ClassNames(
4021
4086
  "usa-language-container",
@@ -4027,7 +4092,7 @@ function MenuLanguageSelector({
4027
4092
  unstyled ? "usa-button--unstyled" : "usa-button--primary",
4028
4093
  "usa-language__link"
4029
4094
  );
4030
- return /* @__PURE__ */ jsx("nav", { "aria-label": navAriaLabel, className, children: /* @__PURE__ */ jsx("div", { className: containerClasses, children: /* @__PURE__ */ jsx("ul", { className: "usa-language__primary usa-accordion", children: /* @__PURE__ */ jsxs("li", { className: "usa-language__primary-item", children: [
4095
+ return /* @__PURE__ */ jsx("nav", { "aria-label": navAriaLabel, className, children: /* @__PURE__ */ jsx("div", { className: containerClasses, ...extraAttributes, children: /* @__PURE__ */ jsx("ul", { className: "usa-language__primary usa-accordion", children: /* @__PURE__ */ jsxs("li", { className: "usa-language__primary-item", children: [
4031
4096
  /* @__PURE__ */ jsx(
4032
4097
  "button",
4033
4098
  {
@@ -4062,12 +4127,13 @@ function LanguageSelector({
4062
4127
  navAriaLabel = "Language selection",
4063
4128
  className = "",
4064
4129
  onSelect = null,
4130
+ extraAttributes,
4065
4131
  ...props2
4066
4132
  }) {
4067
4133
  const resolvedVariant = variant || (languages.length > 2 ? "menu" : "two");
4068
4134
  const classes = ClassNames("usx-language-selector", className);
4069
4135
  if (!languages || languages.length === 0) {
4070
- return /* @__PURE__ */ jsx("div", { className: classes, children: "LanguageSelector" });
4136
+ return /* @__PURE__ */ jsx("div", { className: classes, ...extraAttributes, children: "LanguageSelector" });
4071
4137
  }
4072
4138
  if (resolvedVariant === "two") {
4073
4139
  const target = languages.find((lang) => !lang.current) || languages[1] || languages[0];
@@ -4078,6 +4144,7 @@ function LanguageSelector({
4078
4144
  onSelect,
4079
4145
  className: classes,
4080
4146
  navAriaLabel,
4147
+ extraAttributes,
4081
4148
  ...props2
4082
4149
  }
4083
4150
  );
@@ -4093,6 +4160,7 @@ function LanguageSelector({
4093
4160
  onSelect,
4094
4161
  className: classes,
4095
4162
  navAriaLabel,
4163
+ extraAttributes,
4096
4164
  ...props2
4097
4165
  }
4098
4166
  );
@@ -4158,6 +4226,7 @@ function Layout({
4158
4226
  expandable = false,
4159
4227
  onToggleExpanded,
4160
4228
  className = "",
4229
+ extraAttributes,
4161
4230
  ...props2
4162
4231
  }) {
4163
4232
  const [expanded, setExpanded] = useState(false);
@@ -4188,7 +4257,7 @@ function Layout({
4188
4257
  ]
4189
4258
  }
4190
4259
  ) : null;
4191
- return /* @__PURE__ */ jsx("div", { className: classes, ...props2, children: variant === "single-column" ? /* @__PURE__ */ jsx(SingleColumnLayout, { expandButton, children: children || content }) : variant === "grid" ? /* @__PURE__ */ jsx(
4260
+ return /* @__PURE__ */ jsx("div", { className: classes, ...props2, ...extraAttributes, children: variant === "single-column" ? /* @__PURE__ */ jsx(SingleColumnLayout, { expandButton, children: children || content }) : variant === "grid" ? /* @__PURE__ */ jsx(
4192
4261
  GridLayout,
4193
4262
  {
4194
4263
  leftSidebar,
@@ -4227,7 +4296,7 @@ function renderItems(items = [], parentOptions = {}) {
4227
4296
  ] }, index);
4228
4297
  });
4229
4298
  }
4230
- function List({ items = [], ordered = false, unstyled = false, className = "", ...props2 }) {
4299
+ function List({ items = [], caption, ordered = false, unstyled = false, className = "", ...props2 }) {
4231
4300
  const classes = ClassNames(
4232
4301
  "usa-list",
4233
4302
  "usx-list",
@@ -4235,7 +4304,11 @@ function List({ items = [], ordered = false, unstyled = false, className = "", .
4235
4304
  className
4236
4305
  );
4237
4306
  const Tag2 = ordered ? "ol" : "ul";
4238
- return /* @__PURE__ */ jsx(Tag2, { className: classes, ...props2, children: renderItems(items, { ordered, unstyled }) });
4307
+ const list = /* @__PURE__ */ jsx(Tag2, { className: classes, ...props2, children: renderItems(items, { ordered, unstyled }) });
4308
+ return caption ? /* @__PURE__ */ jsxs("figure", { className: "usx-list-figure", children: [
4309
+ /* @__PURE__ */ jsx("figcaption", { className: "usx-list-figure__caption", children: caption }),
4310
+ list
4311
+ ] }) : list;
4239
4312
  }
4240
4313
  const MONTH_OPTIONS = [
4241
4314
  { value: "1", label: "January" },
@@ -4267,6 +4340,12 @@ function MemorableDate({
4267
4340
  defaultMonth,
4268
4341
  defaultDay,
4269
4342
  defaultYear,
4343
+ month,
4344
+ day,
4345
+ year,
4346
+ onMonthChange,
4347
+ onDayChange,
4348
+ onYearChange,
4270
4349
  disabled = false,
4271
4350
  ariaDisabled = false,
4272
4351
  required = false,
@@ -4296,7 +4375,8 @@ function MemorableDate({
4296
4375
  label: monthLabel,
4297
4376
  options: MONTH_OPTIONS,
4298
4377
  placeholder: "- Select -",
4299
- defaultValue: defaultMonth,
4378
+ ...month !== void 0 ? { value: month } : { defaultValue: defaultMonth },
4379
+ onChange: onMonthChange,
4300
4380
  required,
4301
4381
  "aria-describedby": describedBy(monthHintId),
4302
4382
  "aria-invalid": hasError || void 0,
@@ -4315,7 +4395,8 @@ function MemorableDate({
4315
4395
  name: dayName || dayId,
4316
4396
  label: dayLabel,
4317
4397
  placeholder: "",
4318
- defaultValue: defaultDay,
4398
+ ...day !== void 0 ? { value: day } : { defaultValue: defaultDay },
4399
+ onChange: onDayChange,
4319
4400
  maxLength: 2,
4320
4401
  pattern: "[0-9]*",
4321
4402
  inputMode: "numeric",
@@ -4336,7 +4417,8 @@ function MemorableDate({
4336
4417
  name: yearName || yearId,
4337
4418
  label: yearLabel,
4338
4419
  placeholder: "",
4339
- defaultValue: defaultYear,
4420
+ ...year !== void 0 ? { value: year } : { defaultValue: defaultYear },
4421
+ onChange: onYearChange,
4340
4422
  minLength: 4,
4341
4423
  maxLength: 4,
4342
4424
  pattern: "[0-9]*",
@@ -4440,6 +4522,7 @@ function Modal({
4440
4522
  forceAction = false,
4441
4523
  className = "",
4442
4524
  children,
4525
+ extraAttributes,
4443
4526
  ...props2
4444
4527
  }) {
4445
4528
  const classes = ClassNames("usa-modal", "usx-modal", {
@@ -4455,6 +4538,7 @@ function Modal({
4455
4538
  "aria-describedby": `${id}-description`,
4456
4539
  ...forceAction ? { "data-force-action": true } : {},
4457
4540
  ...props2,
4541
+ ...extraAttributes,
4458
4542
  children: /* @__PURE__ */ jsxs("div", { className: "usa-modal__content", children: [
4459
4543
  /* @__PURE__ */ jsxs("div", { className: "usa-modal__main", children: [
4460
4544
  /* @__PURE__ */ jsx("h2", { className: "usa-modal__heading", id: `${id}-heading`, children: heading }),
@@ -4523,6 +4607,7 @@ function Popover({
4523
4607
  summaryProps,
4524
4608
  panelClassName,
4525
4609
  contentClassName,
4610
+ extraAttributes,
4526
4611
  children,
4527
4612
  ...props2
4528
4613
  }) {
@@ -4537,6 +4622,7 @@ function Popover({
4537
4622
  open: initiallyOpen || void 0,
4538
4623
  "data-side": side,
4539
4624
  "data-align": align,
4625
+ ...extraAttributes,
4540
4626
  children: [
4541
4627
  /* @__PURE__ */ jsx(Summary, { unstyled: true, ...composedSummaryProps }),
4542
4628
  /* @__PURE__ */ jsxs(
@@ -4637,6 +4723,7 @@ function RangeSlider({
4637
4723
  textPreposition = "of",
4638
4724
  formGroup = true,
4639
4725
  className = "",
4726
+ extraAttributes,
4640
4727
  ...props2
4641
4728
  }) {
4642
4729
  const hintId = hint ? `${id}-hint` : void 0;
@@ -4656,14 +4743,14 @@ function RangeSlider({
4656
4743
  min,
4657
4744
  max,
4658
4745
  step,
4659
- value: typeof value !== "undefined" ? value : void 0,
4660
- defaultValue,
4746
+ ...value !== void 0 ? { value } : { defaultValue },
4661
4747
  disabled,
4662
4748
  required,
4663
4749
  "aria-describedby": describedBy,
4664
4750
  ...textUnit ? { "data-text-unit": textUnit } : {},
4665
4751
  ...textPreposition ? { "data-text-preposition": textPreposition } : {},
4666
- ...props2
4752
+ ...props2,
4753
+ ...extraAttributes
4667
4754
  }
4668
4755
  )
4669
4756
  ] });
@@ -4913,53 +5000,16 @@ const Swap = ({
4913
5000
  ] });
4914
5001
  return /* @__PURE__ */ jsx("label", { className: classes, ...props2, children: content });
4915
5002
  };
4916
- const Switch = ({
4917
- id,
4918
- name,
4919
- checked,
4920
- defaultChecked,
4921
- disabled = false,
4922
- onChange,
4923
- size = "md",
4924
- variant = "",
4925
- className = "",
4926
- label,
4927
- indeterminate = false,
4928
- ...props2
4929
- }) => {
4930
- const classes = ClassNames(
4931
- "usx-switch",
4932
- size && `usx-toggle-${size}`,
4933
- variant && `text-${variant}`,
4934
- className
4935
- );
4936
- const ref = React.useRef(null);
4937
- React.useEffect(() => {
4938
- if (ref.current) {
4939
- ref.current.indeterminate = Boolean(indeterminate);
5003
+ function Switch({ className, labelClassName, color, ...props2 }) {
5004
+ return /* @__PURE__ */ jsx(
5005
+ Checkbox,
5006
+ {
5007
+ ...props2,
5008
+ className: ClassNames("usx-switch", className),
5009
+ labelClassName: ClassNames(labelClassName, color && `before-${color}`)
4940
5010
  }
4941
- }, [indeterminate]);
4942
- const inputProps = {
4943
- id,
4944
- name,
4945
- type: "checkbox",
4946
- className: classes,
4947
- checked: typeof checked === "boolean" ? checked : void 0,
4948
- defaultChecked,
4949
- disabled,
4950
- "aria-checked": indeterminate ? "mixed" : typeof checked === "boolean" ? checked : void 0,
4951
- onChange,
4952
- ...props2
4953
- };
4954
- const input = /* @__PURE__ */ jsx("input", { ref, ...inputProps });
4955
- if (label) {
4956
- return /* @__PURE__ */ jsxs("label", { className: "usa-label usx-switch__label", children: [
4957
- input,
4958
- label
4959
- ] });
4960
- }
4961
- return input;
4962
- };
5011
+ );
5012
+ }
4963
5013
  function Table({
4964
5014
  columns = [],
4965
5015
  data = [],
@@ -4973,6 +5023,7 @@ function Table({
4973
5023
  responsive = false,
4974
5024
  className,
4975
5025
  children,
5026
+ extraAttributes,
4976
5027
  ...props2
4977
5028
  }) {
4978
5029
  const hasSorting = !children && columns.some((column) => column.sortable);
@@ -4981,6 +5032,7 @@ function Table({
4981
5032
  "table",
4982
5033
  {
4983
5034
  ...props2,
5035
+ ...extraAttributes,
4984
5036
  className: ClassNames(
4985
5037
  "usa-table",
4986
5038
  "usx-table",
@@ -5023,19 +5075,6 @@ function Table({
5023
5075
  }
5024
5076
  ) : table;
5025
5077
  }
5026
- const TagGroup = ({
5027
- tagProps = null,
5028
- children = null,
5029
- className = "",
5030
- ...props2
5031
- }) => {
5032
- const classes = ClassNames(
5033
- "usx-tag-group",
5034
- className
5035
- );
5036
- const content = children ? children : Array.isArray(tagProps) ? tagProps.map((t, i) => /* @__PURE__ */ jsx(Tag, { ...t }, t.id || t.value || i)) : null;
5037
- return /* @__PURE__ */ jsx("div", { className: classes, ...props2, children: content });
5038
- };
5039
5078
  function TaskList({ tasks = [], className }) {
5040
5079
  return /* @__PURE__ */ jsx("ul", { className: ClassNames("usx-task-list", className), children: tasks == null ? void 0 : tasks.map((task, i) => {
5041
5080
  return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Clickable, { href: task.href, className: "usx-task-list__item", children: [
@@ -5052,66 +5091,107 @@ function ThemePicker({
5052
5091
  name,
5053
5092
  label = "Theme",
5054
5093
  themes = [],
5094
+ variant = "default",
5055
5095
  value,
5056
5096
  defaultValue,
5057
5097
  onChange,
5058
- className = ""
5098
+ className = "",
5099
+ extraAttributes
5059
5100
  }) {
5060
- var _a;
5101
+ var _a, _b, _c, _d, _e, _f;
5061
5102
  const selectId = id || "theme-picker";
5062
- const selection = value !== void 0 ? { value } : { defaultValue: defaultValue ?? ((_a = themes[0]) == null ? void 0 : _a.value) };
5063
- return /* @__PURE__ */ jsxs("div", { className: ClassNames("usx-theme-picker", className), children: [
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 }),
5064
5112
  /* @__PURE__ */ jsx(
5065
- "button",
5113
+ "select",
5066
5114
  {
5067
- type: "button",
5068
- className: "usa-button usx-button usx-button--ghost usx-theme-picker__trigger",
5069
- "aria-label": label,
5070
- "aria-expanded": "false",
5071
- "aria-controls": `${selectId}-panel`,
5072
- children: /* @__PURE__ */ jsx(PaletteIcon, {})
5115
+ id: selectId,
5116
+ 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),
5123
+ children: themes.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
5073
5124
  }
5074
- ),
5075
- /* @__PURE__ */ jsxs("div", { id: `${selectId}-panel`, className: "usx-theme-picker__panel", children: [
5076
- /* @__PURE__ */ jsx(Label, { htmlFor: selectId, screenReaderOnly: true, children: label }),
5077
- /* @__PURE__ */ jsx(
5078
- "select",
5079
- {
5080
- id: selectId,
5081
- name,
5082
- className: "usa-select usx-select",
5083
- ...selection,
5084
- onChange: (event) => onChange == null ? void 0 : onChange(event.target.value),
5085
- children: themes.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
5086
- }
5087
- ),
5088
- /* @__PURE__ */ jsx(
5089
- "button",
5090
- {
5091
- type: "button",
5092
- className: "usa-button usx-button usa-button--primary usx-theme-picker__toggle",
5093
- "aria-label": "Confirm theme",
5094
- children: /* @__PURE__ */ jsx(Icon, { name: "close", className: "usx-theme-picker__icon" })
5095
- }
5096
- )
5097
- ] })
5125
+ )
5098
5126
  ] });
5099
- }
5100
- function PaletteIcon() {
5101
- return /* @__PURE__ */ jsx(
5102
- "svg",
5127
+ return /* @__PURE__ */ jsxs(
5128
+ "div",
5103
5129
  {
5104
- className: "usa-icon usx-theme-picker__icon",
5105
- "aria-hidden": "true",
5106
- focusable: "false",
5107
- viewBox: "0 0 24 24",
5108
- children: /* @__PURE__ */ jsx(
5109
- "path",
5110
- {
5111
- fill: "currentColor",
5112
- 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"
5113
- }
5114
- )
5130
+ className: ClassNames(
5131
+ "usx-theme-picker",
5132
+ variant !== "default" && `usx-theme-picker--${variant}`,
5133
+ className
5134
+ ),
5135
+ ...extraAttributes,
5136
+ children: [
5137
+ variant === "default" && /* @__PURE__ */ jsxs(Fragment, { children: [
5138
+ /* @__PURE__ */ jsx(
5139
+ "button",
5140
+ {
5141
+ type: "button",
5142
+ className: "usa-button usx-button usx-button--ghost usx-theme-picker__trigger",
5143
+ "aria-label": label,
5144
+ "aria-expanded": "false",
5145
+ "aria-controls": `${selectId}-panel`,
5146
+ children: /* @__PURE__ */ jsx(Icon, { name: "color_palette", source: "usx", className: "usx-theme-picker__icon" })
5147
+ }
5148
+ ),
5149
+ /* @__PURE__ */ jsxs("div", { id: `${selectId}-panel`, className: "usx-theme-picker__panel", children: [
5150
+ select(),
5151
+ /* @__PURE__ */ jsx(
5152
+ "button",
5153
+ {
5154
+ type: "button",
5155
+ className: "usa-button usx-button usa-button--primary usx-theme-picker__toggle",
5156
+ "aria-label": "Confirm theme",
5157
+ children: /* @__PURE__ */ jsx(Icon, { name: "close", className: "usx-theme-picker__icon" })
5158
+ }
5159
+ )
5160
+ ] })
5161
+ ] }),
5162
+ variant === "swap" && /* @__PURE__ */ jsxs(Fragment, { children: [
5163
+ /* @__PURE__ */ jsx(
5164
+ Swap,
5165
+ {
5166
+ className: "usx-theme-picker__swap usa-button usx-button usx-button--ghost",
5167
+ 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
+ },
5177
+ offContent: /* @__PURE__ */ jsx(Icon, { name: "sun", source: "usx", className: "usx-theme-picker__icon" }),
5178
+ onContent: /* @__PURE__ */ jsx(Icon, { name: "moon", source: "usx", className: "usx-theme-picker__icon" })
5179
+ }
5180
+ ),
5181
+ /* @__PURE__ */ jsx("div", { className: "usx-theme-picker__fallback", children: select() })
5182
+ ] }),
5183
+ variant === "ghost-select" && /* @__PURE__ */ jsxs("div", { className: "usx-theme-picker__ghost", children: [
5184
+ /* @__PURE__ */ jsx(
5185
+ "span",
5186
+ {
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" })
5190
+ }
5191
+ ),
5192
+ select(true)
5193
+ ] })
5194
+ ]
5115
5195
  }
5116
5196
  );
5117
5197
  }
@@ -5125,11 +5205,13 @@ function TimePicker({
5125
5205
  ariaDisabled = false,
5126
5206
  required = false,
5127
5207
  defaultValue = null,
5208
+ value,
5128
5209
  minTime = null,
5129
5210
  maxTime = null,
5130
5211
  step = null,
5131
5212
  formGroup = true,
5132
5213
  className = "",
5214
+ extraAttributes,
5133
5215
  ...props2
5134
5216
  }) {
5135
5217
  const labelId = `${id}-label`;
@@ -5154,6 +5236,7 @@ function TimePicker({
5154
5236
  /* @__PURE__ */ jsx(
5155
5237
  "div",
5156
5238
  {
5239
+ ...extraAttributes,
5157
5240
  className: containerClasses,
5158
5241
  ...minTime ? { "data-min-time": minTime } : {},
5159
5242
  ...maxTime ? { "data-max-time": maxTime } : {},
@@ -5166,7 +5249,7 @@ function TimePicker({
5166
5249
  name: name || id,
5167
5250
  type: "text",
5168
5251
  "aria-describedby": describedBy,
5169
- defaultValue: defaultValue || void 0,
5252
+ ...value !== void 0 ? { value } : { defaultValue: defaultValue || void 0 },
5170
5253
  disabled,
5171
5254
  "aria-disabled": !disabled && ariaDisabled ? "true" : void 0,
5172
5255
  required,