@solexllc/usx-react 0.3.1 → 0.4.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 +132 -0
- package/dist/index.cjs +181 -182
- package/dist/index.js +181 -182
- package/package.json +6 -5
- package/src/assets.ts +16 -0
- package/src/components/alert/Alert.tsx +4 -3
- package/src/components/alert/alert.django.html +2 -3
- package/src/components/alert/config.json +15 -4
- package/src/components/banner/Banner.tsx +8 -6
- package/src/components/banner/banner.django.html +4 -5
- package/src/components/banner/config.json +5 -1
- package/src/components/button/Button.tsx +1 -1
- package/src/components/button/button.django.html +2 -2
- package/src/components/button/config.json +14 -6
- package/src/components/code/Code.tsx +4 -27
- package/src/components/code/code.django.html +3 -9
- package/src/components/code/config.json +4 -0
- package/src/components/copy-to-clipboard/CopyToClipboard.tsx +35 -24
- package/src/components/copy-to-clipboard/config.json +14 -7
- package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +14 -14
- package/src/components/footer/Footer.tsx +26 -6
- package/src/components/footer/config.json +4 -0
- package/src/components/footer/footer.django.html +10 -9
- package/src/components/header/Branding.tsx +9 -6
- package/src/components/header/Header.tsx +3 -1
- package/src/components/header/config.json +4 -0
- package/src/components/header/header.django.html +5 -26
- package/src/components/header/header.html +10 -10
- package/src/components/icon/Icon.tsx +6 -3
- package/src/components/icon/config.json +12 -6
- package/src/components/icon/icon.django.html +6 -4
- package/src/components/image/Image.tsx +8 -4
- package/src/components/image/config.json +10 -2
- package/src/components/image/image.django.html +8 -6
- package/src/components/layout/config.json +9 -9
- package/src/components/layout/layout.django.html +1 -1
- package/src/components/spinner/Spinner.tsx +18 -25
- package/src/components/spinner/config.json +4 -0
- package/src/components/spinner/spinner.django.html +4 -6
- package/src/components/tooltip/Tooltip.tsx +4 -2
- package/src/components/tooltip/config.json +7 -2
- package/src/components/tooltip/tooltip.django.html +1 -1
package/dist/index.cjs
CHANGED
|
@@ -152,6 +152,39 @@
|
|
|
152
152
|
}
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
|
+
function getAssetUrl(assetPath, staticBaseUrl) {
|
|
156
|
+
if (/^[a-z][a-z\d+.-]*:/i.test(assetPath)) return assetPath;
|
|
157
|
+
const base = staticBaseUrl || typeof window !== "undefined" && window.usxBaseUrl || "/";
|
|
158
|
+
return `${base.replace(/\/+$/, "")}/${assetPath.replace(/^\/+/, "")}`;
|
|
159
|
+
}
|
|
160
|
+
function getAssetSrcSet(srcSet, staticBaseUrl) {
|
|
161
|
+
return srcSet.replace(/(^\s*|,\s*)(\S*[^,\s])(?=,?(?:\s|$))/g, (_match, separator, url) => `${separator}${getAssetUrl(url, staticBaseUrl)}`);
|
|
162
|
+
}
|
|
163
|
+
function Icon({
|
|
164
|
+
name,
|
|
165
|
+
source = "uswds",
|
|
166
|
+
size = 2,
|
|
167
|
+
color,
|
|
168
|
+
alt = name + " icon",
|
|
169
|
+
staticBaseUrl,
|
|
170
|
+
staticUrlPrefix,
|
|
171
|
+
className = "",
|
|
172
|
+
...props
|
|
173
|
+
}) {
|
|
174
|
+
const spritePrefix = staticUrlPrefix ?? getAssetUrl(`img/${source === "usx" ? "usx-sprite.svg" : "sprite.svg"}#`, staticBaseUrl);
|
|
175
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
"svg",
|
|
177
|
+
{
|
|
178
|
+
className: "usa-icon " + (size ? size === 1 ? "usx-icon--size-1" : "usa-icon--size-" + size : "") + " " + (color ? "text-" + color : "") + " " + className,
|
|
179
|
+
"aria-hidden": "true",
|
|
180
|
+
"aria-label": alt,
|
|
181
|
+
focusable: "false",
|
|
182
|
+
role: "img",
|
|
183
|
+
...props,
|
|
184
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: spritePrefix + name })
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
155
188
|
function Alert({
|
|
156
189
|
heading,
|
|
157
190
|
text,
|
|
@@ -163,6 +196,7 @@
|
|
|
163
196
|
ariaLabel,
|
|
164
197
|
ariaLabelledby,
|
|
165
198
|
onDismiss = void 0,
|
|
199
|
+
staticBaseUrl,
|
|
166
200
|
children = null,
|
|
167
201
|
...props
|
|
168
202
|
}) {
|
|
@@ -189,32 +223,9 @@
|
|
|
189
223
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...accessibilityProps, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-alert__body", children: [
|
|
190
224
|
!slim && heading ? /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "usa-alert__heading", children: heading }) : null,
|
|
191
225
|
children ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-alert__text", children }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "usa-alert__text", children: text }),
|
|
192
|
-
onDismiss && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "usx-alert__dismiss", "aria-label": "Dismiss alert", onClick: onDismiss, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
+
onDismiss && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "usx-alert__dismiss", "aria-label": "Dismiss alert", onClick: onDismiss, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "close", size: 3, staticBaseUrl }) })
|
|
193
227
|
] }) });
|
|
194
228
|
}
|
|
195
|
-
function Icon({
|
|
196
|
-
name,
|
|
197
|
-
source = "uswds",
|
|
198
|
-
size = 2,
|
|
199
|
-
color,
|
|
200
|
-
alt = name + " icon",
|
|
201
|
-
staticUrlPrefix = (typeof window !== "undefined" && window.usxBaseUrl || "/") + "img/" + (source === "usx" ? "usx-sprite.svg" : "sprite.svg") + "#",
|
|
202
|
-
className = "",
|
|
203
|
-
...props
|
|
204
|
-
}) {
|
|
205
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
-
"svg",
|
|
207
|
-
{
|
|
208
|
-
className: "usa-icon " + (size ? size === 1 ? "usx-icon--size-1" : "usa-icon--size-" + size : "") + " " + (color ? "text-" + color : "") + " " + className,
|
|
209
|
-
"aria-hidden": "true",
|
|
210
|
-
"aria-label": alt,
|
|
211
|
-
focusable: "false",
|
|
212
|
-
role: "img",
|
|
213
|
-
...props,
|
|
214
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: staticUrlPrefix + name })
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
229
|
const shapeClassMap = {
|
|
219
230
|
circle: "usx-circle",
|
|
220
231
|
"rounded-sm": "usx-rounded-sm",
|
|
@@ -355,7 +366,8 @@
|
|
|
355
366
|
function Banner({
|
|
356
367
|
id = "gov-banner",
|
|
357
368
|
ariaLabel = "Official government website",
|
|
358
|
-
flagSrc
|
|
369
|
+
flagSrc,
|
|
370
|
+
staticBaseUrl,
|
|
359
371
|
tld = ".gov",
|
|
360
372
|
bannerText = "An official website of the United States government",
|
|
361
373
|
bannerActionText = "Here's how you know",
|
|
@@ -366,7 +378,7 @@
|
|
|
366
378
|
"A ",
|
|
367
379
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "lock" }),
|
|
368
380
|
" (",
|
|
369
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "lock", size: 1 }),
|
|
381
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "lock", size: 1, staticBaseUrl }),
|
|
370
382
|
") or ",
|
|
371
383
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "https://" }),
|
|
372
384
|
" means you’ve safely connected to the ",
|
|
@@ -376,7 +388,6 @@
|
|
|
376
388
|
className = "",
|
|
377
389
|
...props
|
|
378
390
|
}) {
|
|
379
|
-
const assetBaseUrl = typeof window !== "undefined" && window.usxBaseUrl || "/";
|
|
380
391
|
const classes = classNames(
|
|
381
392
|
"usa-banner",
|
|
382
393
|
"usx-banner",
|
|
@@ -389,7 +400,7 @@
|
|
|
389
400
|
{
|
|
390
401
|
"aria-hidden": "true",
|
|
391
402
|
className: "usa-banner__header-flag",
|
|
392
|
-
src: flagSrc,
|
|
403
|
+
src: getAssetUrl(flagSrc ?? "img/us_flag_small.png", staticBaseUrl),
|
|
393
404
|
alt: ""
|
|
394
405
|
}
|
|
395
406
|
) }),
|
|
@@ -427,7 +438,7 @@
|
|
|
427
438
|
"img",
|
|
428
439
|
{
|
|
429
440
|
className: "usa-banner__icon usa-media-block__img",
|
|
430
|
-
src:
|
|
441
|
+
src: getAssetUrl("img/icon-dot-gov.svg", staticBaseUrl),
|
|
431
442
|
role: "img",
|
|
432
443
|
alt: "",
|
|
433
444
|
"aria-hidden": "true"
|
|
@@ -444,7 +455,7 @@
|
|
|
444
455
|
"img",
|
|
445
456
|
{
|
|
446
457
|
className: "usa-banner__icon usa-media-block__img",
|
|
447
|
-
src:
|
|
458
|
+
src: getAssetUrl("img/icon-https.svg", staticBaseUrl),
|
|
448
459
|
role: "img",
|
|
449
460
|
alt: "",
|
|
450
461
|
"aria-hidden": "true"
|
|
@@ -559,33 +570,71 @@
|
|
|
559
570
|
}
|
|
560
571
|
) });
|
|
561
572
|
}
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
573
|
+
const Required = ({
|
|
574
|
+
title = "Required",
|
|
575
|
+
children = null,
|
|
576
|
+
className = "",
|
|
577
|
+
...props
|
|
578
|
+
}) => {
|
|
579
|
+
const classes = classNames("usx-required", className);
|
|
580
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
581
|
+
/* @__PURE__ */ jsxRuntime.jsx("abbr", { title, className: classes, ...props, children: "*" }),
|
|
582
|
+
" ",
|
|
583
|
+
children ? children : ""
|
|
584
|
+
] });
|
|
567
585
|
};
|
|
586
|
+
function Label({
|
|
587
|
+
htmlFor,
|
|
588
|
+
required = false,
|
|
589
|
+
error = false,
|
|
590
|
+
children = null,
|
|
591
|
+
screenReaderOnly = false,
|
|
592
|
+
className = "",
|
|
593
|
+
classOverride = false,
|
|
594
|
+
...props
|
|
595
|
+
}) {
|
|
596
|
+
const classes = classNames(
|
|
597
|
+
"usa-label",
|
|
598
|
+
"usx-label",
|
|
599
|
+
{ "usa-sr-only": screenReaderOnly, "usa-label--error": !!error },
|
|
600
|
+
className
|
|
601
|
+
);
|
|
602
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
603
|
+
"label",
|
|
604
|
+
{
|
|
605
|
+
className: classOverride ? className : classes,
|
|
606
|
+
...htmlFor ? { htmlFor } : {},
|
|
607
|
+
...props,
|
|
608
|
+
children: [
|
|
609
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(Required, {}),
|
|
610
|
+
children
|
|
611
|
+
]
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
}
|
|
568
615
|
const Spinner = ({
|
|
569
616
|
size = 3,
|
|
570
|
-
color
|
|
617
|
+
color,
|
|
571
618
|
label = null,
|
|
572
619
|
screenReaderLabel = null,
|
|
573
|
-
staticUrlPrefix
|
|
620
|
+
staticUrlPrefix,
|
|
621
|
+
staticBaseUrl,
|
|
574
622
|
className = "",
|
|
575
623
|
...props
|
|
576
624
|
}) => {
|
|
577
625
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { role: "status", "aria-live": "polite", className: `usx-spinner ${className}`, ...props, children: [
|
|
578
626
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
-
|
|
627
|
+
Icon,
|
|
580
628
|
{
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
629
|
+
name: "spinner",
|
|
630
|
+
source: "usx",
|
|
631
|
+
size,
|
|
632
|
+
color,
|
|
633
|
+
staticBaseUrl
|
|
585
634
|
}
|
|
586
635
|
),
|
|
587
|
-
screenReaderLabel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
588
|
-
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
636
|
+
screenReaderLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { screenReaderOnly: true, children: screenReaderLabel }),
|
|
637
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(Label, { children: label })
|
|
589
638
|
] });
|
|
590
639
|
};
|
|
591
640
|
function Button({
|
|
@@ -625,7 +674,7 @@
|
|
|
625
674
|
const classes = classNames(
|
|
626
675
|
"usa-button",
|
|
627
676
|
"usx-button",
|
|
628
|
-
variant
|
|
677
|
+
variant && variantClasses[variant],
|
|
629
678
|
big && "usa-button--big",
|
|
630
679
|
inverse && "usa-button--inverse",
|
|
631
680
|
ghost && "usx-button--ghost",
|
|
@@ -774,6 +823,8 @@
|
|
|
774
823
|
objectFit = "",
|
|
775
824
|
maxWidth,
|
|
776
825
|
maxHeight,
|
|
826
|
+
staticBaseUrl,
|
|
827
|
+
srcSet,
|
|
777
828
|
className = "",
|
|
778
829
|
...props
|
|
779
830
|
}) {
|
|
@@ -801,14 +852,14 @@
|
|
|
801
852
|
"source",
|
|
802
853
|
{
|
|
803
854
|
...source.media ? { media: source.media } : {},
|
|
804
|
-
srcSet: source.srcSet,
|
|
855
|
+
srcSet: getAssetSrcSet(source.srcSet, staticBaseUrl),
|
|
805
856
|
...source.type ? { type: source.type } : {},
|
|
806
857
|
...source.sizes ? { sizes: source.sizes } : {}
|
|
807
858
|
},
|
|
808
859
|
i
|
|
809
860
|
)),
|
|
810
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: src.fallback, alt, style, ...props })
|
|
811
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt, style, ...props });
|
|
861
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: getAssetUrl(src.fallback, staticBaseUrl), srcSet: srcSet ? getAssetSrcSet(srcSet, staticBaseUrl) : void 0, alt, style, ...props })
|
|
862
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("img", { src: getAssetUrl(src, staticBaseUrl), srcSet: srcSet ? getAssetSrcSet(srcSet, staticBaseUrl) : void 0, alt, style, ...props });
|
|
812
863
|
if (caption) {
|
|
813
864
|
return /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: classes, style, children: [
|
|
814
865
|
imgElement,
|
|
@@ -948,48 +999,6 @@
|
|
|
948
999
|
);
|
|
949
1000
|
return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: classes, ...props, children: cardProps.map((card, index) => /* @__PURE__ */ jsxRuntime.jsx(Card, { ...card, tag: "li" }, index)) });
|
|
950
1001
|
}
|
|
951
|
-
const Required = ({
|
|
952
|
-
title = "Required",
|
|
953
|
-
children = null,
|
|
954
|
-
className = "",
|
|
955
|
-
...props
|
|
956
|
-
}) => {
|
|
957
|
-
const classes = classNames("usx-required", className);
|
|
958
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
959
|
-
/* @__PURE__ */ jsxRuntime.jsx("abbr", { title, className: classes, ...props, children: "*" }),
|
|
960
|
-
" ",
|
|
961
|
-
children ? children : ""
|
|
962
|
-
] });
|
|
963
|
-
};
|
|
964
|
-
function Label({
|
|
965
|
-
htmlFor,
|
|
966
|
-
required = false,
|
|
967
|
-
error = false,
|
|
968
|
-
children = null,
|
|
969
|
-
screenReaderOnly = false,
|
|
970
|
-
className = "",
|
|
971
|
-
classOverride = false,
|
|
972
|
-
...props
|
|
973
|
-
}) {
|
|
974
|
-
const classes = classNames(
|
|
975
|
-
"usa-label",
|
|
976
|
-
"usx-label",
|
|
977
|
-
{ "usa-sr-only": screenReaderOnly, "usa-label--error": !!error },
|
|
978
|
-
className
|
|
979
|
-
);
|
|
980
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
981
|
-
"label",
|
|
982
|
-
{
|
|
983
|
-
className: classOverride ? className : classes,
|
|
984
|
-
...htmlFor ? { htmlFor } : {},
|
|
985
|
-
...props,
|
|
986
|
-
children: [
|
|
987
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(Required, {}),
|
|
988
|
-
children
|
|
989
|
-
]
|
|
990
|
-
}
|
|
991
|
-
);
|
|
992
|
-
}
|
|
993
1002
|
function Hint({
|
|
994
1003
|
id,
|
|
995
1004
|
children = null,
|
|
@@ -1332,24 +1341,69 @@
|
|
|
1332
1341
|
Clickable.Link = ClickableLink;
|
|
1333
1342
|
Clickable.ColorChange = ClickableColorChange;
|
|
1334
1343
|
Clickable.BgColorChange = ClickableBgColorChange;
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1344
|
+
const Tooltip = ({
|
|
1345
|
+
label,
|
|
1346
|
+
position = "top",
|
|
1347
|
+
children,
|
|
1348
|
+
className = "",
|
|
1349
|
+
bodyClassName = "",
|
|
1350
|
+
...props
|
|
1351
|
+
}) => {
|
|
1352
|
+
const validPositions = ["top", "bottom", "left", "right"];
|
|
1353
|
+
const normalizedPosition = validPositions.includes(position) ? position : "top";
|
|
1354
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: classNames("usx-tooltip", className), ...props, children: [
|
|
1355
|
+
children,
|
|
1356
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1357
|
+
"span",
|
|
1358
|
+
{
|
|
1359
|
+
className: classNames("usa-tooltip__body", `usa-tooltip__body--${normalizedPosition}`, bodyClassName),
|
|
1360
|
+
role: "tooltip",
|
|
1361
|
+
children: label
|
|
1362
|
+
}
|
|
1363
|
+
)
|
|
1364
|
+
] });
|
|
1365
|
+
};
|
|
1366
|
+
function copyTextToClipboard(text) {
|
|
1367
|
+
if (window.navigator.clipboard) {
|
|
1368
|
+
return window.navigator.clipboard.writeText(text);
|
|
1350
1369
|
}
|
|
1351
1370
|
}
|
|
1352
|
-
function
|
|
1371
|
+
function CopyToClipboard({
|
|
1372
|
+
copyText = "",
|
|
1373
|
+
label = null,
|
|
1374
|
+
tooltipProps,
|
|
1375
|
+
staticBaseUrl,
|
|
1376
|
+
className = ""
|
|
1377
|
+
}) {
|
|
1378
|
+
const button = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1379
|
+
Button,
|
|
1380
|
+
{
|
|
1381
|
+
ghost: true,
|
|
1382
|
+
className: classNames("usx-copy", className),
|
|
1383
|
+
onClick: () => copyTextToClipboard(copyText),
|
|
1384
|
+
type: "button",
|
|
1385
|
+
children: [
|
|
1386
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "content_copy", size: 0, className: "usx-copy__copy", staticBaseUrl }),
|
|
1387
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "check", size: 0, className: "usx-copy__check", staticBaseUrl }),
|
|
1388
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "margin-left-1", children: label })
|
|
1389
|
+
]
|
|
1390
|
+
}
|
|
1391
|
+
);
|
|
1392
|
+
if (!tooltipProps) return button;
|
|
1393
|
+
const { label: tooltipLabel, copiedTooltip = "Copied", ...tooltipOptions } = tooltipProps;
|
|
1394
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1395
|
+
Tooltip,
|
|
1396
|
+
{
|
|
1397
|
+
...tooltipOptions,
|
|
1398
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1399
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "usx-copy__tooltip--copy", children: tooltipLabel }),
|
|
1400
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "usx-copy__tooltip--copied", children: copiedTooltip })
|
|
1401
|
+
] }),
|
|
1402
|
+
children: button
|
|
1403
|
+
}
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
function Code({ lines = [], allowHtml = false, copyText = null, staticBaseUrl, className = "" }) {
|
|
1353
1407
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames("usx-mockup-code", className), children: [
|
|
1354
1408
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-mockup-code__content", children: lines.map((line, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1355
1409
|
"pre",
|
|
@@ -1360,17 +1414,7 @@
|
|
|
1360
1414
|
},
|
|
1361
1415
|
i
|
|
1362
1416
|
)) }),
|
|
1363
|
-
copyText && /* @__PURE__ */ jsxRuntime.
|
|
1364
|
-
"button",
|
|
1365
|
-
{
|
|
1366
|
-
className: "usa-button usx-button usx-button--ghost usx-copy",
|
|
1367
|
-
onClick: () => usxCopy(copyText),
|
|
1368
|
-
children: [
|
|
1369
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "usa-icon usx-copy__copy", "aria-hidden": "true", focusable: "false", role: "img", children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: "./img/sprite.svg#content_copy" }) }),
|
|
1370
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "usa-icon usx-copy__check", "aria-hidden": "true", focusable: "false", role: "img", children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: "./img/sprite.svg#check" }) })
|
|
1371
|
-
]
|
|
1372
|
-
}
|
|
1373
|
-
)
|
|
1417
|
+
copyText && /* @__PURE__ */ jsxRuntime.jsx(CopyToClipboard, { copyText, staticBaseUrl, tooltipProps: { label: "Copy", copiedTooltip: "Copied", position: "left" } })
|
|
1374
1418
|
] });
|
|
1375
1419
|
}
|
|
1376
1420
|
function CollectionItem({ href, heading, description, imgSrc, imgAlt = "", calendarDate, meta, tags }) {
|
|
@@ -1470,38 +1514,6 @@
|
|
|
1470
1514
|
] });
|
|
1471
1515
|
return formGroup ? /* @__PURE__ */ jsxRuntime.jsx(FormGroup, { error: !!error, children: content }) : content;
|
|
1472
1516
|
}
|
|
1473
|
-
function CopyToClipboard({
|
|
1474
|
-
copyText = "",
|
|
1475
|
-
label = null,
|
|
1476
|
-
tooltip = null,
|
|
1477
|
-
copiedTooltip = "Copied",
|
|
1478
|
-
className = ""
|
|
1479
|
-
}) {
|
|
1480
|
-
const button = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1481
|
-
"button",
|
|
1482
|
-
{
|
|
1483
|
-
className: classNames(
|
|
1484
|
-
"usa-button",
|
|
1485
|
-
"usx-button",
|
|
1486
|
-
"usx-button--ghost",
|
|
1487
|
-
"usx-copy",
|
|
1488
|
-
className
|
|
1489
|
-
),
|
|
1490
|
-
onClick: () => window.navigator.clipboard.writeText(copyText),
|
|
1491
|
-
type: "button",
|
|
1492
|
-
children: [
|
|
1493
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "usa-icon usx-copy__copy", "aria-hidden": "true", focusable: "false", role: "img", children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: "./img/sprite.svg#content_copy" }) }),
|
|
1494
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "usa-icon usx-copy__check", "aria-hidden": "true", focusable: "false", role: "img", children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: "./img/sprite.svg#check" }) }),
|
|
1495
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "margin-left-1", children: label })
|
|
1496
|
-
]
|
|
1497
|
-
}
|
|
1498
|
-
);
|
|
1499
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "usx-tooltip", children: [
|
|
1500
|
-
button,
|
|
1501
|
-
tooltip && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-tooltip__body usa-tooltip__body--right usx-copy__tooltip--copy", role: "tooltip", children: tooltip }),
|
|
1502
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-tooltip__body usa-tooltip__body--right usx-copy__tooltip--copied", role: "tooltip", children: copiedTooltip })
|
|
1503
|
-
] });
|
|
1504
|
-
}
|
|
1505
1517
|
function DatePicker({
|
|
1506
1518
|
id = "date-picker",
|
|
1507
1519
|
name,
|
|
@@ -1827,7 +1839,7 @@
|
|
|
1827
1839
|
] });
|
|
1828
1840
|
return formGroup ? /* @__PURE__ */ jsxRuntime.jsx(FormGroup, { error: !!error, children: content }) : content;
|
|
1829
1841
|
}
|
|
1830
|
-
function BrandingContent({ config, projectUrl }) {
|
|
1842
|
+
function BrandingContent({ config, projectUrl, staticBaseUrl }) {
|
|
1831
1843
|
const { title, symbol, symbolInverse, logo, logoInverse, alt } = config;
|
|
1832
1844
|
const label = alt ?? title ?? "";
|
|
1833
1845
|
if (logo) {
|
|
@@ -1838,11 +1850,12 @@
|
|
|
1838
1850
|
...projectUrl ? { href: projectUrl } : {},
|
|
1839
1851
|
className: "usx-image usx-logo__image",
|
|
1840
1852
|
children: [
|
|
1841
|
-
/* @__PURE__ */ jsxRuntime.jsx(Image, { src: logo, alt: label, className: "usx-logo__variant" }),
|
|
1853
|
+
/* @__PURE__ */ jsxRuntime.jsx(Image, { src: logo, alt: label, staticBaseUrl, className: "usx-logo__variant" }),
|
|
1842
1854
|
logoInverse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1843
1855
|
Image,
|
|
1844
1856
|
{
|
|
1845
1857
|
src: logoInverse,
|
|
1858
|
+
staticBaseUrl,
|
|
1846
1859
|
alt: label,
|
|
1847
1860
|
className: "usx-logo__variant usx-logo__variant--inverse"
|
|
1848
1861
|
}
|
|
@@ -1852,11 +1865,11 @@
|
|
|
1852
1865
|
);
|
|
1853
1866
|
}
|
|
1854
1867
|
return /* @__PURE__ */ jsxRuntime.jsxs("em", { className: "usa-logo__text", children: [
|
|
1855
|
-
symbol && /* @__PURE__ */ jsxRuntime.jsx("img", { src: symbol, alt: "", "aria-hidden": "true", className: "usx-logo__symbol usx-logo__variant" }),
|
|
1868
|
+
symbol && /* @__PURE__ */ jsxRuntime.jsx("img", { src: getAssetUrl(symbol, staticBaseUrl), alt: "", "aria-hidden": "true", className: "usx-logo__symbol usx-logo__variant" }),
|
|
1856
1869
|
symbolInverse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1857
1870
|
"img",
|
|
1858
1871
|
{
|
|
1859
|
-
src: symbolInverse,
|
|
1872
|
+
src: getAssetUrl(symbolInverse, staticBaseUrl),
|
|
1860
1873
|
alt: "",
|
|
1861
1874
|
"aria-hidden": "true",
|
|
1862
1875
|
className: "usx-logo__symbol usx-logo__variant usx-logo__variant--inverse"
|
|
@@ -1865,14 +1878,14 @@
|
|
|
1865
1878
|
title && (projectUrl ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: projectUrl, className: "usx-logo__title", children: title }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usx-logo__title", children: title }))
|
|
1866
1879
|
] });
|
|
1867
1880
|
}
|
|
1868
|
-
function Branding({ branding, projectUrl = "/", className = "", ...props }) {
|
|
1881
|
+
function Branding({ branding, projectUrl = "/", staticBaseUrl, className = "", ...props }) {
|
|
1869
1882
|
if (!branding) return null;
|
|
1870
1883
|
const classes = classNames(
|
|
1871
1884
|
"usa-logo",
|
|
1872
1885
|
"usx-logo",
|
|
1873
1886
|
className
|
|
1874
1887
|
);
|
|
1875
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...props, children: /* @__PURE__ */ jsxRuntime.jsx(BrandingContent, { config: branding, projectUrl }) });
|
|
1888
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes, ...props, children: /* @__PURE__ */ jsxRuntime.jsx(BrandingContent, { config: branding, projectUrl, staticBaseUrl }) });
|
|
1876
1889
|
}
|
|
1877
1890
|
function FooterReturnToTop({ label = "Return to top", href = "#", className = "" }) {
|
|
1878
1891
|
const classes = classNames(
|
|
@@ -1918,9 +1931,9 @@
|
|
|
1918
1931
|
] })
|
|
1919
1932
|
] });
|
|
1920
1933
|
}
|
|
1921
|
-
function FooterSocialLinks({ links = [], className = "" }) {
|
|
1934
|
+
function FooterSocialLinks({ links = [], staticBaseUrl, className = "" }) {
|
|
1922
1935
|
if (!links.length) return null;
|
|
1923
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["usa-footer__social-links grid-row grid-gap-1 usx-footer__social-links", className].filter(Boolean).join(" "), children: links.map((link, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsxRuntime.jsx("a", { className: "usa-social-link", href: link.href, "aria-label": link.alt, children: /* @__PURE__ */ jsxRuntime.jsx("img", { className: "usa-social-link__icon", src: link.icon, alt: link.alt }) }) }, i)) });
|
|
1936
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["usa-footer__social-links grid-row grid-gap-1 usx-footer__social-links", className].filter(Boolean).join(" "), children: links.map((link, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsxRuntime.jsx("a", { className: "usa-social-link", href: link.href, "aria-label": link.alt, children: /* @__PURE__ */ jsxRuntime.jsx("img", { className: "usa-social-link__icon", src: getAssetUrl(link.icon, staticBaseUrl), alt: link.alt }) }) }, i)) });
|
|
1924
1937
|
}
|
|
1925
1938
|
function normalizeContactLink(value, scheme) {
|
|
1926
1939
|
var _a;
|
|
@@ -1958,6 +1971,7 @@
|
|
|
1958
1971
|
signUp = null,
|
|
1959
1972
|
branding = null,
|
|
1960
1973
|
brandingUrl = "/",
|
|
1974
|
+
staticBaseUrl,
|
|
1961
1975
|
socialLinks = [],
|
|
1962
1976
|
contactHeading = null,
|
|
1963
1977
|
contactPhone = null,
|
|
@@ -1987,9 +2001,9 @@
|
|
|
1987
2001
|
links: contactLinks
|
|
1988
2002
|
}
|
|
1989
2003
|
) : null;
|
|
1990
|
-
const socialEl = socialLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(FooterSocialLinks, { links: socialLinks }) : null;
|
|
2004
|
+
const socialEl = socialLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(FooterSocialLinks, { links: socialLinks, staticBaseUrl }) : null;
|
|
1991
2005
|
const logoClassName = variant === "slim" ? "usa-footer__logo grid-row grid-gap-2 usx-footer__logo" : "usa-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2 usx-footer__logo";
|
|
1992
|
-
const brandingEl = branding ? /* @__PURE__ */ jsxRuntime.jsx(Branding, { branding, projectUrl: brandingUrl, className: logoClassName }) : null;
|
|
2006
|
+
const brandingEl = branding ? /* @__PURE__ */ jsxRuntime.jsx(Branding, { branding, projectUrl: brandingUrl, staticBaseUrl, className: logoClassName }) : null;
|
|
1993
2007
|
const secondaryContactBlock = socialEl || contactEl ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-footer__contact-links mobile-lg:grid-col-6", children: [
|
|
1994
2008
|
socialEl,
|
|
1995
2009
|
contactEl
|
|
@@ -2008,11 +2022,16 @@
|
|
|
2008
2022
|
] });
|
|
2009
2023
|
}
|
|
2010
2024
|
if (variant === "slim") {
|
|
2025
|
+
const slimContactLinks = [
|
|
2026
|
+
normalizeContactLink(contactPhone, "tel:"),
|
|
2027
|
+
normalizeContactLink(contactEmail, "mailto:"),
|
|
2028
|
+
...contactLinks
|
|
2029
|
+
].filter(Boolean);
|
|
2011
2030
|
return /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: classes, ...props, children: [
|
|
2012
2031
|
returnToTopEl,
|
|
2013
2032
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-footer__primary-section", children: primaryChildren ?? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-footer__primary-container grid-row", children: [
|
|
2014
2033
|
navLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mobile-lg:grid-col-8", children: /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "usa-footer__nav", "aria-label": navAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "grid-row grid-gap", children: navLinks.map((link, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "mobile-lg:grid-col-6 desktop:grid-col-auto usa-footer__primary-content", children: /* @__PURE__ */ jsxRuntime.jsx("a", { className: "usa-footer__primary-link", href: link.href, "aria-label": link.ariaLabel || void 0, children: link.text }) }, i)) }) }) }),
|
|
2015
|
-
|
|
2034
|
+
slimContactLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mobile-lg:grid-col-4", children: /* @__PURE__ */ jsxRuntime.jsx("address", { className: "usa-footer__address usx-footer__contact", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-row grid-gap", children: slimContactLinks.map((link, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-col-auto mobile-lg:grid-col-12 desktop:grid-col-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-footer__contact-info", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.href, children: link.text }) }) }, index)) }) }) })
|
|
2016
2035
|
] }) }),
|
|
2017
2036
|
(brandingEl || secondaryChildren) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-footer__secondary-section", children: secondaryChildren ?? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-container", children: brandingEl }) })
|
|
2018
2037
|
] });
|
|
@@ -2185,6 +2204,7 @@
|
|
|
2185
2204
|
function Header({
|
|
2186
2205
|
id = "header",
|
|
2187
2206
|
branding,
|
|
2207
|
+
staticBaseUrl,
|
|
2188
2208
|
projectUrl = "/",
|
|
2189
2209
|
navSections = [],
|
|
2190
2210
|
secondaryLinks = [],
|
|
@@ -2212,7 +2232,7 @@
|
|
|
2212
2232
|
{ "usx-nav--sticky": stickyNav }
|
|
2213
2233
|
);
|
|
2214
2234
|
const navbar = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-navbar", children: [
|
|
2215
|
-
/* @__PURE__ */ jsxRuntime.jsx(Branding, { branding, projectUrl }),
|
|
2235
|
+
/* @__PURE__ */ jsxRuntime.jsx(Branding, { branding, projectUrl, staticBaseUrl }),
|
|
2216
2236
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "usa-menu-btn align-center", children: useMenuIcon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", size: 3 }) : "Menu" })
|
|
2217
2237
|
] });
|
|
2218
2238
|
if (extended) {
|
|
@@ -4831,27 +4851,6 @@
|
|
|
4831
4851
|
] }, inputId);
|
|
4832
4852
|
}) });
|
|
4833
4853
|
};
|
|
4834
|
-
const Tooltip = ({
|
|
4835
|
-
label,
|
|
4836
|
-
position = "top",
|
|
4837
|
-
children,
|
|
4838
|
-
className = "",
|
|
4839
|
-
...props
|
|
4840
|
-
}) => {
|
|
4841
|
-
const validPositions = ["top", "bottom", "left", "right"];
|
|
4842
|
-
const normalizedPosition = validPositions.includes(position) ? position : "top";
|
|
4843
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: classNames("usx-tooltip", className), ...props, children: [
|
|
4844
|
-
children,
|
|
4845
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4846
|
-
"span",
|
|
4847
|
-
{
|
|
4848
|
-
className: `usa-tooltip__body usa-tooltip__body--${normalizedPosition}`,
|
|
4849
|
-
role: "tooltip",
|
|
4850
|
-
children: label
|
|
4851
|
-
}
|
|
4852
|
-
)
|
|
4853
|
-
] });
|
|
4854
|
-
};
|
|
4855
4854
|
const Villain = ({
|
|
4856
4855
|
title = "",
|
|
4857
4856
|
callout = "",
|