@cdt5058/json-render-uswds 0.0.1 → 0.1.1
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/CHANGELOG.md +55 -0
- package/LICENSE +201 -0
- package/README.md +194 -28
- package/dist/catalog.d.mts +1325 -0
- package/dist/catalog.d.ts +1325 -0
- package/dist/catalog.js +1170 -0
- package/dist/catalog.js.map +1 -0
- package/dist/catalog.mjs +7 -0
- package/dist/catalog.mjs.map +1 -0
- package/dist/chunk-QYJNF5RV.mjs +1146 -0
- package/dist/chunk-QYJNF5RV.mjs.map +1 -0
- package/dist/index.d.mts +90 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +3789 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2627 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +94 -6
package/dist/index.js
ADDED
|
@@ -0,0 +1,3789 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
uswdsComponentDefinitions: () => uswdsComponentDefinitions,
|
|
24
|
+
uswdsComponents: () => uswdsComponents
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/components.tsx
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_react2 = require("@json-render/react");
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
function safeHref(url) {
|
|
33
|
+
if (!url) return void 0;
|
|
34
|
+
if (/^\s*(javascript|vbscript|data):/i.test(url)) return "#";
|
|
35
|
+
return url;
|
|
36
|
+
}
|
|
37
|
+
function safeCssUrl(url) {
|
|
38
|
+
if (!url) return void 0;
|
|
39
|
+
return url.replace(/['"()\\\n\r]/g, "");
|
|
40
|
+
}
|
|
41
|
+
function getPaginationRange(current, total) {
|
|
42
|
+
if (total <= 7) {
|
|
43
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
44
|
+
}
|
|
45
|
+
const pages = [];
|
|
46
|
+
pages.push(1);
|
|
47
|
+
if (current > 3) pages.push("ellipsis");
|
|
48
|
+
const start = Math.max(2, current - 1);
|
|
49
|
+
const end = Math.min(total - 1, current + 1);
|
|
50
|
+
for (let i = start; i <= end; i++) pages.push(i);
|
|
51
|
+
if (current < total - 2) pages.push("ellipsis");
|
|
52
|
+
pages.push(total);
|
|
53
|
+
return pages;
|
|
54
|
+
}
|
|
55
|
+
function getButtonClass(variant) {
|
|
56
|
+
const base = "usa-button";
|
|
57
|
+
switch (variant) {
|
|
58
|
+
case "secondary":
|
|
59
|
+
return `${base} usa-button--secondary`;
|
|
60
|
+
case "accent-cool":
|
|
61
|
+
return `${base} usa-button--accent-cool`;
|
|
62
|
+
case "accent-warm":
|
|
63
|
+
return `${base} usa-button--accent-warm`;
|
|
64
|
+
case "base":
|
|
65
|
+
return `${base} usa-button--base`;
|
|
66
|
+
case "outline":
|
|
67
|
+
return `${base} usa-button--outline`;
|
|
68
|
+
case "outline-inverse":
|
|
69
|
+
return `${base} usa-button--outline usa-button--inverse`;
|
|
70
|
+
case "big":
|
|
71
|
+
return `${base} usa-button--big`;
|
|
72
|
+
case "unstyled":
|
|
73
|
+
return `${base} usa-button--unstyled`;
|
|
74
|
+
default:
|
|
75
|
+
return base;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
var uswdsComponents = {
|
|
79
|
+
// ── Layout ────────────────────────────────────────────────────────────
|
|
80
|
+
Grid: ({ props, children }) => {
|
|
81
|
+
const cols = Math.max(1, Math.min(12, props.columns ?? 1));
|
|
82
|
+
const gapMap = {
|
|
83
|
+
sm: "grid-gap-sm",
|
|
84
|
+
md: "grid-gap",
|
|
85
|
+
lg: "grid-gap-lg"
|
|
86
|
+
};
|
|
87
|
+
const gapClass = gapMap[props.gap ?? "md"] ?? "grid-gap";
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `grid-row ${gapClass}`, children: Array.isArray(children) ? children.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: `tablet:grid-col-${Math.floor(12 / cols)}`,
|
|
92
|
+
children: child
|
|
93
|
+
},
|
|
94
|
+
i
|
|
95
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `tablet:grid-col-${Math.floor(12 / cols)}`, children }) });
|
|
96
|
+
},
|
|
97
|
+
Card: ({ props, children }) => {
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `usa-card${props.flag ? " usa-card--flag" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-card__container", children: [
|
|
99
|
+
props.mediaUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__media", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__img", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: props.mediaUrl, alt: props.mediaAlt ?? "" }) }) }),
|
|
100
|
+
(props.title || props.description) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__header", children: props.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "usa-card__heading", children: props.title }) }),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-card__body", children: [
|
|
102
|
+
props.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: props.description }),
|
|
103
|
+
children
|
|
104
|
+
] })
|
|
105
|
+
] }) });
|
|
106
|
+
},
|
|
107
|
+
Divider: (_) => {
|
|
108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("hr", { className: "usa-divider" });
|
|
109
|
+
},
|
|
110
|
+
CardGroup: ({ props }) => {
|
|
111
|
+
const cards = props.cards ?? [];
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-card-group", children: cards.map((card, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
113
|
+
"li",
|
|
114
|
+
{
|
|
115
|
+
className: `usa-card tablet:grid-col-4${props.flag ? " usa-card--flag" : ""}`,
|
|
116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-card__container", children: [
|
|
117
|
+
card.mediaUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__media", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__img", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: card.mediaUrl, alt: card.mediaAlt ?? "" }) }) }),
|
|
118
|
+
card.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__header", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "usa-card__heading", children: card.title }) }),
|
|
119
|
+
card.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__body", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: card.description }) }),
|
|
120
|
+
card.footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-card__footer", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: card.footer }) })
|
|
121
|
+
] })
|
|
122
|
+
},
|
|
123
|
+
i
|
|
124
|
+
)) });
|
|
125
|
+
},
|
|
126
|
+
Footer: ({ props }) => {
|
|
127
|
+
const variant = props.variant ?? "medium";
|
|
128
|
+
const groups = props.navGroups ?? [];
|
|
129
|
+
const contact = props.contactInfo ?? [];
|
|
130
|
+
const socialIcons = {
|
|
131
|
+
facebook: "M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",
|
|
132
|
+
twitter: "M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z",
|
|
133
|
+
youtube: "M22.54 6.42a2.78 2.78 0 0 0-1.95-1.96C18.88 4 12 4 12 4s-6.88 0-8.59.46a2.78 2.78 0 0 0-1.95 1.96A29 29 0 0 0 1 12a29 29 0 0 0 .46 5.58 2.78 2.78 0 0 0 1.95 1.95C5.12 20 12 20 12 20s6.88 0 8.59-.47a2.78 2.78 0 0 0 1.95-1.95A29 29 0 0 0 23 12a29 29 0 0 0-.46-5.58zM9.75 15.02V8.98L15.5 12l-5.75 3.02z",
|
|
134
|
+
instagram: "M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37zm1.5-4.87h.01M7.5 2h9A5.5 5.5 0 0 1 22 7.5v9A5.5 5.5 0 0 1 16.5 22h-9A5.5 5.5 0 0 1 2 16.5v-9A5.5 5.5 0 0 1 7.5 2z",
|
|
135
|
+
linkedin: "M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6zM2 9h4v12H2z M4 6a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",
|
|
136
|
+
github: "M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22",
|
|
137
|
+
rss: "M4 11a9 9 0 0 1 9 9M4 4a16 16 0 0 1 16 16 M5 19a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"
|
|
138
|
+
};
|
|
139
|
+
const returnToTopEl = props.returnToTop ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-container usa-footer__return-to-top", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "#top", children: "Return to top" }) }) : null;
|
|
140
|
+
const logoEl = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-footer__logo grid-row grid-gap-2", children: [
|
|
141
|
+
props.logoUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-col-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
142
|
+
"img",
|
|
143
|
+
{
|
|
144
|
+
className: "usa-footer__logo-img",
|
|
145
|
+
src: props.logoUrl,
|
|
146
|
+
alt: props.logoAlt ?? ""
|
|
147
|
+
}
|
|
148
|
+
) }),
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-col-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-footer__logo-heading", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
+
"a",
|
|
151
|
+
{
|
|
152
|
+
className: "usa-footer__logo-anchor",
|
|
153
|
+
href: safeHref(props.agencyUrl) ?? "/",
|
|
154
|
+
children: props.agencyName
|
|
155
|
+
}
|
|
156
|
+
) }) })
|
|
157
|
+
] });
|
|
158
|
+
const contactEl = contact.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("address", { className: "usa-footer__address", children: [
|
|
159
|
+
props.contactHeading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-footer__contact-heading", children: props.contactHeading }),
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__contact-info grid-row grid-gap", children: contact.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-col-auto", children: item.type === "email" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: `mailto:${item.value}`, children: item.value }) : item.type === "phone" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: `tel:${item.value.replace(/\D/g, "")}`, children: item.value }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: item.value }) }, i)) })
|
|
161
|
+
] }) : null;
|
|
162
|
+
const socialEl = (props.socialLinks ?? []).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__social-links grid-row grid-gap-1", children: (props.socialLinks ?? []).map((s) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-col-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
"a",
|
|
164
|
+
{
|
|
165
|
+
className: "usa-social-link",
|
|
166
|
+
href: safeHref(s.href),
|
|
167
|
+
"aria-label": s.label,
|
|
168
|
+
rel: "noreferrer",
|
|
169
|
+
target: "_blank",
|
|
170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
171
|
+
"svg",
|
|
172
|
+
{
|
|
173
|
+
className: "usa-icon",
|
|
174
|
+
"aria-hidden": "true",
|
|
175
|
+
viewBox: "0 0 24 24",
|
|
176
|
+
width: "24",
|
|
177
|
+
height: "24",
|
|
178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: socialIcons[s.platform] ?? "" })
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
) }, s.platform)) }) : null;
|
|
183
|
+
if (variant === "slim") {
|
|
184
|
+
const links2 = groups[0]?.links ?? [];
|
|
185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { className: "usa-footer usa-footer--slim", children: [
|
|
186
|
+
returnToTopEl,
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__primary-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid-row grid-gap", children: [
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tablet:grid-col-fill usa-footer__primary-content", children: logoEl }),
|
|
189
|
+
links2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tablet:grid-col-auto usa-footer__primary-content usa-footer__primary-content--collapsible", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": "Footer navigation", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "grid-row grid-gap", children: links2.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
190
|
+
"li",
|
|
191
|
+
{
|
|
192
|
+
className: "mobile-lg:grid-col-auto usa-footer__primary-content",
|
|
193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
194
|
+
"a",
|
|
195
|
+
{
|
|
196
|
+
href: safeHref(link.href),
|
|
197
|
+
className: "usa-footer__primary-link",
|
|
198
|
+
children: link.label
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
},
|
|
202
|
+
i
|
|
203
|
+
)) }) }) })
|
|
204
|
+
] }) }) }),
|
|
205
|
+
(contact.length > 0 || socialEl) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__secondary-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-row grid-gap", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-footer__contact-links mobile-lg:grid-col-12", children: [
|
|
206
|
+
socialEl,
|
|
207
|
+
contactEl
|
|
208
|
+
] }) }) }) })
|
|
209
|
+
] });
|
|
210
|
+
}
|
|
211
|
+
if (variant === "big") {
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { className: "usa-footer usa-footer--big", children: [
|
|
213
|
+
returnToTopEl,
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__primary-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-row grid-gap-4", children: groups.map((group, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tablet:grid-col-4", children: [
|
|
215
|
+
group.heading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-footer__primary-link", children: group.heading }),
|
|
216
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-list usa-list--unstyled", children: group.links.map((link, j) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-footer__secondary-link", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: safeHref(link.href), children: link.label }) }, j)) })
|
|
217
|
+
] }, i)) }) }) }),
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__secondary-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid-row grid-gap", children: [
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tablet:grid-col-4", children: logoEl }),
|
|
220
|
+
(contact.length > 0 || socialEl) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tablet:grid-col-8 usa-footer__contact-links", children: [
|
|
221
|
+
socialEl,
|
|
222
|
+
contactEl
|
|
223
|
+
] })
|
|
224
|
+
] }) }) })
|
|
225
|
+
] });
|
|
226
|
+
}
|
|
227
|
+
const links = groups[0]?.links ?? [];
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { className: "usa-footer", children: [
|
|
229
|
+
returnToTopEl,
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__primary-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: "usa-footer__nav", "aria-label": "Footer navigation", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "grid-row grid-gap", children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
231
|
+
"li",
|
|
232
|
+
{
|
|
233
|
+
className: "mobile-lg:grid-col-4 desktop:grid-col-auto usa-footer__primary-content",
|
|
234
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: safeHref(link.href), className: "usa-footer__primary-link", children: link.label })
|
|
235
|
+
},
|
|
236
|
+
i
|
|
237
|
+
)) }) }) }),
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-footer__secondary-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid-row grid-gap", children: [
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tablet:grid-col-4", children: logoEl }),
|
|
240
|
+
(contact.length > 0 || socialEl) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tablet:grid-col-8 usa-footer__contact-links", children: [
|
|
241
|
+
socialEl,
|
|
242
|
+
contactEl
|
|
243
|
+
] })
|
|
244
|
+
] }) }) })
|
|
245
|
+
] });
|
|
246
|
+
},
|
|
247
|
+
// ── Navigation ────────────────────────────────────────────────────────
|
|
248
|
+
Accordion: ({ props }) => {
|
|
249
|
+
const items = props.items ?? [];
|
|
250
|
+
const [openItems, setOpenItems] = (0, import_react.useState)(() => {
|
|
251
|
+
const initial = /* @__PURE__ */ new Set();
|
|
252
|
+
items.forEach((item, i) => {
|
|
253
|
+
if (item.expanded) initial.add(i);
|
|
254
|
+
});
|
|
255
|
+
return initial;
|
|
256
|
+
});
|
|
257
|
+
const toggle = (index) => {
|
|
258
|
+
setOpenItems((prev) => {
|
|
259
|
+
const next = new Set(prev);
|
|
260
|
+
if (props.multiselectable) {
|
|
261
|
+
if (next.has(index)) {
|
|
262
|
+
next.delete(index);
|
|
263
|
+
} else {
|
|
264
|
+
next.add(index);
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
if (next.has(index)) {
|
|
268
|
+
next.clear();
|
|
269
|
+
} else {
|
|
270
|
+
next.clear();
|
|
271
|
+
next.add(index);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return next;
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
278
|
+
"div",
|
|
279
|
+
{
|
|
280
|
+
className: `usa-accordion${props.bordered ? " usa-accordion--bordered" : ""}`,
|
|
281
|
+
children: items.map((item, i) => {
|
|
282
|
+
const isOpen = openItems.has(i);
|
|
283
|
+
const headingId = `accordion-heading-${i}`;
|
|
284
|
+
const contentId = `accordion-content-${i}`;
|
|
285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "usa-accordion__heading", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
287
|
+
"button",
|
|
288
|
+
{
|
|
289
|
+
type: "button",
|
|
290
|
+
className: "usa-accordion__button",
|
|
291
|
+
"aria-expanded": isOpen,
|
|
292
|
+
"aria-controls": contentId,
|
|
293
|
+
id: headingId,
|
|
294
|
+
onClick: () => toggle(i),
|
|
295
|
+
children: item.title
|
|
296
|
+
}
|
|
297
|
+
) }),
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
id: contentId,
|
|
302
|
+
className: "usa-accordion__content usa-prose",
|
|
303
|
+
hidden: !isOpen,
|
|
304
|
+
role: "region",
|
|
305
|
+
"aria-labelledby": headingId,
|
|
306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: item.content })
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] }, i);
|
|
310
|
+
})
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
},
|
|
314
|
+
Pagination: ({
|
|
315
|
+
props,
|
|
316
|
+
bindings,
|
|
317
|
+
emit
|
|
318
|
+
}) => {
|
|
319
|
+
const [boundPage, setBoundPage] = (0, import_react2.useBoundProp)(
|
|
320
|
+
props.page,
|
|
321
|
+
bindings?.page
|
|
322
|
+
);
|
|
323
|
+
const [localPage, setLocalPage] = (0, import_react.useState)(props.page ?? 1);
|
|
324
|
+
const isBound = !!bindings?.page;
|
|
325
|
+
const page = isBound ? boundPage ?? 1 : localPage;
|
|
326
|
+
const setPage = isBound ? setBoundPage : setLocalPage;
|
|
327
|
+
const total = props.totalPages;
|
|
328
|
+
const range = getPaginationRange(page, total);
|
|
329
|
+
const navigate = (p) => {
|
|
330
|
+
if (p < 1 || p > total) return;
|
|
331
|
+
setPage(p);
|
|
332
|
+
emit("change");
|
|
333
|
+
};
|
|
334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
335
|
+
"nav",
|
|
336
|
+
{
|
|
337
|
+
"aria-label": props.ariaLabel ?? "Pagination",
|
|
338
|
+
className: "usa-pagination",
|
|
339
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { className: "usa-pagination__list", children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-pagination__item usa-pagination__arrow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
341
|
+
"a",
|
|
342
|
+
{
|
|
343
|
+
href: "#",
|
|
344
|
+
className: "usa-pagination__link usa-pagination__previous-page",
|
|
345
|
+
"aria-label": "Previous page",
|
|
346
|
+
"aria-disabled": page <= 1,
|
|
347
|
+
onClick: (e) => {
|
|
348
|
+
e.preventDefault();
|
|
349
|
+
navigate(page - 1);
|
|
350
|
+
},
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
353
|
+
"svg",
|
|
354
|
+
{
|
|
355
|
+
className: "usa-icon",
|
|
356
|
+
"aria-hidden": "true",
|
|
357
|
+
role: "img",
|
|
358
|
+
viewBox: "0 0 24 24",
|
|
359
|
+
width: "24",
|
|
360
|
+
height: "24",
|
|
361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6z" })
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-pagination__link-text", children: "Previous" })
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
) }),
|
|
368
|
+
range.map(
|
|
369
|
+
(item, i) => item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
370
|
+
"li",
|
|
371
|
+
{
|
|
372
|
+
className: "usa-pagination__item usa-pagination__overflow",
|
|
373
|
+
role: "presentation",
|
|
374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u2026" })
|
|
375
|
+
},
|
|
376
|
+
`ellipsis-${i}`
|
|
377
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
378
|
+
"li",
|
|
379
|
+
{
|
|
380
|
+
className: "usa-pagination__item usa-pagination__page-no",
|
|
381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
382
|
+
"a",
|
|
383
|
+
{
|
|
384
|
+
href: "#",
|
|
385
|
+
className: `usa-pagination__button${page === item ? " usa-current" : ""}`,
|
|
386
|
+
"aria-label": `Page ${item}`,
|
|
387
|
+
"aria-current": page === item ? "page" : void 0,
|
|
388
|
+
onClick: (e) => {
|
|
389
|
+
e.preventDefault();
|
|
390
|
+
navigate(item);
|
|
391
|
+
},
|
|
392
|
+
children: item
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
},
|
|
396
|
+
item
|
|
397
|
+
)
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-pagination__item usa-pagination__arrow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
400
|
+
"a",
|
|
401
|
+
{
|
|
402
|
+
href: "#",
|
|
403
|
+
className: "usa-pagination__link usa-pagination__next-page",
|
|
404
|
+
"aria-label": "Next page",
|
|
405
|
+
"aria-disabled": page >= total,
|
|
406
|
+
onClick: (e) => {
|
|
407
|
+
e.preventDefault();
|
|
408
|
+
navigate(page + 1);
|
|
409
|
+
},
|
|
410
|
+
children: [
|
|
411
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-pagination__link-text", children: "Next" }),
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
413
|
+
"svg",
|
|
414
|
+
{
|
|
415
|
+
className: "usa-icon",
|
|
416
|
+
"aria-hidden": "true",
|
|
417
|
+
role: "img",
|
|
418
|
+
viewBox: "0 0 24 24",
|
|
419
|
+
width: "24",
|
|
420
|
+
height: "24",
|
|
421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z" })
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
) })
|
|
427
|
+
] })
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
},
|
|
431
|
+
StepIndicator: ({
|
|
432
|
+
props
|
|
433
|
+
}) => {
|
|
434
|
+
const steps = props.steps ?? [];
|
|
435
|
+
const current = Math.max(1, Math.min(steps.length, Number(props.currentStep) || 1));
|
|
436
|
+
const countersClass = props.counters === "small" ? " usa-step-indicator--counters-sm" : props.counters === "default" ? " usa-step-indicator--counters" : "";
|
|
437
|
+
const centeredClass = props.centered ? " usa-step-indicator--center" : "";
|
|
438
|
+
const noLabelsClass = props.noLabels ? " usa-step-indicator--no-labels" : "";
|
|
439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
440
|
+
"div",
|
|
441
|
+
{
|
|
442
|
+
className: `usa-step-indicator${countersClass}${centeredClass}${noLabelsClass}`,
|
|
443
|
+
"aria-label": "Progress",
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "usa-step-indicator__segments", children: steps.map((label, i) => {
|
|
446
|
+
const stepNum = i + 1;
|
|
447
|
+
const isComplete = stepNum < current;
|
|
448
|
+
const isCurrent = stepNum === current;
|
|
449
|
+
const segClass = isComplete ? "usa-step-indicator__segment usa-step-indicator__segment--complete" : isCurrent ? "usa-step-indicator__segment usa-step-indicator__segment--current" : "usa-step-indicator__segment";
|
|
450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
451
|
+
"li",
|
|
452
|
+
{
|
|
453
|
+
className: segClass,
|
|
454
|
+
"aria-current": isCurrent ? "step" : void 0,
|
|
455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "usa-step-indicator__segment-label", children: [
|
|
456
|
+
label,
|
|
457
|
+
isComplete && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: "completed" }),
|
|
458
|
+
isCurrent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: "in progress" })
|
|
459
|
+
] })
|
|
460
|
+
},
|
|
461
|
+
i
|
|
462
|
+
);
|
|
463
|
+
}) }),
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-step-indicator__header", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h4", { className: "usa-step-indicator__heading", children: [
|
|
465
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "usa-step-indicator__heading-counter", children: [
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: "Step " }),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-step-indicator__current-step", children: current }),
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "usa-step-indicator__total-steps", children: [
|
|
469
|
+
" ",
|
|
470
|
+
"of ",
|
|
471
|
+
steps.length
|
|
472
|
+
] })
|
|
473
|
+
] }),
|
|
474
|
+
steps[current - 1] && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-step-indicator__heading-text", children: steps[current - 1] })
|
|
475
|
+
] }) })
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
},
|
|
480
|
+
Breadcrumb: ({ props }) => {
|
|
481
|
+
const items = props.items ?? [];
|
|
482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: "usa-breadcrumb", "aria-label": "Breadcrumbs", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "usa-breadcrumb__list", children: items.map((item, i) => {
|
|
483
|
+
const isLast = i === items.length - 1;
|
|
484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
485
|
+
"li",
|
|
486
|
+
{
|
|
487
|
+
className: `usa-breadcrumb__list-item${isLast ? " usa-current" : ""}`,
|
|
488
|
+
"aria-current": isLast ? "page" : void 0,
|
|
489
|
+
children: item.href && !isLast ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: safeHref(item.href), className: "usa-breadcrumb__link", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.label }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.label })
|
|
490
|
+
},
|
|
491
|
+
i
|
|
492
|
+
);
|
|
493
|
+
}) }) });
|
|
494
|
+
},
|
|
495
|
+
Header: ({ props }) => {
|
|
496
|
+
const [mobileOpen, setMobileOpen] = (0, import_react.useState)(false);
|
|
497
|
+
const [openDropdown, setOpenDropdown] = (0, import_react.useState)(null);
|
|
498
|
+
const uid = (0, import_react.useId)();
|
|
499
|
+
const isExtended = props.variant === "extended";
|
|
500
|
+
const navItems = props.navItems ?? [];
|
|
501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `usa-overlay${mobileOpen ? " is-visible" : ""}` }),
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
504
|
+
"header",
|
|
505
|
+
{
|
|
506
|
+
className: `usa-header${isExtended ? " usa-header--extended" : " usa-header--basic"}`,
|
|
507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-nav-container", children: [
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-navbar", children: [
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-logo", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { className: "usa-logo__text", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: safeHref(props.siteUrl) ?? "/", title: "Home", children: [
|
|
510
|
+
props.logoUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
511
|
+
"img",
|
|
512
|
+
{
|
|
513
|
+
className: "usa-header__logo",
|
|
514
|
+
src: props.logoUrl,
|
|
515
|
+
alt: props.logoAlt ?? "",
|
|
516
|
+
style: {
|
|
517
|
+
maxHeight: "2.5rem",
|
|
518
|
+
marginRight: "0.5rem",
|
|
519
|
+
verticalAlign: "middle"
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
props.siteName
|
|
524
|
+
] }) }) }),
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
526
|
+
"button",
|
|
527
|
+
{
|
|
528
|
+
type: "button",
|
|
529
|
+
className: "usa-menu-btn",
|
|
530
|
+
onClick: () => setMobileOpen(true),
|
|
531
|
+
children: "Menu"
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
] }),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
536
|
+
"nav",
|
|
537
|
+
{
|
|
538
|
+
"aria-label": "Primary navigation",
|
|
539
|
+
className: `usa-nav${mobileOpen ? " is-visible" : ""}`,
|
|
540
|
+
children: [
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
542
|
+
"button",
|
|
543
|
+
{
|
|
544
|
+
type: "button",
|
|
545
|
+
className: "usa-nav__close",
|
|
546
|
+
onClick: () => {
|
|
547
|
+
setMobileOpen(false);
|
|
548
|
+
setOpenDropdown(null);
|
|
549
|
+
},
|
|
550
|
+
children: [
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
552
|
+
"svg",
|
|
553
|
+
{
|
|
554
|
+
className: "usa-icon",
|
|
555
|
+
"aria-hidden": "true",
|
|
556
|
+
focusable: false,
|
|
557
|
+
role: "img",
|
|
558
|
+
viewBox: "0 0 24 24",
|
|
559
|
+
width: "24",
|
|
560
|
+
height: "24",
|
|
561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
"Close"
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
),
|
|
568
|
+
props.showSearch && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { role: "search", className: "usa-search usa-search--small", children: [
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
570
|
+
"label",
|
|
571
|
+
{
|
|
572
|
+
className: "usa-sr-only",
|
|
573
|
+
htmlFor: `${uid}-header-search`,
|
|
574
|
+
children: "Search"
|
|
575
|
+
}
|
|
576
|
+
),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
578
|
+
"input",
|
|
579
|
+
{
|
|
580
|
+
className: "usa-input",
|
|
581
|
+
id: `${uid}-header-search`,
|
|
582
|
+
type: "search",
|
|
583
|
+
name: "search"
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { className: "usa-button", type: "submit", children: [
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
588
|
+
"svg",
|
|
589
|
+
{
|
|
590
|
+
className: "usa-icon",
|
|
591
|
+
"aria-hidden": "true",
|
|
592
|
+
role: "img",
|
|
593
|
+
viewBox: "0 0 24 24",
|
|
594
|
+
width: "24",
|
|
595
|
+
height: "24",
|
|
596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14" })
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: "Search" })
|
|
600
|
+
] })
|
|
601
|
+
] }),
|
|
602
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-nav__primary usa-accordion", children: navItems.map((item, i) => {
|
|
603
|
+
const hasDropdown = item.items && item.items.length > 0;
|
|
604
|
+
const isOpen = openDropdown === i;
|
|
605
|
+
const dropdownId = `${uid}-nav-dropdown-${i}`;
|
|
606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
607
|
+
"li",
|
|
608
|
+
{
|
|
609
|
+
className: `usa-nav__primary-item${item.current ? " usa-current" : ""}`,
|
|
610
|
+
children: hasDropdown ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
612
|
+
"button",
|
|
613
|
+
{
|
|
614
|
+
type: "button",
|
|
615
|
+
className: `usa-accordion__button usa-nav__link${item.current ? " usa-current" : ""}`,
|
|
616
|
+
"aria-expanded": isOpen,
|
|
617
|
+
"aria-controls": dropdownId,
|
|
618
|
+
onClick: () => setOpenDropdown(isOpen ? null : i),
|
|
619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.label })
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
623
|
+
"ul",
|
|
624
|
+
{
|
|
625
|
+
id: dropdownId,
|
|
626
|
+
className: "usa-nav__submenu",
|
|
627
|
+
hidden: !isOpen,
|
|
628
|
+
children: (item.items ?? []).map((sub, j) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: safeHref(sub.href), children: sub.label }) }, j))
|
|
629
|
+
}
|
|
630
|
+
)
|
|
631
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
632
|
+
"a",
|
|
633
|
+
{
|
|
634
|
+
href: safeHref(item.href),
|
|
635
|
+
className: `usa-nav__link${item.current ? " usa-current" : ""}`,
|
|
636
|
+
"aria-current": item.current ? "page" : void 0,
|
|
637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.label })
|
|
638
|
+
}
|
|
639
|
+
)
|
|
640
|
+
},
|
|
641
|
+
i
|
|
642
|
+
);
|
|
643
|
+
}) })
|
|
644
|
+
]
|
|
645
|
+
}
|
|
646
|
+
)
|
|
647
|
+
] })
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
] });
|
|
651
|
+
},
|
|
652
|
+
SkipNav: ({ props }) => {
|
|
653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "usa-skipnav", href: safeHref(props.href) ?? "#main-content", children: props.label ?? "Skip to main content" });
|
|
654
|
+
},
|
|
655
|
+
SideNav: ({ props }) => {
|
|
656
|
+
const items = props.items ?? [];
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": props.ariaLabel ?? "Side navigation", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-sidenav", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "usa-sidenav__item", children: [
|
|
658
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
659
|
+
"a",
|
|
660
|
+
{
|
|
661
|
+
href: safeHref(item.href),
|
|
662
|
+
className: item.current ? "usa-current" : void 0,
|
|
663
|
+
"aria-current": item.current ? "page" : void 0,
|
|
664
|
+
children: item.label
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
item.children && item.children.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-sidenav__sublist", children: item.children.map((child, j) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-sidenav__item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
668
|
+
"a",
|
|
669
|
+
{
|
|
670
|
+
href: safeHref(child.href),
|
|
671
|
+
className: child.current ? "usa-current" : void 0,
|
|
672
|
+
"aria-current": child.current ? "page" : void 0,
|
|
673
|
+
children: child.label
|
|
674
|
+
}
|
|
675
|
+
) }, j)) })
|
|
676
|
+
] }, i)) }) });
|
|
677
|
+
},
|
|
678
|
+
LanguageSelector: ({
|
|
679
|
+
props
|
|
680
|
+
}) => {
|
|
681
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
682
|
+
const uid = (0, import_react.useId)();
|
|
683
|
+
const submenuId = `${uid}-language-submenu`;
|
|
684
|
+
const languages = props.languages ?? [];
|
|
685
|
+
const current = props.currentLang ?? "";
|
|
686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": "Language selector", className: "usa-language-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-language__primary", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "usa-language__primary-item", children: [
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
688
|
+
"button",
|
|
689
|
+
{
|
|
690
|
+
type: "button",
|
|
691
|
+
className: "usa-accordion__button usa-language__link",
|
|
692
|
+
"aria-expanded": open,
|
|
693
|
+
"aria-controls": submenuId,
|
|
694
|
+
onClick: () => setOpen((v) => !v),
|
|
695
|
+
children: languages.find((l) => l.lang === current)?.label ?? "Language"
|
|
696
|
+
}
|
|
697
|
+
),
|
|
698
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { id: submenuId, className: "usa-language__submenu", hidden: !open, children: languages.filter((l) => l.lang !== current).map((lang) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-language__submenu-item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
699
|
+
"a",
|
|
700
|
+
{
|
|
701
|
+
href: safeHref(lang.href),
|
|
702
|
+
lang: lang.lang,
|
|
703
|
+
hrefLang: lang.lang,
|
|
704
|
+
className: "usa-language__submenu-link",
|
|
705
|
+
children: lang.localLabel ?? lang.label
|
|
706
|
+
}
|
|
707
|
+
) }, lang.lang)) })
|
|
708
|
+
] }) }) });
|
|
709
|
+
},
|
|
710
|
+
Link: ({ props, emit }) => {
|
|
711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
712
|
+
"a",
|
|
713
|
+
{
|
|
714
|
+
href: safeHref(props.href),
|
|
715
|
+
className: props.variant === "nav" ? "usa-nav__link" : "usa-link",
|
|
716
|
+
target: props.external ? "_blank" : void 0,
|
|
717
|
+
rel: props.external ? "noreferrer" : void 0,
|
|
718
|
+
onClick: () => emit("press"),
|
|
719
|
+
children: [
|
|
720
|
+
props.label,
|
|
721
|
+
props.external && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
722
|
+
"svg",
|
|
723
|
+
{
|
|
724
|
+
className: "usa-icon",
|
|
725
|
+
"aria-label": "(external link)",
|
|
726
|
+
role: "img",
|
|
727
|
+
viewBox: "0 0 24 24",
|
|
728
|
+
width: "16",
|
|
729
|
+
height: "16",
|
|
730
|
+
style: { marginLeft: "0.25em", verticalAlign: "middle" },
|
|
731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 19H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z" })
|
|
732
|
+
}
|
|
733
|
+
)
|
|
734
|
+
]
|
|
735
|
+
}
|
|
736
|
+
);
|
|
737
|
+
},
|
|
738
|
+
InPageNavigation: ({
|
|
739
|
+
props
|
|
740
|
+
}) => {
|
|
741
|
+
const items = props.items ?? [];
|
|
742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
743
|
+
"nav",
|
|
744
|
+
{
|
|
745
|
+
"aria-label": props.heading ?? "On this page",
|
|
746
|
+
className: "usa-in-page-nav",
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-in-page-nav__header", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-in-page-nav__title", children: props.heading ?? "On this page" }) }),
|
|
749
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-in-page-nav__list", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-in-page-nav__item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: safeHref(item.href), className: "usa-in-page-nav__link", children: item.label }) }, i)) })
|
|
750
|
+
]
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
},
|
|
754
|
+
// ── Data Display ──────────────────────────────────────────────────────
|
|
755
|
+
Table: ({ props }) => {
|
|
756
|
+
const columns = props.columns ?? [];
|
|
757
|
+
const rows = (props.rows ?? []).map((row) => row.map(String));
|
|
758
|
+
const tableClass = [
|
|
759
|
+
"usa-table",
|
|
760
|
+
props.borderless ? "usa-table--borderless" : "",
|
|
761
|
+
props.striped ? "usa-table--striped" : "",
|
|
762
|
+
props.compact ? "usa-table--compact" : ""
|
|
763
|
+
].filter(Boolean).join(" ");
|
|
764
|
+
const table = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: tableClass, children: [
|
|
765
|
+
props.caption && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { children: props.caption }),
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: col }, col)) }) }),
|
|
767
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: row.map((cell, j) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: cell }, j)) }, i)) })
|
|
768
|
+
] });
|
|
769
|
+
if (props.scrollable) {
|
|
770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-table-container--scrollable", tabIndex: 0, children: table });
|
|
771
|
+
}
|
|
772
|
+
return table;
|
|
773
|
+
},
|
|
774
|
+
Heading: ({ props }) => {
|
|
775
|
+
const level = props.level ?? "h2";
|
|
776
|
+
if (level === "h1") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "usa-prose", children: props.text });
|
|
777
|
+
if (level === "h3") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "usa-prose", children: props.text });
|
|
778
|
+
if (level === "h4") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "usa-prose", children: props.text });
|
|
779
|
+
if (level === "h5") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h5", { className: "usa-prose", children: props.text });
|
|
780
|
+
if (level === "h6") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h6", { className: "usa-prose", children: props.text });
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "usa-prose", children: props.text });
|
|
782
|
+
},
|
|
783
|
+
Text: ({ props }) => {
|
|
784
|
+
if (props.variant === "lead") {
|
|
785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-intro", children: props.text });
|
|
786
|
+
}
|
|
787
|
+
if (props.variant === "small") {
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { className: "usa-prose", children: props.text });
|
|
789
|
+
}
|
|
790
|
+
if (props.variant === "code") {
|
|
791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { className: "usa-prose", children: props.text });
|
|
792
|
+
}
|
|
793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-prose", children: props.text });
|
|
794
|
+
},
|
|
795
|
+
Alert: ({ props }) => {
|
|
796
|
+
const typeClass = props.type === "success" ? "usa-alert--success" : props.type === "warning" ? "usa-alert--warning" : props.type === "error" ? "usa-alert--error" : props.type === "emergency" ? "usa-alert--emergency" : "usa-alert--info";
|
|
797
|
+
const slimClass = props.slim ? " usa-alert--slim" : "";
|
|
798
|
+
const noIconClass = props.noIcon ? " usa-alert--no-icon" : "";
|
|
799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
800
|
+
"div",
|
|
801
|
+
{
|
|
802
|
+
className: `usa-alert ${typeClass}${slimClass}${noIconClass}`,
|
|
803
|
+
role: "alert",
|
|
804
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-alert__body", children: [
|
|
805
|
+
props.heading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "usa-alert__heading", children: props.heading }),
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-alert__text", children: props.message })
|
|
807
|
+
] })
|
|
808
|
+
}
|
|
809
|
+
);
|
|
810
|
+
},
|
|
811
|
+
SiteAlert: ({ props }) => {
|
|
812
|
+
const typeClass = props.type === "emergency" ? "usa-site-alert--emergency" : "usa-site-alert--info";
|
|
813
|
+
const slimClass = props.slim ? " usa-site-alert--slim" : "";
|
|
814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
815
|
+
"section",
|
|
816
|
+
{
|
|
817
|
+
className: `usa-site-alert ${typeClass}${slimClass}`,
|
|
818
|
+
"aria-label": "Site alert",
|
|
819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-alert", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-alert__body", children: [
|
|
820
|
+
props.heading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "usa-alert__heading", children: props.heading }),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-alert__text", children: props.message })
|
|
822
|
+
] }) })
|
|
823
|
+
}
|
|
824
|
+
);
|
|
825
|
+
},
|
|
826
|
+
Tag: ({ props }) => {
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `usa-tag${props.big ? " usa-tag--big" : ""}`, children: props.text });
|
|
828
|
+
},
|
|
829
|
+
SummaryBox: ({ props }) => {
|
|
830
|
+
const uid = (0, import_react.useId)();
|
|
831
|
+
const headingId = `${uid}-summary-heading`;
|
|
832
|
+
const items = props.items ?? [];
|
|
833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
834
|
+
"div",
|
|
835
|
+
{
|
|
836
|
+
className: "usa-summary-box",
|
|
837
|
+
role: "region",
|
|
838
|
+
"aria-labelledby": headingId,
|
|
839
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-summary-box__body", children: [
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "usa-summary-box__heading", id: headingId, children: props.heading }),
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-summary-box__text", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-list", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-summary-box__list-item", children: item }, i)) }) })
|
|
842
|
+
] })
|
|
843
|
+
}
|
|
844
|
+
);
|
|
845
|
+
},
|
|
846
|
+
ProcessList: ({ props }) => {
|
|
847
|
+
const items = props.items ?? [];
|
|
848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "usa-process-list", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "usa-process-list__item", children: [
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "usa-process-list__heading", children: item.heading }),
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "margin-top-05", children: item.content })
|
|
851
|
+
] }, i)) });
|
|
852
|
+
},
|
|
853
|
+
GovBanner: ({ props }) => {
|
|
854
|
+
const [expanded, setExpanded] = (0, import_react.useState)(props.expanded ?? false);
|
|
855
|
+
const tld = props.tld ?? ".gov";
|
|
856
|
+
const isMil = tld === ".mil";
|
|
857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
858
|
+
"section",
|
|
859
|
+
{
|
|
860
|
+
className: `usa-banner${expanded ? " usa-banner--expanded" : ""}`,
|
|
861
|
+
"aria-label": "Official website of the United States government",
|
|
862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-accordion", children: [
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: "usa-banner__header", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-banner__inner", children: [
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-col-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
865
|
+
"svg",
|
|
866
|
+
{
|
|
867
|
+
"aria-hidden": "true",
|
|
868
|
+
className: "usa-banner__header-flag",
|
|
869
|
+
width: "16",
|
|
870
|
+
height: "11",
|
|
871
|
+
viewBox: "0 0 16 11",
|
|
872
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
873
|
+
children: [
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { width: "16", height: "11", fill: "#B22234" }),
|
|
875
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { y: "0.846", width: "16", height: "0.846", fill: "white" }),
|
|
876
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { y: "2.539", width: "16", height: "0.846", fill: "white" }),
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { y: "4.231", width: "16", height: "0.846", fill: "white" }),
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { y: "5.923", width: "16", height: "0.846", fill: "white" }),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { y: "7.615", width: "16", height: "0.846", fill: "white" }),
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { y: "9.307", width: "16", height: "0.846", fill: "white" }),
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { width: "6.4", height: "5.923", fill: "#3C3B6E" })
|
|
882
|
+
]
|
|
883
|
+
}
|
|
884
|
+
) }),
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
886
|
+
"div",
|
|
887
|
+
{
|
|
888
|
+
className: "grid-col-fill tablet:grid-col-auto",
|
|
889
|
+
"aria-hidden": "true",
|
|
890
|
+
children: [
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-banner__header-text", children: "An official website of the United States government" }),
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-banner__header-action", children: "Here's how you know" })
|
|
893
|
+
]
|
|
894
|
+
}
|
|
895
|
+
),
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
897
|
+
"button",
|
|
898
|
+
{
|
|
899
|
+
type: "button",
|
|
900
|
+
className: "usa-accordion__button usa-banner__button",
|
|
901
|
+
"aria-expanded": expanded,
|
|
902
|
+
"aria-controls": "gov-banner-content",
|
|
903
|
+
onClick: () => setExpanded((v) => !v),
|
|
904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-banner__button-text", children: "Here's how you know" })
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
] }) }),
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
909
|
+
"div",
|
|
910
|
+
{
|
|
911
|
+
className: "usa-banner__content usa-accordion__content",
|
|
912
|
+
id: "gov-banner-content",
|
|
913
|
+
hidden: !expanded,
|
|
914
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid-row grid-gap-lg", children: [
|
|
915
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-banner__guidance tablet:grid-col-6", children: [
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
917
|
+
"svg",
|
|
918
|
+
{
|
|
919
|
+
className: "usa-banner__icon usa-media-block__img",
|
|
920
|
+
"aria-hidden": "true",
|
|
921
|
+
width: "40",
|
|
922
|
+
height: "40",
|
|
923
|
+
viewBox: "0 0 40 40",
|
|
924
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
925
|
+
children: [
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "20", cy: "20", r: "20", fill: "#005ea2" }),
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
928
|
+
"path",
|
|
929
|
+
{
|
|
930
|
+
fill: "white",
|
|
931
|
+
d: "M20 9l11 6.5V17H9v-1.5L20 9zM11 19h3v11h-3V19zm7.5 0h3v11h-3V19zm7 0h3v11h-3V19zM9 31h22v2H9V31z"
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
]
|
|
935
|
+
}
|
|
936
|
+
),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-media-block__body", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [
|
|
939
|
+
"Official ",
|
|
940
|
+
isMil ? ".mil" : ".gov",
|
|
941
|
+
" websites use HTTPS"
|
|
942
|
+
] }),
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
944
|
+
"A ",
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "lock" }),
|
|
946
|
+
" or ",
|
|
947
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "https://" }),
|
|
948
|
+
" ",
|
|
949
|
+
"means you've safely connected to the",
|
|
950
|
+
" ",
|
|
951
|
+
isMil ? ".mil" : ".gov",
|
|
952
|
+
" website."
|
|
953
|
+
] }) })
|
|
954
|
+
] }),
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-banner__guidance tablet:grid-col-6", children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
957
|
+
"svg",
|
|
958
|
+
{
|
|
959
|
+
className: "usa-banner__icon usa-media-block__img",
|
|
960
|
+
"aria-hidden": "true",
|
|
961
|
+
width: "40",
|
|
962
|
+
height: "40",
|
|
963
|
+
viewBox: "0 0 40 40",
|
|
964
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
965
|
+
children: [
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "20", cy: "20", r: "20", fill: "#005ea2" }),
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
968
|
+
"path",
|
|
969
|
+
{
|
|
970
|
+
fill: "white",
|
|
971
|
+
d: "M20 10c-3.9 0-7 3.1-7 7v2h-2v13h18V19h-2v-2c0-3.9-3.1-7-7-7zm0 3c2.2 0 4 1.8 4 4v2h-8v-2c0-2.2 1.8-4 4-4zm0 11a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"
|
|
972
|
+
}
|
|
973
|
+
)
|
|
974
|
+
]
|
|
975
|
+
}
|
|
976
|
+
),
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-media-block__body", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [
|
|
979
|
+
"Secure ",
|
|
980
|
+
isMil ? ".mil" : ".gov",
|
|
981
|
+
" websites use HTTPS"
|
|
982
|
+
] }),
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
984
|
+
"Share sensitive information only on official, secure websites."
|
|
985
|
+
] }) })
|
|
986
|
+
] })
|
|
987
|
+
] })
|
|
988
|
+
}
|
|
989
|
+
)
|
|
990
|
+
] })
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
},
|
|
994
|
+
Identifier: ({ props }) => {
|
|
995
|
+
const links = props.links ?? [];
|
|
996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "usa-identifier", children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
998
|
+
"section",
|
|
999
|
+
{
|
|
1000
|
+
className: "usa-identifier__section usa-identifier__section--masthead",
|
|
1001
|
+
"aria-label": "Agency identifier",
|
|
1002
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-identifier__container", children: [
|
|
1003
|
+
props.logoUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-identifier__logos", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1004
|
+
"a",
|
|
1005
|
+
{
|
|
1006
|
+
href: safeHref(props.agencyUrl) ?? "/",
|
|
1007
|
+
className: "usa-identifier__logo",
|
|
1008
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1009
|
+
"img",
|
|
1010
|
+
{
|
|
1011
|
+
className: "usa-identifier__logo-img",
|
|
1012
|
+
src: props.logoUrl,
|
|
1013
|
+
alt: props.logoAlt ?? `${props.agencyName} logo`,
|
|
1014
|
+
role: "img"
|
|
1015
|
+
}
|
|
1016
|
+
)
|
|
1017
|
+
}
|
|
1018
|
+
) }),
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1020
|
+
"section",
|
|
1021
|
+
{
|
|
1022
|
+
className: "usa-identifier__identity",
|
|
1023
|
+
"aria-label": "Agency description",
|
|
1024
|
+
children: [
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-identifier__identity-domain", children: props.domain }),
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-identifier__identity-disclaimer", children: props.disclaimer ?? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1027
|
+
"An official website of the",
|
|
1028
|
+
" ",
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "usa-link", href: safeHref(props.agencyUrl) ?? "/", children: props.agencyName })
|
|
1030
|
+
] }) })
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
)
|
|
1034
|
+
] })
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1038
|
+
"nav",
|
|
1039
|
+
{
|
|
1040
|
+
className: "usa-identifier__section usa-identifier__section--required-links",
|
|
1041
|
+
"aria-label": "Important links",
|
|
1042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-identifier__container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-identifier__required-links-list", children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-identifier__required-links-item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1043
|
+
"a",
|
|
1044
|
+
{
|
|
1045
|
+
href: safeHref(link.href),
|
|
1046
|
+
className: "usa-identifier__required-link usa-link",
|
|
1047
|
+
children: link.label
|
|
1048
|
+
}
|
|
1049
|
+
) }, i)) }) })
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
(props.showUsagov ?? true) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1053
|
+
"section",
|
|
1054
|
+
{
|
|
1055
|
+
className: "usa-identifier__section usa-identifier__section--usagov",
|
|
1056
|
+
"aria-label": "U.S. government information and services",
|
|
1057
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-identifier__container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-identifier__usagov-description", children: [
|
|
1058
|
+
"Looking for U.S. government information and services?",
|
|
1059
|
+
" ",
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "usa-link", href: "https://www.usa.gov/", children: "Visit USA.gov" })
|
|
1061
|
+
] }) })
|
|
1062
|
+
}
|
|
1063
|
+
)
|
|
1064
|
+
] });
|
|
1065
|
+
},
|
|
1066
|
+
IconList: ({ props }) => {
|
|
1067
|
+
const items = props.items ?? [];
|
|
1068
|
+
const sizeClass = props.size ? ` usa-icon-list--size-${props.size}` : "";
|
|
1069
|
+
const colorMap = {
|
|
1070
|
+
success: "text-green",
|
|
1071
|
+
error: "text-red",
|
|
1072
|
+
warning: "text-gold",
|
|
1073
|
+
info: "text-blue",
|
|
1074
|
+
default: ""
|
|
1075
|
+
};
|
|
1076
|
+
const iconPaths = {
|
|
1077
|
+
check_circle: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5l-4.5-4.5 1.41-1.41L10 13.67l7.09-7.09 1.41 1.41L10 16.5z",
|
|
1078
|
+
cancel: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",
|
|
1079
|
+
info: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z",
|
|
1080
|
+
warning: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z",
|
|
1081
|
+
error: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z",
|
|
1082
|
+
star: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",
|
|
1083
|
+
arrow_forward: "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
|
1084
|
+
};
|
|
1085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { className: `usa-icon-list${sizeClass}`, children: [
|
|
1086
|
+
props.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-icon-list__item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-icon-list__title", children: props.title }) }),
|
|
1087
|
+
items.map((item, i) => {
|
|
1088
|
+
const color = colorMap[item.color ?? "default"] ?? "";
|
|
1089
|
+
const path = iconPaths[item.icon] ?? iconPaths["info"];
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "usa-icon-list__item", children: [
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `usa-icon-list__icon${color ? ` ${color}` : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1092
|
+
"svg",
|
|
1093
|
+
{
|
|
1094
|
+
className: "usa-icon",
|
|
1095
|
+
"aria-hidden": "true",
|
|
1096
|
+
role: "img",
|
|
1097
|
+
viewBox: "0 0 24 24",
|
|
1098
|
+
width: "24",
|
|
1099
|
+
height: "24",
|
|
1100
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: path })
|
|
1101
|
+
}
|
|
1102
|
+
) }),
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-icon-list__content", children: item.content })
|
|
1104
|
+
] }, i);
|
|
1105
|
+
})
|
|
1106
|
+
] });
|
|
1107
|
+
},
|
|
1108
|
+
Collection: ({ props }) => {
|
|
1109
|
+
const items = props.items ?? [];
|
|
1110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-collection", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "usa-collection__item", children: [
|
|
1111
|
+
item.thumbnailUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1112
|
+
"img",
|
|
1113
|
+
{
|
|
1114
|
+
className: "usa-collection__thumbnail",
|
|
1115
|
+
src: item.thumbnailUrl,
|
|
1116
|
+
alt: item.thumbnailAlt ?? ""
|
|
1117
|
+
}
|
|
1118
|
+
),
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-collection__body", children: [
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "usa-collection__heading", children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "usa-link", href: safeHref(item.href), children: item.heading }) : item.heading }),
|
|
1121
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-collection__description", children: item.description }),
|
|
1122
|
+
(item.date || item.tags && item.tags.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { className: "usa-collection__meta", "aria-label": "Topics", children: [
|
|
1123
|
+
item.date && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-collection__meta-item usa-collection__calendar-date", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { dateTime: item.date, children: item.dateLabel ?? item.date }) }),
|
|
1124
|
+
(item.tags ?? []).map((tag) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-collection__meta-item usa-tag", children: tag }, tag))
|
|
1125
|
+
] })
|
|
1126
|
+
] })
|
|
1127
|
+
] }, i)) });
|
|
1128
|
+
},
|
|
1129
|
+
Tooltip: ({ props }) => {
|
|
1130
|
+
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
1131
|
+
const uid = (0, import_react.useId)();
|
|
1132
|
+
const tooltipId = `${uid}-tooltip`;
|
|
1133
|
+
const position = props.position ?? "top";
|
|
1134
|
+
const positionClass = `usa-tooltip__body--${position}`;
|
|
1135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1136
|
+
"span",
|
|
1137
|
+
{
|
|
1138
|
+
className: "usa-tooltip",
|
|
1139
|
+
style: { position: "relative", display: "inline-block" },
|
|
1140
|
+
onMouseEnter: () => setVisible(true),
|
|
1141
|
+
onMouseLeave: () => setVisible(false),
|
|
1142
|
+
onFocus: () => setVisible(true),
|
|
1143
|
+
onBlur: () => setVisible(false),
|
|
1144
|
+
children: [
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1146
|
+
"span",
|
|
1147
|
+
{
|
|
1148
|
+
tabIndex: 0,
|
|
1149
|
+
className: "usa-tooltip__trigger",
|
|
1150
|
+
"aria-describedby": tooltipId,
|
|
1151
|
+
children: props.label
|
|
1152
|
+
}
|
|
1153
|
+
),
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1155
|
+
"span",
|
|
1156
|
+
{
|
|
1157
|
+
id: tooltipId,
|
|
1158
|
+
className: `usa-tooltip__body ${positionClass}${visible ? " is-set is-visible" : ""}`,
|
|
1159
|
+
role: "tooltip",
|
|
1160
|
+
"aria-hidden": !visible,
|
|
1161
|
+
children: props.content
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1164
|
+
]
|
|
1165
|
+
}
|
|
1166
|
+
);
|
|
1167
|
+
},
|
|
1168
|
+
// ── Form Inputs ───────────────────────────────────────────────────────
|
|
1169
|
+
Button: ({ props, emit }) => {
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1171
|
+
"button",
|
|
1172
|
+
{
|
|
1173
|
+
type: props.type ?? "button",
|
|
1174
|
+
className: getButtonClass(props.variant),
|
|
1175
|
+
disabled: props.disabled ?? false,
|
|
1176
|
+
onClick: () => emit("press"),
|
|
1177
|
+
children: props.label
|
|
1178
|
+
}
|
|
1179
|
+
);
|
|
1180
|
+
},
|
|
1181
|
+
ButtonGroup: ({
|
|
1182
|
+
props,
|
|
1183
|
+
emit
|
|
1184
|
+
}) => {
|
|
1185
|
+
const buttons = props.buttons ?? [];
|
|
1186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1187
|
+
"ul",
|
|
1188
|
+
{
|
|
1189
|
+
className: `usa-button-group${props.segmented ? " usa-button-group--segmented" : ""}`,
|
|
1190
|
+
children: buttons.map((btn) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "usa-button-group__item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1191
|
+
"button",
|
|
1192
|
+
{
|
|
1193
|
+
type: "button",
|
|
1194
|
+
className: getButtonClass(btn.variant ?? "default"),
|
|
1195
|
+
onClick: () => emit("press"),
|
|
1196
|
+
"data-value": btn.value,
|
|
1197
|
+
children: btn.label
|
|
1198
|
+
}
|
|
1199
|
+
) }, btn.value))
|
|
1200
|
+
}
|
|
1201
|
+
);
|
|
1202
|
+
},
|
|
1203
|
+
Input: ({
|
|
1204
|
+
props,
|
|
1205
|
+
bindings,
|
|
1206
|
+
emit
|
|
1207
|
+
}) => {
|
|
1208
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1209
|
+
props.value,
|
|
1210
|
+
bindings?.value
|
|
1211
|
+
);
|
|
1212
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
1213
|
+
const isBound = !!bindings?.value;
|
|
1214
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
1215
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1216
|
+
const validateOn = props.validateOn ?? "blur";
|
|
1217
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
1218
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
1219
|
+
bindings?.value ?? "",
|
|
1220
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
1221
|
+
);
|
|
1222
|
+
const hasError = errors.length > 0;
|
|
1223
|
+
const inputId = props.name;
|
|
1224
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
1225
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
1226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1227
|
+
"div",
|
|
1228
|
+
{
|
|
1229
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
1232
|
+
props.label,
|
|
1233
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1234
|
+
] }),
|
|
1235
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1236
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1238
|
+
"input",
|
|
1239
|
+
{
|
|
1240
|
+
className: `usa-input${hasError ? " usa-input--error" : ""}`,
|
|
1241
|
+
id: inputId,
|
|
1242
|
+
name: props.name,
|
|
1243
|
+
type: props.type ?? "text",
|
|
1244
|
+
placeholder: props.placeholder ?? void 0,
|
|
1245
|
+
required: props.required ?? void 0,
|
|
1246
|
+
disabled: props.disabled ?? void 0,
|
|
1247
|
+
value,
|
|
1248
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
1249
|
+
onChange: (e) => {
|
|
1250
|
+
setValue(e.target.value);
|
|
1251
|
+
if (hasValidation && validateOn === "change") validate();
|
|
1252
|
+
},
|
|
1253
|
+
onKeyDown: (e) => {
|
|
1254
|
+
if (e.key === "Enter") emit("submit");
|
|
1255
|
+
},
|
|
1256
|
+
onFocus: () => emit("focus"),
|
|
1257
|
+
onBlur: () => {
|
|
1258
|
+
if (hasValidation && validateOn === "blur") validate();
|
|
1259
|
+
emit("blur");
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
)
|
|
1263
|
+
]
|
|
1264
|
+
}
|
|
1265
|
+
);
|
|
1266
|
+
},
|
|
1267
|
+
Textarea: ({
|
|
1268
|
+
props,
|
|
1269
|
+
bindings
|
|
1270
|
+
}) => {
|
|
1271
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1272
|
+
props.value,
|
|
1273
|
+
bindings?.value
|
|
1274
|
+
);
|
|
1275
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
1276
|
+
const isBound = !!bindings?.value;
|
|
1277
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
1278
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1279
|
+
const validateOn = props.validateOn ?? "blur";
|
|
1280
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
1281
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
1282
|
+
bindings?.value ?? "",
|
|
1283
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
1284
|
+
);
|
|
1285
|
+
const hasError = errors.length > 0;
|
|
1286
|
+
const inputId = props.name;
|
|
1287
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
1288
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
1289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1290
|
+
"div",
|
|
1291
|
+
{
|
|
1292
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
1293
|
+
children: [
|
|
1294
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
1295
|
+
props.label,
|
|
1296
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1297
|
+
] }),
|
|
1298
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1299
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1301
|
+
"textarea",
|
|
1302
|
+
{
|
|
1303
|
+
className: `usa-textarea${hasError ? " usa-input--error" : ""}`,
|
|
1304
|
+
id: inputId,
|
|
1305
|
+
name: props.name,
|
|
1306
|
+
placeholder: props.placeholder ?? void 0,
|
|
1307
|
+
required: props.required ?? void 0,
|
|
1308
|
+
rows: props.rows ?? 4,
|
|
1309
|
+
value,
|
|
1310
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
1311
|
+
onChange: (e) => {
|
|
1312
|
+
setValue(e.target.value);
|
|
1313
|
+
if (hasValidation && validateOn === "change") validate();
|
|
1314
|
+
},
|
|
1315
|
+
onBlur: () => {
|
|
1316
|
+
if (hasValidation && validateOn === "blur") validate();
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
]
|
|
1321
|
+
}
|
|
1322
|
+
);
|
|
1323
|
+
},
|
|
1324
|
+
Select: ({
|
|
1325
|
+
props,
|
|
1326
|
+
bindings,
|
|
1327
|
+
emit
|
|
1328
|
+
}) => {
|
|
1329
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1330
|
+
props.value,
|
|
1331
|
+
bindings?.value
|
|
1332
|
+
);
|
|
1333
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
1334
|
+
const isBound = !!bindings?.value;
|
|
1335
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
1336
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1337
|
+
const validateOn = props.validateOn ?? "change";
|
|
1338
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
1339
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
1340
|
+
bindings?.value ?? "",
|
|
1341
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
1342
|
+
);
|
|
1343
|
+
const hasError = errors.length > 0;
|
|
1344
|
+
const inputId = props.name;
|
|
1345
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
1346
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
1347
|
+
const options = (props.options ?? []).map(
|
|
1348
|
+
(opt) => typeof opt === "string" ? { label: opt, value: opt } : opt
|
|
1349
|
+
);
|
|
1350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1351
|
+
"div",
|
|
1352
|
+
{
|
|
1353
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
1354
|
+
children: [
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
1356
|
+
props.label,
|
|
1357
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1358
|
+
] }),
|
|
1359
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1360
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1362
|
+
"select",
|
|
1363
|
+
{
|
|
1364
|
+
className: `usa-select${hasError ? " usa-input--error" : ""}`,
|
|
1365
|
+
id: inputId,
|
|
1366
|
+
name: props.name,
|
|
1367
|
+
required: props.required ?? void 0,
|
|
1368
|
+
value,
|
|
1369
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
1370
|
+
onChange: (e) => {
|
|
1371
|
+
setValue(e.target.value);
|
|
1372
|
+
if (hasValidation && validateOn === "change") validate();
|
|
1373
|
+
emit("change");
|
|
1374
|
+
},
|
|
1375
|
+
children: [
|
|
1376
|
+
props.placeholder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", disabled: true, children: props.placeholder }),
|
|
1377
|
+
options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
1378
|
+
]
|
|
1379
|
+
}
|
|
1380
|
+
)
|
|
1381
|
+
]
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
},
|
|
1385
|
+
Checkbox: ({
|
|
1386
|
+
props,
|
|
1387
|
+
bindings,
|
|
1388
|
+
emit
|
|
1389
|
+
}) => {
|
|
1390
|
+
const [boundChecked, setBoundChecked] = (0, import_react2.useBoundProp)(
|
|
1391
|
+
props.checked,
|
|
1392
|
+
bindings?.checked
|
|
1393
|
+
);
|
|
1394
|
+
const [localChecked, setLocalChecked] = (0, import_react.useState)(false);
|
|
1395
|
+
const isBound = !!bindings?.checked;
|
|
1396
|
+
const checked = isBound ? boundChecked ?? false : localChecked;
|
|
1397
|
+
const setChecked = isBound ? setBoundChecked : setLocalChecked;
|
|
1398
|
+
const validateOn = props.validateOn ?? "change";
|
|
1399
|
+
const hasValidation = !!(bindings?.checked && props.checks?.length);
|
|
1400
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
1401
|
+
bindings?.checked ?? "",
|
|
1402
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
1403
|
+
);
|
|
1404
|
+
const inputId = props.name;
|
|
1405
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
1406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1407
|
+
"div",
|
|
1408
|
+
{
|
|
1409
|
+
className: `usa-form-group${errors.length > 0 ? " usa-form-group--error" : ""}`,
|
|
1410
|
+
children: [
|
|
1411
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1412
|
+
"div",
|
|
1413
|
+
{
|
|
1414
|
+
className: `usa-checkbox${props.tile ? " usa-checkbox--tile" : ""}`,
|
|
1415
|
+
children: [
|
|
1416
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1417
|
+
"input",
|
|
1418
|
+
{
|
|
1419
|
+
className: "usa-checkbox__input",
|
|
1420
|
+
id: inputId,
|
|
1421
|
+
type: "checkbox",
|
|
1422
|
+
name: props.name,
|
|
1423
|
+
checked,
|
|
1424
|
+
"aria-describedby": hintId,
|
|
1425
|
+
onChange: (e) => {
|
|
1426
|
+
setChecked(e.target.checked);
|
|
1427
|
+
if (hasValidation && validateOn === "change") validate();
|
|
1428
|
+
emit("change");
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
),
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-checkbox__label", htmlFor: inputId, children: [
|
|
1433
|
+
props.label,
|
|
1434
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-checkbox__label-description", id: hintId, children: props.hint })
|
|
1435
|
+
] })
|
|
1436
|
+
]
|
|
1437
|
+
}
|
|
1438
|
+
),
|
|
1439
|
+
errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", role: "alert", children: errors[0] })
|
|
1440
|
+
]
|
|
1441
|
+
}
|
|
1442
|
+
);
|
|
1443
|
+
},
|
|
1444
|
+
CheckboxGroup: ({
|
|
1445
|
+
props,
|
|
1446
|
+
bindings,
|
|
1447
|
+
emit
|
|
1448
|
+
}) => {
|
|
1449
|
+
const [boundValues, setBoundValues] = (0, import_react2.useBoundProp)(
|
|
1450
|
+
props.values,
|
|
1451
|
+
bindings?.values
|
|
1452
|
+
);
|
|
1453
|
+
const [localValues, setLocalValues] = (0, import_react.useState)([]);
|
|
1454
|
+
const isBound = !!bindings?.values;
|
|
1455
|
+
const values = isBound ? boundValues ?? [] : localValues;
|
|
1456
|
+
const setValues = isBound ? setBoundValues : setLocalValues;
|
|
1457
|
+
const options = props.options ?? [];
|
|
1458
|
+
const toggle = (val) => {
|
|
1459
|
+
const next = values.includes(val) ? values.filter((v) => v !== val) : [...values, val];
|
|
1460
|
+
setValues(next);
|
|
1461
|
+
emit("change");
|
|
1462
|
+
};
|
|
1463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { className: "usa-fieldset", children: [
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("legend", { className: "usa-legend", children: props.legend }),
|
|
1465
|
+
options.map((opt) => {
|
|
1466
|
+
const optId = `${props.name}-${opt.value}`;
|
|
1467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1468
|
+
"div",
|
|
1469
|
+
{
|
|
1470
|
+
className: `usa-checkbox${props.tile ? " usa-checkbox--tile" : ""}`,
|
|
1471
|
+
children: [
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1473
|
+
"input",
|
|
1474
|
+
{
|
|
1475
|
+
className: "usa-checkbox__input",
|
|
1476
|
+
id: optId,
|
|
1477
|
+
type: "checkbox",
|
|
1478
|
+
name: props.name,
|
|
1479
|
+
value: opt.value,
|
|
1480
|
+
checked: values.includes(opt.value),
|
|
1481
|
+
onChange: () => toggle(opt.value)
|
|
1482
|
+
}
|
|
1483
|
+
),
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-checkbox__label", htmlFor: optId, children: [
|
|
1485
|
+
opt.label,
|
|
1486
|
+
opt.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-checkbox__label-description", children: opt.hint })
|
|
1487
|
+
] })
|
|
1488
|
+
]
|
|
1489
|
+
},
|
|
1490
|
+
opt.value
|
|
1491
|
+
);
|
|
1492
|
+
})
|
|
1493
|
+
] });
|
|
1494
|
+
},
|
|
1495
|
+
Radio: ({
|
|
1496
|
+
props,
|
|
1497
|
+
bindings,
|
|
1498
|
+
emit
|
|
1499
|
+
}) => {
|
|
1500
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1501
|
+
props.value,
|
|
1502
|
+
bindings?.value
|
|
1503
|
+
);
|
|
1504
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
1505
|
+
const isBound = !!bindings?.value;
|
|
1506
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
1507
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1508
|
+
const validateOn = props.validateOn ?? "change";
|
|
1509
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
1510
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
1511
|
+
bindings?.value ?? "",
|
|
1512
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
1513
|
+
);
|
|
1514
|
+
const options = props.options ?? [];
|
|
1515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1516
|
+
"fieldset",
|
|
1517
|
+
{
|
|
1518
|
+
className: `usa-fieldset${errors.length > 0 ? " usa-form-group--error" : ""}`,
|
|
1519
|
+
children: [
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("legend", { className: "usa-legend", children: props.legend }),
|
|
1521
|
+
errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", role: "alert", children: errors[0] }),
|
|
1522
|
+
options.map((opt) => {
|
|
1523
|
+
const optId = `${props.name}-${opt.value}`;
|
|
1524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1525
|
+
"div",
|
|
1526
|
+
{
|
|
1527
|
+
className: `usa-radio${props.tile ? " usa-radio--tile" : ""}`,
|
|
1528
|
+
children: [
|
|
1529
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1530
|
+
"input",
|
|
1531
|
+
{
|
|
1532
|
+
className: "usa-radio__input usa-radio__input--tile",
|
|
1533
|
+
id: optId,
|
|
1534
|
+
type: "radio",
|
|
1535
|
+
name: props.name,
|
|
1536
|
+
value: opt.value,
|
|
1537
|
+
checked: value === opt.value,
|
|
1538
|
+
onChange: () => {
|
|
1539
|
+
setValue(opt.value);
|
|
1540
|
+
if (hasValidation && validateOn === "change") validate();
|
|
1541
|
+
emit("change");
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
),
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-radio__label", htmlFor: optId, children: [
|
|
1546
|
+
opt.label,
|
|
1547
|
+
opt.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-radio__label-description", children: opt.hint })
|
|
1548
|
+
] })
|
|
1549
|
+
]
|
|
1550
|
+
},
|
|
1551
|
+
opt.value
|
|
1552
|
+
);
|
|
1553
|
+
})
|
|
1554
|
+
]
|
|
1555
|
+
}
|
|
1556
|
+
);
|
|
1557
|
+
},
|
|
1558
|
+
FileInput: ({ props, emit }) => {
|
|
1559
|
+
const inputId = props.name;
|
|
1560
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
1561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group", children: [
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
1563
|
+
props.label,
|
|
1564
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1565
|
+
] }),
|
|
1566
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1568
|
+
"input",
|
|
1569
|
+
{
|
|
1570
|
+
id: inputId,
|
|
1571
|
+
className: "usa-file-input",
|
|
1572
|
+
type: "file",
|
|
1573
|
+
name: props.name,
|
|
1574
|
+
accept: props.accept ?? void 0,
|
|
1575
|
+
multiple: props.multiple ?? void 0,
|
|
1576
|
+
required: props.required ?? void 0,
|
|
1577
|
+
"aria-describedby": hintId,
|
|
1578
|
+
onChange: () => emit("change")
|
|
1579
|
+
}
|
|
1580
|
+
)
|
|
1581
|
+
] });
|
|
1582
|
+
},
|
|
1583
|
+
Search: ({
|
|
1584
|
+
props,
|
|
1585
|
+
bindings,
|
|
1586
|
+
emit
|
|
1587
|
+
}) => {
|
|
1588
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1589
|
+
props.value,
|
|
1590
|
+
bindings?.value
|
|
1591
|
+
);
|
|
1592
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
1593
|
+
const uid = (0, import_react.useId)();
|
|
1594
|
+
const fieldId = `${uid}-search-field`;
|
|
1595
|
+
const isBound = !!bindings?.value;
|
|
1596
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
1597
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1598
|
+
const sizeClass = props.size === "small" ? " usa-search--small" : props.size === "big" ? " usa-search--big" : "";
|
|
1599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { role: "search", className: `usa-search${sizeClass}`, children: [
|
|
1600
|
+
props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "usa-sr-only", htmlFor: fieldId, children: props.label }),
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1602
|
+
"input",
|
|
1603
|
+
{
|
|
1604
|
+
className: "usa-input",
|
|
1605
|
+
id: fieldId,
|
|
1606
|
+
type: "search",
|
|
1607
|
+
name: "search",
|
|
1608
|
+
placeholder: props.placeholder ?? void 0,
|
|
1609
|
+
value,
|
|
1610
|
+
onChange: (e) => {
|
|
1611
|
+
setValue(e.target.value);
|
|
1612
|
+
emit("change");
|
|
1613
|
+
},
|
|
1614
|
+
onKeyDown: (e) => {
|
|
1615
|
+
if (e.key === "Enter") emit("submit");
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
),
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1620
|
+
"button",
|
|
1621
|
+
{
|
|
1622
|
+
className: "usa-button",
|
|
1623
|
+
type: "submit",
|
|
1624
|
+
onClick: () => emit("submit"),
|
|
1625
|
+
children: [
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1627
|
+
"svg",
|
|
1628
|
+
{
|
|
1629
|
+
className: "usa-icon",
|
|
1630
|
+
"aria-hidden": "true",
|
|
1631
|
+
role: "img",
|
|
1632
|
+
viewBox: "0 0 24 24",
|
|
1633
|
+
width: "24",
|
|
1634
|
+
height: "24",
|
|
1635
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14" })
|
|
1636
|
+
}
|
|
1637
|
+
),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-search__submit-text", children: "Search" })
|
|
1639
|
+
]
|
|
1640
|
+
}
|
|
1641
|
+
)
|
|
1642
|
+
] });
|
|
1643
|
+
},
|
|
1644
|
+
RangeInput: ({
|
|
1645
|
+
props,
|
|
1646
|
+
bindings,
|
|
1647
|
+
emit
|
|
1648
|
+
}) => {
|
|
1649
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1650
|
+
props.value,
|
|
1651
|
+
bindings?.value
|
|
1652
|
+
);
|
|
1653
|
+
const [localValue, setLocalValue] = (0, import_react.useState)(props.value ?? props.min ?? 0);
|
|
1654
|
+
const isBound = !!bindings?.value;
|
|
1655
|
+
const value = isBound ? boundValue ?? 0 : localValue;
|
|
1656
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1657
|
+
const inputId = props.name;
|
|
1658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group", children: [
|
|
1659
|
+
props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "usa-label", htmlFor: inputId, children: props.label }),
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1661
|
+
"input",
|
|
1662
|
+
{
|
|
1663
|
+
className: "usa-range",
|
|
1664
|
+
id: inputId,
|
|
1665
|
+
name: props.name,
|
|
1666
|
+
type: "range",
|
|
1667
|
+
min: props.min ?? 0,
|
|
1668
|
+
max: props.max ?? 100,
|
|
1669
|
+
step: props.step ?? 1,
|
|
1670
|
+
value,
|
|
1671
|
+
onChange: (e) => {
|
|
1672
|
+
setValue(Number(e.target.value));
|
|
1673
|
+
emit("change");
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
)
|
|
1677
|
+
] });
|
|
1678
|
+
},
|
|
1679
|
+
DateInputGroup: ({
|
|
1680
|
+
props,
|
|
1681
|
+
bindings,
|
|
1682
|
+
emit
|
|
1683
|
+
}) => {
|
|
1684
|
+
const [boundMonth, setBoundMonth] = (0, import_react2.useBoundProp)(
|
|
1685
|
+
props.monthValue,
|
|
1686
|
+
bindings?.monthValue
|
|
1687
|
+
);
|
|
1688
|
+
const [boundDay, setBoundDay] = (0, import_react2.useBoundProp)(
|
|
1689
|
+
props.dayValue,
|
|
1690
|
+
bindings?.dayValue
|
|
1691
|
+
);
|
|
1692
|
+
const [boundYear, setBoundYear] = (0, import_react2.useBoundProp)(
|
|
1693
|
+
props.yearValue,
|
|
1694
|
+
bindings?.yearValue
|
|
1695
|
+
);
|
|
1696
|
+
const [localMonth, setLocalMonth] = (0, import_react.useState)(props.monthValue ?? "");
|
|
1697
|
+
const [localDay, setLocalDay] = (0, import_react.useState)(props.dayValue ?? "");
|
|
1698
|
+
const [localYear, setLocalYear] = (0, import_react.useState)(props.yearValue ?? "");
|
|
1699
|
+
const monthVal = bindings?.monthValue ? boundMonth ?? "" : localMonth;
|
|
1700
|
+
const dayVal = bindings?.dayValue ? boundDay ?? "" : localDay;
|
|
1701
|
+
const yearVal = bindings?.yearValue ? boundYear ?? "" : localYear;
|
|
1702
|
+
const hintId = props.hint ? `${props.name}-hint` : void 0;
|
|
1703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { className: "usa-fieldset", children: [
|
|
1704
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("legend", { className: "usa-legend", children: props.label }),
|
|
1705
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-memorable-date", children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group usa-form-group--month", children: [
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "usa-label", htmlFor: `${props.name}-month`, children: "Month" }),
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1710
|
+
"input",
|
|
1711
|
+
{
|
|
1712
|
+
className: "usa-input usa-input--inline",
|
|
1713
|
+
id: `${props.name}-month`,
|
|
1714
|
+
name: `${props.name}_month`,
|
|
1715
|
+
type: "text",
|
|
1716
|
+
inputMode: "numeric",
|
|
1717
|
+
minLength: 1,
|
|
1718
|
+
maxLength: 2,
|
|
1719
|
+
pattern: "[0-9]*",
|
|
1720
|
+
placeholder: "MM",
|
|
1721
|
+
required: props.required ?? void 0,
|
|
1722
|
+
value: monthVal,
|
|
1723
|
+
"aria-describedby": hintId,
|
|
1724
|
+
onChange: (e) => {
|
|
1725
|
+
const v = e.target.value.replace(/\D/g, "").slice(0, 2);
|
|
1726
|
+
if (bindings?.monthValue) setBoundMonth(v);
|
|
1727
|
+
else setLocalMonth(v);
|
|
1728
|
+
emit("change");
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
)
|
|
1732
|
+
] }),
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group usa-form-group--day", children: [
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "usa-label", htmlFor: `${props.name}-day`, children: "Day" }),
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1736
|
+
"input",
|
|
1737
|
+
{
|
|
1738
|
+
className: "usa-input usa-input--inline",
|
|
1739
|
+
id: `${props.name}-day`,
|
|
1740
|
+
name: `${props.name}_day`,
|
|
1741
|
+
type: "text",
|
|
1742
|
+
inputMode: "numeric",
|
|
1743
|
+
minLength: 1,
|
|
1744
|
+
maxLength: 2,
|
|
1745
|
+
pattern: "[0-9]*",
|
|
1746
|
+
placeholder: "DD",
|
|
1747
|
+
required: props.required ?? void 0,
|
|
1748
|
+
value: dayVal,
|
|
1749
|
+
onChange: (e) => {
|
|
1750
|
+
const v = e.target.value.replace(/\D/g, "").slice(0, 2);
|
|
1751
|
+
if (bindings?.dayValue) setBoundDay(v);
|
|
1752
|
+
else setLocalDay(v);
|
|
1753
|
+
emit("change");
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
)
|
|
1757
|
+
] }),
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group usa-form-group--year", children: [
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "usa-label", htmlFor: `${props.name}-year`, children: "Year" }),
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1761
|
+
"input",
|
|
1762
|
+
{
|
|
1763
|
+
className: "usa-input usa-input--inline",
|
|
1764
|
+
id: `${props.name}-year`,
|
|
1765
|
+
name: `${props.name}_year`,
|
|
1766
|
+
type: "text",
|
|
1767
|
+
inputMode: "numeric",
|
|
1768
|
+
minLength: 4,
|
|
1769
|
+
maxLength: 4,
|
|
1770
|
+
pattern: "[0-9]*",
|
|
1771
|
+
placeholder: "YYYY",
|
|
1772
|
+
required: props.required ?? void 0,
|
|
1773
|
+
value: yearVal,
|
|
1774
|
+
onChange: (e) => {
|
|
1775
|
+
const v = e.target.value.replace(/\D/g, "").slice(0, 4);
|
|
1776
|
+
if (bindings?.yearValue) setBoundYear(v);
|
|
1777
|
+
else setLocalYear(v);
|
|
1778
|
+
emit("change");
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
)
|
|
1782
|
+
] })
|
|
1783
|
+
] })
|
|
1784
|
+
] });
|
|
1785
|
+
},
|
|
1786
|
+
DateRangePicker: ({
|
|
1787
|
+
props,
|
|
1788
|
+
bindings,
|
|
1789
|
+
emit
|
|
1790
|
+
}) => {
|
|
1791
|
+
const [boundStart, setBoundStart] = (0, import_react2.useBoundProp)(
|
|
1792
|
+
props.startValue,
|
|
1793
|
+
bindings?.startValue
|
|
1794
|
+
);
|
|
1795
|
+
const [boundEnd, setBoundEnd] = (0, import_react2.useBoundProp)(
|
|
1796
|
+
props.endValue,
|
|
1797
|
+
bindings?.endValue
|
|
1798
|
+
);
|
|
1799
|
+
const [localStart, setLocalStart] = (0, import_react.useState)(props.startValue ?? "");
|
|
1800
|
+
const [localEnd, setLocalEnd] = (0, import_react.useState)(props.endValue ?? "");
|
|
1801
|
+
const startVal = bindings?.startValue ? boundStart ?? "" : localStart;
|
|
1802
|
+
const endVal = bindings?.endValue ? boundEnd ?? "" : localEnd;
|
|
1803
|
+
const hintId = props.hint ? `${props.startName}-hint` : void 0;
|
|
1804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-date-range-picker", children: [
|
|
1805
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-date-range-picker__range-start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group", children: [
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: props.startName, children: [
|
|
1808
|
+
props.startLabel,
|
|
1809
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1810
|
+
] }),
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-date-picker", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1812
|
+
"input",
|
|
1813
|
+
{
|
|
1814
|
+
className: "usa-input",
|
|
1815
|
+
id: props.startName,
|
|
1816
|
+
name: props.startName,
|
|
1817
|
+
type: "date",
|
|
1818
|
+
required: props.required ?? void 0,
|
|
1819
|
+
min: props.minDate ?? void 0,
|
|
1820
|
+
max: endVal || props.maxDate || void 0,
|
|
1821
|
+
value: startVal,
|
|
1822
|
+
"aria-describedby": hintId,
|
|
1823
|
+
onChange: (e) => {
|
|
1824
|
+
const v = e.target.value;
|
|
1825
|
+
if (bindings?.startValue) setBoundStart(v);
|
|
1826
|
+
else setLocalStart(v);
|
|
1827
|
+
emit("change");
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
) })
|
|
1831
|
+
] }) }),
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-date-range-picker__range-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group", children: [
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: props.endName, children: [
|
|
1834
|
+
props.endLabel,
|
|
1835
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1836
|
+
] }),
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-date-picker", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1838
|
+
"input",
|
|
1839
|
+
{
|
|
1840
|
+
className: "usa-input",
|
|
1841
|
+
id: props.endName,
|
|
1842
|
+
name: props.endName,
|
|
1843
|
+
type: "date",
|
|
1844
|
+
required: props.required ?? void 0,
|
|
1845
|
+
min: startVal || props.minDate || void 0,
|
|
1846
|
+
max: props.maxDate ?? void 0,
|
|
1847
|
+
value: endVal,
|
|
1848
|
+
onChange: (e) => {
|
|
1849
|
+
const v = e.target.value;
|
|
1850
|
+
if (bindings?.endValue) setBoundEnd(v);
|
|
1851
|
+
else setLocalEnd(v);
|
|
1852
|
+
emit("change");
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
) })
|
|
1856
|
+
] }) })
|
|
1857
|
+
] });
|
|
1858
|
+
},
|
|
1859
|
+
InputMask: ({
|
|
1860
|
+
props,
|
|
1861
|
+
bindings,
|
|
1862
|
+
emit
|
|
1863
|
+
}) => {
|
|
1864
|
+
const PRESETS = {
|
|
1865
|
+
phone: "(___) ___-____",
|
|
1866
|
+
zip: "_____",
|
|
1867
|
+
"zip+4": "_____-____",
|
|
1868
|
+
ssn: "___-__-____"
|
|
1869
|
+
};
|
|
1870
|
+
const pattern = props.preset && props.preset !== "custom" ? PRESETS[props.preset] ?? "" : props.pattern ?? "";
|
|
1871
|
+
function applyMask(raw) {
|
|
1872
|
+
const digits = raw.replace(/\D/g, "");
|
|
1873
|
+
let result = "";
|
|
1874
|
+
let di = 0;
|
|
1875
|
+
for (const ch of pattern) {
|
|
1876
|
+
if (di >= digits.length) break;
|
|
1877
|
+
if (ch === "_") {
|
|
1878
|
+
result += digits[di++];
|
|
1879
|
+
} else {
|
|
1880
|
+
result += ch;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
return result;
|
|
1884
|
+
}
|
|
1885
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1886
|
+
props.value,
|
|
1887
|
+
bindings?.value
|
|
1888
|
+
);
|
|
1889
|
+
const [localValue, setLocalValue] = (0, import_react.useState)(
|
|
1890
|
+
props.value ? applyMask(props.value) : ""
|
|
1891
|
+
);
|
|
1892
|
+
const isBound = !!bindings?.value;
|
|
1893
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
1894
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1895
|
+
const validateOn = props.validateOn ?? "blur";
|
|
1896
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
1897
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
1898
|
+
bindings?.value ?? "",
|
|
1899
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
1900
|
+
);
|
|
1901
|
+
const hasError = errors.length > 0;
|
|
1902
|
+
const inputId = props.name;
|
|
1903
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
1904
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
1905
|
+
const placeholder = pattern.length > 0 ? pattern : void 0;
|
|
1906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1907
|
+
"div",
|
|
1908
|
+
{
|
|
1909
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
1910
|
+
children: [
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
1912
|
+
props.label,
|
|
1913
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1914
|
+
] }),
|
|
1915
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1916
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-input-mask", "data-mask": pattern, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1918
|
+
"input",
|
|
1919
|
+
{
|
|
1920
|
+
className: `usa-masked usa-input${hasError ? " usa-input--error" : ""}`,
|
|
1921
|
+
id: inputId,
|
|
1922
|
+
name: props.name,
|
|
1923
|
+
type: "text",
|
|
1924
|
+
inputMode: "numeric",
|
|
1925
|
+
placeholder,
|
|
1926
|
+
required: props.required ?? void 0,
|
|
1927
|
+
value,
|
|
1928
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
1929
|
+
onChange: (e) => {
|
|
1930
|
+
const masked = applyMask(e.target.value);
|
|
1931
|
+
setValue(masked);
|
|
1932
|
+
if (hasValidation && validateOn === "change") validate();
|
|
1933
|
+
emit("change");
|
|
1934
|
+
},
|
|
1935
|
+
onBlur: () => {
|
|
1936
|
+
if (hasValidation && validateOn === "blur") validate();
|
|
1937
|
+
emit("blur");
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
) })
|
|
1941
|
+
]
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
},
|
|
1945
|
+
Password: ({
|
|
1946
|
+
props,
|
|
1947
|
+
bindings,
|
|
1948
|
+
emit
|
|
1949
|
+
}) => {
|
|
1950
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
1951
|
+
props.value,
|
|
1952
|
+
bindings?.value
|
|
1953
|
+
);
|
|
1954
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
1955
|
+
const isBound = !!bindings?.value;
|
|
1956
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
1957
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1958
|
+
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
1959
|
+
const validateOn = props.validateOn ?? "blur";
|
|
1960
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
1961
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
1962
|
+
bindings?.value ?? "",
|
|
1963
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
1964
|
+
);
|
|
1965
|
+
const hasError = errors.length > 0;
|
|
1966
|
+
const inputId = props.name;
|
|
1967
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
1968
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
1969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1970
|
+
"div",
|
|
1971
|
+
{
|
|
1972
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
1973
|
+
children: [
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
1975
|
+
props.label,
|
|
1976
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
1977
|
+
] }),
|
|
1978
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
1979
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-input-group", children: [
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1982
|
+
"input",
|
|
1983
|
+
{
|
|
1984
|
+
className: `usa-input${hasError ? " usa-input--error" : ""}`,
|
|
1985
|
+
id: inputId,
|
|
1986
|
+
name: props.name,
|
|
1987
|
+
type: visible ? "text" : "password",
|
|
1988
|
+
autoComplete: "current-password",
|
|
1989
|
+
required: props.required ?? void 0,
|
|
1990
|
+
value,
|
|
1991
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
1992
|
+
onChange: (e) => {
|
|
1993
|
+
setValue(e.target.value);
|
|
1994
|
+
if (hasValidation && validateOn === "change") validate();
|
|
1995
|
+
emit("change");
|
|
1996
|
+
},
|
|
1997
|
+
onBlur: () => {
|
|
1998
|
+
if (hasValidation && validateOn === "blur") validate();
|
|
1999
|
+
emit("blur");
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
),
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-input-group__append", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2004
|
+
"button",
|
|
2005
|
+
{
|
|
2006
|
+
type: "button",
|
|
2007
|
+
className: "usa-show-password usa-button usa-button--unstyled",
|
|
2008
|
+
"aria-controls": inputId,
|
|
2009
|
+
"aria-label": visible ? "Hide password" : "Show password",
|
|
2010
|
+
onClick: () => setVisible((v) => !v),
|
|
2011
|
+
children: visible ? "Hide password" : "Show password"
|
|
2012
|
+
}
|
|
2013
|
+
) })
|
|
2014
|
+
] })
|
|
2015
|
+
]
|
|
2016
|
+
}
|
|
2017
|
+
);
|
|
2018
|
+
},
|
|
2019
|
+
ComboBox: ({
|
|
2020
|
+
props,
|
|
2021
|
+
bindings,
|
|
2022
|
+
emit
|
|
2023
|
+
}) => {
|
|
2024
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
2025
|
+
props.value,
|
|
2026
|
+
bindings?.value
|
|
2027
|
+
);
|
|
2028
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
2029
|
+
const isBound = !!bindings?.value;
|
|
2030
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
2031
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
2032
|
+
const [query, setQuery] = (0, import_react.useState)("");
|
|
2033
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
2034
|
+
const validateOn = props.validateOn ?? "change";
|
|
2035
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
2036
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
2037
|
+
bindings?.value ?? "",
|
|
2038
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
2039
|
+
);
|
|
2040
|
+
const allOptions = (props.options ?? []).map(
|
|
2041
|
+
(opt) => typeof opt === "string" ? { label: opt, value: opt } : opt
|
|
2042
|
+
);
|
|
2043
|
+
const filtered = query ? allOptions.filter(
|
|
2044
|
+
(o) => o.label.toLowerCase().includes(query.toLowerCase())
|
|
2045
|
+
) : allOptions;
|
|
2046
|
+
const selectedLabel = allOptions.find((o) => o.value === value)?.label ?? value;
|
|
2047
|
+
const hasError = errors.length > 0;
|
|
2048
|
+
const inputId = props.name;
|
|
2049
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
2050
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
2051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2052
|
+
"div",
|
|
2053
|
+
{
|
|
2054
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
2055
|
+
children: [
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: `${inputId}-combo`, children: [
|
|
2057
|
+
props.label,
|
|
2058
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
2059
|
+
] }),
|
|
2060
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
2061
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2063
|
+
"div",
|
|
2064
|
+
{
|
|
2065
|
+
className: `usa-combo-box${value ? " usa-combo-box--pristine" : ""}`,
|
|
2066
|
+
style: { position: "relative" },
|
|
2067
|
+
children: [
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2069
|
+
"select",
|
|
2070
|
+
{
|
|
2071
|
+
className: "usa-select usa-sr-only",
|
|
2072
|
+
name: props.name,
|
|
2073
|
+
id: inputId,
|
|
2074
|
+
"aria-hidden": "true",
|
|
2075
|
+
tabIndex: -1,
|
|
2076
|
+
value,
|
|
2077
|
+
onChange: () => {
|
|
2078
|
+
},
|
|
2079
|
+
required: props.required ?? void 0,
|
|
2080
|
+
children: [
|
|
2081
|
+
props.placeholder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: props.placeholder }),
|
|
2082
|
+
allOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
2083
|
+
]
|
|
2084
|
+
}
|
|
2085
|
+
),
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2087
|
+
"input",
|
|
2088
|
+
{
|
|
2089
|
+
id: `${inputId}-combo`,
|
|
2090
|
+
className: `usa-combo-box__input${hasError ? " usa-input--error" : ""}`,
|
|
2091
|
+
type: "text",
|
|
2092
|
+
autoComplete: "off",
|
|
2093
|
+
role: "combobox",
|
|
2094
|
+
"aria-owns": `${inputId}-list`,
|
|
2095
|
+
"aria-expanded": open,
|
|
2096
|
+
"aria-autocomplete": "list",
|
|
2097
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
2098
|
+
placeholder: props.placeholder ?? void 0,
|
|
2099
|
+
value: open ? query : selectedLabel,
|
|
2100
|
+
onFocus: () => {
|
|
2101
|
+
setOpen(true);
|
|
2102
|
+
setQuery("");
|
|
2103
|
+
},
|
|
2104
|
+
onBlur: () => setTimeout(() => setOpen(false), 150),
|
|
2105
|
+
onChange: (e) => setQuery(e.target.value)
|
|
2106
|
+
}
|
|
2107
|
+
),
|
|
2108
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-combo-box__toggle-list__wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2109
|
+
"button",
|
|
2110
|
+
{
|
|
2111
|
+
type: "button",
|
|
2112
|
+
className: "usa-combo-box__toggle-list",
|
|
2113
|
+
"aria-label": "Toggle the dropdown list",
|
|
2114
|
+
tabIndex: -1,
|
|
2115
|
+
onClick: () => setOpen((v) => !v),
|
|
2116
|
+
children: "\xA0"
|
|
2117
|
+
}
|
|
2118
|
+
) }),
|
|
2119
|
+
open && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2120
|
+
"ul",
|
|
2121
|
+
{
|
|
2122
|
+
id: `${inputId}-list`,
|
|
2123
|
+
className: "usa-combo-box__list",
|
|
2124
|
+
role: "listbox",
|
|
2125
|
+
"aria-label": props.label,
|
|
2126
|
+
style: {
|
|
2127
|
+
position: "absolute",
|
|
2128
|
+
zIndex: 100,
|
|
2129
|
+
width: "100%",
|
|
2130
|
+
background: "#fff",
|
|
2131
|
+
border: "1px solid #565c65",
|
|
2132
|
+
maxHeight: 220,
|
|
2133
|
+
overflowY: "auto",
|
|
2134
|
+
margin: 0,
|
|
2135
|
+
padding: 0,
|
|
2136
|
+
listStyle: "none"
|
|
2137
|
+
},
|
|
2138
|
+
children: filtered.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2139
|
+
"li",
|
|
2140
|
+
{
|
|
2141
|
+
className: `usa-combo-box__list-option${value === opt.value ? " usa-combo-box__list-option--selected" : ""}`,
|
|
2142
|
+
role: "option",
|
|
2143
|
+
"aria-selected": value === opt.value,
|
|
2144
|
+
"aria-setsize": filtered.length,
|
|
2145
|
+
style: { padding: "0.5rem 1rem", cursor: "pointer" },
|
|
2146
|
+
onMouseDown: () => {
|
|
2147
|
+
setValue(opt.value);
|
|
2148
|
+
setQuery("");
|
|
2149
|
+
setOpen(false);
|
|
2150
|
+
if (hasValidation && validateOn === "change") validate();
|
|
2151
|
+
emit("change");
|
|
2152
|
+
},
|
|
2153
|
+
children: opt.label
|
|
2154
|
+
},
|
|
2155
|
+
opt.value
|
|
2156
|
+
))
|
|
2157
|
+
}
|
|
2158
|
+
)
|
|
2159
|
+
]
|
|
2160
|
+
}
|
|
2161
|
+
)
|
|
2162
|
+
]
|
|
2163
|
+
}
|
|
2164
|
+
);
|
|
2165
|
+
},
|
|
2166
|
+
DatePicker: ({
|
|
2167
|
+
props,
|
|
2168
|
+
bindings,
|
|
2169
|
+
emit
|
|
2170
|
+
}) => {
|
|
2171
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
2172
|
+
props.value,
|
|
2173
|
+
bindings?.value
|
|
2174
|
+
);
|
|
2175
|
+
const [localValue, setLocalValue] = (0, import_react.useState)(props.value ?? "");
|
|
2176
|
+
const isBound = !!bindings?.value;
|
|
2177
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
2178
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
2179
|
+
const validateOn = props.validateOn ?? "change";
|
|
2180
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
2181
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
2182
|
+
bindings?.value ?? "",
|
|
2183
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
2184
|
+
);
|
|
2185
|
+
const hasError = errors.length > 0;
|
|
2186
|
+
const inputId = props.name;
|
|
2187
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
2188
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
2189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2190
|
+
"div",
|
|
2191
|
+
{
|
|
2192
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
2193
|
+
children: [
|
|
2194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
2195
|
+
props.label,
|
|
2196
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
2197
|
+
] }),
|
|
2198
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint ?? "mm/dd/yyyy" }),
|
|
2199
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
2200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-date-picker", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2201
|
+
"input",
|
|
2202
|
+
{
|
|
2203
|
+
className: `usa-input${hasError ? " usa-input--error" : ""}`,
|
|
2204
|
+
id: inputId,
|
|
2205
|
+
name: props.name,
|
|
2206
|
+
type: "date",
|
|
2207
|
+
required: props.required ?? void 0,
|
|
2208
|
+
min: props.minDate ?? void 0,
|
|
2209
|
+
max: props.maxDate ?? void 0,
|
|
2210
|
+
value,
|
|
2211
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
2212
|
+
onChange: (e) => {
|
|
2213
|
+
setValue(e.target.value);
|
|
2214
|
+
if (hasValidation && validateOn === "change") validate();
|
|
2215
|
+
emit("change");
|
|
2216
|
+
},
|
|
2217
|
+
onBlur: () => {
|
|
2218
|
+
if (hasValidation && validateOn === "blur") validate();
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
) })
|
|
2222
|
+
]
|
|
2223
|
+
}
|
|
2224
|
+
);
|
|
2225
|
+
},
|
|
2226
|
+
TimePicker: ({
|
|
2227
|
+
props,
|
|
2228
|
+
bindings,
|
|
2229
|
+
emit
|
|
2230
|
+
}) => {
|
|
2231
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
2232
|
+
props.value,
|
|
2233
|
+
bindings?.value
|
|
2234
|
+
);
|
|
2235
|
+
const [localValue, setLocalValue] = (0, import_react.useState)(props.value ?? "");
|
|
2236
|
+
const isBound = !!bindings?.value;
|
|
2237
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
2238
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
2239
|
+
const step = props.step ?? 30;
|
|
2240
|
+
const toMinutes = (t) => {
|
|
2241
|
+
const [h, m] = t.split(":").map(Number);
|
|
2242
|
+
return (h ?? 0) * 60 + (m ?? 0);
|
|
2243
|
+
};
|
|
2244
|
+
const toTime = (mins) => {
|
|
2245
|
+
const h = Math.floor(mins / 60);
|
|
2246
|
+
const m = mins % 60;
|
|
2247
|
+
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
2248
|
+
};
|
|
2249
|
+
const minMins = props.minTime ? toMinutes(props.minTime) : 0;
|
|
2250
|
+
const maxMins = props.maxTime ? toMinutes(props.maxTime) : 23 * 60 + 59;
|
|
2251
|
+
const options = [];
|
|
2252
|
+
for (let m = minMins; m <= maxMins; m += step) {
|
|
2253
|
+
options.push(toTime(m));
|
|
2254
|
+
}
|
|
2255
|
+
const formatDisplay = (t) => {
|
|
2256
|
+
if (!t) return "";
|
|
2257
|
+
const [h, m] = t.split(":").map(Number);
|
|
2258
|
+
const hour = h ?? 0;
|
|
2259
|
+
const suffix = hour >= 12 ? "p.m." : "a.m.";
|
|
2260
|
+
const displayH = hour % 12 || 12;
|
|
2261
|
+
return `${displayH}:${String(m ?? 0).padStart(2, "0")} ${suffix}`;
|
|
2262
|
+
};
|
|
2263
|
+
const inputId = props.name;
|
|
2264
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
2265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-form-group", children: [
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
2267
|
+
props.label,
|
|
2268
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
2269
|
+
] }),
|
|
2270
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-time-picker", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2272
|
+
"select",
|
|
2273
|
+
{
|
|
2274
|
+
className: "usa-select",
|
|
2275
|
+
id: inputId,
|
|
2276
|
+
name: props.name,
|
|
2277
|
+
required: props.required ?? void 0,
|
|
2278
|
+
value,
|
|
2279
|
+
"aria-describedby": hintId,
|
|
2280
|
+
onChange: (e) => {
|
|
2281
|
+
setValue(e.target.value);
|
|
2282
|
+
emit("change");
|
|
2283
|
+
},
|
|
2284
|
+
children: [
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "- Select -" }),
|
|
2286
|
+
options.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: t, children: formatDisplay(t) }, t))
|
|
2287
|
+
]
|
|
2288
|
+
}
|
|
2289
|
+
) })
|
|
2290
|
+
] });
|
|
2291
|
+
},
|
|
2292
|
+
CharacterCount: ({
|
|
2293
|
+
props,
|
|
2294
|
+
bindings,
|
|
2295
|
+
emit
|
|
2296
|
+
}) => {
|
|
2297
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
2298
|
+
props.value,
|
|
2299
|
+
bindings?.value
|
|
2300
|
+
);
|
|
2301
|
+
const [localValue, setLocalValue] = (0, import_react.useState)(props.value ?? "");
|
|
2302
|
+
const isBound = !!bindings?.value;
|
|
2303
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
2304
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
2305
|
+
const validateOn = props.validateOn ?? "change";
|
|
2306
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
2307
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
2308
|
+
bindings?.value ?? "",
|
|
2309
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
2310
|
+
);
|
|
2311
|
+
const remaining = props.maxLength - value.length;
|
|
2312
|
+
const isOver = remaining < 0;
|
|
2313
|
+
const hasError = errors.length > 0 || isOver;
|
|
2314
|
+
const inputId = props.name;
|
|
2315
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
2316
|
+
const statusId = `${inputId}-status`;
|
|
2317
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
2318
|
+
const sharedProps = {
|
|
2319
|
+
id: inputId,
|
|
2320
|
+
name: props.name,
|
|
2321
|
+
className: `usa-${props.multiline ? "textarea" : "input"}${hasError ? " usa-input--error" : ""}`,
|
|
2322
|
+
maxLength: props.maxLength,
|
|
2323
|
+
required: props.required ?? void 0,
|
|
2324
|
+
value,
|
|
2325
|
+
"aria-describedby": [hintId, statusId, errorId].filter(Boolean).join(" "),
|
|
2326
|
+
onChange: (e) => {
|
|
2327
|
+
setValue(e.target.value);
|
|
2328
|
+
if (hasValidation && validateOn === "change") validate();
|
|
2329
|
+
emit("change");
|
|
2330
|
+
},
|
|
2331
|
+
onBlur: () => {
|
|
2332
|
+
if (hasValidation && validateOn === "blur") validate();
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2336
|
+
"div",
|
|
2337
|
+
{
|
|
2338
|
+
className: `usa-form-group usa-character-count${hasError ? " usa-form-group--error" : ""}`,
|
|
2339
|
+
children: [
|
|
2340
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
2341
|
+
props.label,
|
|
2342
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
2343
|
+
] }),
|
|
2344
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
2345
|
+
isOver && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: `${Math.abs(remaining)} characters over limit` }),
|
|
2346
|
+
!isOver && errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
2347
|
+
props.multiline ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { ...sharedProps, rows: props.rows ?? 4 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ...sharedProps, type: "text" }),
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2349
|
+
"span",
|
|
2350
|
+
{
|
|
2351
|
+
id: statusId,
|
|
2352
|
+
className: `usa-character-count__status${isOver ? " usa-character-count__status--invalid" : ""}`,
|
|
2353
|
+
"aria-live": "polite",
|
|
2354
|
+
children: isOver ? `${Math.abs(remaining)} characters over limit` : `${remaining} characters allowed`
|
|
2355
|
+
}
|
|
2356
|
+
)
|
|
2357
|
+
]
|
|
2358
|
+
}
|
|
2359
|
+
);
|
|
2360
|
+
},
|
|
2361
|
+
// ── Additional Display ────────────────────────────────────────────────
|
|
2362
|
+
Icon: ({ props }) => {
|
|
2363
|
+
const sizeClass = props.size ? ` usa-icon--size-${props.size}` : "";
|
|
2364
|
+
const colorClass = props.color ? ` ${props.color}` : "";
|
|
2365
|
+
const iconPaths = {
|
|
2366
|
+
check: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",
|
|
2367
|
+
check_circle: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5l-4.5-4.5 1.41-1.41L10 13.67l7.09-7.09 1.41 1.41L10 16.5z",
|
|
2368
|
+
close: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",
|
|
2369
|
+
cancel: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",
|
|
2370
|
+
search: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14",
|
|
2371
|
+
arrow_forward: "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",
|
|
2372
|
+
arrow_back: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z",
|
|
2373
|
+
info: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z",
|
|
2374
|
+
warning: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z",
|
|
2375
|
+
error: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z",
|
|
2376
|
+
star: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",
|
|
2377
|
+
menu: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z",
|
|
2378
|
+
expand_more: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z",
|
|
2379
|
+
expand_less: "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",
|
|
2380
|
+
lock: "M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z",
|
|
2381
|
+
mail: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z",
|
|
2382
|
+
phone: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z",
|
|
2383
|
+
home: "M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z",
|
|
2384
|
+
person: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z",
|
|
2385
|
+
settings: "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"
|
|
2386
|
+
};
|
|
2387
|
+
const path = iconPaths[props.name] ?? iconPaths["info"];
|
|
2388
|
+
const isAriaHidden = !props.ariaLabel;
|
|
2389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2390
|
+
"svg",
|
|
2391
|
+
{
|
|
2392
|
+
className: `usa-icon${sizeClass}${colorClass}`,
|
|
2393
|
+
"aria-hidden": isAriaHidden ? true : void 0,
|
|
2394
|
+
"aria-label": props.ariaLabel ?? void 0,
|
|
2395
|
+
role: props.ariaLabel ? "img" : void 0,
|
|
2396
|
+
viewBox: "0 0 24 24",
|
|
2397
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: path })
|
|
2399
|
+
}
|
|
2400
|
+
);
|
|
2401
|
+
},
|
|
2402
|
+
InputGroup: ({
|
|
2403
|
+
props,
|
|
2404
|
+
bindings,
|
|
2405
|
+
emit
|
|
2406
|
+
}) => {
|
|
2407
|
+
const [boundValue, setBoundValue] = (0, import_react2.useBoundProp)(
|
|
2408
|
+
props.value,
|
|
2409
|
+
bindings?.value
|
|
2410
|
+
);
|
|
2411
|
+
const [localValue, setLocalValue] = (0, import_react.useState)("");
|
|
2412
|
+
const isBound = !!bindings?.value;
|
|
2413
|
+
const value = isBound ? boundValue ?? "" : localValue;
|
|
2414
|
+
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
2415
|
+
const validateOn = props.validateOn ?? "blur";
|
|
2416
|
+
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
2417
|
+
const { errors, validate } = (0, import_react2.useFieldValidation)(
|
|
2418
|
+
bindings?.value ?? "",
|
|
2419
|
+
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
2420
|
+
);
|
|
2421
|
+
const hasError = errors.length > 0;
|
|
2422
|
+
const inputId = props.name;
|
|
2423
|
+
const hintId = props.hint ? `${inputId}-hint` : void 0;
|
|
2424
|
+
const errorId = hasError ? `${inputId}-error` : void 0;
|
|
2425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2426
|
+
"div",
|
|
2427
|
+
{
|
|
2428
|
+
className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
|
|
2429
|
+
children: [
|
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "usa-label", htmlFor: inputId, children: [
|
|
2431
|
+
props.label,
|
|
2432
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-sr-only", children: " (required)" })
|
|
2433
|
+
] }),
|
|
2434
|
+
props.hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hint", id: hintId, children: props.hint }),
|
|
2435
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
|
|
2436
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2437
|
+
"div",
|
|
2438
|
+
{
|
|
2439
|
+
className: `usa-input-group${hasError ? " usa-input-group--error" : ""}`,
|
|
2440
|
+
children: [
|
|
2441
|
+
props.prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-input-prefix", "aria-hidden": "true", children: props.prefix }),
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2443
|
+
"input",
|
|
2444
|
+
{
|
|
2445
|
+
className: `usa-input${hasError ? " usa-input--error" : ""}`,
|
|
2446
|
+
id: inputId,
|
|
2447
|
+
name: props.name,
|
|
2448
|
+
type: props.type ?? "text",
|
|
2449
|
+
placeholder: props.placeholder ?? void 0,
|
|
2450
|
+
required: props.required ?? void 0,
|
|
2451
|
+
disabled: props.disabled ?? void 0,
|
|
2452
|
+
value,
|
|
2453
|
+
"aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
|
|
2454
|
+
onChange: (e) => {
|
|
2455
|
+
setValue(e.target.value);
|
|
2456
|
+
if (hasValidation && validateOn === "change") validate();
|
|
2457
|
+
emit("change");
|
|
2458
|
+
},
|
|
2459
|
+
onBlur: () => {
|
|
2460
|
+
if (hasValidation && validateOn === "blur") validate();
|
|
2461
|
+
emit("blur");
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
),
|
|
2465
|
+
props.suffix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-input-suffix", "aria-hidden": "true", children: props.suffix })
|
|
2466
|
+
]
|
|
2467
|
+
}
|
|
2468
|
+
)
|
|
2469
|
+
]
|
|
2470
|
+
}
|
|
2471
|
+
);
|
|
2472
|
+
},
|
|
2473
|
+
List: ({ props }) => {
|
|
2474
|
+
const items = props.items ?? [];
|
|
2475
|
+
const variant = props.variant ?? "unordered";
|
|
2476
|
+
const className = variant === "unstyled" ? "usa-list usa-list--unstyled" : "usa-list";
|
|
2477
|
+
if (variant === "ordered") {
|
|
2478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className, children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: item }, i)) });
|
|
2479
|
+
}
|
|
2480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className, children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: item }, i)) });
|
|
2481
|
+
},
|
|
2482
|
+
ValidationChecklist: ({
|
|
2483
|
+
props
|
|
2484
|
+
}) => {
|
|
2485
|
+
const items = props.items ?? [];
|
|
2486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2487
|
+
props.heading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-prose", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: props.heading }) }),
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "usa-checklist", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2489
|
+
"li",
|
|
2490
|
+
{
|
|
2491
|
+
className: `usa-checklist__item${item.checked ? " usa-checklist__item--checked" : ""}`,
|
|
2492
|
+
children: item.label
|
|
2493
|
+
},
|
|
2494
|
+
i
|
|
2495
|
+
)) })
|
|
2496
|
+
] });
|
|
2497
|
+
},
|
|
2498
|
+
// ── Page-level / Layout Components ───────────────────────────────────
|
|
2499
|
+
Form: ({ props, children, emit }) => {
|
|
2500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2501
|
+
"form",
|
|
2502
|
+
{
|
|
2503
|
+
className: `usa-form${props.large ? " usa-form--large" : ""}`,
|
|
2504
|
+
onSubmit: (e) => {
|
|
2505
|
+
e.preventDefault();
|
|
2506
|
+
emit("submit");
|
|
2507
|
+
},
|
|
2508
|
+
children
|
|
2509
|
+
}
|
|
2510
|
+
);
|
|
2511
|
+
},
|
|
2512
|
+
Section: ({ props, children }) => {
|
|
2513
|
+
const variantClass = props.variant === "light" ? " usa-section--light" : props.variant === "dark" ? " usa-section--dark" : "";
|
|
2514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: `usa-section${variantClass}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid-container", children: [
|
|
2515
|
+
props.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "usa-prose", children: props.title }),
|
|
2516
|
+
props.text && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "usa-prose", children: props.text }),
|
|
2517
|
+
children
|
|
2518
|
+
] }) });
|
|
2519
|
+
},
|
|
2520
|
+
Prose: ({ props, children }) => {
|
|
2521
|
+
const element = props.element ?? "div";
|
|
2522
|
+
if (element === "article")
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", { className: "usa-prose", children });
|
|
2524
|
+
if (element === "section")
|
|
2525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { children });
|
|
2526
|
+
if (element === "main")
|
|
2527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", { children });
|
|
2528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children });
|
|
2529
|
+
},
|
|
2530
|
+
Hero: ({ props }) => {
|
|
2531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2532
|
+
"section",
|
|
2533
|
+
{
|
|
2534
|
+
className: "usa-hero",
|
|
2535
|
+
"aria-label": props.ariaLabel ?? "Introduction",
|
|
2536
|
+
style: props.backgroundUrl ? { backgroundImage: `url(${safeCssUrl(props.backgroundUrl)})` } : void 0,
|
|
2537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-hero__callout", children: [
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h1", { className: "usa-hero__heading", children: [
|
|
2539
|
+
props.eyebrow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "usa-hero__heading--alt", children: props.eyebrow }),
|
|
2540
|
+
props.heading
|
|
2541
|
+
] }),
|
|
2542
|
+
props.body && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: props.body })
|
|
2543
|
+
] }) })
|
|
2544
|
+
}
|
|
2545
|
+
);
|
|
2546
|
+
},
|
|
2547
|
+
GraphicList: ({ props }) => {
|
|
2548
|
+
const items = props.items ?? [];
|
|
2549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: "usa-graphic-list usa-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid-container", children: [
|
|
2550
|
+
props.heading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "usa-graphic-list__heading", children: props.heading }),
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-graphic-list__row grid-row grid-gap", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-media-block tablet:grid-col", children: [
|
|
2552
|
+
item.imageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2553
|
+
"img",
|
|
2554
|
+
{
|
|
2555
|
+
className: "usa-media-block__img",
|
|
2556
|
+
src: item.imageUrl,
|
|
2557
|
+
alt: item.imageAlt ?? ""
|
|
2558
|
+
}
|
|
2559
|
+
),
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-media-block__body", children: [
|
|
2561
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "usa-graphic-list__heading", children: item.heading }),
|
|
2562
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: item.content })
|
|
2563
|
+
] })
|
|
2564
|
+
] }, i)) })
|
|
2565
|
+
] }) });
|
|
2566
|
+
},
|
|
2567
|
+
EmbedContainer: ({
|
|
2568
|
+
props
|
|
2569
|
+
}) => {
|
|
2570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usa-embed-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2571
|
+
"iframe",
|
|
2572
|
+
{
|
|
2573
|
+
src: safeHref(props.src),
|
|
2574
|
+
title: props.title,
|
|
2575
|
+
sandbox: "allow-scripts allow-same-origin allow-fullscreen allow-forms allow-popups",
|
|
2576
|
+
allowFullScreen: true,
|
|
2577
|
+
loading: "lazy",
|
|
2578
|
+
referrerPolicy: "no-referrer-when-downgrade"
|
|
2579
|
+
}
|
|
2580
|
+
) });
|
|
2581
|
+
},
|
|
2582
|
+
// ── Overlay / Modal ───────────────────────────────────────────────────
|
|
2583
|
+
Modal: ({ props, children }) => {
|
|
2584
|
+
const [open, setOpen] = (0, import_react2.useStateBinding)(props.openPath ?? "");
|
|
2585
|
+
const isOpen = open ?? false;
|
|
2586
|
+
const uid = (0, import_react.useId)();
|
|
2587
|
+
const modalId = `${uid}-modal`;
|
|
2588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2589
|
+
"div",
|
|
2590
|
+
{
|
|
2591
|
+
className: "usa-modal-overlay",
|
|
2592
|
+
"aria-controls": modalId,
|
|
2593
|
+
"data-open-modal": true,
|
|
2594
|
+
onClick: (e) => {
|
|
2595
|
+
if (e.target === e.currentTarget) setOpen(false);
|
|
2596
|
+
},
|
|
2597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2598
|
+
"div",
|
|
2599
|
+
{
|
|
2600
|
+
className: `usa-modal${props.large ? " usa-modal--lg" : ""}`,
|
|
2601
|
+
id: modalId,
|
|
2602
|
+
"aria-labelledby": `${modalId}-heading`,
|
|
2603
|
+
"aria-describedby": `${modalId}-description`,
|
|
2604
|
+
role: "dialog",
|
|
2605
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-modal__content", children: [
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-modal__main", children: [
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "usa-modal__heading", id: `${modalId}-heading`, children: props.heading }),
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "usa-prose", id: `${modalId}-description`, children: [
|
|
2609
|
+
props.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: props.description }),
|
|
2610
|
+
children
|
|
2611
|
+
] })
|
|
2612
|
+
] }),
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2614
|
+
"button",
|
|
2615
|
+
{
|
|
2616
|
+
type: "button",
|
|
2617
|
+
className: "usa-button usa-modal__close",
|
|
2618
|
+
"aria-label": "Close this window",
|
|
2619
|
+
onClick: () => setOpen(false),
|
|
2620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2621
|
+
"svg",
|
|
2622
|
+
{
|
|
2623
|
+
className: "usa-icon",
|
|
2624
|
+
"aria-hidden": "true",
|
|
2625
|
+
focusable: "false",
|
|
2626
|
+
role: "img",
|
|
2627
|
+
viewBox: "0 0 24 24",
|
|
2628
|
+
width: "24",
|
|
2629
|
+
height: "24",
|
|
2630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })
|
|
2631
|
+
}
|
|
2632
|
+
)
|
|
2633
|
+
}
|
|
2634
|
+
)
|
|
2635
|
+
] })
|
|
2636
|
+
}
|
|
2637
|
+
)
|
|
2638
|
+
}
|
|
2639
|
+
) });
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
|
|
2643
|
+
// src/catalog.ts
|
|
2644
|
+
var import_zod = require("zod");
|
|
2645
|
+
var validationCheckSchema = import_zod.z.array(
|
|
2646
|
+
import_zod.z.object({
|
|
2647
|
+
type: import_zod.z.string(),
|
|
2648
|
+
message: import_zod.z.string(),
|
|
2649
|
+
args: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
|
|
2650
|
+
})
|
|
2651
|
+
).nullable();
|
|
2652
|
+
var validateOnSchema = import_zod.z.enum(["change", "blur", "submit"]).nullable();
|
|
2653
|
+
var uswdsComponentDefinitions = {
|
|
2654
|
+
// ==========================================================================
|
|
2655
|
+
// Layout Components
|
|
2656
|
+
// ==========================================================================
|
|
2657
|
+
Grid: {
|
|
2658
|
+
props: import_zod.z.object({
|
|
2659
|
+
columns: import_zod.z.number().nullable(),
|
|
2660
|
+
gap: import_zod.z.enum(["sm", "md", "lg"]).nullable()
|
|
2661
|
+
}),
|
|
2662
|
+
slots: ["default"],
|
|
2663
|
+
description: "USWDS grid row with equal-width columns. columns: 1-12. gap: spacing between columns.",
|
|
2664
|
+
example: { columns: 3, gap: "md" }
|
|
2665
|
+
},
|
|
2666
|
+
CardGroup: {
|
|
2667
|
+
props: import_zod.z.object({
|
|
2668
|
+
cards: import_zod.z.array(
|
|
2669
|
+
import_zod.z.object({
|
|
2670
|
+
title: import_zod.z.string().nullable(),
|
|
2671
|
+
description: import_zod.z.string().nullable(),
|
|
2672
|
+
mediaUrl: import_zod.z.string().nullable(),
|
|
2673
|
+
mediaAlt: import_zod.z.string().nullable(),
|
|
2674
|
+
footer: import_zod.z.string().nullable()
|
|
2675
|
+
})
|
|
2676
|
+
),
|
|
2677
|
+
flag: import_zod.z.boolean().nullable()
|
|
2678
|
+
}),
|
|
2679
|
+
description: "USWDS group of cards in a responsive grid. cards: [{title, description, mediaUrl?, mediaAlt?, footer?}]. flag for horizontal card layout.",
|
|
2680
|
+
example: {
|
|
2681
|
+
cards: [
|
|
2682
|
+
{
|
|
2683
|
+
title: "Card One",
|
|
2684
|
+
description: "Description one.",
|
|
2685
|
+
mediaUrl: null,
|
|
2686
|
+
mediaAlt: null,
|
|
2687
|
+
footer: null
|
|
2688
|
+
},
|
|
2689
|
+
{
|
|
2690
|
+
title: "Card Two",
|
|
2691
|
+
description: "Description two.",
|
|
2692
|
+
mediaUrl: null,
|
|
2693
|
+
mediaAlt: null,
|
|
2694
|
+
footer: null
|
|
2695
|
+
}
|
|
2696
|
+
]
|
|
2697
|
+
}
|
|
2698
|
+
},
|
|
2699
|
+
Card: {
|
|
2700
|
+
props: import_zod.z.object({
|
|
2701
|
+
title: import_zod.z.string().nullable(),
|
|
2702
|
+
description: import_zod.z.string().nullable(),
|
|
2703
|
+
headerFirst: import_zod.z.boolean().nullable(),
|
|
2704
|
+
mediaUrl: import_zod.z.string().nullable(),
|
|
2705
|
+
mediaAlt: import_zod.z.string().nullable(),
|
|
2706
|
+
flag: import_zod.z.boolean().nullable()
|
|
2707
|
+
}),
|
|
2708
|
+
slots: ["default"],
|
|
2709
|
+
description: "USWDS card container. Use title/description for header, mediaUrl for an image, flag for horizontal layout.",
|
|
2710
|
+
example: { title: "Card Title", description: "Supporting text." }
|
|
2711
|
+
},
|
|
2712
|
+
Divider: {
|
|
2713
|
+
props: import_zod.z.object({}),
|
|
2714
|
+
description: "USWDS horizontal rule divider (usa-divider)."
|
|
2715
|
+
},
|
|
2716
|
+
Footer: {
|
|
2717
|
+
props: import_zod.z.object({
|
|
2718
|
+
variant: import_zod.z.enum(["slim", "medium", "big"]).nullable(),
|
|
2719
|
+
agencyName: import_zod.z.string(),
|
|
2720
|
+
agencyUrl: import_zod.z.string().nullable(),
|
|
2721
|
+
logoUrl: import_zod.z.string().nullable(),
|
|
2722
|
+
logoAlt: import_zod.z.string().nullable(),
|
|
2723
|
+
navGroups: import_zod.z.array(
|
|
2724
|
+
import_zod.z.object({
|
|
2725
|
+
heading: import_zod.z.string().nullable(),
|
|
2726
|
+
links: import_zod.z.array(import_zod.z.object({ label: import_zod.z.string(), href: import_zod.z.string() }))
|
|
2727
|
+
})
|
|
2728
|
+
).nullable(),
|
|
2729
|
+
contactHeading: import_zod.z.string().nullable(),
|
|
2730
|
+
contactInfo: import_zod.z.array(
|
|
2731
|
+
import_zod.z.object({
|
|
2732
|
+
type: import_zod.z.enum(["address", "phone", "email"]),
|
|
2733
|
+
value: import_zod.z.string()
|
|
2734
|
+
})
|
|
2735
|
+
).nullable(),
|
|
2736
|
+
socialLinks: import_zod.z.array(
|
|
2737
|
+
import_zod.z.object({
|
|
2738
|
+
platform: import_zod.z.enum([
|
|
2739
|
+
"facebook",
|
|
2740
|
+
"twitter",
|
|
2741
|
+
"youtube",
|
|
2742
|
+
"instagram",
|
|
2743
|
+
"rss",
|
|
2744
|
+
"linkedin",
|
|
2745
|
+
"github"
|
|
2746
|
+
]),
|
|
2747
|
+
href: import_zod.z.string(),
|
|
2748
|
+
label: import_zod.z.string()
|
|
2749
|
+
})
|
|
2750
|
+
).nullable(),
|
|
2751
|
+
returnToTop: import_zod.z.boolean().nullable()
|
|
2752
|
+
}),
|
|
2753
|
+
description: "USWDS site footer. variant: slim (compact), medium (default), big (multi-column nav). navGroups: [{heading?, links: [{label, href}]}]. For big variant, each group becomes a column.",
|
|
2754
|
+
example: {
|
|
2755
|
+
variant: "medium",
|
|
2756
|
+
agencyName: "Agency Name",
|
|
2757
|
+
agencyUrl: "/",
|
|
2758
|
+
logoUrl: null,
|
|
2759
|
+
logoAlt: null,
|
|
2760
|
+
navGroups: [
|
|
2761
|
+
{
|
|
2762
|
+
heading: null,
|
|
2763
|
+
links: [
|
|
2764
|
+
{ label: "Home", href: "/" },
|
|
2765
|
+
{ label: "About", href: "/about" },
|
|
2766
|
+
{ label: "Contact", href: "/contact" }
|
|
2767
|
+
]
|
|
2768
|
+
}
|
|
2769
|
+
],
|
|
2770
|
+
contactHeading: "Contact",
|
|
2771
|
+
contactInfo: [
|
|
2772
|
+
{ type: "address", value: "1800 F Street NW, Washington, DC 20405" },
|
|
2773
|
+
{ type: "phone", value: "1-800-FED-INFO" },
|
|
2774
|
+
{ type: "email", value: "info@agency.gov" }
|
|
2775
|
+
],
|
|
2776
|
+
socialLinks: null,
|
|
2777
|
+
returnToTop: true
|
|
2778
|
+
}
|
|
2779
|
+
},
|
|
2780
|
+
// ==========================================================================
|
|
2781
|
+
// Navigation Components
|
|
2782
|
+
// ==========================================================================
|
|
2783
|
+
Accordion: {
|
|
2784
|
+
props: import_zod.z.object({
|
|
2785
|
+
items: import_zod.z.array(
|
|
2786
|
+
import_zod.z.object({
|
|
2787
|
+
title: import_zod.z.string(),
|
|
2788
|
+
content: import_zod.z.string(),
|
|
2789
|
+
expanded: import_zod.z.boolean().nullable()
|
|
2790
|
+
})
|
|
2791
|
+
),
|
|
2792
|
+
bordered: import_zod.z.boolean().nullable(),
|
|
2793
|
+
multiselectable: import_zod.z.boolean().nullable()
|
|
2794
|
+
}),
|
|
2795
|
+
description: "USWDS accordion. Items as [{title, content, expanded?}]. bordered adds border styling. multiselectable allows multiple open panels.",
|
|
2796
|
+
example: {
|
|
2797
|
+
items: [
|
|
2798
|
+
{ title: "First item", content: "Content for first item." },
|
|
2799
|
+
{ title: "Second item", content: "Content for second item." }
|
|
2800
|
+
]
|
|
2801
|
+
}
|
|
2802
|
+
},
|
|
2803
|
+
Pagination: {
|
|
2804
|
+
props: import_zod.z.object({
|
|
2805
|
+
totalPages: import_zod.z.number(),
|
|
2806
|
+
page: import_zod.z.number().nullable(),
|
|
2807
|
+
ariaLabel: import_zod.z.string().nullable()
|
|
2808
|
+
}),
|
|
2809
|
+
events: ["change"],
|
|
2810
|
+
description: "USWDS pagination navigation. Use { $bindState } on page for current page number.",
|
|
2811
|
+
example: { totalPages: 10, page: 1 }
|
|
2812
|
+
},
|
|
2813
|
+
StepIndicator: {
|
|
2814
|
+
props: import_zod.z.object({
|
|
2815
|
+
steps: import_zod.z.array(import_zod.z.string()),
|
|
2816
|
+
currentStep: import_zod.z.number(),
|
|
2817
|
+
counters: import_zod.z.enum(["default", "small"]).nullable(),
|
|
2818
|
+
centered: import_zod.z.boolean().nullable(),
|
|
2819
|
+
noLabels: import_zod.z.boolean().nullable()
|
|
2820
|
+
}),
|
|
2821
|
+
description: "USWDS step indicator for multi-step forms. steps: array of step labels. currentStep: 1-based index of active step.",
|
|
2822
|
+
example: {
|
|
2823
|
+
steps: ["Personal info", "Household", "Review"],
|
|
2824
|
+
currentStep: 1
|
|
2825
|
+
}
|
|
2826
|
+
},
|
|
2827
|
+
Header: {
|
|
2828
|
+
props: import_zod.z.object({
|
|
2829
|
+
variant: import_zod.z.enum(["basic", "extended"]).nullable(),
|
|
2830
|
+
siteName: import_zod.z.string(),
|
|
2831
|
+
siteUrl: import_zod.z.string().nullable(),
|
|
2832
|
+
logoUrl: import_zod.z.string().nullable(),
|
|
2833
|
+
logoAlt: import_zod.z.string().nullable(),
|
|
2834
|
+
navItems: import_zod.z.array(
|
|
2835
|
+
import_zod.z.object({
|
|
2836
|
+
label: import_zod.z.string(),
|
|
2837
|
+
href: import_zod.z.string(),
|
|
2838
|
+
current: import_zod.z.boolean().nullable(),
|
|
2839
|
+
items: import_zod.z.array(
|
|
2840
|
+
import_zod.z.object({
|
|
2841
|
+
label: import_zod.z.string(),
|
|
2842
|
+
href: import_zod.z.string()
|
|
2843
|
+
})
|
|
2844
|
+
).nullable()
|
|
2845
|
+
})
|
|
2846
|
+
).nullable(),
|
|
2847
|
+
showSearch: import_zod.z.boolean().nullable()
|
|
2848
|
+
}),
|
|
2849
|
+
description: "USWDS site header with primary navigation. variant: basic (default) or extended (taller with logo). navItems: [{label, href, current?, items?}] \u2014 items creates a dropdown. showSearch adds a search bar.",
|
|
2850
|
+
example: {
|
|
2851
|
+
variant: "basic",
|
|
2852
|
+
siteName: "Agency Name",
|
|
2853
|
+
siteUrl: "/",
|
|
2854
|
+
logoUrl: null,
|
|
2855
|
+
logoAlt: null,
|
|
2856
|
+
navItems: [
|
|
2857
|
+
{ label: "Home", href: "/", current: true, items: null },
|
|
2858
|
+
{ label: "About", href: "/about", current: false, items: null },
|
|
2859
|
+
{
|
|
2860
|
+
label: "Topics",
|
|
2861
|
+
href: "/topics",
|
|
2862
|
+
current: false,
|
|
2863
|
+
items: [
|
|
2864
|
+
{ label: "Topic One", href: "/topics/one" },
|
|
2865
|
+
{ label: "Topic Two", href: "/topics/two" }
|
|
2866
|
+
]
|
|
2867
|
+
}
|
|
2868
|
+
],
|
|
2869
|
+
showSearch: false
|
|
2870
|
+
}
|
|
2871
|
+
},
|
|
2872
|
+
SkipNav: {
|
|
2873
|
+
props: import_zod.z.object({
|
|
2874
|
+
href: import_zod.z.string().nullable(),
|
|
2875
|
+
label: import_zod.z.string().nullable()
|
|
2876
|
+
}),
|
|
2877
|
+
description: "USWDS skip navigation link. Renders an off-screen anchor that appears on focus, letting keyboard users jump past repeated navigation. href defaults to '#main-content'.",
|
|
2878
|
+
example: { href: "#main-content", label: "Skip to main content" }
|
|
2879
|
+
},
|
|
2880
|
+
SideNav: {
|
|
2881
|
+
props: import_zod.z.object({
|
|
2882
|
+
items: import_zod.z.array(
|
|
2883
|
+
import_zod.z.object({
|
|
2884
|
+
label: import_zod.z.string(),
|
|
2885
|
+
href: import_zod.z.string(),
|
|
2886
|
+
current: import_zod.z.boolean().nullable(),
|
|
2887
|
+
children: import_zod.z.array(
|
|
2888
|
+
import_zod.z.object({
|
|
2889
|
+
label: import_zod.z.string(),
|
|
2890
|
+
href: import_zod.z.string(),
|
|
2891
|
+
current: import_zod.z.boolean().nullable()
|
|
2892
|
+
})
|
|
2893
|
+
).nullable()
|
|
2894
|
+
})
|
|
2895
|
+
),
|
|
2896
|
+
ariaLabel: import_zod.z.string().nullable()
|
|
2897
|
+
}),
|
|
2898
|
+
description: "USWDS side navigation. items: [{label, href, current?, children?}]. Mark the active page with current: true.",
|
|
2899
|
+
example: {
|
|
2900
|
+
ariaLabel: "Side navigation",
|
|
2901
|
+
items: [
|
|
2902
|
+
{
|
|
2903
|
+
label: "Overview",
|
|
2904
|
+
href: "/overview",
|
|
2905
|
+
current: false,
|
|
2906
|
+
children: null
|
|
2907
|
+
},
|
|
2908
|
+
{
|
|
2909
|
+
label: "Getting started",
|
|
2910
|
+
href: "/getting-started",
|
|
2911
|
+
current: true,
|
|
2912
|
+
children: [
|
|
2913
|
+
{
|
|
2914
|
+
label: "Installation",
|
|
2915
|
+
href: "/getting-started/install",
|
|
2916
|
+
current: false
|
|
2917
|
+
},
|
|
2918
|
+
{
|
|
2919
|
+
label: "Configuration",
|
|
2920
|
+
href: "/getting-started/config",
|
|
2921
|
+
current: false
|
|
2922
|
+
}
|
|
2923
|
+
]
|
|
2924
|
+
}
|
|
2925
|
+
]
|
|
2926
|
+
}
|
|
2927
|
+
},
|
|
2928
|
+
LanguageSelector: {
|
|
2929
|
+
props: import_zod.z.object({
|
|
2930
|
+
languages: import_zod.z.array(
|
|
2931
|
+
import_zod.z.object({
|
|
2932
|
+
label: import_zod.z.string(),
|
|
2933
|
+
href: import_zod.z.string(),
|
|
2934
|
+
lang: import_zod.z.string(),
|
|
2935
|
+
localLabel: import_zod.z.string().nullable()
|
|
2936
|
+
})
|
|
2937
|
+
),
|
|
2938
|
+
currentLang: import_zod.z.string().nullable()
|
|
2939
|
+
}),
|
|
2940
|
+
description: "USWDS language selector. languages: [{label, href, lang, localLabel?}]. currentLang: BCP-47 code of the active language (e.g. 'en').",
|
|
2941
|
+
example: {
|
|
2942
|
+
currentLang: "en",
|
|
2943
|
+
languages: [
|
|
2944
|
+
{ label: "English", href: "/en", lang: "en", localLabel: null },
|
|
2945
|
+
{ label: "Spanish", href: "/es", lang: "es", localLabel: "Espa\xF1ol" },
|
|
2946
|
+
{ label: "French", href: "/fr", lang: "fr", localLabel: "Fran\xE7ais" }
|
|
2947
|
+
]
|
|
2948
|
+
}
|
|
2949
|
+
},
|
|
2950
|
+
Link: {
|
|
2951
|
+
props: import_zod.z.object({
|
|
2952
|
+
label: import_zod.z.string(),
|
|
2953
|
+
href: import_zod.z.string(),
|
|
2954
|
+
external: import_zod.z.boolean().nullable(),
|
|
2955
|
+
variant: import_zod.z.enum(["default", "nav"]).nullable()
|
|
2956
|
+
}),
|
|
2957
|
+
events: ["press"],
|
|
2958
|
+
description: "USWDS anchor link. external adds an external-link indicator. variant: default or nav (for navigation contexts).",
|
|
2959
|
+
example: { label: "Learn more", href: "/about" }
|
|
2960
|
+
},
|
|
2961
|
+
InPageNavigation: {
|
|
2962
|
+
props: import_zod.z.object({
|
|
2963
|
+
items: import_zod.z.array(
|
|
2964
|
+
import_zod.z.object({
|
|
2965
|
+
label: import_zod.z.string(),
|
|
2966
|
+
href: import_zod.z.string()
|
|
2967
|
+
})
|
|
2968
|
+
),
|
|
2969
|
+
heading: import_zod.z.string().nullable()
|
|
2970
|
+
}),
|
|
2971
|
+
description: "USWDS in-page navigation with jump links to sections. items: [{label, href}] where href is an anchor like '#section-1'.",
|
|
2972
|
+
example: {
|
|
2973
|
+
heading: "On this page",
|
|
2974
|
+
items: [
|
|
2975
|
+
{ label: "Introduction", href: "#introduction" },
|
|
2976
|
+
{ label: "Requirements", href: "#requirements" },
|
|
2977
|
+
{ label: "How to apply", href: "#how-to-apply" }
|
|
2978
|
+
]
|
|
2979
|
+
}
|
|
2980
|
+
},
|
|
2981
|
+
Breadcrumb: {
|
|
2982
|
+
props: import_zod.z.object({
|
|
2983
|
+
items: import_zod.z.array(
|
|
2984
|
+
import_zod.z.object({
|
|
2985
|
+
label: import_zod.z.string(),
|
|
2986
|
+
href: import_zod.z.string().nullable()
|
|
2987
|
+
})
|
|
2988
|
+
)
|
|
2989
|
+
}),
|
|
2990
|
+
description: "USWDS breadcrumb navigation. items: array of {label, href?}. Last item is current page (no link).",
|
|
2991
|
+
example: {
|
|
2992
|
+
items: [
|
|
2993
|
+
{ label: "Home", href: "/" },
|
|
2994
|
+
{ label: "Components", href: "/components" },
|
|
2995
|
+
{ label: "Breadcrumb", href: null }
|
|
2996
|
+
]
|
|
2997
|
+
}
|
|
2998
|
+
},
|
|
2999
|
+
// ==========================================================================
|
|
3000
|
+
// Data Display Components
|
|
3001
|
+
// ==========================================================================
|
|
3002
|
+
Identifier: {
|
|
3003
|
+
props: import_zod.z.object({
|
|
3004
|
+
domain: import_zod.z.string(),
|
|
3005
|
+
agencyName: import_zod.z.string(),
|
|
3006
|
+
agencyUrl: import_zod.z.string().nullable(),
|
|
3007
|
+
logoUrl: import_zod.z.string().nullable(),
|
|
3008
|
+
logoAlt: import_zod.z.string().nullable(),
|
|
3009
|
+
disclaimer: import_zod.z.string().nullable(),
|
|
3010
|
+
links: import_zod.z.array(import_zod.z.object({ label: import_zod.z.string(), href: import_zod.z.string() })).nullable(),
|
|
3011
|
+
showUsagov: import_zod.z.boolean().nullable()
|
|
3012
|
+
}),
|
|
3013
|
+
description: "USWDS agency identifier section. Shows domain, agency name, logo, required links, and USA.gov footer. Place at the bottom of .gov pages.",
|
|
3014
|
+
example: {
|
|
3015
|
+
domain: "agency.gov",
|
|
3016
|
+
agencyName: "U.S. Department of Example",
|
|
3017
|
+
agencyUrl: "/",
|
|
3018
|
+
logoUrl: null,
|
|
3019
|
+
logoAlt: null,
|
|
3020
|
+
disclaimer: null,
|
|
3021
|
+
links: [
|
|
3022
|
+
{ label: "About agency.gov", href: "/about" },
|
|
3023
|
+
{ label: "Accessibility statement", href: "/accessibility" },
|
|
3024
|
+
{ label: "Privacy policy", href: "/privacy" },
|
|
3025
|
+
{ label: "No FEAR Act data", href: "/no-fear" },
|
|
3026
|
+
{ label: "Office of the Inspector General", href: "/oig" },
|
|
3027
|
+
{ label: "Performance reports", href: "/performance" },
|
|
3028
|
+
{ label: "FOIA requests", href: "/foia" }
|
|
3029
|
+
],
|
|
3030
|
+
showUsagov: true
|
|
3031
|
+
}
|
|
3032
|
+
},
|
|
3033
|
+
GovBanner: {
|
|
3034
|
+
props: import_zod.z.object({
|
|
3035
|
+
tld: import_zod.z.enum([".gov", ".mil"]).nullable(),
|
|
3036
|
+
expanded: import_zod.z.boolean().nullable()
|
|
3037
|
+
}),
|
|
3038
|
+
description: "USWDS government site banner ('An official website of the United States government'). tld: '.gov' (default) or '.mil'. expanded: show expanded explanation by default.",
|
|
3039
|
+
example: { tld: ".gov" }
|
|
3040
|
+
},
|
|
3041
|
+
Collection: {
|
|
3042
|
+
props: import_zod.z.object({
|
|
3043
|
+
items: import_zod.z.array(
|
|
3044
|
+
import_zod.z.object({
|
|
3045
|
+
heading: import_zod.z.string(),
|
|
3046
|
+
href: import_zod.z.string().nullable(),
|
|
3047
|
+
description: import_zod.z.string().nullable(),
|
|
3048
|
+
date: import_zod.z.string().nullable(),
|
|
3049
|
+
dateLabel: import_zod.z.string().nullable(),
|
|
3050
|
+
tags: import_zod.z.array(import_zod.z.string()).nullable(),
|
|
3051
|
+
thumbnailUrl: import_zod.z.string().nullable(),
|
|
3052
|
+
thumbnailAlt: import_zod.z.string().nullable()
|
|
3053
|
+
})
|
|
3054
|
+
)
|
|
3055
|
+
}),
|
|
3056
|
+
description: "USWDS collection list of content items. items: [{heading, href?, description?, date?, dateLabel?, tags?, thumbnailUrl?, thumbnailAlt?}].",
|
|
3057
|
+
example: {
|
|
3058
|
+
items: [
|
|
3059
|
+
{
|
|
3060
|
+
heading: "Article Title",
|
|
3061
|
+
href: "/articles/1",
|
|
3062
|
+
description: "A short description of the article.",
|
|
3063
|
+
date: "2024-01-15",
|
|
3064
|
+
dateLabel: "January 15, 2024",
|
|
3065
|
+
tags: ["Policy", "Health"],
|
|
3066
|
+
thumbnailUrl: null,
|
|
3067
|
+
thumbnailAlt: null
|
|
3068
|
+
}
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
},
|
|
3072
|
+
IconList: {
|
|
3073
|
+
props: import_zod.z.object({
|
|
3074
|
+
items: import_zod.z.array(
|
|
3075
|
+
import_zod.z.object({
|
|
3076
|
+
icon: import_zod.z.string(),
|
|
3077
|
+
content: import_zod.z.string(),
|
|
3078
|
+
color: import_zod.z.enum(["default", "success", "warning", "error", "info"]).nullable()
|
|
3079
|
+
})
|
|
3080
|
+
),
|
|
3081
|
+
title: import_zod.z.string().nullable(),
|
|
3082
|
+
size: import_zod.z.enum(["sm", "lg", "xl", "2xl", "3xl"]).nullable()
|
|
3083
|
+
}),
|
|
3084
|
+
description: "USWDS icon list. items: [{icon, content, color?}]. icon is a USWDS icon name (e.g. 'check_circle', 'cancel', 'info'). size controls icon size.",
|
|
3085
|
+
example: {
|
|
3086
|
+
title: "Requirements",
|
|
3087
|
+
items: [
|
|
3088
|
+
{
|
|
3089
|
+
icon: "check_circle",
|
|
3090
|
+
content: "Requirement one is met.",
|
|
3091
|
+
color: "success"
|
|
3092
|
+
},
|
|
3093
|
+
{
|
|
3094
|
+
icon: "check_circle",
|
|
3095
|
+
content: "Requirement two is met.",
|
|
3096
|
+
color: "success"
|
|
3097
|
+
},
|
|
3098
|
+
{
|
|
3099
|
+
icon: "cancel",
|
|
3100
|
+
content: "Requirement three is not met.",
|
|
3101
|
+
color: "error"
|
|
3102
|
+
}
|
|
3103
|
+
]
|
|
3104
|
+
}
|
|
3105
|
+
},
|
|
3106
|
+
Tooltip: {
|
|
3107
|
+
props: import_zod.z.object({
|
|
3108
|
+
label: import_zod.z.string(),
|
|
3109
|
+
content: import_zod.z.string(),
|
|
3110
|
+
position: import_zod.z.enum(["top", "bottom", "left", "right"]).nullable()
|
|
3111
|
+
}),
|
|
3112
|
+
description: "USWDS tooltip shown on hover. label: the visible trigger text. content: tooltip text. position: top (default), bottom, left, right.",
|
|
3113
|
+
example: {
|
|
3114
|
+
label: "Hover me",
|
|
3115
|
+
content: "This is a tooltip",
|
|
3116
|
+
position: "top"
|
|
3117
|
+
}
|
|
3118
|
+
},
|
|
3119
|
+
Table: {
|
|
3120
|
+
props: import_zod.z.object({
|
|
3121
|
+
columns: import_zod.z.array(import_zod.z.string()),
|
|
3122
|
+
rows: import_zod.z.array(import_zod.z.array(import_zod.z.string())),
|
|
3123
|
+
caption: import_zod.z.string().nullable(),
|
|
3124
|
+
borderless: import_zod.z.boolean().nullable(),
|
|
3125
|
+
striped: import_zod.z.boolean().nullable(),
|
|
3126
|
+
compact: import_zod.z.boolean().nullable(),
|
|
3127
|
+
scrollable: import_zod.z.boolean().nullable()
|
|
3128
|
+
}),
|
|
3129
|
+
description: "USWDS data table. columns: header labels. rows: 2D array of cell strings. borderless/striped/compact for styling variants.",
|
|
3130
|
+
example: {
|
|
3131
|
+
columns: ["Name", "Role", "Status"],
|
|
3132
|
+
rows: [
|
|
3133
|
+
["Alice", "Admin", "Active"],
|
|
3134
|
+
["Bob", "User", "Inactive"]
|
|
3135
|
+
]
|
|
3136
|
+
}
|
|
3137
|
+
},
|
|
3138
|
+
Heading: {
|
|
3139
|
+
props: import_zod.z.object({
|
|
3140
|
+
text: import_zod.z.string(),
|
|
3141
|
+
level: import_zod.z.enum(["h1", "h2", "h3", "h4", "h5", "h6"]).nullable()
|
|
3142
|
+
}),
|
|
3143
|
+
description: "USWDS heading text (h1\u2013h6) with usa-prose styling.",
|
|
3144
|
+
example: { text: "Page Title", level: "h1" }
|
|
3145
|
+
},
|
|
3146
|
+
Text: {
|
|
3147
|
+
props: import_zod.z.object({
|
|
3148
|
+
text: import_zod.z.string(),
|
|
3149
|
+
variant: import_zod.z.enum(["body", "lead", "small", "code"]).nullable()
|
|
3150
|
+
}),
|
|
3151
|
+
description: "USWDS paragraph text. variant: body (default), lead, small, code.",
|
|
3152
|
+
example: { text: "Supporting paragraph text." }
|
|
3153
|
+
},
|
|
3154
|
+
Alert: {
|
|
3155
|
+
props: import_zod.z.object({
|
|
3156
|
+
heading: import_zod.z.string().nullable(),
|
|
3157
|
+
message: import_zod.z.string(),
|
|
3158
|
+
type: import_zod.z.enum(["info", "success", "warning", "error", "emergency"]).nullable(),
|
|
3159
|
+
slim: import_zod.z.boolean().nullable(),
|
|
3160
|
+
noIcon: import_zod.z.boolean().nullable()
|
|
3161
|
+
}),
|
|
3162
|
+
description: "USWDS alert banner. type: info (default), success, warning, error, emergency. slim for compact variant.",
|
|
3163
|
+
example: {
|
|
3164
|
+
heading: "Success",
|
|
3165
|
+
message: "Your form has been submitted.",
|
|
3166
|
+
type: "success"
|
|
3167
|
+
}
|
|
3168
|
+
},
|
|
3169
|
+
SiteAlert: {
|
|
3170
|
+
props: import_zod.z.object({
|
|
3171
|
+
heading: import_zod.z.string().nullable(),
|
|
3172
|
+
message: import_zod.z.string(),
|
|
3173
|
+
type: import_zod.z.enum(["info", "emergency"]).nullable(),
|
|
3174
|
+
slim: import_zod.z.boolean().nullable()
|
|
3175
|
+
}),
|
|
3176
|
+
description: "USWDS site-wide alert banner for important announcements. type: info (default) or emergency.",
|
|
3177
|
+
example: {
|
|
3178
|
+
heading: "Official website of the United States government",
|
|
3179
|
+
message: "Here's how you know this is a government site.",
|
|
3180
|
+
type: "info"
|
|
3181
|
+
}
|
|
3182
|
+
},
|
|
3183
|
+
Tag: {
|
|
3184
|
+
props: import_zod.z.object({
|
|
3185
|
+
text: import_zod.z.string(),
|
|
3186
|
+
big: import_zod.z.boolean().nullable()
|
|
3187
|
+
}),
|
|
3188
|
+
description: "USWDS tag/label badge. big for larger variant.",
|
|
3189
|
+
example: { text: "New" }
|
|
3190
|
+
},
|
|
3191
|
+
SummaryBox: {
|
|
3192
|
+
props: import_zod.z.object({
|
|
3193
|
+
heading: import_zod.z.string(),
|
|
3194
|
+
items: import_zod.z.array(import_zod.z.string())
|
|
3195
|
+
}),
|
|
3196
|
+
description: "USWDS summary box with a heading and bullet list of key information.",
|
|
3197
|
+
example: {
|
|
3198
|
+
heading: "Key information",
|
|
3199
|
+
items: ["Item one", "Item two", "Item three"]
|
|
3200
|
+
}
|
|
3201
|
+
},
|
|
3202
|
+
ProcessList: {
|
|
3203
|
+
props: import_zod.z.object({
|
|
3204
|
+
items: import_zod.z.array(
|
|
3205
|
+
import_zod.z.object({
|
|
3206
|
+
heading: import_zod.z.string(),
|
|
3207
|
+
content: import_zod.z.string()
|
|
3208
|
+
})
|
|
3209
|
+
)
|
|
3210
|
+
}),
|
|
3211
|
+
description: "USWDS numbered process list for step-by-step instructions. items: [{heading, content}].",
|
|
3212
|
+
example: {
|
|
3213
|
+
items: [
|
|
3214
|
+
{ heading: "Apply", content: "Submit your application online." },
|
|
3215
|
+
{ heading: "Review", content: "We review your application." },
|
|
3216
|
+
{ heading: "Approval", content: "Receive your decision letter." }
|
|
3217
|
+
]
|
|
3218
|
+
}
|
|
3219
|
+
},
|
|
3220
|
+
// ==========================================================================
|
|
3221
|
+
// Form Input Components
|
|
3222
|
+
// ==========================================================================
|
|
3223
|
+
Button: {
|
|
3224
|
+
props: import_zod.z.object({
|
|
3225
|
+
label: import_zod.z.string(),
|
|
3226
|
+
variant: import_zod.z.enum([
|
|
3227
|
+
"default",
|
|
3228
|
+
"secondary",
|
|
3229
|
+
"accent-cool",
|
|
3230
|
+
"accent-warm",
|
|
3231
|
+
"base",
|
|
3232
|
+
"outline",
|
|
3233
|
+
"outline-inverse",
|
|
3234
|
+
"big",
|
|
3235
|
+
"unstyled"
|
|
3236
|
+
]).nullable(),
|
|
3237
|
+
disabled: import_zod.z.boolean().nullable(),
|
|
3238
|
+
type: import_zod.z.enum(["button", "submit", "reset"]).nullable()
|
|
3239
|
+
}),
|
|
3240
|
+
events: ["press"],
|
|
3241
|
+
description: "USWDS button. variant: default (primary), secondary, accent-cool, accent-warm, base, outline, outline-inverse, big, unstyled.",
|
|
3242
|
+
example: { label: "Submit", variant: "default" }
|
|
3243
|
+
},
|
|
3244
|
+
ButtonGroup: {
|
|
3245
|
+
props: import_zod.z.object({
|
|
3246
|
+
buttons: import_zod.z.array(
|
|
3247
|
+
import_zod.z.object({
|
|
3248
|
+
label: import_zod.z.string(),
|
|
3249
|
+
value: import_zod.z.string(),
|
|
3250
|
+
variant: import_zod.z.enum(["default", "secondary", "outline"]).nullable()
|
|
3251
|
+
})
|
|
3252
|
+
),
|
|
3253
|
+
segmented: import_zod.z.boolean().nullable()
|
|
3254
|
+
}),
|
|
3255
|
+
events: ["press"],
|
|
3256
|
+
description: "USWDS button group. buttons: [{label, value, variant?}]. segmented renders as a connected group.",
|
|
3257
|
+
example: {
|
|
3258
|
+
buttons: [
|
|
3259
|
+
{ label: "Back", value: "back", variant: "outline" },
|
|
3260
|
+
{ label: "Continue", value: "continue", variant: "default" }
|
|
3261
|
+
]
|
|
3262
|
+
}
|
|
3263
|
+
},
|
|
3264
|
+
Input: {
|
|
3265
|
+
props: import_zod.z.object({
|
|
3266
|
+
label: import_zod.z.string(),
|
|
3267
|
+
name: import_zod.z.string(),
|
|
3268
|
+
type: import_zod.z.enum(["text", "email", "password", "number", "search", "tel", "url"]).nullable(),
|
|
3269
|
+
placeholder: import_zod.z.string().nullable(),
|
|
3270
|
+
hint: import_zod.z.string().nullable(),
|
|
3271
|
+
value: import_zod.z.string().nullable(),
|
|
3272
|
+
required: import_zod.z.boolean().nullable(),
|
|
3273
|
+
disabled: import_zod.z.boolean().nullable(),
|
|
3274
|
+
checks: validationCheckSchema,
|
|
3275
|
+
validateOn: validateOnSchema
|
|
3276
|
+
}),
|
|
3277
|
+
events: ["submit", "focus", "blur"],
|
|
3278
|
+
description: "USWDS text input. Use { $bindState } on value for two-way binding. hint adds helper text below label. Use checks for validation.",
|
|
3279
|
+
example: {
|
|
3280
|
+
label: "Email address",
|
|
3281
|
+
name: "email",
|
|
3282
|
+
type: "email",
|
|
3283
|
+
hint: "e.g. name@example.gov"
|
|
3284
|
+
}
|
|
3285
|
+
},
|
|
3286
|
+
Textarea: {
|
|
3287
|
+
props: import_zod.z.object({
|
|
3288
|
+
label: import_zod.z.string(),
|
|
3289
|
+
name: import_zod.z.string(),
|
|
3290
|
+
placeholder: import_zod.z.string().nullable(),
|
|
3291
|
+
hint: import_zod.z.string().nullable(),
|
|
3292
|
+
rows: import_zod.z.number().nullable(),
|
|
3293
|
+
value: import_zod.z.string().nullable(),
|
|
3294
|
+
required: import_zod.z.boolean().nullable(),
|
|
3295
|
+
checks: validationCheckSchema,
|
|
3296
|
+
validateOn: validateOnSchema
|
|
3297
|
+
}),
|
|
3298
|
+
description: "USWDS multi-line textarea. Use { $bindState } on value for binding. hint adds helper text below label.",
|
|
3299
|
+
example: { label: "Message", name: "message", rows: 4 }
|
|
3300
|
+
},
|
|
3301
|
+
Select: {
|
|
3302
|
+
props: import_zod.z.object({
|
|
3303
|
+
label: import_zod.z.string(),
|
|
3304
|
+
name: import_zod.z.string(),
|
|
3305
|
+
options: import_zod.z.array(
|
|
3306
|
+
import_zod.z.union([
|
|
3307
|
+
import_zod.z.string(),
|
|
3308
|
+
import_zod.z.object({ label: import_zod.z.string(), value: import_zod.z.string() })
|
|
3309
|
+
])
|
|
3310
|
+
),
|
|
3311
|
+
placeholder: import_zod.z.string().nullable(),
|
|
3312
|
+
hint: import_zod.z.string().nullable(),
|
|
3313
|
+
value: import_zod.z.string().nullable(),
|
|
3314
|
+
required: import_zod.z.boolean().nullable(),
|
|
3315
|
+
checks: validationCheckSchema,
|
|
3316
|
+
validateOn: validateOnSchema
|
|
3317
|
+
}),
|
|
3318
|
+
events: ["change"],
|
|
3319
|
+
description: "USWDS select dropdown. options: array of strings or {label, value} objects. Use { $bindState } on value for binding.",
|
|
3320
|
+
example: {
|
|
3321
|
+
label: "State",
|
|
3322
|
+
name: "state",
|
|
3323
|
+
options: ["Alabama", "Alaska", "Arizona"]
|
|
3324
|
+
}
|
|
3325
|
+
},
|
|
3326
|
+
Checkbox: {
|
|
3327
|
+
props: import_zod.z.object({
|
|
3328
|
+
label: import_zod.z.string(),
|
|
3329
|
+
name: import_zod.z.string(),
|
|
3330
|
+
hint: import_zod.z.string().nullable(),
|
|
3331
|
+
checked: import_zod.z.boolean().nullable(),
|
|
3332
|
+
tile: import_zod.z.boolean().nullable(),
|
|
3333
|
+
checks: validationCheckSchema,
|
|
3334
|
+
validateOn: validateOnSchema
|
|
3335
|
+
}),
|
|
3336
|
+
events: ["change"],
|
|
3337
|
+
description: "USWDS checkbox. Use { $bindState } on checked for binding. tile renders as a large tile variant.",
|
|
3338
|
+
example: { label: "I agree to the terms", name: "terms" }
|
|
3339
|
+
},
|
|
3340
|
+
CheckboxGroup: {
|
|
3341
|
+
props: import_zod.z.object({
|
|
3342
|
+
legend: import_zod.z.string(),
|
|
3343
|
+
name: import_zod.z.string(),
|
|
3344
|
+
options: import_zod.z.array(
|
|
3345
|
+
import_zod.z.object({
|
|
3346
|
+
label: import_zod.z.string(),
|
|
3347
|
+
value: import_zod.z.string(),
|
|
3348
|
+
hint: import_zod.z.string().nullable()
|
|
3349
|
+
})
|
|
3350
|
+
),
|
|
3351
|
+
tile: import_zod.z.boolean().nullable(),
|
|
3352
|
+
values: import_zod.z.array(import_zod.z.string()).nullable()
|
|
3353
|
+
}),
|
|
3354
|
+
events: ["change"],
|
|
3355
|
+
description: "USWDS group of checkboxes in a fieldset. Use { $bindState } on values for selected values array.",
|
|
3356
|
+
example: {
|
|
3357
|
+
legend: "Select all that apply",
|
|
3358
|
+
name: "interests",
|
|
3359
|
+
options: [
|
|
3360
|
+
{ label: "Technology", value: "tech", hint: null },
|
|
3361
|
+
{ label: "Science", value: "science", hint: null }
|
|
3362
|
+
]
|
|
3363
|
+
}
|
|
3364
|
+
},
|
|
3365
|
+
Radio: {
|
|
3366
|
+
props: import_zod.z.object({
|
|
3367
|
+
legend: import_zod.z.string(),
|
|
3368
|
+
name: import_zod.z.string(),
|
|
3369
|
+
options: import_zod.z.array(
|
|
3370
|
+
import_zod.z.object({
|
|
3371
|
+
label: import_zod.z.string(),
|
|
3372
|
+
value: import_zod.z.string(),
|
|
3373
|
+
hint: import_zod.z.string().nullable()
|
|
3374
|
+
})
|
|
3375
|
+
),
|
|
3376
|
+
tile: import_zod.z.boolean().nullable(),
|
|
3377
|
+
value: import_zod.z.string().nullable(),
|
|
3378
|
+
checks: validationCheckSchema,
|
|
3379
|
+
validateOn: validateOnSchema
|
|
3380
|
+
}),
|
|
3381
|
+
events: ["change"],
|
|
3382
|
+
description: "USWDS radio button group. Use { $bindState } on value for binding. tile renders as tile variant.",
|
|
3383
|
+
example: {
|
|
3384
|
+
legend: "Select an option",
|
|
3385
|
+
name: "option",
|
|
3386
|
+
options: [
|
|
3387
|
+
{ label: "Yes", value: "yes", hint: null },
|
|
3388
|
+
{ label: "No", value: "no", hint: null }
|
|
3389
|
+
]
|
|
3390
|
+
}
|
|
3391
|
+
},
|
|
3392
|
+
FileInput: {
|
|
3393
|
+
props: import_zod.z.object({
|
|
3394
|
+
label: import_zod.z.string(),
|
|
3395
|
+
name: import_zod.z.string(),
|
|
3396
|
+
hint: import_zod.z.string().nullable(),
|
|
3397
|
+
accept: import_zod.z.string().nullable(),
|
|
3398
|
+
multiple: import_zod.z.boolean().nullable(),
|
|
3399
|
+
required: import_zod.z.boolean().nullable()
|
|
3400
|
+
}),
|
|
3401
|
+
events: ["change"],
|
|
3402
|
+
description: "USWDS file input. accept: MIME types (e.g. '.pdf,.doc'). multiple allows selecting multiple files.",
|
|
3403
|
+
example: {
|
|
3404
|
+
label: "Upload document",
|
|
3405
|
+
name: "document",
|
|
3406
|
+
hint: "Accepted formats: PDF, DOC",
|
|
3407
|
+
accept: ".pdf,.doc,.docx"
|
|
3408
|
+
}
|
|
3409
|
+
},
|
|
3410
|
+
Search: {
|
|
3411
|
+
props: import_zod.z.object({
|
|
3412
|
+
label: import_zod.z.string().nullable(),
|
|
3413
|
+
placeholder: import_zod.z.string().nullable(),
|
|
3414
|
+
value: import_zod.z.string().nullable(),
|
|
3415
|
+
size: import_zod.z.enum(["small", "medium", "big"]).nullable()
|
|
3416
|
+
}),
|
|
3417
|
+
events: ["submit", "change"],
|
|
3418
|
+
description: "USWDS search bar. Use { $bindState } on value for the input value. size: small, medium (default), big.",
|
|
3419
|
+
example: { placeholder: "Search...", size: "medium" }
|
|
3420
|
+
},
|
|
3421
|
+
RangeInput: {
|
|
3422
|
+
props: import_zod.z.object({
|
|
3423
|
+
label: import_zod.z.string().nullable(),
|
|
3424
|
+
name: import_zod.z.string(),
|
|
3425
|
+
min: import_zod.z.number().nullable(),
|
|
3426
|
+
max: import_zod.z.number().nullable(),
|
|
3427
|
+
step: import_zod.z.number().nullable(),
|
|
3428
|
+
value: import_zod.z.number().nullable()
|
|
3429
|
+
}),
|
|
3430
|
+
events: ["change"],
|
|
3431
|
+
description: "USWDS range slider input. Use { $bindState } on value for binding.",
|
|
3432
|
+
example: { label: "Select a value", name: "range", min: 0, max: 100 }
|
|
3433
|
+
},
|
|
3434
|
+
DateInputGroup: {
|
|
3435
|
+
props: import_zod.z.object({
|
|
3436
|
+
label: import_zod.z.string(),
|
|
3437
|
+
name: import_zod.z.string(),
|
|
3438
|
+
hint: import_zod.z.string().nullable(),
|
|
3439
|
+
required: import_zod.z.boolean().nullable(),
|
|
3440
|
+
monthValue: import_zod.z.string().nullable(),
|
|
3441
|
+
dayValue: import_zod.z.string().nullable(),
|
|
3442
|
+
yearValue: import_zod.z.string().nullable()
|
|
3443
|
+
}),
|
|
3444
|
+
events: ["change"],
|
|
3445
|
+
description: "USWDS three-field date input (separate month, day, year inputs). Use { $bindState } on monthValue/dayValue/yearValue for individual field bindings.",
|
|
3446
|
+
example: {
|
|
3447
|
+
label: "Date of birth",
|
|
3448
|
+
name: "dob",
|
|
3449
|
+
hint: "For example: January 19 2000"
|
|
3450
|
+
}
|
|
3451
|
+
},
|
|
3452
|
+
DateRangePicker: {
|
|
3453
|
+
props: import_zod.z.object({
|
|
3454
|
+
startLabel: import_zod.z.string(),
|
|
3455
|
+
endLabel: import_zod.z.string(),
|
|
3456
|
+
startName: import_zod.z.string(),
|
|
3457
|
+
endName: import_zod.z.string(),
|
|
3458
|
+
hint: import_zod.z.string().nullable(),
|
|
3459
|
+
startValue: import_zod.z.string().nullable(),
|
|
3460
|
+
endValue: import_zod.z.string().nullable(),
|
|
3461
|
+
minDate: import_zod.z.string().nullable(),
|
|
3462
|
+
maxDate: import_zod.z.string().nullable(),
|
|
3463
|
+
required: import_zod.z.boolean().nullable()
|
|
3464
|
+
}),
|
|
3465
|
+
events: ["change"],
|
|
3466
|
+
description: "USWDS date range picker with start and end date inputs. Values are ISO date strings (YYYY-MM-DD). Use { $bindState } on startValue/endValue.",
|
|
3467
|
+
example: {
|
|
3468
|
+
startLabel: "Start date",
|
|
3469
|
+
endLabel: "End date",
|
|
3470
|
+
startName: "start_date",
|
|
3471
|
+
endName: "end_date",
|
|
3472
|
+
hint: "mm/dd/yyyy"
|
|
3473
|
+
}
|
|
3474
|
+
},
|
|
3475
|
+
InputMask: {
|
|
3476
|
+
props: import_zod.z.object({
|
|
3477
|
+
label: import_zod.z.string(),
|
|
3478
|
+
name: import_zod.z.string(),
|
|
3479
|
+
preset: import_zod.z.enum(["phone", "zip", "zip+4", "ssn", "custom"]).nullable(),
|
|
3480
|
+
pattern: import_zod.z.string().nullable(),
|
|
3481
|
+
hint: import_zod.z.string().nullable(),
|
|
3482
|
+
value: import_zod.z.string().nullable(),
|
|
3483
|
+
required: import_zod.z.boolean().nullable(),
|
|
3484
|
+
checks: validationCheckSchema,
|
|
3485
|
+
validateOn: validateOnSchema
|
|
3486
|
+
}),
|
|
3487
|
+
events: ["change", "blur"],
|
|
3488
|
+
description: "USWDS input with automatic formatting mask. preset: phone '(___) ___-____', zip '_____', zip+4 '_____-____', ssn '___-__-____'. Or supply a custom pattern where '_' = digit.",
|
|
3489
|
+
example: {
|
|
3490
|
+
label: "Phone number",
|
|
3491
|
+
name: "phone",
|
|
3492
|
+
preset: "phone",
|
|
3493
|
+
hint: "(___) ___-____"
|
|
3494
|
+
}
|
|
3495
|
+
},
|
|
3496
|
+
Password: {
|
|
3497
|
+
props: import_zod.z.object({
|
|
3498
|
+
label: import_zod.z.string(),
|
|
3499
|
+
name: import_zod.z.string(),
|
|
3500
|
+
hint: import_zod.z.string().nullable(),
|
|
3501
|
+
value: import_zod.z.string().nullable(),
|
|
3502
|
+
required: import_zod.z.boolean().nullable(),
|
|
3503
|
+
checks: validationCheckSchema,
|
|
3504
|
+
validateOn: validateOnSchema
|
|
3505
|
+
}),
|
|
3506
|
+
events: ["change", "blur"],
|
|
3507
|
+
description: "USWDS password input with show/hide toggle button. Use { $bindState } on value for binding. Supports validation checks.",
|
|
3508
|
+
example: {
|
|
3509
|
+
label: "Password",
|
|
3510
|
+
name: "password",
|
|
3511
|
+
hint: "Must be at least 12 characters"
|
|
3512
|
+
}
|
|
3513
|
+
},
|
|
3514
|
+
ComboBox: {
|
|
3515
|
+
props: import_zod.z.object({
|
|
3516
|
+
label: import_zod.z.string(),
|
|
3517
|
+
name: import_zod.z.string(),
|
|
3518
|
+
options: import_zod.z.array(
|
|
3519
|
+
import_zod.z.union([
|
|
3520
|
+
import_zod.z.string(),
|
|
3521
|
+
import_zod.z.object({ label: import_zod.z.string(), value: import_zod.z.string() })
|
|
3522
|
+
])
|
|
3523
|
+
),
|
|
3524
|
+
placeholder: import_zod.z.string().nullable(),
|
|
3525
|
+
hint: import_zod.z.string().nullable(),
|
|
3526
|
+
value: import_zod.z.string().nullable(),
|
|
3527
|
+
required: import_zod.z.boolean().nullable(),
|
|
3528
|
+
checks: validationCheckSchema,
|
|
3529
|
+
validateOn: validateOnSchema
|
|
3530
|
+
}),
|
|
3531
|
+
events: ["change"],
|
|
3532
|
+
description: "USWDS combo box \u2014 a searchable/filterable select dropdown. options: strings or {label, value}. Use { $bindState } on value for binding.",
|
|
3533
|
+
example: {
|
|
3534
|
+
label: "Select a fruit",
|
|
3535
|
+
name: "fruit",
|
|
3536
|
+
options: ["Apple", "Banana", "Cherry", "Date", "Elderberry"],
|
|
3537
|
+
placeholder: "- Select -"
|
|
3538
|
+
}
|
|
3539
|
+
},
|
|
3540
|
+
DatePicker: {
|
|
3541
|
+
props: import_zod.z.object({
|
|
3542
|
+
label: import_zod.z.string(),
|
|
3543
|
+
name: import_zod.z.string(),
|
|
3544
|
+
hint: import_zod.z.string().nullable(),
|
|
3545
|
+
value: import_zod.z.string().nullable(),
|
|
3546
|
+
minDate: import_zod.z.string().nullable(),
|
|
3547
|
+
maxDate: import_zod.z.string().nullable(),
|
|
3548
|
+
required: import_zod.z.boolean().nullable(),
|
|
3549
|
+
checks: validationCheckSchema,
|
|
3550
|
+
validateOn: validateOnSchema
|
|
3551
|
+
}),
|
|
3552
|
+
events: ["change"],
|
|
3553
|
+
description: "USWDS date picker. value/minDate/maxDate are ISO date strings (YYYY-MM-DD). Use { $bindState } on value for binding.",
|
|
3554
|
+
example: {
|
|
3555
|
+
label: "Date of birth",
|
|
3556
|
+
name: "dob",
|
|
3557
|
+
hint: "mm/dd/yyyy"
|
|
3558
|
+
}
|
|
3559
|
+
},
|
|
3560
|
+
TimePicker: {
|
|
3561
|
+
props: import_zod.z.object({
|
|
3562
|
+
label: import_zod.z.string(),
|
|
3563
|
+
name: import_zod.z.string(),
|
|
3564
|
+
hint: import_zod.z.string().nullable(),
|
|
3565
|
+
value: import_zod.z.string().nullable(),
|
|
3566
|
+
minTime: import_zod.z.string().nullable(),
|
|
3567
|
+
maxTime: import_zod.z.string().nullable(),
|
|
3568
|
+
step: import_zod.z.number().nullable(),
|
|
3569
|
+
required: import_zod.z.boolean().nullable()
|
|
3570
|
+
}),
|
|
3571
|
+
events: ["change"],
|
|
3572
|
+
description: "USWDS time picker. value/minTime/maxTime use 'HH:MM' 24-hour format. step is in minutes (default 30). Use { $bindState } on value.",
|
|
3573
|
+
example: {
|
|
3574
|
+
label: "Appointment time",
|
|
3575
|
+
name: "appt_time",
|
|
3576
|
+
hint: "Select a time",
|
|
3577
|
+
step: 30
|
|
3578
|
+
}
|
|
3579
|
+
},
|
|
3580
|
+
CharacterCount: {
|
|
3581
|
+
props: import_zod.z.object({
|
|
3582
|
+
label: import_zod.z.string(),
|
|
3583
|
+
name: import_zod.z.string(),
|
|
3584
|
+
maxLength: import_zod.z.number(),
|
|
3585
|
+
hint: import_zod.z.string().nullable(),
|
|
3586
|
+
value: import_zod.z.string().nullable(),
|
|
3587
|
+
multiline: import_zod.z.boolean().nullable(),
|
|
3588
|
+
rows: import_zod.z.number().nullable(),
|
|
3589
|
+
required: import_zod.z.boolean().nullable(),
|
|
3590
|
+
checks: validationCheckSchema,
|
|
3591
|
+
validateOn: validateOnSchema
|
|
3592
|
+
}),
|
|
3593
|
+
events: ["change"],
|
|
3594
|
+
description: "USWDS input or textarea with a live character count indicator. maxLength: character limit. multiline: renders as textarea. Use { $bindState } on value.",
|
|
3595
|
+
example: {
|
|
3596
|
+
label: "Brief description",
|
|
3597
|
+
name: "description",
|
|
3598
|
+
maxLength: 150,
|
|
3599
|
+
hint: "Enter a short summary",
|
|
3600
|
+
multiline: true
|
|
3601
|
+
}
|
|
3602
|
+
},
|
|
3603
|
+
// ==========================================================================
|
|
3604
|
+
// Overlay / Modal Components
|
|
3605
|
+
// ==========================================================================
|
|
3606
|
+
Modal: {
|
|
3607
|
+
props: import_zod.z.object({
|
|
3608
|
+
heading: import_zod.z.string(),
|
|
3609
|
+
description: import_zod.z.string().nullable(),
|
|
3610
|
+
openPath: import_zod.z.string(),
|
|
3611
|
+
large: import_zod.z.boolean().nullable()
|
|
3612
|
+
}),
|
|
3613
|
+
slots: ["default"],
|
|
3614
|
+
description: "USWDS modal dialog. Set openPath to a boolean state path. Use setState to toggle open/close.",
|
|
3615
|
+
example: {
|
|
3616
|
+
heading: "Are you sure?",
|
|
3617
|
+
description: "This action cannot be undone.",
|
|
3618
|
+
openPath: "/modal/open"
|
|
3619
|
+
}
|
|
3620
|
+
},
|
|
3621
|
+
// ==========================================================================
|
|
3622
|
+
// Additional Display Components
|
|
3623
|
+
// ==========================================================================
|
|
3624
|
+
Icon: {
|
|
3625
|
+
props: import_zod.z.object({
|
|
3626
|
+
name: import_zod.z.string(),
|
|
3627
|
+
size: import_zod.z.enum(["sm", "md", "lg", "xl", "2xl", "3xl"]).nullable(),
|
|
3628
|
+
color: import_zod.z.string().nullable(),
|
|
3629
|
+
ariaLabel: import_zod.z.string().nullable()
|
|
3630
|
+
}),
|
|
3631
|
+
description: "USWDS standalone SVG icon from the USWDS icon set. name: USWDS icon name (e.g. 'check', 'close', 'search', 'arrow_forward'). size: sm\u20133xl. color: a USWDS text-color utility class (e.g. 'text-primary').",
|
|
3632
|
+
example: { name: "check_circle", size: "lg", color: "text-green" }
|
|
3633
|
+
},
|
|
3634
|
+
InputGroup: {
|
|
3635
|
+
props: import_zod.z.object({
|
|
3636
|
+
label: import_zod.z.string(),
|
|
3637
|
+
name: import_zod.z.string(),
|
|
3638
|
+
type: import_zod.z.enum(["text", "email", "password", "number", "search", "tel", "url"]).nullable(),
|
|
3639
|
+
prefix: import_zod.z.string().nullable(),
|
|
3640
|
+
suffix: import_zod.z.string().nullable(),
|
|
3641
|
+
placeholder: import_zod.z.string().nullable(),
|
|
3642
|
+
hint: import_zod.z.string().nullable(),
|
|
3643
|
+
value: import_zod.z.string().nullable(),
|
|
3644
|
+
required: import_zod.z.boolean().nullable(),
|
|
3645
|
+
disabled: import_zod.z.boolean().nullable(),
|
|
3646
|
+
checks: validationCheckSchema,
|
|
3647
|
+
validateOn: validateOnSchema
|
|
3648
|
+
}),
|
|
3649
|
+
events: ["change", "blur"],
|
|
3650
|
+
description: "USWDS input group \u2014 a text input with an optional prefix and/or suffix add-on (e.g. currency symbol, unit label). Use { $bindState } on value for two-way binding.",
|
|
3651
|
+
example: {
|
|
3652
|
+
label: "Amount",
|
|
3653
|
+
name: "amount",
|
|
3654
|
+
prefix: "$",
|
|
3655
|
+
suffix: ".00",
|
|
3656
|
+
type: "number",
|
|
3657
|
+
placeholder: "0"
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3660
|
+
List: {
|
|
3661
|
+
props: import_zod.z.object({
|
|
3662
|
+
items: import_zod.z.array(import_zod.z.string()),
|
|
3663
|
+
variant: import_zod.z.enum(["unordered", "ordered", "unstyled"]).nullable()
|
|
3664
|
+
}),
|
|
3665
|
+
description: "USWDS list. variant: unordered (default, bullet list), ordered (numbered list), unstyled (no bullets/numbers).",
|
|
3666
|
+
example: {
|
|
3667
|
+
variant: "unordered",
|
|
3668
|
+
items: ["First item", "Second item", "Third item"]
|
|
3669
|
+
}
|
|
3670
|
+
},
|
|
3671
|
+
ValidationChecklist: {
|
|
3672
|
+
props: import_zod.z.object({
|
|
3673
|
+
items: import_zod.z.array(
|
|
3674
|
+
import_zod.z.object({
|
|
3675
|
+
label: import_zod.z.string(),
|
|
3676
|
+
checked: import_zod.z.boolean().nullable()
|
|
3677
|
+
})
|
|
3678
|
+
),
|
|
3679
|
+
heading: import_zod.z.string().nullable()
|
|
3680
|
+
}),
|
|
3681
|
+
description: "USWDS validation checklist (usa-checklist). Displays a list of password/input requirements with checked/unchecked states.",
|
|
3682
|
+
example: {
|
|
3683
|
+
heading: "Password must contain:",
|
|
3684
|
+
items: [
|
|
3685
|
+
{ label: "At least 12 characters", checked: true },
|
|
3686
|
+
{ label: "At least one uppercase letter", checked: false },
|
|
3687
|
+
{ label: "At least one number", checked: false }
|
|
3688
|
+
]
|
|
3689
|
+
}
|
|
3690
|
+
},
|
|
3691
|
+
Prose: {
|
|
3692
|
+
props: import_zod.z.object({
|
|
3693
|
+
element: import_zod.z.enum(["div", "article", "section", "main"]).nullable()
|
|
3694
|
+
}),
|
|
3695
|
+
slots: ["default"],
|
|
3696
|
+
description: "USWDS prose typography wrapper (usa-prose). Applies USWDS text styles \u2014 headings, paragraphs, lists, links, blockquotes, code blocks \u2014 to nested content. element: div (default), article, section, or main.",
|
|
3697
|
+
example: { element: "article" }
|
|
3698
|
+
},
|
|
3699
|
+
Hero: {
|
|
3700
|
+
props: import_zod.z.object({
|
|
3701
|
+
heading: import_zod.z.string(),
|
|
3702
|
+
eyebrow: import_zod.z.string().nullable(),
|
|
3703
|
+
body: import_zod.z.string().nullable(),
|
|
3704
|
+
backgroundUrl: import_zod.z.string().nullable(),
|
|
3705
|
+
ariaLabel: import_zod.z.string().nullable()
|
|
3706
|
+
}),
|
|
3707
|
+
description: "USWDS hero section \u2014 full-width landing page callout with optional background image. heading: headline text. eyebrow: smaller label above the headline. body: supporting paragraph. backgroundUrl: CSS background image URL (user-supplied).",
|
|
3708
|
+
example: {
|
|
3709
|
+
heading: "A tagline that explains your agency\u2019s focus",
|
|
3710
|
+
eyebrow: null,
|
|
3711
|
+
body: "Support the text about your agency with a brief, relevant sentence or two.",
|
|
3712
|
+
backgroundUrl: null,
|
|
3713
|
+
ariaLabel: "Introduction"
|
|
3714
|
+
}
|
|
3715
|
+
},
|
|
3716
|
+
GraphicList: {
|
|
3717
|
+
props: import_zod.z.object({
|
|
3718
|
+
heading: import_zod.z.string().nullable(),
|
|
3719
|
+
items: import_zod.z.array(
|
|
3720
|
+
import_zod.z.object({
|
|
3721
|
+
imageUrl: import_zod.z.string().nullable(),
|
|
3722
|
+
imageAlt: import_zod.z.string().nullable(),
|
|
3723
|
+
heading: import_zod.z.string(),
|
|
3724
|
+
content: import_zod.z.string()
|
|
3725
|
+
})
|
|
3726
|
+
)
|
|
3727
|
+
}),
|
|
3728
|
+
description: "USWDS graphic list \u2014 a responsive grid of image+text media blocks for showcasing values, programs, or features. items: [{imageUrl?, imageAlt?, heading, content}].",
|
|
3729
|
+
example: {
|
|
3730
|
+
heading: null,
|
|
3731
|
+
items: [
|
|
3732
|
+
{
|
|
3733
|
+
imageUrl: null,
|
|
3734
|
+
imageAlt: null,
|
|
3735
|
+
heading: "Graphic heading",
|
|
3736
|
+
content: "A short description of what this item represents."
|
|
3737
|
+
},
|
|
3738
|
+
{
|
|
3739
|
+
imageUrl: null,
|
|
3740
|
+
imageAlt: null,
|
|
3741
|
+
heading: "Graphic heading",
|
|
3742
|
+
content: "A short description of what this item represents."
|
|
3743
|
+
}
|
|
3744
|
+
]
|
|
3745
|
+
}
|
|
3746
|
+
},
|
|
3747
|
+
EmbedContainer: {
|
|
3748
|
+
props: import_zod.z.object({
|
|
3749
|
+
src: import_zod.z.string(),
|
|
3750
|
+
title: import_zod.z.string(),
|
|
3751
|
+
ratio: import_zod.z.enum(["16x9", "4x3"]).nullable()
|
|
3752
|
+
}),
|
|
3753
|
+
description: "USWDS embed container \u2014 a responsive aspect-ratio wrapper for iframe embeds such as YouTube videos. ratio: 16x9 (default) or 4x3. Provide a descriptive title for accessibility.",
|
|
3754
|
+
example: {
|
|
3755
|
+
src: "https://www.youtube.com/embed/example",
|
|
3756
|
+
title: "An example video",
|
|
3757
|
+
ratio: "16x9"
|
|
3758
|
+
}
|
|
3759
|
+
},
|
|
3760
|
+
Form: {
|
|
3761
|
+
props: import_zod.z.object({
|
|
3762
|
+
large: import_zod.z.boolean().nullable()
|
|
3763
|
+
}),
|
|
3764
|
+
slots: ["default"],
|
|
3765
|
+
events: ["submit"],
|
|
3766
|
+
description: "USWDS form container (usa-form). Applies USWDS form layout \u2014 constrained max-width and consistent label/input spacing \u2014 to nested form elements. large: wider form variant. Wrap Input, Select, Checkbox, Radio, and other form components as children.",
|
|
3767
|
+
example: { large: false }
|
|
3768
|
+
},
|
|
3769
|
+
Section: {
|
|
3770
|
+
props: import_zod.z.object({
|
|
3771
|
+
title: import_zod.z.string().nullable(),
|
|
3772
|
+
text: import_zod.z.string().nullable(),
|
|
3773
|
+
variant: import_zod.z.enum(["default", "light", "dark"]).nullable()
|
|
3774
|
+
}),
|
|
3775
|
+
slots: ["default"],
|
|
3776
|
+
description: "USWDS page section (usa-section). Applies consistent vertical padding to a full-width page section inside a grid-container. variant: default, light (lighter background), dark (darker background). title and text are optional \u2014 use children slots for richer content.",
|
|
3777
|
+
example: {
|
|
3778
|
+
title: "Section title",
|
|
3779
|
+
text: "Supporting section description text.",
|
|
3780
|
+
variant: null
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
};
|
|
3784
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
3785
|
+
0 && (module.exports = {
|
|
3786
|
+
uswdsComponentDefinitions,
|
|
3787
|
+
uswdsComponents
|
|
3788
|
+
});
|
|
3789
|
+
//# sourceMappingURL=index.js.map
|