@solexllc/usx-react 0.9.0 → 0.10.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.
- package/README.md +6 -5
- package/dist/index.cjs +123 -97
- package/dist/index.js +124 -98
- package/package.json +4 -4
- package/src/components/accordion/Accordion.tsx +4 -1
- package/src/components/accordion/accordion.django.html +1 -1
- package/src/components/accordion/config.json +1 -0
- package/src/components/banner/Banner.tsx +3 -1
- package/src/components/banner/banner.django.html +1 -1
- package/src/components/banner/config.json +1 -0
- package/src/components/carousel/carousel.django-snapshot.html +0 -40
- package/src/components/carousel/carousel.react-snapshot.html +0 -38
- package/src/components/character-count/CharacterCount.tsx +3 -0
- package/src/components/character-count/character-count.django-snapshot.html +43 -0
- package/src/components/character-count/character-count.django.html +2 -2
- package/src/components/character-count/character-count.react-snapshot.html +37 -0
- package/src/components/character-count/config.json +9 -0
- package/src/components/checkbox/Checkbox.tsx +16 -17
- package/src/components/checkbox/checkbox.django-snapshot.html +18 -0
- package/src/components/checkbox/checkbox.django.html +6 -4
- package/src/components/checkbox/checkbox.react-snapshot.html +14 -0
- package/src/components/checkbox/config.json +4 -4
- package/src/components/checkbox-group/checkbox-group.django-snapshot.html +54 -0
- package/src/components/checkbox-group/checkbox-group.react-snapshot.html +45 -0
- package/src/components/combobox/Combobox.tsx +6 -1
- package/src/components/combobox/combobox.django-snapshot.html +141 -0
- package/src/components/combobox/combobox.django.html +2 -2
- package/src/components/combobox/combobox.react-snapshot.html +76 -0
- package/src/components/combobox/config.json +9 -0
- package/src/components/data-table/DataTable.tsx +4 -1
- package/src/components/data-table/config.json +4 -0
- package/src/components/data-table/data-table.django.html +1 -1
- package/src/components/date-picker/DatePicker.tsx +6 -1
- package/src/components/date-picker/config.json +9 -0
- package/src/components/date-picker/date-picker.django-snapshot.html +23 -0
- package/src/components/date-picker/date-picker.django.html +4 -4
- package/src/components/date-picker/date-picker.react-snapshot.html +19 -0
- package/src/components/date-range-picker/DateRangePicker.tsx +11 -2
- package/src/components/date-range-picker/config.json +14 -0
- package/src/components/date-range-picker/date-range-picker.django-snapshot.html +47 -0
- package/src/components/date-range-picker/date-range-picker.django.html +5 -5
- package/src/components/date-range-picker/date-range-picker.react-snapshot.html +38 -0
- package/src/components/drawer/Drawer.tsx +3 -1
- package/src/components/drawer/config.json +4 -0
- package/src/components/drawer/drawer.django.html +1 -1
- package/src/components/file-input/FileInput.tsx +7 -2
- package/src/components/file-input/_contents.django.html +2 -1
- package/src/components/file-input/config.json +4 -0
- package/src/components/header/Header.tsx +15 -9
- package/src/components/header/config.json +1 -0
- package/src/components/header/header.django-snapshot.html +24 -0
- package/src/components/header/header.django.html +8 -4
- package/src/components/header/header.html +20 -0
- package/src/components/header/header.react-snapshot.html +20 -0
- package/src/components/in-page-nav/InPageNav.tsx +3 -0
- package/src/components/in-page-nav/config.json +1 -0
- package/src/components/in-page-nav/in-page-nav.django.html +1 -1
- package/src/components/input/Input.tsx +3 -0
- package/src/components/input/config.json +10 -0
- package/src/components/input/input.django-snapshot.html +24 -0
- package/src/components/input/input.django.html +4 -4
- package/src/components/input/input.react-snapshot.html +22 -0
- package/src/components/language-selector/LanguageSelector.tsx +10 -5
- package/src/components/language-selector/config.json +1 -0
- package/src/components/language-selector/language-selector.django.html +2 -2
- package/src/components/layout/Layout.tsx +3 -1
- package/src/components/layout/config.json +4 -0
- package/src/components/layout/layout.django.html +1 -1
- package/src/components/memorable-date/MemorableDate.tsx +18 -3
- package/src/components/memorable-date/config.json +15 -0
- package/src/components/memorable-date/memorable-date.django-snapshot.html +82 -0
- package/src/components/memorable-date/memorable-date.django.html +14 -14
- package/src/components/memorable-date/memorable-date.react-snapshot.html +70 -0
- package/src/components/modal/Modal.tsx +3 -0
- package/src/components/modal/config.json +1 -0
- package/src/components/modal/modal.django.html +1 -1
- package/src/components/popover/Popover.tsx +3 -0
- package/src/components/popover/config.json +4 -0
- package/src/components/popover/popover.django-snapshot.html +30 -0
- package/src/components/popover/popover.django.html +1 -0
- package/src/components/radio-buttons/RadioButtons.tsx +5 -1
- package/src/components/radio-buttons/radio-buttons.django-snapshot.html +65 -0
- package/src/components/radio-buttons/radio-buttons.django.html +1 -1
- package/src/components/radio-buttons/radio-buttons.react-snapshot.html +53 -0
- package/src/components/range-slider/RangeSlider.tsx +4 -2
- package/src/components/range-slider/config.json +1 -0
- package/src/components/range-slider/range-slider.django-snapshot.html +17 -0
- package/src/components/range-slider/range-slider.django.html +4 -4
- package/src/components/range-slider/range-slider.react-snapshot.html +16 -0
- package/src/components/search/Search.tsx +6 -1
- package/src/components/search/config.json +5 -0
- package/src/components/search/search.django-snapshot.html +683 -563
- package/src/components/search/search.django.html +1 -1
- package/src/components/search/search.react-snapshot.html +25 -0
- package/src/components/select/Select.tsx +3 -1
- package/src/components/select/config.json +5 -0
- package/src/components/select/select.django-snapshot.html +15 -0
- package/src/components/select/select.django.html +2 -2
- package/src/components/select/select.react-snapshot.html +11 -0
- package/src/components/switch/Switch.tsx +13 -70
- package/src/components/switch/config.json +60 -23
- package/src/components/switch/switch.django-snapshot.html +507 -56
- package/src/components/switch/switch.django.html +23 -26
- package/src/components/switch/switch.html +425 -33
- package/src/components/switch/switch.react-snapshot.html +447 -58
- package/src/components/table/Table.tsx +3 -1
- package/src/components/table/config.json +1 -0
- package/src/components/table/table.django.html +1 -1
- package/src/components/text-area/TextArea.tsx +3 -1
- package/src/components/text-area/config.json +5 -0
- package/src/components/text-area/text-area.django-snapshot.html +18 -0
- package/src/components/text-area/text-area.django.html +4 -4
- package/src/components/text-area/text-area.react-snapshot.html +16 -0
- package/src/components/theme-picker/ThemePicker.tsx +3 -1
- package/src/components/theme-picker/config.json +14 -1
- package/src/components/theme-picker/theme-picker.django-snapshot.html +64 -0
- package/src/components/theme-picker/theme-picker.django.html +2 -2
- package/src/components/theme-picker/theme-picker.react-snapshot.html +52 -0
- package/src/components/time-picker/TimePicker.tsx +6 -1
- package/src/components/time-picker/config.json +9 -0
- package/src/components/time-picker/time-picker.django-snapshot.html +26 -0
- package/src/components/time-picker/time-picker.django.html +4 -4
- 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,
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
1235
|
-
|
|
1236
|
-
|
|
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
|
|
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
|
{
|
|
@@ -3196,12 +3223,14 @@ function FileInput({
|
|
|
3196
3223
|
onFilesChange = null,
|
|
3197
3224
|
defaultFiles = [],
|
|
3198
3225
|
formGroup = true,
|
|
3226
|
+
extraAttributes,
|
|
3199
3227
|
...props2
|
|
3200
3228
|
}) {
|
|
3201
3229
|
const hintId = hint ? `${id}-hint` : void 0;
|
|
3202
3230
|
const errorId = error ? `${id}-error` : void 0;
|
|
3203
3231
|
const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
|
|
3204
3232
|
const isManagedMultiple = multiple && manageIndividualFiles;
|
|
3233
|
+
const usxManagedDisabled = (extraAttributes == null ? void 0 : extraAttributes["usx-data-enhanced"]) === "true";
|
|
3205
3234
|
const nextFileId = useRef(0);
|
|
3206
3235
|
const [managedFiles, setManagedFiles] = useState(
|
|
3207
3236
|
() => defaultFiles.map((entry) => ({ key: nextFileId.current++, file: null, ...entry }))
|
|
@@ -3246,7 +3275,8 @@ function FileInput({
|
|
|
3246
3275
|
disabled,
|
|
3247
3276
|
required,
|
|
3248
3277
|
...invalidFileTypeMessage ? { "data-errormessage": invalidFileTypeMessage } : {},
|
|
3249
|
-
...props2
|
|
3278
|
+
...props2,
|
|
3279
|
+
...extraAttributes
|
|
3250
3280
|
}
|
|
3251
3281
|
)
|
|
3252
3282
|
] });
|
|
@@ -3256,7 +3286,7 @@ function FileInput({
|
|
|
3256
3286
|
commonLabel,
|
|
3257
3287
|
commonHint,
|
|
3258
3288
|
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(
|
|
3289
|
+
/* @__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
3290
|
"input",
|
|
3261
3291
|
{
|
|
3262
3292
|
ref: (node) => {
|
|
@@ -3273,7 +3303,8 @@ function FileInput({
|
|
|
3273
3303
|
required: required && managedFiles.length === 0,
|
|
3274
3304
|
...invalidFileTypeMessage ? { "data-errormessage": invalidFileTypeMessage } : {},
|
|
3275
3305
|
...props2,
|
|
3276
|
-
|
|
3306
|
+
...extraAttributes,
|
|
3307
|
+
onChange: usxManagedDisabled ? void 0 : addFiles
|
|
3277
3308
|
}
|
|
3278
3309
|
) }),
|
|
3279
3310
|
/* @__PURE__ */ jsx(FileList, { files: managedFiles, hint: fileListHint, onRemove: removeFile, disabled })
|
|
@@ -3498,6 +3529,8 @@ function Search({
|
|
|
3498
3529
|
placeholder,
|
|
3499
3530
|
action,
|
|
3500
3531
|
defaultValue,
|
|
3532
|
+
value,
|
|
3533
|
+
onChange,
|
|
3501
3534
|
onSubmit,
|
|
3502
3535
|
className = ""
|
|
3503
3536
|
}) {
|
|
@@ -3537,7 +3570,8 @@ function Search({
|
|
|
3537
3570
|
label,
|
|
3538
3571
|
screenReaderOnlyLabel: true,
|
|
3539
3572
|
placeholder: placeholder ?? "",
|
|
3540
|
-
defaultValue,
|
|
3573
|
+
...value !== void 0 ? { value } : { defaultValue },
|
|
3574
|
+
onChange,
|
|
3541
3575
|
type: "search",
|
|
3542
3576
|
name: searchKey,
|
|
3543
3577
|
formGroup: false
|
|
@@ -3654,6 +3688,7 @@ function Header({
|
|
|
3654
3688
|
className = "",
|
|
3655
3689
|
utilityContent = null,
|
|
3656
3690
|
navEndContent = null,
|
|
3691
|
+
extraAttributes,
|
|
3657
3692
|
...props2
|
|
3658
3693
|
}) {
|
|
3659
3694
|
const headerClasses = ClassNames(
|
|
@@ -3669,14 +3704,15 @@ function Header({
|
|
|
3669
3704
|
"usx-nav",
|
|
3670
3705
|
{ "usx-nav--sticky": stickyNav }
|
|
3671
3706
|
);
|
|
3707
|
+
const hasNavigation = navSections.length > 0 || Boolean(searchProps || utilityContent || extended && (secondaryLinks.length > 0 || navEndContent));
|
|
3672
3708
|
const navbar = /* @__PURE__ */ jsxs("div", { className: "usa-navbar", children: [
|
|
3673
3709
|
/* @__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" })
|
|
3710
|
+
hasNavigation && /* @__PURE__ */ jsx("button", { type: "button", className: "usa-menu-btn align-center", children: useMenuIcon ? /* @__PURE__ */ jsx(Icon, { name: "menu", size: 3 }) : "Menu" })
|
|
3675
3711
|
] });
|
|
3676
3712
|
if (extended) {
|
|
3677
3713
|
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: [
|
|
3714
|
+
/* @__PURE__ */ jsx("header", { id, className: headerClasses, ...props2, ...extraAttributes, children: navbar }),
|
|
3715
|
+
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
3716
|
/* @__PURE__ */ jsx(
|
|
3681
3717
|
PrimaryNav,
|
|
3682
3718
|
{
|
|
@@ -3707,9 +3743,9 @@ function Header({
|
|
|
3707
3743
|
] }) })
|
|
3708
3744
|
] });
|
|
3709
3745
|
}
|
|
3710
|
-
return /* @__PURE__ */ jsx("header", { id, className: headerClasses, ...props2, children: /* @__PURE__ */ jsxs("div", { className: "usa-nav-container", children: [
|
|
3746
|
+
return /* @__PURE__ */ jsx("header", { id, className: headerClasses, ...props2, ...extraAttributes, children: /* @__PURE__ */ jsxs("div", { className: "usa-nav-container", children: [
|
|
3711
3747
|
navbar,
|
|
3712
|
-
/* @__PURE__ */ jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsx(
|
|
3748
|
+
hasNavigation && /* @__PURE__ */ jsx("nav", { "aria-label": "Primary navigation", className: navClasses, children: /* @__PURE__ */ jsx(
|
|
3713
3749
|
PrimaryNav,
|
|
3714
3750
|
{
|
|
3715
3751
|
navSections,
|
|
@@ -3942,6 +3978,7 @@ function InPageNav({
|
|
|
3942
3978
|
children = null,
|
|
3943
3979
|
className = "",
|
|
3944
3980
|
contentClassName = "",
|
|
3981
|
+
extraAttributes,
|
|
3945
3982
|
...props2
|
|
3946
3983
|
}) {
|
|
3947
3984
|
const contentId = `${id}-content`;
|
|
@@ -3960,7 +3997,8 @@ function InPageNav({
|
|
|
3960
3997
|
"data-root-margin": rootMargin,
|
|
3961
3998
|
"data-threshold": threshold,
|
|
3962
3999
|
"data-minimum-heading-count": minimumHeadingCount,
|
|
3963
|
-
...props2
|
|
4000
|
+
...props2,
|
|
4001
|
+
...extraAttributes
|
|
3964
4002
|
}
|
|
3965
4003
|
),
|
|
3966
4004
|
/* @__PURE__ */ jsx(
|
|
@@ -3998,14 +4036,14 @@ function LanguageLabel({ code, label, description }) {
|
|
|
3998
4036
|
description ? ` (${description})` : null
|
|
3999
4037
|
] });
|
|
4000
4038
|
}
|
|
4001
|
-
function TwoLanguageSelector({ target, onSelect, className, navAriaLabel }) {
|
|
4039
|
+
function TwoLanguageSelector({ target, onSelect, className, navAriaLabel, extraAttributes }) {
|
|
4002
4040
|
const handleClick = (event) => {
|
|
4003
4041
|
if (onSelect) onSelect(target, event);
|
|
4004
4042
|
if (!target.href) event.preventDefault();
|
|
4005
4043
|
};
|
|
4006
4044
|
const Tag2 = target.href ? "a" : "button";
|
|
4007
4045
|
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 }) }) }) });
|
|
4046
|
+
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
4047
|
}
|
|
4010
4048
|
function MenuLanguageSelector({
|
|
4011
4049
|
languages,
|
|
@@ -4015,7 +4053,8 @@ function MenuLanguageSelector({
|
|
|
4015
4053
|
id,
|
|
4016
4054
|
onSelect,
|
|
4017
4055
|
className,
|
|
4018
|
-
navAriaLabel
|
|
4056
|
+
navAriaLabel,
|
|
4057
|
+
extraAttributes
|
|
4019
4058
|
}) {
|
|
4020
4059
|
const containerClasses = ClassNames(
|
|
4021
4060
|
"usa-language-container",
|
|
@@ -4027,7 +4066,7 @@ function MenuLanguageSelector({
|
|
|
4027
4066
|
unstyled ? "usa-button--unstyled" : "usa-button--primary",
|
|
4028
4067
|
"usa-language__link"
|
|
4029
4068
|
);
|
|
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: [
|
|
4069
|
+
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
4070
|
/* @__PURE__ */ jsx(
|
|
4032
4071
|
"button",
|
|
4033
4072
|
{
|
|
@@ -4062,12 +4101,13 @@ function LanguageSelector({
|
|
|
4062
4101
|
navAriaLabel = "Language selection",
|
|
4063
4102
|
className = "",
|
|
4064
4103
|
onSelect = null,
|
|
4104
|
+
extraAttributes,
|
|
4065
4105
|
...props2
|
|
4066
4106
|
}) {
|
|
4067
4107
|
const resolvedVariant = variant || (languages.length > 2 ? "menu" : "two");
|
|
4068
4108
|
const classes = ClassNames("usx-language-selector", className);
|
|
4069
4109
|
if (!languages || languages.length === 0) {
|
|
4070
|
-
return /* @__PURE__ */ jsx("div", { className: classes, children: "LanguageSelector" });
|
|
4110
|
+
return /* @__PURE__ */ jsx("div", { className: classes, ...extraAttributes, children: "LanguageSelector" });
|
|
4071
4111
|
}
|
|
4072
4112
|
if (resolvedVariant === "two") {
|
|
4073
4113
|
const target = languages.find((lang) => !lang.current) || languages[1] || languages[0];
|
|
@@ -4078,6 +4118,7 @@ function LanguageSelector({
|
|
|
4078
4118
|
onSelect,
|
|
4079
4119
|
className: classes,
|
|
4080
4120
|
navAriaLabel,
|
|
4121
|
+
extraAttributes,
|
|
4081
4122
|
...props2
|
|
4082
4123
|
}
|
|
4083
4124
|
);
|
|
@@ -4093,6 +4134,7 @@ function LanguageSelector({
|
|
|
4093
4134
|
onSelect,
|
|
4094
4135
|
className: classes,
|
|
4095
4136
|
navAriaLabel,
|
|
4137
|
+
extraAttributes,
|
|
4096
4138
|
...props2
|
|
4097
4139
|
}
|
|
4098
4140
|
);
|
|
@@ -4158,6 +4200,7 @@ function Layout({
|
|
|
4158
4200
|
expandable = false,
|
|
4159
4201
|
onToggleExpanded,
|
|
4160
4202
|
className = "",
|
|
4203
|
+
extraAttributes,
|
|
4161
4204
|
...props2
|
|
4162
4205
|
}) {
|
|
4163
4206
|
const [expanded, setExpanded] = useState(false);
|
|
@@ -4188,7 +4231,7 @@ function Layout({
|
|
|
4188
4231
|
]
|
|
4189
4232
|
}
|
|
4190
4233
|
) : null;
|
|
4191
|
-
return /* @__PURE__ */ jsx("div", { className: classes, ...props2, children: variant === "single-column" ? /* @__PURE__ */ jsx(SingleColumnLayout, { expandButton, children: children || content }) : variant === "grid" ? /* @__PURE__ */ jsx(
|
|
4234
|
+
return /* @__PURE__ */ jsx("div", { className: classes, ...props2, ...extraAttributes, children: variant === "single-column" ? /* @__PURE__ */ jsx(SingleColumnLayout, { expandButton, children: children || content }) : variant === "grid" ? /* @__PURE__ */ jsx(
|
|
4192
4235
|
GridLayout,
|
|
4193
4236
|
{
|
|
4194
4237
|
leftSidebar,
|
|
@@ -4267,6 +4310,12 @@ function MemorableDate({
|
|
|
4267
4310
|
defaultMonth,
|
|
4268
4311
|
defaultDay,
|
|
4269
4312
|
defaultYear,
|
|
4313
|
+
month,
|
|
4314
|
+
day,
|
|
4315
|
+
year,
|
|
4316
|
+
onMonthChange,
|
|
4317
|
+
onDayChange,
|
|
4318
|
+
onYearChange,
|
|
4270
4319
|
disabled = false,
|
|
4271
4320
|
ariaDisabled = false,
|
|
4272
4321
|
required = false,
|
|
@@ -4296,7 +4345,8 @@ function MemorableDate({
|
|
|
4296
4345
|
label: monthLabel,
|
|
4297
4346
|
options: MONTH_OPTIONS,
|
|
4298
4347
|
placeholder: "- Select -",
|
|
4299
|
-
defaultValue: defaultMonth,
|
|
4348
|
+
...month !== void 0 ? { value: month } : { defaultValue: defaultMonth },
|
|
4349
|
+
onChange: onMonthChange,
|
|
4300
4350
|
required,
|
|
4301
4351
|
"aria-describedby": describedBy(monthHintId),
|
|
4302
4352
|
"aria-invalid": hasError || void 0,
|
|
@@ -4315,7 +4365,8 @@ function MemorableDate({
|
|
|
4315
4365
|
name: dayName || dayId,
|
|
4316
4366
|
label: dayLabel,
|
|
4317
4367
|
placeholder: "",
|
|
4318
|
-
defaultValue: defaultDay,
|
|
4368
|
+
...day !== void 0 ? { value: day } : { defaultValue: defaultDay },
|
|
4369
|
+
onChange: onDayChange,
|
|
4319
4370
|
maxLength: 2,
|
|
4320
4371
|
pattern: "[0-9]*",
|
|
4321
4372
|
inputMode: "numeric",
|
|
@@ -4336,7 +4387,8 @@ function MemorableDate({
|
|
|
4336
4387
|
name: yearName || yearId,
|
|
4337
4388
|
label: yearLabel,
|
|
4338
4389
|
placeholder: "",
|
|
4339
|
-
defaultValue: defaultYear,
|
|
4390
|
+
...year !== void 0 ? { value: year } : { defaultValue: defaultYear },
|
|
4391
|
+
onChange: onYearChange,
|
|
4340
4392
|
minLength: 4,
|
|
4341
4393
|
maxLength: 4,
|
|
4342
4394
|
pattern: "[0-9]*",
|
|
@@ -4440,6 +4492,7 @@ function Modal({
|
|
|
4440
4492
|
forceAction = false,
|
|
4441
4493
|
className = "",
|
|
4442
4494
|
children,
|
|
4495
|
+
extraAttributes,
|
|
4443
4496
|
...props2
|
|
4444
4497
|
}) {
|
|
4445
4498
|
const classes = ClassNames("usa-modal", "usx-modal", {
|
|
@@ -4455,6 +4508,7 @@ function Modal({
|
|
|
4455
4508
|
"aria-describedby": `${id}-description`,
|
|
4456
4509
|
...forceAction ? { "data-force-action": true } : {},
|
|
4457
4510
|
...props2,
|
|
4511
|
+
...extraAttributes,
|
|
4458
4512
|
children: /* @__PURE__ */ jsxs("div", { className: "usa-modal__content", children: [
|
|
4459
4513
|
/* @__PURE__ */ jsxs("div", { className: "usa-modal__main", children: [
|
|
4460
4514
|
/* @__PURE__ */ jsx("h2", { className: "usa-modal__heading", id: `${id}-heading`, children: heading }),
|
|
@@ -4523,6 +4577,7 @@ function Popover({
|
|
|
4523
4577
|
summaryProps,
|
|
4524
4578
|
panelClassName,
|
|
4525
4579
|
contentClassName,
|
|
4580
|
+
extraAttributes,
|
|
4526
4581
|
children,
|
|
4527
4582
|
...props2
|
|
4528
4583
|
}) {
|
|
@@ -4537,6 +4592,7 @@ function Popover({
|
|
|
4537
4592
|
open: initiallyOpen || void 0,
|
|
4538
4593
|
"data-side": side,
|
|
4539
4594
|
"data-align": align,
|
|
4595
|
+
...extraAttributes,
|
|
4540
4596
|
children: [
|
|
4541
4597
|
/* @__PURE__ */ jsx(Summary, { unstyled: true, ...composedSummaryProps }),
|
|
4542
4598
|
/* @__PURE__ */ jsxs(
|
|
@@ -4637,6 +4693,7 @@ function RangeSlider({
|
|
|
4637
4693
|
textPreposition = "of",
|
|
4638
4694
|
formGroup = true,
|
|
4639
4695
|
className = "",
|
|
4696
|
+
extraAttributes,
|
|
4640
4697
|
...props2
|
|
4641
4698
|
}) {
|
|
4642
4699
|
const hintId = hint ? `${id}-hint` : void 0;
|
|
@@ -4656,14 +4713,14 @@ function RangeSlider({
|
|
|
4656
4713
|
min,
|
|
4657
4714
|
max,
|
|
4658
4715
|
step,
|
|
4659
|
-
value
|
|
4660
|
-
defaultValue,
|
|
4716
|
+
...value !== void 0 ? { value } : { defaultValue },
|
|
4661
4717
|
disabled,
|
|
4662
4718
|
required,
|
|
4663
4719
|
"aria-describedby": describedBy,
|
|
4664
4720
|
...textUnit ? { "data-text-unit": textUnit } : {},
|
|
4665
4721
|
...textPreposition ? { "data-text-preposition": textPreposition } : {},
|
|
4666
|
-
...props2
|
|
4722
|
+
...props2,
|
|
4723
|
+
...extraAttributes
|
|
4667
4724
|
}
|
|
4668
4725
|
)
|
|
4669
4726
|
] });
|
|
@@ -4913,53 +4970,16 @@ const Swap = ({
|
|
|
4913
4970
|
] });
|
|
4914
4971
|
return /* @__PURE__ */ jsx("label", { className: classes, ...props2, children: content });
|
|
4915
4972
|
};
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
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);
|
|
4973
|
+
function Switch({ className, labelClassName, color, ...props2 }) {
|
|
4974
|
+
return /* @__PURE__ */ jsx(
|
|
4975
|
+
Checkbox,
|
|
4976
|
+
{
|
|
4977
|
+
...props2,
|
|
4978
|
+
className: ClassNames("usx-switch", className),
|
|
4979
|
+
labelClassName: ClassNames(labelClassName, color && `before-${color}`)
|
|
4940
4980
|
}
|
|
4941
|
-
|
|
4942
|
-
|
|
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
|
-
};
|
|
4981
|
+
);
|
|
4982
|
+
}
|
|
4963
4983
|
function Table({
|
|
4964
4984
|
columns = [],
|
|
4965
4985
|
data = [],
|
|
@@ -4973,6 +4993,7 @@ function Table({
|
|
|
4973
4993
|
responsive = false,
|
|
4974
4994
|
className,
|
|
4975
4995
|
children,
|
|
4996
|
+
extraAttributes,
|
|
4976
4997
|
...props2
|
|
4977
4998
|
}) {
|
|
4978
4999
|
const hasSorting = !children && columns.some((column) => column.sortable);
|
|
@@ -4981,6 +5002,7 @@ function Table({
|
|
|
4981
5002
|
"table",
|
|
4982
5003
|
{
|
|
4983
5004
|
...props2,
|
|
5005
|
+
...extraAttributes,
|
|
4984
5006
|
className: ClassNames(
|
|
4985
5007
|
"usa-table",
|
|
4986
5008
|
"usx-table",
|
|
@@ -5055,12 +5077,13 @@ function ThemePicker({
|
|
|
5055
5077
|
value,
|
|
5056
5078
|
defaultValue,
|
|
5057
5079
|
onChange,
|
|
5058
|
-
className = ""
|
|
5080
|
+
className = "",
|
|
5081
|
+
extraAttributes
|
|
5059
5082
|
}) {
|
|
5060
5083
|
var _a;
|
|
5061
5084
|
const selectId = id || "theme-picker";
|
|
5062
5085
|
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: [
|
|
5086
|
+
return /* @__PURE__ */ jsxs("div", { className: ClassNames("usx-theme-picker", className), ...extraAttributes, children: [
|
|
5064
5087
|
/* @__PURE__ */ jsx(
|
|
5065
5088
|
"button",
|
|
5066
5089
|
{
|
|
@@ -5125,11 +5148,13 @@ function TimePicker({
|
|
|
5125
5148
|
ariaDisabled = false,
|
|
5126
5149
|
required = false,
|
|
5127
5150
|
defaultValue = null,
|
|
5151
|
+
value,
|
|
5128
5152
|
minTime = null,
|
|
5129
5153
|
maxTime = null,
|
|
5130
5154
|
step = null,
|
|
5131
5155
|
formGroup = true,
|
|
5132
5156
|
className = "",
|
|
5157
|
+
extraAttributes,
|
|
5133
5158
|
...props2
|
|
5134
5159
|
}) {
|
|
5135
5160
|
const labelId = `${id}-label`;
|
|
@@ -5154,6 +5179,7 @@ function TimePicker({
|
|
|
5154
5179
|
/* @__PURE__ */ jsx(
|
|
5155
5180
|
"div",
|
|
5156
5181
|
{
|
|
5182
|
+
...extraAttributes,
|
|
5157
5183
|
className: containerClasses,
|
|
5158
5184
|
...minTime ? { "data-min-time": minTime } : {},
|
|
5159
5185
|
...maxTime ? { "data-max-time": maxTime } : {},
|
|
@@ -5166,7 +5192,7 @@ function TimePicker({
|
|
|
5166
5192
|
name: name || id,
|
|
5167
5193
|
type: "text",
|
|
5168
5194
|
"aria-describedby": describedBy,
|
|
5169
|
-
defaultValue: defaultValue || void 0,
|
|
5195
|
+
...value !== void 0 ? { value } : { defaultValue: defaultValue || void 0 },
|
|
5170
5196
|
disabled,
|
|
5171
5197
|
"aria-disabled": !disabled && ariaDisabled ? "true" : void 0,
|
|
5172
5198
|
required,
|