@cdt5058/json-render-uswds 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2627 @@
1
+ import {
2
+ uswdsComponentDefinitions
3
+ } from "./chunk-QYJNF5RV.mjs";
4
+
5
+ // src/components.tsx
6
+ import { useState, useId } from "react";
7
+ import {
8
+ useBoundProp,
9
+ useStateBinding,
10
+ useFieldValidation
11
+ } from "@json-render/react";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ function safeHref(url) {
14
+ if (!url) return void 0;
15
+ if (/^\s*(javascript|vbscript|data):/i.test(url)) return "#";
16
+ return url;
17
+ }
18
+ function safeCssUrl(url) {
19
+ if (!url) return void 0;
20
+ return url.replace(/['"()\\\n\r]/g, "");
21
+ }
22
+ function getPaginationRange(current, total) {
23
+ if (total <= 7) {
24
+ return Array.from({ length: total }, (_, i) => i + 1);
25
+ }
26
+ const pages = [];
27
+ pages.push(1);
28
+ if (current > 3) pages.push("ellipsis");
29
+ const start = Math.max(2, current - 1);
30
+ const end = Math.min(total - 1, current + 1);
31
+ for (let i = start; i <= end; i++) pages.push(i);
32
+ if (current < total - 2) pages.push("ellipsis");
33
+ pages.push(total);
34
+ return pages;
35
+ }
36
+ function getButtonClass(variant) {
37
+ const base = "usa-button";
38
+ switch (variant) {
39
+ case "secondary":
40
+ return `${base} usa-button--secondary`;
41
+ case "accent-cool":
42
+ return `${base} usa-button--accent-cool`;
43
+ case "accent-warm":
44
+ return `${base} usa-button--accent-warm`;
45
+ case "base":
46
+ return `${base} usa-button--base`;
47
+ case "outline":
48
+ return `${base} usa-button--outline`;
49
+ case "outline-inverse":
50
+ return `${base} usa-button--outline usa-button--inverse`;
51
+ case "big":
52
+ return `${base} usa-button--big`;
53
+ case "unstyled":
54
+ return `${base} usa-button--unstyled`;
55
+ default:
56
+ return base;
57
+ }
58
+ }
59
+ var uswdsComponents = {
60
+ // ── Layout ────────────────────────────────────────────────────────────
61
+ Grid: ({ props, children }) => {
62
+ const cols = Math.max(1, Math.min(12, props.columns ?? 1));
63
+ const gapMap = {
64
+ sm: "grid-gap-sm",
65
+ md: "grid-gap",
66
+ lg: "grid-gap-lg"
67
+ };
68
+ const gapClass = gapMap[props.gap ?? "md"] ?? "grid-gap";
69
+ return /* @__PURE__ */ jsx("div", { className: `grid-row ${gapClass}`, children: Array.isArray(children) ? children.map((child, i) => /* @__PURE__ */ jsx(
70
+ "div",
71
+ {
72
+ className: `tablet:grid-col-${Math.floor(12 / cols)}`,
73
+ children: child
74
+ },
75
+ i
76
+ )) : /* @__PURE__ */ jsx("div", { className: `tablet:grid-col-${Math.floor(12 / cols)}`, children }) });
77
+ },
78
+ Card: ({ props, children }) => {
79
+ return /* @__PURE__ */ jsx("div", { className: `usa-card${props.flag ? " usa-card--flag" : ""}`, children: /* @__PURE__ */ jsxs("div", { className: "usa-card__container", children: [
80
+ props.mediaUrl && /* @__PURE__ */ jsx("div", { className: "usa-card__media", children: /* @__PURE__ */ jsx("div", { className: "usa-card__img", children: /* @__PURE__ */ jsx("img", { src: props.mediaUrl, alt: props.mediaAlt ?? "" }) }) }),
81
+ (props.title || props.description) && /* @__PURE__ */ jsx("div", { className: "usa-card__header", children: props.title && /* @__PURE__ */ jsx("h2", { className: "usa-card__heading", children: props.title }) }),
82
+ /* @__PURE__ */ jsxs("div", { className: "usa-card__body", children: [
83
+ props.description && /* @__PURE__ */ jsx("p", { children: props.description }),
84
+ children
85
+ ] })
86
+ ] }) });
87
+ },
88
+ Divider: (_) => {
89
+ return /* @__PURE__ */ jsx("hr", { className: "usa-divider" });
90
+ },
91
+ CardGroup: ({ props }) => {
92
+ const cards = props.cards ?? [];
93
+ return /* @__PURE__ */ jsx("ul", { className: "usa-card-group", children: cards.map((card, i) => /* @__PURE__ */ jsx(
94
+ "li",
95
+ {
96
+ className: `usa-card tablet:grid-col-4${props.flag ? " usa-card--flag" : ""}`,
97
+ children: /* @__PURE__ */ jsxs("div", { className: "usa-card__container", children: [
98
+ card.mediaUrl && /* @__PURE__ */ jsx("div", { className: "usa-card__media", children: /* @__PURE__ */ jsx("div", { className: "usa-card__img", children: /* @__PURE__ */ jsx("img", { src: card.mediaUrl, alt: card.mediaAlt ?? "" }) }) }),
99
+ card.title && /* @__PURE__ */ jsx("div", { className: "usa-card__header", children: /* @__PURE__ */ jsx("h2", { className: "usa-card__heading", children: card.title }) }),
100
+ card.description && /* @__PURE__ */ jsx("div", { className: "usa-card__body", children: /* @__PURE__ */ jsx("p", { children: card.description }) }),
101
+ card.footer && /* @__PURE__ */ jsx("div", { className: "usa-card__footer", children: /* @__PURE__ */ jsx("p", { children: card.footer }) })
102
+ ] })
103
+ },
104
+ i
105
+ )) });
106
+ },
107
+ Footer: ({ props }) => {
108
+ const variant = props.variant ?? "medium";
109
+ const groups = props.navGroups ?? [];
110
+ const contact = props.contactInfo ?? [];
111
+ const socialIcons = {
112
+ facebook: "M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",
113
+ 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",
114
+ 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",
115
+ 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",
116
+ 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",
117
+ 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",
118
+ 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"
119
+ };
120
+ const returnToTopEl = props.returnToTop ? /* @__PURE__ */ jsx("div", { className: "grid-container usa-footer__return-to-top", children: /* @__PURE__ */ jsx("a", { href: "#top", children: "Return to top" }) }) : null;
121
+ const logoEl = /* @__PURE__ */ jsxs("div", { className: "usa-footer__logo grid-row grid-gap-2", children: [
122
+ props.logoUrl && /* @__PURE__ */ jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsx(
123
+ "img",
124
+ {
125
+ className: "usa-footer__logo-img",
126
+ src: props.logoUrl,
127
+ alt: props.logoAlt ?? ""
128
+ }
129
+ ) }),
130
+ /* @__PURE__ */ jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsx("p", { className: "usa-footer__logo-heading", children: /* @__PURE__ */ jsx(
131
+ "a",
132
+ {
133
+ className: "usa-footer__logo-anchor",
134
+ href: safeHref(props.agencyUrl) ?? "/",
135
+ children: props.agencyName
136
+ }
137
+ ) }) })
138
+ ] });
139
+ const contactEl = contact.length > 0 ? /* @__PURE__ */ jsxs("address", { className: "usa-footer__address", children: [
140
+ props.contactHeading && /* @__PURE__ */ jsx("p", { className: "usa-footer__contact-heading", children: props.contactHeading }),
141
+ /* @__PURE__ */ jsx("div", { className: "usa-footer__contact-info grid-row grid-gap", children: contact.map((item, i) => /* @__PURE__ */ jsx("div", { className: "grid-col-auto", children: item.type === "email" ? /* @__PURE__ */ jsx("a", { href: `mailto:${item.value}`, children: item.value }) : item.type === "phone" ? /* @__PURE__ */ jsx("a", { href: `tel:${item.value.replace(/\D/g, "")}`, children: item.value }) : /* @__PURE__ */ jsx("p", { children: item.value }) }, i)) })
142
+ ] }) : null;
143
+ const socialEl = (props.socialLinks ?? []).length > 0 ? /* @__PURE__ */ jsx("div", { className: "usa-footer__social-links grid-row grid-gap-1", children: (props.socialLinks ?? []).map((s) => /* @__PURE__ */ jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsx(
144
+ "a",
145
+ {
146
+ className: "usa-social-link",
147
+ href: safeHref(s.href),
148
+ "aria-label": s.label,
149
+ rel: "noreferrer",
150
+ target: "_blank",
151
+ children: /* @__PURE__ */ jsx(
152
+ "svg",
153
+ {
154
+ className: "usa-icon",
155
+ "aria-hidden": "true",
156
+ viewBox: "0 0 24 24",
157
+ width: "24",
158
+ height: "24",
159
+ children: /* @__PURE__ */ jsx("path", { d: socialIcons[s.platform] ?? "" })
160
+ }
161
+ )
162
+ }
163
+ ) }, s.platform)) }) : null;
164
+ if (variant === "slim") {
165
+ const links2 = groups[0]?.links ?? [];
166
+ return /* @__PURE__ */ jsxs("footer", { className: "usa-footer usa-footer--slim", children: [
167
+ returnToTopEl,
168
+ /* @__PURE__ */ jsx("div", { className: "usa-footer__primary-section", children: /* @__PURE__ */ jsx("div", { className: "grid-container", children: /* @__PURE__ */ jsxs("div", { className: "grid-row grid-gap", children: [
169
+ /* @__PURE__ */ jsx("div", { className: "tablet:grid-col-fill usa-footer__primary-content", children: logoEl }),
170
+ links2.length > 0 && /* @__PURE__ */ jsx("div", { className: "tablet:grid-col-auto usa-footer__primary-content usa-footer__primary-content--collapsible", children: /* @__PURE__ */ jsx("nav", { "aria-label": "Footer navigation", children: /* @__PURE__ */ jsx("ul", { className: "grid-row grid-gap", children: links2.map((link, i) => /* @__PURE__ */ jsx(
171
+ "li",
172
+ {
173
+ className: "mobile-lg:grid-col-auto usa-footer__primary-content",
174
+ children: /* @__PURE__ */ jsx(
175
+ "a",
176
+ {
177
+ href: safeHref(link.href),
178
+ className: "usa-footer__primary-link",
179
+ children: link.label
180
+ }
181
+ )
182
+ },
183
+ i
184
+ )) }) }) })
185
+ ] }) }) }),
186
+ (contact.length > 0 || socialEl) && /* @__PURE__ */ jsx("div", { className: "usa-footer__secondary-section", children: /* @__PURE__ */ jsx("div", { className: "grid-container", children: /* @__PURE__ */ jsx("div", { className: "grid-row grid-gap", children: /* @__PURE__ */ jsxs("div", { className: "usa-footer__contact-links mobile-lg:grid-col-12", children: [
187
+ socialEl,
188
+ contactEl
189
+ ] }) }) }) })
190
+ ] });
191
+ }
192
+ if (variant === "big") {
193
+ return /* @__PURE__ */ jsxs("footer", { className: "usa-footer usa-footer--big", children: [
194
+ returnToTopEl,
195
+ /* @__PURE__ */ jsx("div", { className: "usa-footer__primary-section", children: /* @__PURE__ */ jsx("div", { className: "grid-container", children: /* @__PURE__ */ jsx("div", { className: "grid-row grid-gap-4", children: groups.map((group, i) => /* @__PURE__ */ jsxs("div", { className: "tablet:grid-col-4", children: [
196
+ group.heading && /* @__PURE__ */ jsx("p", { className: "usa-footer__primary-link", children: group.heading }),
197
+ /* @__PURE__ */ jsx("ul", { className: "usa-list usa-list--unstyled", children: group.links.map((link, j) => /* @__PURE__ */ jsx("li", { className: "usa-footer__secondary-link", children: /* @__PURE__ */ jsx("a", { href: safeHref(link.href), children: link.label }) }, j)) })
198
+ ] }, i)) }) }) }),
199
+ /* @__PURE__ */ jsx("div", { className: "usa-footer__secondary-section", children: /* @__PURE__ */ jsx("div", { className: "grid-container", children: /* @__PURE__ */ jsxs("div", { className: "grid-row grid-gap", children: [
200
+ /* @__PURE__ */ jsx("div", { className: "tablet:grid-col-4", children: logoEl }),
201
+ (contact.length > 0 || socialEl) && /* @__PURE__ */ jsxs("div", { className: "tablet:grid-col-8 usa-footer__contact-links", children: [
202
+ socialEl,
203
+ contactEl
204
+ ] })
205
+ ] }) }) })
206
+ ] });
207
+ }
208
+ const links = groups[0]?.links ?? [];
209
+ return /* @__PURE__ */ jsxs("footer", { className: "usa-footer", children: [
210
+ returnToTopEl,
211
+ /* @__PURE__ */ jsx("div", { className: "usa-footer__primary-section", children: /* @__PURE__ */ jsx("nav", { className: "usa-footer__nav", "aria-label": "Footer navigation", children: /* @__PURE__ */ jsx("ul", { className: "grid-row grid-gap", children: links.map((link, i) => /* @__PURE__ */ jsx(
212
+ "li",
213
+ {
214
+ className: "mobile-lg:grid-col-4 desktop:grid-col-auto usa-footer__primary-content",
215
+ children: /* @__PURE__ */ jsx("a", { href: safeHref(link.href), className: "usa-footer__primary-link", children: link.label })
216
+ },
217
+ i
218
+ )) }) }) }),
219
+ /* @__PURE__ */ jsx("div", { className: "usa-footer__secondary-section", children: /* @__PURE__ */ jsx("div", { className: "grid-container", children: /* @__PURE__ */ jsxs("div", { className: "grid-row grid-gap", children: [
220
+ /* @__PURE__ */ jsx("div", { className: "tablet:grid-col-4", children: logoEl }),
221
+ (contact.length > 0 || socialEl) && /* @__PURE__ */ jsxs("div", { className: "tablet:grid-col-8 usa-footer__contact-links", children: [
222
+ socialEl,
223
+ contactEl
224
+ ] })
225
+ ] }) }) })
226
+ ] });
227
+ },
228
+ // ── Navigation ────────────────────────────────────────────────────────
229
+ Accordion: ({ props }) => {
230
+ const items = props.items ?? [];
231
+ const [openItems, setOpenItems] = useState(() => {
232
+ const initial = /* @__PURE__ */ new Set();
233
+ items.forEach((item, i) => {
234
+ if (item.expanded) initial.add(i);
235
+ });
236
+ return initial;
237
+ });
238
+ const toggle = (index) => {
239
+ setOpenItems((prev) => {
240
+ const next = new Set(prev);
241
+ if (props.multiselectable) {
242
+ if (next.has(index)) {
243
+ next.delete(index);
244
+ } else {
245
+ next.add(index);
246
+ }
247
+ } else {
248
+ if (next.has(index)) {
249
+ next.clear();
250
+ } else {
251
+ next.clear();
252
+ next.add(index);
253
+ }
254
+ }
255
+ return next;
256
+ });
257
+ };
258
+ return /* @__PURE__ */ jsx(
259
+ "div",
260
+ {
261
+ className: `usa-accordion${props.bordered ? " usa-accordion--bordered" : ""}`,
262
+ children: items.map((item, i) => {
263
+ const isOpen = openItems.has(i);
264
+ const headingId = `accordion-heading-${i}`;
265
+ const contentId = `accordion-content-${i}`;
266
+ return /* @__PURE__ */ jsxs("div", { children: [
267
+ /* @__PURE__ */ jsx("h4", { className: "usa-accordion__heading", children: /* @__PURE__ */ jsx(
268
+ "button",
269
+ {
270
+ type: "button",
271
+ className: "usa-accordion__button",
272
+ "aria-expanded": isOpen,
273
+ "aria-controls": contentId,
274
+ id: headingId,
275
+ onClick: () => toggle(i),
276
+ children: item.title
277
+ }
278
+ ) }),
279
+ /* @__PURE__ */ jsx(
280
+ "div",
281
+ {
282
+ id: contentId,
283
+ className: "usa-accordion__content usa-prose",
284
+ hidden: !isOpen,
285
+ role: "region",
286
+ "aria-labelledby": headingId,
287
+ children: /* @__PURE__ */ jsx("p", { children: item.content })
288
+ }
289
+ )
290
+ ] }, i);
291
+ })
292
+ }
293
+ );
294
+ },
295
+ Pagination: ({
296
+ props,
297
+ bindings,
298
+ emit
299
+ }) => {
300
+ const [boundPage, setBoundPage] = useBoundProp(
301
+ props.page,
302
+ bindings?.page
303
+ );
304
+ const [localPage, setLocalPage] = useState(props.page ?? 1);
305
+ const isBound = !!bindings?.page;
306
+ const page = isBound ? boundPage ?? 1 : localPage;
307
+ const setPage = isBound ? setBoundPage : setLocalPage;
308
+ const total = props.totalPages;
309
+ const range = getPaginationRange(page, total);
310
+ const navigate = (p) => {
311
+ if (p < 1 || p > total) return;
312
+ setPage(p);
313
+ emit("change");
314
+ };
315
+ return /* @__PURE__ */ jsx(
316
+ "nav",
317
+ {
318
+ "aria-label": props.ariaLabel ?? "Pagination",
319
+ className: "usa-pagination",
320
+ children: /* @__PURE__ */ jsxs("ul", { className: "usa-pagination__list", children: [
321
+ /* @__PURE__ */ jsx("li", { className: "usa-pagination__item usa-pagination__arrow", children: /* @__PURE__ */ jsxs(
322
+ "a",
323
+ {
324
+ href: "#",
325
+ className: "usa-pagination__link usa-pagination__previous-page",
326
+ "aria-label": "Previous page",
327
+ "aria-disabled": page <= 1,
328
+ onClick: (e) => {
329
+ e.preventDefault();
330
+ navigate(page - 1);
331
+ },
332
+ children: [
333
+ /* @__PURE__ */ jsx(
334
+ "svg",
335
+ {
336
+ className: "usa-icon",
337
+ "aria-hidden": "true",
338
+ role: "img",
339
+ viewBox: "0 0 24 24",
340
+ width: "24",
341
+ height: "24",
342
+ children: /* @__PURE__ */ jsx("path", { d: "M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6z" })
343
+ }
344
+ ),
345
+ /* @__PURE__ */ jsx("span", { className: "usa-pagination__link-text", children: "Previous" })
346
+ ]
347
+ }
348
+ ) }),
349
+ range.map(
350
+ (item, i) => item === "ellipsis" ? /* @__PURE__ */ jsx(
351
+ "li",
352
+ {
353
+ className: "usa-pagination__item usa-pagination__overflow",
354
+ role: "presentation",
355
+ children: /* @__PURE__ */ jsx("span", { children: "\u2026" })
356
+ },
357
+ `ellipsis-${i}`
358
+ ) : /* @__PURE__ */ jsx(
359
+ "li",
360
+ {
361
+ className: "usa-pagination__item usa-pagination__page-no",
362
+ children: /* @__PURE__ */ jsx(
363
+ "a",
364
+ {
365
+ href: "#",
366
+ className: `usa-pagination__button${page === item ? " usa-current" : ""}`,
367
+ "aria-label": `Page ${item}`,
368
+ "aria-current": page === item ? "page" : void 0,
369
+ onClick: (e) => {
370
+ e.preventDefault();
371
+ navigate(item);
372
+ },
373
+ children: item
374
+ }
375
+ )
376
+ },
377
+ item
378
+ )
379
+ ),
380
+ /* @__PURE__ */ jsx("li", { className: "usa-pagination__item usa-pagination__arrow", children: /* @__PURE__ */ jsxs(
381
+ "a",
382
+ {
383
+ href: "#",
384
+ className: "usa-pagination__link usa-pagination__next-page",
385
+ "aria-label": "Next page",
386
+ "aria-disabled": page >= total,
387
+ onClick: (e) => {
388
+ e.preventDefault();
389
+ navigate(page + 1);
390
+ },
391
+ children: [
392
+ /* @__PURE__ */ jsx("span", { className: "usa-pagination__link-text", children: "Next" }),
393
+ /* @__PURE__ */ jsx(
394
+ "svg",
395
+ {
396
+ className: "usa-icon",
397
+ "aria-hidden": "true",
398
+ role: "img",
399
+ viewBox: "0 0 24 24",
400
+ width: "24",
401
+ height: "24",
402
+ children: /* @__PURE__ */ jsx("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z" })
403
+ }
404
+ )
405
+ ]
406
+ }
407
+ ) })
408
+ ] })
409
+ }
410
+ );
411
+ },
412
+ StepIndicator: ({
413
+ props
414
+ }) => {
415
+ const steps = props.steps ?? [];
416
+ const current = Math.max(1, Math.min(steps.length, Number(props.currentStep) || 1));
417
+ const countersClass = props.counters === "small" ? " usa-step-indicator--counters-sm" : props.counters === "default" ? " usa-step-indicator--counters" : "";
418
+ const centeredClass = props.centered ? " usa-step-indicator--center" : "";
419
+ const noLabelsClass = props.noLabels ? " usa-step-indicator--no-labels" : "";
420
+ return /* @__PURE__ */ jsxs(
421
+ "div",
422
+ {
423
+ className: `usa-step-indicator${countersClass}${centeredClass}${noLabelsClass}`,
424
+ "aria-label": "Progress",
425
+ children: [
426
+ /* @__PURE__ */ jsx("ol", { className: "usa-step-indicator__segments", children: steps.map((label, i) => {
427
+ const stepNum = i + 1;
428
+ const isComplete = stepNum < current;
429
+ const isCurrent = stepNum === current;
430
+ 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";
431
+ return /* @__PURE__ */ jsx(
432
+ "li",
433
+ {
434
+ className: segClass,
435
+ "aria-current": isCurrent ? "step" : void 0,
436
+ children: /* @__PURE__ */ jsxs("span", { className: "usa-step-indicator__segment-label", children: [
437
+ label,
438
+ isComplete && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: "completed" }),
439
+ isCurrent && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: "in progress" })
440
+ ] })
441
+ },
442
+ i
443
+ );
444
+ }) }),
445
+ /* @__PURE__ */ jsx("div", { className: "usa-step-indicator__header", children: /* @__PURE__ */ jsxs("h4", { className: "usa-step-indicator__heading", children: [
446
+ /* @__PURE__ */ jsxs("span", { className: "usa-step-indicator__heading-counter", children: [
447
+ /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: "Step " }),
448
+ /* @__PURE__ */ jsx("span", { className: "usa-step-indicator__current-step", children: current }),
449
+ /* @__PURE__ */ jsxs("span", { className: "usa-step-indicator__total-steps", children: [
450
+ " ",
451
+ "of ",
452
+ steps.length
453
+ ] })
454
+ ] }),
455
+ steps[current - 1] && /* @__PURE__ */ jsx("span", { className: "usa-step-indicator__heading-text", children: steps[current - 1] })
456
+ ] }) })
457
+ ]
458
+ }
459
+ );
460
+ },
461
+ Breadcrumb: ({ props }) => {
462
+ const items = props.items ?? [];
463
+ return /* @__PURE__ */ jsx("nav", { className: "usa-breadcrumb", "aria-label": "Breadcrumbs", children: /* @__PURE__ */ jsx("ol", { className: "usa-breadcrumb__list", children: items.map((item, i) => {
464
+ const isLast = i === items.length - 1;
465
+ return /* @__PURE__ */ jsx(
466
+ "li",
467
+ {
468
+ className: `usa-breadcrumb__list-item${isLast ? " usa-current" : ""}`,
469
+ "aria-current": isLast ? "page" : void 0,
470
+ children: item.href && !isLast ? /* @__PURE__ */ jsx("a", { href: safeHref(item.href), className: "usa-breadcrumb__link", children: /* @__PURE__ */ jsx("span", { children: item.label }) }) : /* @__PURE__ */ jsx("span", { children: item.label })
471
+ },
472
+ i
473
+ );
474
+ }) }) });
475
+ },
476
+ Header: ({ props }) => {
477
+ const [mobileOpen, setMobileOpen] = useState(false);
478
+ const [openDropdown, setOpenDropdown] = useState(null);
479
+ const uid = useId();
480
+ const isExtended = props.variant === "extended";
481
+ const navItems = props.navItems ?? [];
482
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
483
+ /* @__PURE__ */ jsx("div", { className: `usa-overlay${mobileOpen ? " is-visible" : ""}` }),
484
+ /* @__PURE__ */ jsx(
485
+ "header",
486
+ {
487
+ className: `usa-header${isExtended ? " usa-header--extended" : " usa-header--basic"}`,
488
+ children: /* @__PURE__ */ jsxs("div", { className: "usa-nav-container", children: [
489
+ /* @__PURE__ */ jsxs("div", { className: "usa-navbar", children: [
490
+ /* @__PURE__ */ jsx("div", { className: "usa-logo", children: /* @__PURE__ */ jsx("em", { className: "usa-logo__text", children: /* @__PURE__ */ jsxs("a", { href: safeHref(props.siteUrl) ?? "/", title: "Home", children: [
491
+ props.logoUrl && /* @__PURE__ */ jsx(
492
+ "img",
493
+ {
494
+ className: "usa-header__logo",
495
+ src: props.logoUrl,
496
+ alt: props.logoAlt ?? "",
497
+ style: {
498
+ maxHeight: "2.5rem",
499
+ marginRight: "0.5rem",
500
+ verticalAlign: "middle"
501
+ }
502
+ }
503
+ ),
504
+ props.siteName
505
+ ] }) }) }),
506
+ /* @__PURE__ */ jsx(
507
+ "button",
508
+ {
509
+ type: "button",
510
+ className: "usa-menu-btn",
511
+ onClick: () => setMobileOpen(true),
512
+ children: "Menu"
513
+ }
514
+ )
515
+ ] }),
516
+ /* @__PURE__ */ jsxs(
517
+ "nav",
518
+ {
519
+ "aria-label": "Primary navigation",
520
+ className: `usa-nav${mobileOpen ? " is-visible" : ""}`,
521
+ children: [
522
+ /* @__PURE__ */ jsxs(
523
+ "button",
524
+ {
525
+ type: "button",
526
+ className: "usa-nav__close",
527
+ onClick: () => {
528
+ setMobileOpen(false);
529
+ setOpenDropdown(null);
530
+ },
531
+ children: [
532
+ /* @__PURE__ */ jsx(
533
+ "svg",
534
+ {
535
+ className: "usa-icon",
536
+ "aria-hidden": "true",
537
+ focusable: false,
538
+ role: "img",
539
+ viewBox: "0 0 24 24",
540
+ width: "24",
541
+ height: "24",
542
+ children: /* @__PURE__ */ 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" })
543
+ }
544
+ ),
545
+ "Close"
546
+ ]
547
+ }
548
+ ),
549
+ props.showSearch && /* @__PURE__ */ jsxs("div", { role: "search", className: "usa-search usa-search--small", children: [
550
+ /* @__PURE__ */ jsx(
551
+ "label",
552
+ {
553
+ className: "usa-sr-only",
554
+ htmlFor: `${uid}-header-search`,
555
+ children: "Search"
556
+ }
557
+ ),
558
+ /* @__PURE__ */ jsx(
559
+ "input",
560
+ {
561
+ className: "usa-input",
562
+ id: `${uid}-header-search`,
563
+ type: "search",
564
+ name: "search"
565
+ }
566
+ ),
567
+ /* @__PURE__ */ jsxs("button", { className: "usa-button", type: "submit", children: [
568
+ /* @__PURE__ */ jsx(
569
+ "svg",
570
+ {
571
+ className: "usa-icon",
572
+ "aria-hidden": "true",
573
+ role: "img",
574
+ viewBox: "0 0 24 24",
575
+ width: "24",
576
+ height: "24",
577
+ children: /* @__PURE__ */ 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" })
578
+ }
579
+ ),
580
+ /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: "Search" })
581
+ ] })
582
+ ] }),
583
+ /* @__PURE__ */ jsx("ul", { className: "usa-nav__primary usa-accordion", children: navItems.map((item, i) => {
584
+ const hasDropdown = item.items && item.items.length > 0;
585
+ const isOpen = openDropdown === i;
586
+ const dropdownId = `${uid}-nav-dropdown-${i}`;
587
+ return /* @__PURE__ */ jsx(
588
+ "li",
589
+ {
590
+ className: `usa-nav__primary-item${item.current ? " usa-current" : ""}`,
591
+ children: hasDropdown ? /* @__PURE__ */ jsxs(Fragment, { children: [
592
+ /* @__PURE__ */ jsx(
593
+ "button",
594
+ {
595
+ type: "button",
596
+ className: `usa-accordion__button usa-nav__link${item.current ? " usa-current" : ""}`,
597
+ "aria-expanded": isOpen,
598
+ "aria-controls": dropdownId,
599
+ onClick: () => setOpenDropdown(isOpen ? null : i),
600
+ children: /* @__PURE__ */ jsx("span", { children: item.label })
601
+ }
602
+ ),
603
+ /* @__PURE__ */ jsx(
604
+ "ul",
605
+ {
606
+ id: dropdownId,
607
+ className: "usa-nav__submenu",
608
+ hidden: !isOpen,
609
+ children: (item.items ?? []).map((sub, j) => /* @__PURE__ */ jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsx("a", { href: safeHref(sub.href), children: sub.label }) }, j))
610
+ }
611
+ )
612
+ ] }) : /* @__PURE__ */ jsx(
613
+ "a",
614
+ {
615
+ href: safeHref(item.href),
616
+ className: `usa-nav__link${item.current ? " usa-current" : ""}`,
617
+ "aria-current": item.current ? "page" : void 0,
618
+ children: /* @__PURE__ */ jsx("span", { children: item.label })
619
+ }
620
+ )
621
+ },
622
+ i
623
+ );
624
+ }) })
625
+ ]
626
+ }
627
+ )
628
+ ] })
629
+ }
630
+ )
631
+ ] });
632
+ },
633
+ SkipNav: ({ props }) => {
634
+ return /* @__PURE__ */ jsx("a", { className: "usa-skipnav", href: safeHref(props.href) ?? "#main-content", children: props.label ?? "Skip to main content" });
635
+ },
636
+ SideNav: ({ props }) => {
637
+ const items = props.items ?? [];
638
+ return /* @__PURE__ */ jsx("nav", { "aria-label": props.ariaLabel ?? "Side navigation", children: /* @__PURE__ */ jsx("ul", { className: "usa-sidenav", children: items.map((item, i) => /* @__PURE__ */ jsxs("li", { className: "usa-sidenav__item", children: [
639
+ /* @__PURE__ */ jsx(
640
+ "a",
641
+ {
642
+ href: safeHref(item.href),
643
+ className: item.current ? "usa-current" : void 0,
644
+ "aria-current": item.current ? "page" : void 0,
645
+ children: item.label
646
+ }
647
+ ),
648
+ item.children && item.children.length > 0 && /* @__PURE__ */ jsx("ul", { className: "usa-sidenav__sublist", children: item.children.map((child, j) => /* @__PURE__ */ jsx("li", { className: "usa-sidenav__item", children: /* @__PURE__ */ jsx(
649
+ "a",
650
+ {
651
+ href: safeHref(child.href),
652
+ className: child.current ? "usa-current" : void 0,
653
+ "aria-current": child.current ? "page" : void 0,
654
+ children: child.label
655
+ }
656
+ ) }, j)) })
657
+ ] }, i)) }) });
658
+ },
659
+ LanguageSelector: ({
660
+ props
661
+ }) => {
662
+ const [open, setOpen] = useState(false);
663
+ const uid = useId();
664
+ const submenuId = `${uid}-language-submenu`;
665
+ const languages = props.languages ?? [];
666
+ const current = props.currentLang ?? "";
667
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Language selector", className: "usa-language-container", children: /* @__PURE__ */ jsx("ul", { className: "usa-language__primary", children: /* @__PURE__ */ jsxs("li", { className: "usa-language__primary-item", children: [
668
+ /* @__PURE__ */ jsx(
669
+ "button",
670
+ {
671
+ type: "button",
672
+ className: "usa-accordion__button usa-language__link",
673
+ "aria-expanded": open,
674
+ "aria-controls": submenuId,
675
+ onClick: () => setOpen((v) => !v),
676
+ children: languages.find((l) => l.lang === current)?.label ?? "Language"
677
+ }
678
+ ),
679
+ /* @__PURE__ */ jsx("ul", { id: submenuId, className: "usa-language__submenu", hidden: !open, children: languages.filter((l) => l.lang !== current).map((lang) => /* @__PURE__ */ jsx("li", { className: "usa-language__submenu-item", children: /* @__PURE__ */ jsx(
680
+ "a",
681
+ {
682
+ href: safeHref(lang.href),
683
+ lang: lang.lang,
684
+ hrefLang: lang.lang,
685
+ className: "usa-language__submenu-link",
686
+ children: lang.localLabel ?? lang.label
687
+ }
688
+ ) }, lang.lang)) })
689
+ ] }) }) });
690
+ },
691
+ Link: ({ props, emit }) => {
692
+ return /* @__PURE__ */ jsxs(
693
+ "a",
694
+ {
695
+ href: safeHref(props.href),
696
+ className: props.variant === "nav" ? "usa-nav__link" : "usa-link",
697
+ target: props.external ? "_blank" : void 0,
698
+ rel: props.external ? "noreferrer" : void 0,
699
+ onClick: () => emit("press"),
700
+ children: [
701
+ props.label,
702
+ props.external && /* @__PURE__ */ jsx(
703
+ "svg",
704
+ {
705
+ className: "usa-icon",
706
+ "aria-label": "(external link)",
707
+ role: "img",
708
+ viewBox: "0 0 24 24",
709
+ width: "16",
710
+ height: "16",
711
+ style: { marginLeft: "0.25em", verticalAlign: "middle" },
712
+ children: /* @__PURE__ */ 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" })
713
+ }
714
+ )
715
+ ]
716
+ }
717
+ );
718
+ },
719
+ InPageNavigation: ({
720
+ props
721
+ }) => {
722
+ const items = props.items ?? [];
723
+ return /* @__PURE__ */ jsxs(
724
+ "nav",
725
+ {
726
+ "aria-label": props.heading ?? "On this page",
727
+ className: "usa-in-page-nav",
728
+ children: [
729
+ /* @__PURE__ */ jsx("div", { className: "usa-in-page-nav__header", children: /* @__PURE__ */ jsx("p", { className: "usa-in-page-nav__title", children: props.heading ?? "On this page" }) }),
730
+ /* @__PURE__ */ jsx("ul", { className: "usa-in-page-nav__list", children: items.map((item, i) => /* @__PURE__ */ jsx("li", { className: "usa-in-page-nav__item", children: /* @__PURE__ */ jsx("a", { href: safeHref(item.href), className: "usa-in-page-nav__link", children: item.label }) }, i)) })
731
+ ]
732
+ }
733
+ );
734
+ },
735
+ // ── Data Display ──────────────────────────────────────────────────────
736
+ Table: ({ props }) => {
737
+ const columns = props.columns ?? [];
738
+ const rows = (props.rows ?? []).map((row) => row.map(String));
739
+ const tableClass = [
740
+ "usa-table",
741
+ props.borderless ? "usa-table--borderless" : "",
742
+ props.striped ? "usa-table--striped" : "",
743
+ props.compact ? "usa-table--compact" : ""
744
+ ].filter(Boolean).join(" ");
745
+ const table = /* @__PURE__ */ jsxs("table", { className: tableClass, children: [
746
+ props.caption && /* @__PURE__ */ jsx("caption", { children: props.caption }),
747
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx("th", { scope: "col", children: col }, col)) }) }),
748
+ /* @__PURE__ */ jsx("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx("tr", { children: row.map((cell, j) => /* @__PURE__ */ jsx("td", { children: cell }, j)) }, i)) })
749
+ ] });
750
+ if (props.scrollable) {
751
+ return /* @__PURE__ */ jsx("div", { className: "usa-table-container--scrollable", tabIndex: 0, children: table });
752
+ }
753
+ return table;
754
+ },
755
+ Heading: ({ props }) => {
756
+ const level = props.level ?? "h2";
757
+ if (level === "h1") return /* @__PURE__ */ jsx("h1", { className: "usa-prose", children: props.text });
758
+ if (level === "h3") return /* @__PURE__ */ jsx("h3", { className: "usa-prose", children: props.text });
759
+ if (level === "h4") return /* @__PURE__ */ jsx("h4", { className: "usa-prose", children: props.text });
760
+ if (level === "h5") return /* @__PURE__ */ jsx("h5", { className: "usa-prose", children: props.text });
761
+ if (level === "h6") return /* @__PURE__ */ jsx("h6", { className: "usa-prose", children: props.text });
762
+ return /* @__PURE__ */ jsx("h2", { className: "usa-prose", children: props.text });
763
+ },
764
+ Text: ({ props }) => {
765
+ if (props.variant === "lead") {
766
+ return /* @__PURE__ */ jsx("p", { className: "usa-intro", children: props.text });
767
+ }
768
+ if (props.variant === "small") {
769
+ return /* @__PURE__ */ jsx("small", { className: "usa-prose", children: props.text });
770
+ }
771
+ if (props.variant === "code") {
772
+ return /* @__PURE__ */ jsx("code", { className: "usa-prose", children: props.text });
773
+ }
774
+ return /* @__PURE__ */ jsx("p", { className: "usa-prose", children: props.text });
775
+ },
776
+ Alert: ({ props }) => {
777
+ 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";
778
+ const slimClass = props.slim ? " usa-alert--slim" : "";
779
+ const noIconClass = props.noIcon ? " usa-alert--no-icon" : "";
780
+ return /* @__PURE__ */ jsx(
781
+ "div",
782
+ {
783
+ className: `usa-alert ${typeClass}${slimClass}${noIconClass}`,
784
+ role: "alert",
785
+ children: /* @__PURE__ */ jsxs("div", { className: "usa-alert__body", children: [
786
+ props.heading && /* @__PURE__ */ jsx("h4", { className: "usa-alert__heading", children: props.heading }),
787
+ /* @__PURE__ */ jsx("p", { className: "usa-alert__text", children: props.message })
788
+ ] })
789
+ }
790
+ );
791
+ },
792
+ SiteAlert: ({ props }) => {
793
+ const typeClass = props.type === "emergency" ? "usa-site-alert--emergency" : "usa-site-alert--info";
794
+ const slimClass = props.slim ? " usa-site-alert--slim" : "";
795
+ return /* @__PURE__ */ jsx(
796
+ "section",
797
+ {
798
+ className: `usa-site-alert ${typeClass}${slimClass}`,
799
+ "aria-label": "Site alert",
800
+ children: /* @__PURE__ */ jsx("div", { className: "usa-alert", children: /* @__PURE__ */ jsxs("div", { className: "usa-alert__body", children: [
801
+ props.heading && /* @__PURE__ */ jsx("h3", { className: "usa-alert__heading", children: props.heading }),
802
+ /* @__PURE__ */ jsx("p", { className: "usa-alert__text", children: props.message })
803
+ ] }) })
804
+ }
805
+ );
806
+ },
807
+ Tag: ({ props }) => {
808
+ return /* @__PURE__ */ jsx("span", { className: `usa-tag${props.big ? " usa-tag--big" : ""}`, children: props.text });
809
+ },
810
+ SummaryBox: ({ props }) => {
811
+ const uid = useId();
812
+ const headingId = `${uid}-summary-heading`;
813
+ const items = props.items ?? [];
814
+ return /* @__PURE__ */ jsx(
815
+ "div",
816
+ {
817
+ className: "usa-summary-box",
818
+ role: "region",
819
+ "aria-labelledby": headingId,
820
+ children: /* @__PURE__ */ jsxs("div", { className: "usa-summary-box__body", children: [
821
+ /* @__PURE__ */ jsx("h3", { className: "usa-summary-box__heading", id: headingId, children: props.heading }),
822
+ /* @__PURE__ */ jsx("div", { className: "usa-summary-box__text", children: /* @__PURE__ */ jsx("ul", { className: "usa-list", children: items.map((item, i) => /* @__PURE__ */ jsx("li", { className: "usa-summary-box__list-item", children: item }, i)) }) })
823
+ ] })
824
+ }
825
+ );
826
+ },
827
+ ProcessList: ({ props }) => {
828
+ const items = props.items ?? [];
829
+ return /* @__PURE__ */ jsx("ol", { className: "usa-process-list", children: items.map((item, i) => /* @__PURE__ */ jsxs("li", { className: "usa-process-list__item", children: [
830
+ /* @__PURE__ */ jsx("h4", { className: "usa-process-list__heading", children: item.heading }),
831
+ /* @__PURE__ */ jsx("p", { className: "margin-top-05", children: item.content })
832
+ ] }, i)) });
833
+ },
834
+ GovBanner: ({ props }) => {
835
+ const [expanded, setExpanded] = useState(props.expanded ?? false);
836
+ const tld = props.tld ?? ".gov";
837
+ const isMil = tld === ".mil";
838
+ return /* @__PURE__ */ jsx(
839
+ "section",
840
+ {
841
+ className: `usa-banner${expanded ? " usa-banner--expanded" : ""}`,
842
+ "aria-label": "Official website of the United States government",
843
+ children: /* @__PURE__ */ jsxs("div", { className: "usa-accordion", children: [
844
+ /* @__PURE__ */ jsx("header", { className: "usa-banner__header", children: /* @__PURE__ */ jsxs("div", { className: "usa-banner__inner", children: [
845
+ /* @__PURE__ */ jsx("div", { className: "grid-col-auto", children: /* @__PURE__ */ jsxs(
846
+ "svg",
847
+ {
848
+ "aria-hidden": "true",
849
+ className: "usa-banner__header-flag",
850
+ width: "16",
851
+ height: "11",
852
+ viewBox: "0 0 16 11",
853
+ xmlns: "http://www.w3.org/2000/svg",
854
+ children: [
855
+ /* @__PURE__ */ jsx("rect", { width: "16", height: "11", fill: "#B22234" }),
856
+ /* @__PURE__ */ jsx("rect", { y: "0.846", width: "16", height: "0.846", fill: "white" }),
857
+ /* @__PURE__ */ jsx("rect", { y: "2.539", width: "16", height: "0.846", fill: "white" }),
858
+ /* @__PURE__ */ jsx("rect", { y: "4.231", width: "16", height: "0.846", fill: "white" }),
859
+ /* @__PURE__ */ jsx("rect", { y: "5.923", width: "16", height: "0.846", fill: "white" }),
860
+ /* @__PURE__ */ jsx("rect", { y: "7.615", width: "16", height: "0.846", fill: "white" }),
861
+ /* @__PURE__ */ jsx("rect", { y: "9.307", width: "16", height: "0.846", fill: "white" }),
862
+ /* @__PURE__ */ jsx("rect", { width: "6.4", height: "5.923", fill: "#3C3B6E" })
863
+ ]
864
+ }
865
+ ) }),
866
+ /* @__PURE__ */ jsxs(
867
+ "div",
868
+ {
869
+ className: "grid-col-fill tablet:grid-col-auto",
870
+ "aria-hidden": "true",
871
+ children: [
872
+ /* @__PURE__ */ jsx("p", { className: "usa-banner__header-text", children: "An official website of the United States government" }),
873
+ /* @__PURE__ */ jsx("p", { className: "usa-banner__header-action", children: "Here's how you know" })
874
+ ]
875
+ }
876
+ ),
877
+ /* @__PURE__ */ jsx(
878
+ "button",
879
+ {
880
+ type: "button",
881
+ className: "usa-accordion__button usa-banner__button",
882
+ "aria-expanded": expanded,
883
+ "aria-controls": "gov-banner-content",
884
+ onClick: () => setExpanded((v) => !v),
885
+ children: /* @__PURE__ */ jsx("span", { className: "usa-banner__button-text", children: "Here's how you know" })
886
+ }
887
+ )
888
+ ] }) }),
889
+ /* @__PURE__ */ jsx(
890
+ "div",
891
+ {
892
+ className: "usa-banner__content usa-accordion__content",
893
+ id: "gov-banner-content",
894
+ hidden: !expanded,
895
+ children: /* @__PURE__ */ jsxs("div", { className: "grid-row grid-gap-lg", children: [
896
+ /* @__PURE__ */ jsxs("div", { className: "usa-banner__guidance tablet:grid-col-6", children: [
897
+ /* @__PURE__ */ jsxs(
898
+ "svg",
899
+ {
900
+ className: "usa-banner__icon usa-media-block__img",
901
+ "aria-hidden": "true",
902
+ width: "40",
903
+ height: "40",
904
+ viewBox: "0 0 40 40",
905
+ xmlns: "http://www.w3.org/2000/svg",
906
+ children: [
907
+ /* @__PURE__ */ jsx("circle", { cx: "20", cy: "20", r: "20", fill: "#005ea2" }),
908
+ /* @__PURE__ */ jsx(
909
+ "path",
910
+ {
911
+ fill: "white",
912
+ d: "M20 9l11 6.5V17H9v-1.5L20 9zM11 19h3v11h-3V19zm7.5 0h3v11h-3V19zm7 0h3v11h-3V19zM9 31h22v2H9V31z"
913
+ }
914
+ )
915
+ ]
916
+ }
917
+ ),
918
+ /* @__PURE__ */ jsx("div", { className: "usa-media-block__body", children: /* @__PURE__ */ jsxs("p", { children: [
919
+ /* @__PURE__ */ jsxs("strong", { children: [
920
+ "Official ",
921
+ isMil ? ".mil" : ".gov",
922
+ " websites use HTTPS"
923
+ ] }),
924
+ /* @__PURE__ */ jsx("br", {}),
925
+ "A ",
926
+ /* @__PURE__ */ jsx("strong", { children: "lock" }),
927
+ " or ",
928
+ /* @__PURE__ */ jsx("strong", { children: "https://" }),
929
+ " ",
930
+ "means you've safely connected to the",
931
+ " ",
932
+ isMil ? ".mil" : ".gov",
933
+ " website."
934
+ ] }) })
935
+ ] }),
936
+ /* @__PURE__ */ jsxs("div", { className: "usa-banner__guidance tablet:grid-col-6", children: [
937
+ /* @__PURE__ */ jsxs(
938
+ "svg",
939
+ {
940
+ className: "usa-banner__icon usa-media-block__img",
941
+ "aria-hidden": "true",
942
+ width: "40",
943
+ height: "40",
944
+ viewBox: "0 0 40 40",
945
+ xmlns: "http://www.w3.org/2000/svg",
946
+ children: [
947
+ /* @__PURE__ */ jsx("circle", { cx: "20", cy: "20", r: "20", fill: "#005ea2" }),
948
+ /* @__PURE__ */ jsx(
949
+ "path",
950
+ {
951
+ fill: "white",
952
+ 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"
953
+ }
954
+ )
955
+ ]
956
+ }
957
+ ),
958
+ /* @__PURE__ */ jsx("div", { className: "usa-media-block__body", children: /* @__PURE__ */ jsxs("p", { children: [
959
+ /* @__PURE__ */ jsxs("strong", { children: [
960
+ "Secure ",
961
+ isMil ? ".mil" : ".gov",
962
+ " websites use HTTPS"
963
+ ] }),
964
+ /* @__PURE__ */ jsx("br", {}),
965
+ "Share sensitive information only on official, secure websites."
966
+ ] }) })
967
+ ] })
968
+ ] })
969
+ }
970
+ )
971
+ ] })
972
+ }
973
+ );
974
+ },
975
+ Identifier: ({ props }) => {
976
+ const links = props.links ?? [];
977
+ return /* @__PURE__ */ jsxs("section", { className: "usa-identifier", children: [
978
+ /* @__PURE__ */ jsx(
979
+ "section",
980
+ {
981
+ className: "usa-identifier__section usa-identifier__section--masthead",
982
+ "aria-label": "Agency identifier",
983
+ children: /* @__PURE__ */ jsxs("div", { className: "usa-identifier__container", children: [
984
+ props.logoUrl && /* @__PURE__ */ jsx("div", { className: "usa-identifier__logos", children: /* @__PURE__ */ jsx(
985
+ "a",
986
+ {
987
+ href: safeHref(props.agencyUrl) ?? "/",
988
+ className: "usa-identifier__logo",
989
+ children: /* @__PURE__ */ jsx(
990
+ "img",
991
+ {
992
+ className: "usa-identifier__logo-img",
993
+ src: props.logoUrl,
994
+ alt: props.logoAlt ?? `${props.agencyName} logo`,
995
+ role: "img"
996
+ }
997
+ )
998
+ }
999
+ ) }),
1000
+ /* @__PURE__ */ jsxs(
1001
+ "section",
1002
+ {
1003
+ className: "usa-identifier__identity",
1004
+ "aria-label": "Agency description",
1005
+ children: [
1006
+ /* @__PURE__ */ jsx("p", { className: "usa-identifier__identity-domain", children: props.domain }),
1007
+ /* @__PURE__ */ jsx("p", { className: "usa-identifier__identity-disclaimer", children: props.disclaimer ?? /* @__PURE__ */ jsxs(Fragment, { children: [
1008
+ "An official website of the",
1009
+ " ",
1010
+ /* @__PURE__ */ jsx("a", { className: "usa-link", href: safeHref(props.agencyUrl) ?? "/", children: props.agencyName })
1011
+ ] }) })
1012
+ ]
1013
+ }
1014
+ )
1015
+ ] })
1016
+ }
1017
+ ),
1018
+ links.length > 0 && /* @__PURE__ */ jsx(
1019
+ "nav",
1020
+ {
1021
+ className: "usa-identifier__section usa-identifier__section--required-links",
1022
+ "aria-label": "Important links",
1023
+ children: /* @__PURE__ */ jsx("div", { className: "usa-identifier__container", children: /* @__PURE__ */ jsx("ul", { className: "usa-identifier__required-links-list", children: links.map((link, i) => /* @__PURE__ */ jsx("li", { className: "usa-identifier__required-links-item", children: /* @__PURE__ */ jsx(
1024
+ "a",
1025
+ {
1026
+ href: safeHref(link.href),
1027
+ className: "usa-identifier__required-link usa-link",
1028
+ children: link.label
1029
+ }
1030
+ ) }, i)) }) })
1031
+ }
1032
+ ),
1033
+ (props.showUsagov ?? true) && /* @__PURE__ */ jsx(
1034
+ "section",
1035
+ {
1036
+ className: "usa-identifier__section usa-identifier__section--usagov",
1037
+ "aria-label": "U.S. government information and services",
1038
+ children: /* @__PURE__ */ jsx("div", { className: "usa-identifier__container", children: /* @__PURE__ */ jsxs("div", { className: "usa-identifier__usagov-description", children: [
1039
+ "Looking for U.S. government information and services?",
1040
+ " ",
1041
+ /* @__PURE__ */ jsx("a", { className: "usa-link", href: "https://www.usa.gov/", children: "Visit USA.gov" })
1042
+ ] }) })
1043
+ }
1044
+ )
1045
+ ] });
1046
+ },
1047
+ IconList: ({ props }) => {
1048
+ const items = props.items ?? [];
1049
+ const sizeClass = props.size ? ` usa-icon-list--size-${props.size}` : "";
1050
+ const colorMap = {
1051
+ success: "text-green",
1052
+ error: "text-red",
1053
+ warning: "text-gold",
1054
+ info: "text-blue",
1055
+ default: ""
1056
+ };
1057
+ const iconPaths = {
1058
+ 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",
1059
+ 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",
1060
+ 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",
1061
+ warning: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z",
1062
+ 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",
1063
+ 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",
1064
+ arrow_forward: "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
1065
+ };
1066
+ return /* @__PURE__ */ jsxs("ul", { className: `usa-icon-list${sizeClass}`, children: [
1067
+ props.title && /* @__PURE__ */ jsx("li", { className: "usa-icon-list__item", children: /* @__PURE__ */ jsx("p", { className: "usa-icon-list__title", children: props.title }) }),
1068
+ items.map((item, i) => {
1069
+ const color = colorMap[item.color ?? "default"] ?? "";
1070
+ const path = iconPaths[item.icon] ?? iconPaths["info"];
1071
+ return /* @__PURE__ */ jsxs("li", { className: "usa-icon-list__item", children: [
1072
+ /* @__PURE__ */ jsx("div", { className: `usa-icon-list__icon${color ? ` ${color}` : ""}`, children: /* @__PURE__ */ jsx(
1073
+ "svg",
1074
+ {
1075
+ className: "usa-icon",
1076
+ "aria-hidden": "true",
1077
+ role: "img",
1078
+ viewBox: "0 0 24 24",
1079
+ width: "24",
1080
+ height: "24",
1081
+ children: /* @__PURE__ */ jsx("path", { d: path })
1082
+ }
1083
+ ) }),
1084
+ /* @__PURE__ */ jsx("div", { className: "usa-icon-list__content", children: item.content })
1085
+ ] }, i);
1086
+ })
1087
+ ] });
1088
+ },
1089
+ Collection: ({ props }) => {
1090
+ const items = props.items ?? [];
1091
+ return /* @__PURE__ */ jsx("ul", { className: "usa-collection", children: items.map((item, i) => /* @__PURE__ */ jsxs("li", { className: "usa-collection__item", children: [
1092
+ item.thumbnailUrl && /* @__PURE__ */ jsx(
1093
+ "img",
1094
+ {
1095
+ className: "usa-collection__thumbnail",
1096
+ src: item.thumbnailUrl,
1097
+ alt: item.thumbnailAlt ?? ""
1098
+ }
1099
+ ),
1100
+ /* @__PURE__ */ jsxs("div", { className: "usa-collection__body", children: [
1101
+ /* @__PURE__ */ jsx("h3", { className: "usa-collection__heading", children: item.href ? /* @__PURE__ */ jsx("a", { className: "usa-link", href: safeHref(item.href), children: item.heading }) : item.heading }),
1102
+ item.description && /* @__PURE__ */ jsx("p", { className: "usa-collection__description", children: item.description }),
1103
+ (item.date || item.tags && item.tags.length > 0) && /* @__PURE__ */ jsxs("ul", { className: "usa-collection__meta", "aria-label": "Topics", children: [
1104
+ item.date && /* @__PURE__ */ jsx("li", { className: "usa-collection__meta-item usa-collection__calendar-date", children: /* @__PURE__ */ jsx("time", { dateTime: item.date, children: item.dateLabel ?? item.date }) }),
1105
+ (item.tags ?? []).map((tag) => /* @__PURE__ */ jsx("li", { className: "usa-collection__meta-item usa-tag", children: tag }, tag))
1106
+ ] })
1107
+ ] })
1108
+ ] }, i)) });
1109
+ },
1110
+ Tooltip: ({ props }) => {
1111
+ const [visible, setVisible] = useState(false);
1112
+ const uid = useId();
1113
+ const tooltipId = `${uid}-tooltip`;
1114
+ const position = props.position ?? "top";
1115
+ const positionClass = `usa-tooltip__body--${position}`;
1116
+ return /* @__PURE__ */ jsxs(
1117
+ "span",
1118
+ {
1119
+ className: "usa-tooltip",
1120
+ style: { position: "relative", display: "inline-block" },
1121
+ onMouseEnter: () => setVisible(true),
1122
+ onMouseLeave: () => setVisible(false),
1123
+ onFocus: () => setVisible(true),
1124
+ onBlur: () => setVisible(false),
1125
+ children: [
1126
+ /* @__PURE__ */ jsx(
1127
+ "span",
1128
+ {
1129
+ tabIndex: 0,
1130
+ className: "usa-tooltip__trigger",
1131
+ "aria-describedby": tooltipId,
1132
+ children: props.label
1133
+ }
1134
+ ),
1135
+ /* @__PURE__ */ jsx(
1136
+ "span",
1137
+ {
1138
+ id: tooltipId,
1139
+ className: `usa-tooltip__body ${positionClass}${visible ? " is-set is-visible" : ""}`,
1140
+ role: "tooltip",
1141
+ "aria-hidden": !visible,
1142
+ children: props.content
1143
+ }
1144
+ )
1145
+ ]
1146
+ }
1147
+ );
1148
+ },
1149
+ // ── Form Inputs ───────────────────────────────────────────────────────
1150
+ Button: ({ props, emit }) => {
1151
+ return /* @__PURE__ */ jsx(
1152
+ "button",
1153
+ {
1154
+ type: props.type ?? "button",
1155
+ className: getButtonClass(props.variant),
1156
+ disabled: props.disabled ?? false,
1157
+ onClick: () => emit("press"),
1158
+ children: props.label
1159
+ }
1160
+ );
1161
+ },
1162
+ ButtonGroup: ({
1163
+ props,
1164
+ emit
1165
+ }) => {
1166
+ const buttons = props.buttons ?? [];
1167
+ return /* @__PURE__ */ jsx(
1168
+ "ul",
1169
+ {
1170
+ className: `usa-button-group${props.segmented ? " usa-button-group--segmented" : ""}`,
1171
+ children: buttons.map((btn) => /* @__PURE__ */ jsx("li", { className: "usa-button-group__item", children: /* @__PURE__ */ jsx(
1172
+ "button",
1173
+ {
1174
+ type: "button",
1175
+ className: getButtonClass(btn.variant ?? "default"),
1176
+ onClick: () => emit("press"),
1177
+ "data-value": btn.value,
1178
+ children: btn.label
1179
+ }
1180
+ ) }, btn.value))
1181
+ }
1182
+ );
1183
+ },
1184
+ Input: ({
1185
+ props,
1186
+ bindings,
1187
+ emit
1188
+ }) => {
1189
+ const [boundValue, setBoundValue] = useBoundProp(
1190
+ props.value,
1191
+ bindings?.value
1192
+ );
1193
+ const [localValue, setLocalValue] = useState("");
1194
+ const isBound = !!bindings?.value;
1195
+ const value = isBound ? boundValue ?? "" : localValue;
1196
+ const setValue = isBound ? setBoundValue : setLocalValue;
1197
+ const validateOn = props.validateOn ?? "blur";
1198
+ const hasValidation = !!(bindings?.value && props.checks?.length);
1199
+ const { errors, validate } = useFieldValidation(
1200
+ bindings?.value ?? "",
1201
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
1202
+ );
1203
+ const hasError = errors.length > 0;
1204
+ const inputId = props.name;
1205
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
1206
+ const errorId = hasError ? `${inputId}-error` : void 0;
1207
+ return /* @__PURE__ */ jsxs(
1208
+ "div",
1209
+ {
1210
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
1211
+ children: [
1212
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
1213
+ props.label,
1214
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1215
+ ] }),
1216
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1217
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
1218
+ /* @__PURE__ */ jsx(
1219
+ "input",
1220
+ {
1221
+ className: `usa-input${hasError ? " usa-input--error" : ""}`,
1222
+ id: inputId,
1223
+ name: props.name,
1224
+ type: props.type ?? "text",
1225
+ placeholder: props.placeholder ?? void 0,
1226
+ required: props.required ?? void 0,
1227
+ disabled: props.disabled ?? void 0,
1228
+ value,
1229
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
1230
+ onChange: (e) => {
1231
+ setValue(e.target.value);
1232
+ if (hasValidation && validateOn === "change") validate();
1233
+ },
1234
+ onKeyDown: (e) => {
1235
+ if (e.key === "Enter") emit("submit");
1236
+ },
1237
+ onFocus: () => emit("focus"),
1238
+ onBlur: () => {
1239
+ if (hasValidation && validateOn === "blur") validate();
1240
+ emit("blur");
1241
+ }
1242
+ }
1243
+ )
1244
+ ]
1245
+ }
1246
+ );
1247
+ },
1248
+ Textarea: ({
1249
+ props,
1250
+ bindings
1251
+ }) => {
1252
+ const [boundValue, setBoundValue] = useBoundProp(
1253
+ props.value,
1254
+ bindings?.value
1255
+ );
1256
+ const [localValue, setLocalValue] = useState("");
1257
+ const isBound = !!bindings?.value;
1258
+ const value = isBound ? boundValue ?? "" : localValue;
1259
+ const setValue = isBound ? setBoundValue : setLocalValue;
1260
+ const validateOn = props.validateOn ?? "blur";
1261
+ const hasValidation = !!(bindings?.value && props.checks?.length);
1262
+ const { errors, validate } = useFieldValidation(
1263
+ bindings?.value ?? "",
1264
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
1265
+ );
1266
+ const hasError = errors.length > 0;
1267
+ const inputId = props.name;
1268
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
1269
+ const errorId = hasError ? `${inputId}-error` : void 0;
1270
+ return /* @__PURE__ */ jsxs(
1271
+ "div",
1272
+ {
1273
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
1274
+ children: [
1275
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
1276
+ props.label,
1277
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1278
+ ] }),
1279
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1280
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
1281
+ /* @__PURE__ */ jsx(
1282
+ "textarea",
1283
+ {
1284
+ className: `usa-textarea${hasError ? " usa-input--error" : ""}`,
1285
+ id: inputId,
1286
+ name: props.name,
1287
+ placeholder: props.placeholder ?? void 0,
1288
+ required: props.required ?? void 0,
1289
+ rows: props.rows ?? 4,
1290
+ value,
1291
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
1292
+ onChange: (e) => {
1293
+ setValue(e.target.value);
1294
+ if (hasValidation && validateOn === "change") validate();
1295
+ },
1296
+ onBlur: () => {
1297
+ if (hasValidation && validateOn === "blur") validate();
1298
+ }
1299
+ }
1300
+ )
1301
+ ]
1302
+ }
1303
+ );
1304
+ },
1305
+ Select: ({
1306
+ props,
1307
+ bindings,
1308
+ emit
1309
+ }) => {
1310
+ const [boundValue, setBoundValue] = useBoundProp(
1311
+ props.value,
1312
+ bindings?.value
1313
+ );
1314
+ const [localValue, setLocalValue] = useState("");
1315
+ const isBound = !!bindings?.value;
1316
+ const value = isBound ? boundValue ?? "" : localValue;
1317
+ const setValue = isBound ? setBoundValue : setLocalValue;
1318
+ const validateOn = props.validateOn ?? "change";
1319
+ const hasValidation = !!(bindings?.value && props.checks?.length);
1320
+ const { errors, validate } = useFieldValidation(
1321
+ bindings?.value ?? "",
1322
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
1323
+ );
1324
+ const hasError = errors.length > 0;
1325
+ const inputId = props.name;
1326
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
1327
+ const errorId = hasError ? `${inputId}-error` : void 0;
1328
+ const options = (props.options ?? []).map(
1329
+ (opt) => typeof opt === "string" ? { label: opt, value: opt } : opt
1330
+ );
1331
+ return /* @__PURE__ */ jsxs(
1332
+ "div",
1333
+ {
1334
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
1335
+ children: [
1336
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
1337
+ props.label,
1338
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1339
+ ] }),
1340
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1341
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
1342
+ /* @__PURE__ */ jsxs(
1343
+ "select",
1344
+ {
1345
+ className: `usa-select${hasError ? " usa-input--error" : ""}`,
1346
+ id: inputId,
1347
+ name: props.name,
1348
+ required: props.required ?? void 0,
1349
+ value,
1350
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
1351
+ onChange: (e) => {
1352
+ setValue(e.target.value);
1353
+ if (hasValidation && validateOn === "change") validate();
1354
+ emit("change");
1355
+ },
1356
+ children: [
1357
+ props.placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: props.placeholder }),
1358
+ options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt.value, children: opt.label }, opt.value))
1359
+ ]
1360
+ }
1361
+ )
1362
+ ]
1363
+ }
1364
+ );
1365
+ },
1366
+ Checkbox: ({
1367
+ props,
1368
+ bindings,
1369
+ emit
1370
+ }) => {
1371
+ const [boundChecked, setBoundChecked] = useBoundProp(
1372
+ props.checked,
1373
+ bindings?.checked
1374
+ );
1375
+ const [localChecked, setLocalChecked] = useState(false);
1376
+ const isBound = !!bindings?.checked;
1377
+ const checked = isBound ? boundChecked ?? false : localChecked;
1378
+ const setChecked = isBound ? setBoundChecked : setLocalChecked;
1379
+ const validateOn = props.validateOn ?? "change";
1380
+ const hasValidation = !!(bindings?.checked && props.checks?.length);
1381
+ const { errors, validate } = useFieldValidation(
1382
+ bindings?.checked ?? "",
1383
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
1384
+ );
1385
+ const inputId = props.name;
1386
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
1387
+ return /* @__PURE__ */ jsxs(
1388
+ "div",
1389
+ {
1390
+ className: `usa-form-group${errors.length > 0 ? " usa-form-group--error" : ""}`,
1391
+ children: [
1392
+ /* @__PURE__ */ jsxs(
1393
+ "div",
1394
+ {
1395
+ className: `usa-checkbox${props.tile ? " usa-checkbox--tile" : ""}`,
1396
+ children: [
1397
+ /* @__PURE__ */ jsx(
1398
+ "input",
1399
+ {
1400
+ className: "usa-checkbox__input",
1401
+ id: inputId,
1402
+ type: "checkbox",
1403
+ name: props.name,
1404
+ checked,
1405
+ "aria-describedby": hintId,
1406
+ onChange: (e) => {
1407
+ setChecked(e.target.checked);
1408
+ if (hasValidation && validateOn === "change") validate();
1409
+ emit("change");
1410
+ }
1411
+ }
1412
+ ),
1413
+ /* @__PURE__ */ jsxs("label", { className: "usa-checkbox__label", htmlFor: inputId, children: [
1414
+ props.label,
1415
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-checkbox__label-description", id: hintId, children: props.hint })
1416
+ ] })
1417
+ ]
1418
+ }
1419
+ ),
1420
+ errors.length > 0 && /* @__PURE__ */ jsx("span", { className: "usa-error-message", role: "alert", children: errors[0] })
1421
+ ]
1422
+ }
1423
+ );
1424
+ },
1425
+ CheckboxGroup: ({
1426
+ props,
1427
+ bindings,
1428
+ emit
1429
+ }) => {
1430
+ const [boundValues, setBoundValues] = useBoundProp(
1431
+ props.values,
1432
+ bindings?.values
1433
+ );
1434
+ const [localValues, setLocalValues] = useState([]);
1435
+ const isBound = !!bindings?.values;
1436
+ const values = isBound ? boundValues ?? [] : localValues;
1437
+ const setValues = isBound ? setBoundValues : setLocalValues;
1438
+ const options = props.options ?? [];
1439
+ const toggle = (val) => {
1440
+ const next = values.includes(val) ? values.filter((v) => v !== val) : [...values, val];
1441
+ setValues(next);
1442
+ emit("change");
1443
+ };
1444
+ return /* @__PURE__ */ jsxs("fieldset", { className: "usa-fieldset", children: [
1445
+ /* @__PURE__ */ jsx("legend", { className: "usa-legend", children: props.legend }),
1446
+ options.map((opt) => {
1447
+ const optId = `${props.name}-${opt.value}`;
1448
+ return /* @__PURE__ */ jsxs(
1449
+ "div",
1450
+ {
1451
+ className: `usa-checkbox${props.tile ? " usa-checkbox--tile" : ""}`,
1452
+ children: [
1453
+ /* @__PURE__ */ jsx(
1454
+ "input",
1455
+ {
1456
+ className: "usa-checkbox__input",
1457
+ id: optId,
1458
+ type: "checkbox",
1459
+ name: props.name,
1460
+ value: opt.value,
1461
+ checked: values.includes(opt.value),
1462
+ onChange: () => toggle(opt.value)
1463
+ }
1464
+ ),
1465
+ /* @__PURE__ */ jsxs("label", { className: "usa-checkbox__label", htmlFor: optId, children: [
1466
+ opt.label,
1467
+ opt.hint && /* @__PURE__ */ jsx("span", { className: "usa-checkbox__label-description", children: opt.hint })
1468
+ ] })
1469
+ ]
1470
+ },
1471
+ opt.value
1472
+ );
1473
+ })
1474
+ ] });
1475
+ },
1476
+ Radio: ({
1477
+ props,
1478
+ bindings,
1479
+ emit
1480
+ }) => {
1481
+ const [boundValue, setBoundValue] = useBoundProp(
1482
+ props.value,
1483
+ bindings?.value
1484
+ );
1485
+ const [localValue, setLocalValue] = useState("");
1486
+ const isBound = !!bindings?.value;
1487
+ const value = isBound ? boundValue ?? "" : localValue;
1488
+ const setValue = isBound ? setBoundValue : setLocalValue;
1489
+ const validateOn = props.validateOn ?? "change";
1490
+ const hasValidation = !!(bindings?.value && props.checks?.length);
1491
+ const { errors, validate } = useFieldValidation(
1492
+ bindings?.value ?? "",
1493
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
1494
+ );
1495
+ const options = props.options ?? [];
1496
+ return /* @__PURE__ */ jsxs(
1497
+ "fieldset",
1498
+ {
1499
+ className: `usa-fieldset${errors.length > 0 ? " usa-form-group--error" : ""}`,
1500
+ children: [
1501
+ /* @__PURE__ */ jsx("legend", { className: "usa-legend", children: props.legend }),
1502
+ errors.length > 0 && /* @__PURE__ */ jsx("span", { className: "usa-error-message", role: "alert", children: errors[0] }),
1503
+ options.map((opt) => {
1504
+ const optId = `${props.name}-${opt.value}`;
1505
+ return /* @__PURE__ */ jsxs(
1506
+ "div",
1507
+ {
1508
+ className: `usa-radio${props.tile ? " usa-radio--tile" : ""}`,
1509
+ children: [
1510
+ /* @__PURE__ */ jsx(
1511
+ "input",
1512
+ {
1513
+ className: "usa-radio__input usa-radio__input--tile",
1514
+ id: optId,
1515
+ type: "radio",
1516
+ name: props.name,
1517
+ value: opt.value,
1518
+ checked: value === opt.value,
1519
+ onChange: () => {
1520
+ setValue(opt.value);
1521
+ if (hasValidation && validateOn === "change") validate();
1522
+ emit("change");
1523
+ }
1524
+ }
1525
+ ),
1526
+ /* @__PURE__ */ jsxs("label", { className: "usa-radio__label", htmlFor: optId, children: [
1527
+ opt.label,
1528
+ opt.hint && /* @__PURE__ */ jsx("span", { className: "usa-radio__label-description", children: opt.hint })
1529
+ ] })
1530
+ ]
1531
+ },
1532
+ opt.value
1533
+ );
1534
+ })
1535
+ ]
1536
+ }
1537
+ );
1538
+ },
1539
+ FileInput: ({ props, emit }) => {
1540
+ const inputId = props.name;
1541
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
1542
+ return /* @__PURE__ */ jsxs("div", { className: "usa-form-group", children: [
1543
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
1544
+ props.label,
1545
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1546
+ ] }),
1547
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1548
+ /* @__PURE__ */ jsx(
1549
+ "input",
1550
+ {
1551
+ id: inputId,
1552
+ className: "usa-file-input",
1553
+ type: "file",
1554
+ name: props.name,
1555
+ accept: props.accept ?? void 0,
1556
+ multiple: props.multiple ?? void 0,
1557
+ required: props.required ?? void 0,
1558
+ "aria-describedby": hintId,
1559
+ onChange: () => emit("change")
1560
+ }
1561
+ )
1562
+ ] });
1563
+ },
1564
+ Search: ({
1565
+ props,
1566
+ bindings,
1567
+ emit
1568
+ }) => {
1569
+ const [boundValue, setBoundValue] = useBoundProp(
1570
+ props.value,
1571
+ bindings?.value
1572
+ );
1573
+ const [localValue, setLocalValue] = useState("");
1574
+ const uid = useId();
1575
+ const fieldId = `${uid}-search-field`;
1576
+ const isBound = !!bindings?.value;
1577
+ const value = isBound ? boundValue ?? "" : localValue;
1578
+ const setValue = isBound ? setBoundValue : setLocalValue;
1579
+ const sizeClass = props.size === "small" ? " usa-search--small" : props.size === "big" ? " usa-search--big" : "";
1580
+ return /* @__PURE__ */ jsxs("div", { role: "search", className: `usa-search${sizeClass}`, children: [
1581
+ props.label && /* @__PURE__ */ jsx("label", { className: "usa-sr-only", htmlFor: fieldId, children: props.label }),
1582
+ /* @__PURE__ */ jsx(
1583
+ "input",
1584
+ {
1585
+ className: "usa-input",
1586
+ id: fieldId,
1587
+ type: "search",
1588
+ name: "search",
1589
+ placeholder: props.placeholder ?? void 0,
1590
+ value,
1591
+ onChange: (e) => {
1592
+ setValue(e.target.value);
1593
+ emit("change");
1594
+ },
1595
+ onKeyDown: (e) => {
1596
+ if (e.key === "Enter") emit("submit");
1597
+ }
1598
+ }
1599
+ ),
1600
+ /* @__PURE__ */ jsxs(
1601
+ "button",
1602
+ {
1603
+ className: "usa-button",
1604
+ type: "submit",
1605
+ onClick: () => emit("submit"),
1606
+ children: [
1607
+ /* @__PURE__ */ jsx(
1608
+ "svg",
1609
+ {
1610
+ className: "usa-icon",
1611
+ "aria-hidden": "true",
1612
+ role: "img",
1613
+ viewBox: "0 0 24 24",
1614
+ width: "24",
1615
+ height: "24",
1616
+ children: /* @__PURE__ */ 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" })
1617
+ }
1618
+ ),
1619
+ /* @__PURE__ */ jsx("span", { className: "usa-search__submit-text", children: "Search" })
1620
+ ]
1621
+ }
1622
+ )
1623
+ ] });
1624
+ },
1625
+ RangeInput: ({
1626
+ props,
1627
+ bindings,
1628
+ emit
1629
+ }) => {
1630
+ const [boundValue, setBoundValue] = useBoundProp(
1631
+ props.value,
1632
+ bindings?.value
1633
+ );
1634
+ const [localValue, setLocalValue] = useState(props.value ?? props.min ?? 0);
1635
+ const isBound = !!bindings?.value;
1636
+ const value = isBound ? boundValue ?? 0 : localValue;
1637
+ const setValue = isBound ? setBoundValue : setLocalValue;
1638
+ const inputId = props.name;
1639
+ return /* @__PURE__ */ jsxs("div", { className: "usa-form-group", children: [
1640
+ props.label && /* @__PURE__ */ jsx("label", { className: "usa-label", htmlFor: inputId, children: props.label }),
1641
+ /* @__PURE__ */ jsx(
1642
+ "input",
1643
+ {
1644
+ className: "usa-range",
1645
+ id: inputId,
1646
+ name: props.name,
1647
+ type: "range",
1648
+ min: props.min ?? 0,
1649
+ max: props.max ?? 100,
1650
+ step: props.step ?? 1,
1651
+ value,
1652
+ onChange: (e) => {
1653
+ setValue(Number(e.target.value));
1654
+ emit("change");
1655
+ }
1656
+ }
1657
+ )
1658
+ ] });
1659
+ },
1660
+ DateInputGroup: ({
1661
+ props,
1662
+ bindings,
1663
+ emit
1664
+ }) => {
1665
+ const [boundMonth, setBoundMonth] = useBoundProp(
1666
+ props.monthValue,
1667
+ bindings?.monthValue
1668
+ );
1669
+ const [boundDay, setBoundDay] = useBoundProp(
1670
+ props.dayValue,
1671
+ bindings?.dayValue
1672
+ );
1673
+ const [boundYear, setBoundYear] = useBoundProp(
1674
+ props.yearValue,
1675
+ bindings?.yearValue
1676
+ );
1677
+ const [localMonth, setLocalMonth] = useState(props.monthValue ?? "");
1678
+ const [localDay, setLocalDay] = useState(props.dayValue ?? "");
1679
+ const [localYear, setLocalYear] = useState(props.yearValue ?? "");
1680
+ const monthVal = bindings?.monthValue ? boundMonth ?? "" : localMonth;
1681
+ const dayVal = bindings?.dayValue ? boundDay ?? "" : localDay;
1682
+ const yearVal = bindings?.yearValue ? boundYear ?? "" : localYear;
1683
+ const hintId = props.hint ? `${props.name}-hint` : void 0;
1684
+ return /* @__PURE__ */ jsxs("fieldset", { className: "usa-fieldset", children: [
1685
+ /* @__PURE__ */ jsx("legend", { className: "usa-legend", children: props.label }),
1686
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1687
+ /* @__PURE__ */ jsxs("div", { className: "usa-memorable-date", children: [
1688
+ /* @__PURE__ */ jsxs("div", { className: "usa-form-group usa-form-group--month", children: [
1689
+ /* @__PURE__ */ jsx("label", { className: "usa-label", htmlFor: `${props.name}-month`, children: "Month" }),
1690
+ /* @__PURE__ */ jsx(
1691
+ "input",
1692
+ {
1693
+ className: "usa-input usa-input--inline",
1694
+ id: `${props.name}-month`,
1695
+ name: `${props.name}_month`,
1696
+ type: "text",
1697
+ inputMode: "numeric",
1698
+ minLength: 1,
1699
+ maxLength: 2,
1700
+ pattern: "[0-9]*",
1701
+ placeholder: "MM",
1702
+ required: props.required ?? void 0,
1703
+ value: monthVal,
1704
+ "aria-describedby": hintId,
1705
+ onChange: (e) => {
1706
+ const v = e.target.value.replace(/\D/g, "").slice(0, 2);
1707
+ if (bindings?.monthValue) setBoundMonth(v);
1708
+ else setLocalMonth(v);
1709
+ emit("change");
1710
+ }
1711
+ }
1712
+ )
1713
+ ] }),
1714
+ /* @__PURE__ */ jsxs("div", { className: "usa-form-group usa-form-group--day", children: [
1715
+ /* @__PURE__ */ jsx("label", { className: "usa-label", htmlFor: `${props.name}-day`, children: "Day" }),
1716
+ /* @__PURE__ */ jsx(
1717
+ "input",
1718
+ {
1719
+ className: "usa-input usa-input--inline",
1720
+ id: `${props.name}-day`,
1721
+ name: `${props.name}_day`,
1722
+ type: "text",
1723
+ inputMode: "numeric",
1724
+ minLength: 1,
1725
+ maxLength: 2,
1726
+ pattern: "[0-9]*",
1727
+ placeholder: "DD",
1728
+ required: props.required ?? void 0,
1729
+ value: dayVal,
1730
+ onChange: (e) => {
1731
+ const v = e.target.value.replace(/\D/g, "").slice(0, 2);
1732
+ if (bindings?.dayValue) setBoundDay(v);
1733
+ else setLocalDay(v);
1734
+ emit("change");
1735
+ }
1736
+ }
1737
+ )
1738
+ ] }),
1739
+ /* @__PURE__ */ jsxs("div", { className: "usa-form-group usa-form-group--year", children: [
1740
+ /* @__PURE__ */ jsx("label", { className: "usa-label", htmlFor: `${props.name}-year`, children: "Year" }),
1741
+ /* @__PURE__ */ jsx(
1742
+ "input",
1743
+ {
1744
+ className: "usa-input usa-input--inline",
1745
+ id: `${props.name}-year`,
1746
+ name: `${props.name}_year`,
1747
+ type: "text",
1748
+ inputMode: "numeric",
1749
+ minLength: 4,
1750
+ maxLength: 4,
1751
+ pattern: "[0-9]*",
1752
+ placeholder: "YYYY",
1753
+ required: props.required ?? void 0,
1754
+ value: yearVal,
1755
+ onChange: (e) => {
1756
+ const v = e.target.value.replace(/\D/g, "").slice(0, 4);
1757
+ if (bindings?.yearValue) setBoundYear(v);
1758
+ else setLocalYear(v);
1759
+ emit("change");
1760
+ }
1761
+ }
1762
+ )
1763
+ ] })
1764
+ ] })
1765
+ ] });
1766
+ },
1767
+ DateRangePicker: ({
1768
+ props,
1769
+ bindings,
1770
+ emit
1771
+ }) => {
1772
+ const [boundStart, setBoundStart] = useBoundProp(
1773
+ props.startValue,
1774
+ bindings?.startValue
1775
+ );
1776
+ const [boundEnd, setBoundEnd] = useBoundProp(
1777
+ props.endValue,
1778
+ bindings?.endValue
1779
+ );
1780
+ const [localStart, setLocalStart] = useState(props.startValue ?? "");
1781
+ const [localEnd, setLocalEnd] = useState(props.endValue ?? "");
1782
+ const startVal = bindings?.startValue ? boundStart ?? "" : localStart;
1783
+ const endVal = bindings?.endValue ? boundEnd ?? "" : localEnd;
1784
+ const hintId = props.hint ? `${props.startName}-hint` : void 0;
1785
+ return /* @__PURE__ */ jsxs("div", { className: "usa-date-range-picker", children: [
1786
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1787
+ /* @__PURE__ */ jsx("div", { className: "usa-date-range-picker__range-start", children: /* @__PURE__ */ jsxs("div", { className: "usa-form-group", children: [
1788
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: props.startName, children: [
1789
+ props.startLabel,
1790
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1791
+ ] }),
1792
+ /* @__PURE__ */ jsx("div", { className: "usa-date-picker", children: /* @__PURE__ */ jsx(
1793
+ "input",
1794
+ {
1795
+ className: "usa-input",
1796
+ id: props.startName,
1797
+ name: props.startName,
1798
+ type: "date",
1799
+ required: props.required ?? void 0,
1800
+ min: props.minDate ?? void 0,
1801
+ max: endVal || props.maxDate || void 0,
1802
+ value: startVal,
1803
+ "aria-describedby": hintId,
1804
+ onChange: (e) => {
1805
+ const v = e.target.value;
1806
+ if (bindings?.startValue) setBoundStart(v);
1807
+ else setLocalStart(v);
1808
+ emit("change");
1809
+ }
1810
+ }
1811
+ ) })
1812
+ ] }) }),
1813
+ /* @__PURE__ */ jsx("div", { className: "usa-date-range-picker__range-end", children: /* @__PURE__ */ jsxs("div", { className: "usa-form-group", children: [
1814
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: props.endName, children: [
1815
+ props.endLabel,
1816
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1817
+ ] }),
1818
+ /* @__PURE__ */ jsx("div", { className: "usa-date-picker", children: /* @__PURE__ */ jsx(
1819
+ "input",
1820
+ {
1821
+ className: "usa-input",
1822
+ id: props.endName,
1823
+ name: props.endName,
1824
+ type: "date",
1825
+ required: props.required ?? void 0,
1826
+ min: startVal || props.minDate || void 0,
1827
+ max: props.maxDate ?? void 0,
1828
+ value: endVal,
1829
+ onChange: (e) => {
1830
+ const v = e.target.value;
1831
+ if (bindings?.endValue) setBoundEnd(v);
1832
+ else setLocalEnd(v);
1833
+ emit("change");
1834
+ }
1835
+ }
1836
+ ) })
1837
+ ] }) })
1838
+ ] });
1839
+ },
1840
+ InputMask: ({
1841
+ props,
1842
+ bindings,
1843
+ emit
1844
+ }) => {
1845
+ const PRESETS = {
1846
+ phone: "(___) ___-____",
1847
+ zip: "_____",
1848
+ "zip+4": "_____-____",
1849
+ ssn: "___-__-____"
1850
+ };
1851
+ const pattern = props.preset && props.preset !== "custom" ? PRESETS[props.preset] ?? "" : props.pattern ?? "";
1852
+ function applyMask(raw) {
1853
+ const digits = raw.replace(/\D/g, "");
1854
+ let result = "";
1855
+ let di = 0;
1856
+ for (const ch of pattern) {
1857
+ if (di >= digits.length) break;
1858
+ if (ch === "_") {
1859
+ result += digits[di++];
1860
+ } else {
1861
+ result += ch;
1862
+ }
1863
+ }
1864
+ return result;
1865
+ }
1866
+ const [boundValue, setBoundValue] = useBoundProp(
1867
+ props.value,
1868
+ bindings?.value
1869
+ );
1870
+ const [localValue, setLocalValue] = useState(
1871
+ props.value ? applyMask(props.value) : ""
1872
+ );
1873
+ const isBound = !!bindings?.value;
1874
+ const value = isBound ? boundValue ?? "" : localValue;
1875
+ const setValue = isBound ? setBoundValue : setLocalValue;
1876
+ const validateOn = props.validateOn ?? "blur";
1877
+ const hasValidation = !!(bindings?.value && props.checks?.length);
1878
+ const { errors, validate } = useFieldValidation(
1879
+ bindings?.value ?? "",
1880
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
1881
+ );
1882
+ const hasError = errors.length > 0;
1883
+ const inputId = props.name;
1884
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
1885
+ const errorId = hasError ? `${inputId}-error` : void 0;
1886
+ const placeholder = pattern.length > 0 ? pattern : void 0;
1887
+ return /* @__PURE__ */ jsxs(
1888
+ "div",
1889
+ {
1890
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
1891
+ children: [
1892
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
1893
+ props.label,
1894
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1895
+ ] }),
1896
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1897
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
1898
+ /* @__PURE__ */ jsx("div", { className: "usa-input-mask", "data-mask": pattern, children: /* @__PURE__ */ jsx(
1899
+ "input",
1900
+ {
1901
+ className: `usa-masked usa-input${hasError ? " usa-input--error" : ""}`,
1902
+ id: inputId,
1903
+ name: props.name,
1904
+ type: "text",
1905
+ inputMode: "numeric",
1906
+ placeholder,
1907
+ required: props.required ?? void 0,
1908
+ value,
1909
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
1910
+ onChange: (e) => {
1911
+ const masked = applyMask(e.target.value);
1912
+ setValue(masked);
1913
+ if (hasValidation && validateOn === "change") validate();
1914
+ emit("change");
1915
+ },
1916
+ onBlur: () => {
1917
+ if (hasValidation && validateOn === "blur") validate();
1918
+ emit("blur");
1919
+ }
1920
+ }
1921
+ ) })
1922
+ ]
1923
+ }
1924
+ );
1925
+ },
1926
+ Password: ({
1927
+ props,
1928
+ bindings,
1929
+ emit
1930
+ }) => {
1931
+ const [boundValue, setBoundValue] = useBoundProp(
1932
+ props.value,
1933
+ bindings?.value
1934
+ );
1935
+ const [localValue, setLocalValue] = useState("");
1936
+ const isBound = !!bindings?.value;
1937
+ const value = isBound ? boundValue ?? "" : localValue;
1938
+ const setValue = isBound ? setBoundValue : setLocalValue;
1939
+ const [visible, setVisible] = useState(false);
1940
+ const validateOn = props.validateOn ?? "blur";
1941
+ const hasValidation = !!(bindings?.value && props.checks?.length);
1942
+ const { errors, validate } = useFieldValidation(
1943
+ bindings?.value ?? "",
1944
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
1945
+ );
1946
+ const hasError = errors.length > 0;
1947
+ const inputId = props.name;
1948
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
1949
+ const errorId = hasError ? `${inputId}-error` : void 0;
1950
+ return /* @__PURE__ */ jsxs(
1951
+ "div",
1952
+ {
1953
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
1954
+ children: [
1955
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
1956
+ props.label,
1957
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
1958
+ ] }),
1959
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
1960
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
1961
+ /* @__PURE__ */ jsxs("div", { className: "usa-input-group", children: [
1962
+ /* @__PURE__ */ jsx(
1963
+ "input",
1964
+ {
1965
+ className: `usa-input${hasError ? " usa-input--error" : ""}`,
1966
+ id: inputId,
1967
+ name: props.name,
1968
+ type: visible ? "text" : "password",
1969
+ autoComplete: "current-password",
1970
+ required: props.required ?? void 0,
1971
+ value,
1972
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
1973
+ onChange: (e) => {
1974
+ setValue(e.target.value);
1975
+ if (hasValidation && validateOn === "change") validate();
1976
+ emit("change");
1977
+ },
1978
+ onBlur: () => {
1979
+ if (hasValidation && validateOn === "blur") validate();
1980
+ emit("blur");
1981
+ }
1982
+ }
1983
+ ),
1984
+ /* @__PURE__ */ jsx("div", { className: "usa-input-group__append", children: /* @__PURE__ */ jsx(
1985
+ "button",
1986
+ {
1987
+ type: "button",
1988
+ className: "usa-show-password usa-button usa-button--unstyled",
1989
+ "aria-controls": inputId,
1990
+ "aria-label": visible ? "Hide password" : "Show password",
1991
+ onClick: () => setVisible((v) => !v),
1992
+ children: visible ? "Hide password" : "Show password"
1993
+ }
1994
+ ) })
1995
+ ] })
1996
+ ]
1997
+ }
1998
+ );
1999
+ },
2000
+ ComboBox: ({
2001
+ props,
2002
+ bindings,
2003
+ emit
2004
+ }) => {
2005
+ const [boundValue, setBoundValue] = useBoundProp(
2006
+ props.value,
2007
+ bindings?.value
2008
+ );
2009
+ const [localValue, setLocalValue] = useState("");
2010
+ const isBound = !!bindings?.value;
2011
+ const value = isBound ? boundValue ?? "" : localValue;
2012
+ const setValue = isBound ? setBoundValue : setLocalValue;
2013
+ const [query, setQuery] = useState("");
2014
+ const [open, setOpen] = useState(false);
2015
+ const validateOn = props.validateOn ?? "change";
2016
+ const hasValidation = !!(bindings?.value && props.checks?.length);
2017
+ const { errors, validate } = useFieldValidation(
2018
+ bindings?.value ?? "",
2019
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
2020
+ );
2021
+ const allOptions = (props.options ?? []).map(
2022
+ (opt) => typeof opt === "string" ? { label: opt, value: opt } : opt
2023
+ );
2024
+ const filtered = query ? allOptions.filter(
2025
+ (o) => o.label.toLowerCase().includes(query.toLowerCase())
2026
+ ) : allOptions;
2027
+ const selectedLabel = allOptions.find((o) => o.value === value)?.label ?? value;
2028
+ const hasError = errors.length > 0;
2029
+ const inputId = props.name;
2030
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
2031
+ const errorId = hasError ? `${inputId}-error` : void 0;
2032
+ return /* @__PURE__ */ jsxs(
2033
+ "div",
2034
+ {
2035
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
2036
+ children: [
2037
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: `${inputId}-combo`, children: [
2038
+ props.label,
2039
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
2040
+ ] }),
2041
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
2042
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
2043
+ /* @__PURE__ */ jsxs(
2044
+ "div",
2045
+ {
2046
+ className: `usa-combo-box${value ? " usa-combo-box--pristine" : ""}`,
2047
+ style: { position: "relative" },
2048
+ children: [
2049
+ /* @__PURE__ */ jsxs(
2050
+ "select",
2051
+ {
2052
+ className: "usa-select usa-sr-only",
2053
+ name: props.name,
2054
+ id: inputId,
2055
+ "aria-hidden": "true",
2056
+ tabIndex: -1,
2057
+ value,
2058
+ onChange: () => {
2059
+ },
2060
+ required: props.required ?? void 0,
2061
+ children: [
2062
+ props.placeholder && /* @__PURE__ */ jsx("option", { value: "", children: props.placeholder }),
2063
+ allOptions.map((opt) => /* @__PURE__ */ jsx("option", { value: opt.value, children: opt.label }, opt.value))
2064
+ ]
2065
+ }
2066
+ ),
2067
+ /* @__PURE__ */ jsx(
2068
+ "input",
2069
+ {
2070
+ id: `${inputId}-combo`,
2071
+ className: `usa-combo-box__input${hasError ? " usa-input--error" : ""}`,
2072
+ type: "text",
2073
+ autoComplete: "off",
2074
+ role: "combobox",
2075
+ "aria-owns": `${inputId}-list`,
2076
+ "aria-expanded": open,
2077
+ "aria-autocomplete": "list",
2078
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
2079
+ placeholder: props.placeholder ?? void 0,
2080
+ value: open ? query : selectedLabel,
2081
+ onFocus: () => {
2082
+ setOpen(true);
2083
+ setQuery("");
2084
+ },
2085
+ onBlur: () => setTimeout(() => setOpen(false), 150),
2086
+ onChange: (e) => setQuery(e.target.value)
2087
+ }
2088
+ ),
2089
+ /* @__PURE__ */ jsx("span", { className: "usa-combo-box__toggle-list__wrapper", children: /* @__PURE__ */ jsx(
2090
+ "button",
2091
+ {
2092
+ type: "button",
2093
+ className: "usa-combo-box__toggle-list",
2094
+ "aria-label": "Toggle the dropdown list",
2095
+ tabIndex: -1,
2096
+ onClick: () => setOpen((v) => !v),
2097
+ children: "\xA0"
2098
+ }
2099
+ ) }),
2100
+ open && filtered.length > 0 && /* @__PURE__ */ jsx(
2101
+ "ul",
2102
+ {
2103
+ id: `${inputId}-list`,
2104
+ className: "usa-combo-box__list",
2105
+ role: "listbox",
2106
+ "aria-label": props.label,
2107
+ style: {
2108
+ position: "absolute",
2109
+ zIndex: 100,
2110
+ width: "100%",
2111
+ background: "#fff",
2112
+ border: "1px solid #565c65",
2113
+ maxHeight: 220,
2114
+ overflowY: "auto",
2115
+ margin: 0,
2116
+ padding: 0,
2117
+ listStyle: "none"
2118
+ },
2119
+ children: filtered.map((opt) => /* @__PURE__ */ jsx(
2120
+ "li",
2121
+ {
2122
+ className: `usa-combo-box__list-option${value === opt.value ? " usa-combo-box__list-option--selected" : ""}`,
2123
+ role: "option",
2124
+ "aria-selected": value === opt.value,
2125
+ "aria-setsize": filtered.length,
2126
+ style: { padding: "0.5rem 1rem", cursor: "pointer" },
2127
+ onMouseDown: () => {
2128
+ setValue(opt.value);
2129
+ setQuery("");
2130
+ setOpen(false);
2131
+ if (hasValidation && validateOn === "change") validate();
2132
+ emit("change");
2133
+ },
2134
+ children: opt.label
2135
+ },
2136
+ opt.value
2137
+ ))
2138
+ }
2139
+ )
2140
+ ]
2141
+ }
2142
+ )
2143
+ ]
2144
+ }
2145
+ );
2146
+ },
2147
+ DatePicker: ({
2148
+ props,
2149
+ bindings,
2150
+ emit
2151
+ }) => {
2152
+ const [boundValue, setBoundValue] = useBoundProp(
2153
+ props.value,
2154
+ bindings?.value
2155
+ );
2156
+ const [localValue, setLocalValue] = useState(props.value ?? "");
2157
+ const isBound = !!bindings?.value;
2158
+ const value = isBound ? boundValue ?? "" : localValue;
2159
+ const setValue = isBound ? setBoundValue : setLocalValue;
2160
+ const validateOn = props.validateOn ?? "change";
2161
+ const hasValidation = !!(bindings?.value && props.checks?.length);
2162
+ const { errors, validate } = useFieldValidation(
2163
+ bindings?.value ?? "",
2164
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
2165
+ );
2166
+ const hasError = errors.length > 0;
2167
+ const inputId = props.name;
2168
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
2169
+ const errorId = hasError ? `${inputId}-error` : void 0;
2170
+ return /* @__PURE__ */ jsxs(
2171
+ "div",
2172
+ {
2173
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
2174
+ children: [
2175
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
2176
+ props.label,
2177
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
2178
+ ] }),
2179
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint ?? "mm/dd/yyyy" }),
2180
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
2181
+ /* @__PURE__ */ jsx("div", { className: "usa-date-picker", children: /* @__PURE__ */ jsx(
2182
+ "input",
2183
+ {
2184
+ className: `usa-input${hasError ? " usa-input--error" : ""}`,
2185
+ id: inputId,
2186
+ name: props.name,
2187
+ type: "date",
2188
+ required: props.required ?? void 0,
2189
+ min: props.minDate ?? void 0,
2190
+ max: props.maxDate ?? void 0,
2191
+ value,
2192
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
2193
+ onChange: (e) => {
2194
+ setValue(e.target.value);
2195
+ if (hasValidation && validateOn === "change") validate();
2196
+ emit("change");
2197
+ },
2198
+ onBlur: () => {
2199
+ if (hasValidation && validateOn === "blur") validate();
2200
+ }
2201
+ }
2202
+ ) })
2203
+ ]
2204
+ }
2205
+ );
2206
+ },
2207
+ TimePicker: ({
2208
+ props,
2209
+ bindings,
2210
+ emit
2211
+ }) => {
2212
+ const [boundValue, setBoundValue] = useBoundProp(
2213
+ props.value,
2214
+ bindings?.value
2215
+ );
2216
+ const [localValue, setLocalValue] = useState(props.value ?? "");
2217
+ const isBound = !!bindings?.value;
2218
+ const value = isBound ? boundValue ?? "" : localValue;
2219
+ const setValue = isBound ? setBoundValue : setLocalValue;
2220
+ const step = props.step ?? 30;
2221
+ const toMinutes = (t) => {
2222
+ const [h, m] = t.split(":").map(Number);
2223
+ return (h ?? 0) * 60 + (m ?? 0);
2224
+ };
2225
+ const toTime = (mins) => {
2226
+ const h = Math.floor(mins / 60);
2227
+ const m = mins % 60;
2228
+ return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
2229
+ };
2230
+ const minMins = props.minTime ? toMinutes(props.minTime) : 0;
2231
+ const maxMins = props.maxTime ? toMinutes(props.maxTime) : 23 * 60 + 59;
2232
+ const options = [];
2233
+ for (let m = minMins; m <= maxMins; m += step) {
2234
+ options.push(toTime(m));
2235
+ }
2236
+ const formatDisplay = (t) => {
2237
+ if (!t) return "";
2238
+ const [h, m] = t.split(":").map(Number);
2239
+ const hour = h ?? 0;
2240
+ const suffix = hour >= 12 ? "p.m." : "a.m.";
2241
+ const displayH = hour % 12 || 12;
2242
+ return `${displayH}:${String(m ?? 0).padStart(2, "0")} ${suffix}`;
2243
+ };
2244
+ const inputId = props.name;
2245
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
2246
+ return /* @__PURE__ */ jsxs("div", { className: "usa-form-group", children: [
2247
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
2248
+ props.label,
2249
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
2250
+ ] }),
2251
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
2252
+ /* @__PURE__ */ jsx("div", { className: "usa-time-picker", children: /* @__PURE__ */ jsxs(
2253
+ "select",
2254
+ {
2255
+ className: "usa-select",
2256
+ id: inputId,
2257
+ name: props.name,
2258
+ required: props.required ?? void 0,
2259
+ value,
2260
+ "aria-describedby": hintId,
2261
+ onChange: (e) => {
2262
+ setValue(e.target.value);
2263
+ emit("change");
2264
+ },
2265
+ children: [
2266
+ /* @__PURE__ */ jsx("option", { value: "", children: "- Select -" }),
2267
+ options.map((t) => /* @__PURE__ */ jsx("option", { value: t, children: formatDisplay(t) }, t))
2268
+ ]
2269
+ }
2270
+ ) })
2271
+ ] });
2272
+ },
2273
+ CharacterCount: ({
2274
+ props,
2275
+ bindings,
2276
+ emit
2277
+ }) => {
2278
+ const [boundValue, setBoundValue] = useBoundProp(
2279
+ props.value,
2280
+ bindings?.value
2281
+ );
2282
+ const [localValue, setLocalValue] = useState(props.value ?? "");
2283
+ const isBound = !!bindings?.value;
2284
+ const value = isBound ? boundValue ?? "" : localValue;
2285
+ const setValue = isBound ? setBoundValue : setLocalValue;
2286
+ const validateOn = props.validateOn ?? "change";
2287
+ const hasValidation = !!(bindings?.value && props.checks?.length);
2288
+ const { errors, validate } = useFieldValidation(
2289
+ bindings?.value ?? "",
2290
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
2291
+ );
2292
+ const remaining = props.maxLength - value.length;
2293
+ const isOver = remaining < 0;
2294
+ const hasError = errors.length > 0 || isOver;
2295
+ const inputId = props.name;
2296
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
2297
+ const statusId = `${inputId}-status`;
2298
+ const errorId = hasError ? `${inputId}-error` : void 0;
2299
+ const sharedProps = {
2300
+ id: inputId,
2301
+ name: props.name,
2302
+ className: `usa-${props.multiline ? "textarea" : "input"}${hasError ? " usa-input--error" : ""}`,
2303
+ maxLength: props.maxLength,
2304
+ required: props.required ?? void 0,
2305
+ value,
2306
+ "aria-describedby": [hintId, statusId, errorId].filter(Boolean).join(" "),
2307
+ onChange: (e) => {
2308
+ setValue(e.target.value);
2309
+ if (hasValidation && validateOn === "change") validate();
2310
+ emit("change");
2311
+ },
2312
+ onBlur: () => {
2313
+ if (hasValidation && validateOn === "blur") validate();
2314
+ }
2315
+ };
2316
+ return /* @__PURE__ */ jsxs(
2317
+ "div",
2318
+ {
2319
+ className: `usa-form-group usa-character-count${hasError ? " usa-form-group--error" : ""}`,
2320
+ children: [
2321
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
2322
+ props.label,
2323
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
2324
+ ] }),
2325
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
2326
+ isOver && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: `${Math.abs(remaining)} characters over limit` }),
2327
+ !isOver && errors.length > 0 && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
2328
+ props.multiline ? /* @__PURE__ */ jsx("textarea", { ...sharedProps, rows: props.rows ?? 4 }) : /* @__PURE__ */ jsx("input", { ...sharedProps, type: "text" }),
2329
+ /* @__PURE__ */ jsx(
2330
+ "span",
2331
+ {
2332
+ id: statusId,
2333
+ className: `usa-character-count__status${isOver ? " usa-character-count__status--invalid" : ""}`,
2334
+ "aria-live": "polite",
2335
+ children: isOver ? `${Math.abs(remaining)} characters over limit` : `${remaining} characters allowed`
2336
+ }
2337
+ )
2338
+ ]
2339
+ }
2340
+ );
2341
+ },
2342
+ // ── Additional Display ────────────────────────────────────────────────
2343
+ Icon: ({ props }) => {
2344
+ const sizeClass = props.size ? ` usa-icon--size-${props.size}` : "";
2345
+ const colorClass = props.color ? ` ${props.color}` : "";
2346
+ const iconPaths = {
2347
+ check: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",
2348
+ 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",
2349
+ 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",
2350
+ 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",
2351
+ 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",
2352
+ arrow_forward: "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z",
2353
+ arrow_back: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z",
2354
+ 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",
2355
+ warning: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z",
2356
+ 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",
2357
+ 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",
2358
+ menu: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z",
2359
+ expand_more: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z",
2360
+ expand_less: "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",
2361
+ 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",
2362
+ 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",
2363
+ 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",
2364
+ home: "M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z",
2365
+ 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",
2366
+ 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"
2367
+ };
2368
+ const path = iconPaths[props.name] ?? iconPaths["info"];
2369
+ const isAriaHidden = !props.ariaLabel;
2370
+ return /* @__PURE__ */ jsx(
2371
+ "svg",
2372
+ {
2373
+ className: `usa-icon${sizeClass}${colorClass}`,
2374
+ "aria-hidden": isAriaHidden ? true : void 0,
2375
+ "aria-label": props.ariaLabel ?? void 0,
2376
+ role: props.ariaLabel ? "img" : void 0,
2377
+ viewBox: "0 0 24 24",
2378
+ xmlns: "http://www.w3.org/2000/svg",
2379
+ children: /* @__PURE__ */ jsx("path", { d: path })
2380
+ }
2381
+ );
2382
+ },
2383
+ InputGroup: ({
2384
+ props,
2385
+ bindings,
2386
+ emit
2387
+ }) => {
2388
+ const [boundValue, setBoundValue] = useBoundProp(
2389
+ props.value,
2390
+ bindings?.value
2391
+ );
2392
+ const [localValue, setLocalValue] = useState("");
2393
+ const isBound = !!bindings?.value;
2394
+ const value = isBound ? boundValue ?? "" : localValue;
2395
+ const setValue = isBound ? setBoundValue : setLocalValue;
2396
+ const validateOn = props.validateOn ?? "blur";
2397
+ const hasValidation = !!(bindings?.value && props.checks?.length);
2398
+ const { errors, validate } = useFieldValidation(
2399
+ bindings?.value ?? "",
2400
+ hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
2401
+ );
2402
+ const hasError = errors.length > 0;
2403
+ const inputId = props.name;
2404
+ const hintId = props.hint ? `${inputId}-hint` : void 0;
2405
+ const errorId = hasError ? `${inputId}-error` : void 0;
2406
+ return /* @__PURE__ */ jsxs(
2407
+ "div",
2408
+ {
2409
+ className: `usa-form-group${hasError ? " usa-form-group--error" : ""}`,
2410
+ children: [
2411
+ /* @__PURE__ */ jsxs("label", { className: "usa-label", htmlFor: inputId, children: [
2412
+ props.label,
2413
+ props.required && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: " (required)" })
2414
+ ] }),
2415
+ props.hint && /* @__PURE__ */ jsx("span", { className: "usa-hint", id: hintId, children: props.hint }),
2416
+ hasError && /* @__PURE__ */ jsx("span", { className: "usa-error-message", id: errorId, role: "alert", children: errors[0] }),
2417
+ /* @__PURE__ */ jsxs(
2418
+ "div",
2419
+ {
2420
+ className: `usa-input-group${hasError ? " usa-input-group--error" : ""}`,
2421
+ children: [
2422
+ props.prefix && /* @__PURE__ */ jsx("div", { className: "usa-input-prefix", "aria-hidden": "true", children: props.prefix }),
2423
+ /* @__PURE__ */ jsx(
2424
+ "input",
2425
+ {
2426
+ className: `usa-input${hasError ? " usa-input--error" : ""}`,
2427
+ id: inputId,
2428
+ name: props.name,
2429
+ type: props.type ?? "text",
2430
+ placeholder: props.placeholder ?? void 0,
2431
+ required: props.required ?? void 0,
2432
+ disabled: props.disabled ?? void 0,
2433
+ value,
2434
+ "aria-describedby": [hintId, errorId].filter(Boolean).join(" ") || void 0,
2435
+ onChange: (e) => {
2436
+ setValue(e.target.value);
2437
+ if (hasValidation && validateOn === "change") validate();
2438
+ emit("change");
2439
+ },
2440
+ onBlur: () => {
2441
+ if (hasValidation && validateOn === "blur") validate();
2442
+ emit("blur");
2443
+ }
2444
+ }
2445
+ ),
2446
+ props.suffix && /* @__PURE__ */ jsx("div", { className: "usa-input-suffix", "aria-hidden": "true", children: props.suffix })
2447
+ ]
2448
+ }
2449
+ )
2450
+ ]
2451
+ }
2452
+ );
2453
+ },
2454
+ List: ({ props }) => {
2455
+ const items = props.items ?? [];
2456
+ const variant = props.variant ?? "unordered";
2457
+ const className = variant === "unstyled" ? "usa-list usa-list--unstyled" : "usa-list";
2458
+ if (variant === "ordered") {
2459
+ return /* @__PURE__ */ jsx("ol", { className, children: items.map((item, i) => /* @__PURE__ */ jsx("li", { children: item }, i)) });
2460
+ }
2461
+ return /* @__PURE__ */ jsx("ul", { className, children: items.map((item, i) => /* @__PURE__ */ jsx("li", { children: item }, i)) });
2462
+ },
2463
+ ValidationChecklist: ({
2464
+ props
2465
+ }) => {
2466
+ const items = props.items ?? [];
2467
+ return /* @__PURE__ */ jsxs("div", { children: [
2468
+ props.heading && /* @__PURE__ */ jsx("p", { className: "usa-prose", children: /* @__PURE__ */ jsx("strong", { children: props.heading }) }),
2469
+ /* @__PURE__ */ jsx("ul", { className: "usa-checklist", children: items.map((item, i) => /* @__PURE__ */ jsx(
2470
+ "li",
2471
+ {
2472
+ className: `usa-checklist__item${item.checked ? " usa-checklist__item--checked" : ""}`,
2473
+ children: item.label
2474
+ },
2475
+ i
2476
+ )) })
2477
+ ] });
2478
+ },
2479
+ // ── Page-level / Layout Components ───────────────────────────────────
2480
+ Form: ({ props, children, emit }) => {
2481
+ return /* @__PURE__ */ jsx(
2482
+ "form",
2483
+ {
2484
+ className: `usa-form${props.large ? " usa-form--large" : ""}`,
2485
+ onSubmit: (e) => {
2486
+ e.preventDefault();
2487
+ emit("submit");
2488
+ },
2489
+ children
2490
+ }
2491
+ );
2492
+ },
2493
+ Section: ({ props, children }) => {
2494
+ const variantClass = props.variant === "light" ? " usa-section--light" : props.variant === "dark" ? " usa-section--dark" : "";
2495
+ return /* @__PURE__ */ jsx("section", { className: `usa-section${variantClass}`, children: /* @__PURE__ */ jsxs("div", { className: "grid-container", children: [
2496
+ props.title && /* @__PURE__ */ jsx("h2", { className: "usa-prose", children: props.title }),
2497
+ props.text && /* @__PURE__ */ jsx("p", { className: "usa-prose", children: props.text }),
2498
+ children
2499
+ ] }) });
2500
+ },
2501
+ Prose: ({ props, children }) => {
2502
+ const element = props.element ?? "div";
2503
+ if (element === "article")
2504
+ return /* @__PURE__ */ jsx("article", { className: "usa-prose", children });
2505
+ if (element === "section")
2506
+ return /* @__PURE__ */ jsx("section", { children });
2507
+ if (element === "main")
2508
+ return /* @__PURE__ */ jsx("main", { children });
2509
+ return /* @__PURE__ */ jsx("div", { children });
2510
+ },
2511
+ Hero: ({ props }) => {
2512
+ return /* @__PURE__ */ jsx(
2513
+ "section",
2514
+ {
2515
+ className: "usa-hero",
2516
+ "aria-label": props.ariaLabel ?? "Introduction",
2517
+ style: props.backgroundUrl ? { backgroundImage: `url(${safeCssUrl(props.backgroundUrl)})` } : void 0,
2518
+ children: /* @__PURE__ */ jsx("div", { className: "grid-container", children: /* @__PURE__ */ jsxs("div", { className: "usa-hero__callout", children: [
2519
+ /* @__PURE__ */ jsxs("h1", { className: "usa-hero__heading", children: [
2520
+ props.eyebrow && /* @__PURE__ */ jsx("span", { className: "usa-hero__heading--alt", children: props.eyebrow }),
2521
+ props.heading
2522
+ ] }),
2523
+ props.body && /* @__PURE__ */ jsx("p", { children: props.body })
2524
+ ] }) })
2525
+ }
2526
+ );
2527
+ },
2528
+ GraphicList: ({ props }) => {
2529
+ const items = props.items ?? [];
2530
+ return /* @__PURE__ */ jsx("section", { className: "usa-graphic-list usa-section", children: /* @__PURE__ */ jsxs("div", { className: "grid-container", children: [
2531
+ props.heading && /* @__PURE__ */ jsx("h2", { className: "usa-graphic-list__heading", children: props.heading }),
2532
+ /* @__PURE__ */ jsx("div", { className: "usa-graphic-list__row grid-row grid-gap", children: items.map((item, i) => /* @__PURE__ */ jsxs("div", { className: "usa-media-block tablet:grid-col", children: [
2533
+ item.imageUrl && /* @__PURE__ */ jsx(
2534
+ "img",
2535
+ {
2536
+ className: "usa-media-block__img",
2537
+ src: item.imageUrl,
2538
+ alt: item.imageAlt ?? ""
2539
+ }
2540
+ ),
2541
+ /* @__PURE__ */ jsxs("div", { className: "usa-media-block__body", children: [
2542
+ /* @__PURE__ */ jsx("h3", { className: "usa-graphic-list__heading", children: item.heading }),
2543
+ /* @__PURE__ */ jsx("p", { children: item.content })
2544
+ ] })
2545
+ ] }, i)) })
2546
+ ] }) });
2547
+ },
2548
+ EmbedContainer: ({
2549
+ props
2550
+ }) => {
2551
+ return /* @__PURE__ */ jsx("div", { className: "usa-embed-container", children: /* @__PURE__ */ jsx(
2552
+ "iframe",
2553
+ {
2554
+ src: safeHref(props.src),
2555
+ title: props.title,
2556
+ sandbox: "allow-scripts allow-same-origin allow-fullscreen allow-forms allow-popups",
2557
+ allowFullScreen: true,
2558
+ loading: "lazy",
2559
+ referrerPolicy: "no-referrer-when-downgrade"
2560
+ }
2561
+ ) });
2562
+ },
2563
+ // ── Overlay / Modal ───────────────────────────────────────────────────
2564
+ Modal: ({ props, children }) => {
2565
+ const [open, setOpen] = useStateBinding(props.openPath ?? "");
2566
+ const isOpen = open ?? false;
2567
+ const uid = useId();
2568
+ const modalId = `${uid}-modal`;
2569
+ return /* @__PURE__ */ jsx(Fragment, { children: isOpen && /* @__PURE__ */ jsx(
2570
+ "div",
2571
+ {
2572
+ className: "usa-modal-overlay",
2573
+ "aria-controls": modalId,
2574
+ "data-open-modal": true,
2575
+ onClick: (e) => {
2576
+ if (e.target === e.currentTarget) setOpen(false);
2577
+ },
2578
+ children: /* @__PURE__ */ jsx(
2579
+ "div",
2580
+ {
2581
+ className: `usa-modal${props.large ? " usa-modal--lg" : ""}`,
2582
+ id: modalId,
2583
+ "aria-labelledby": `${modalId}-heading`,
2584
+ "aria-describedby": `${modalId}-description`,
2585
+ role: "dialog",
2586
+ children: /* @__PURE__ */ jsxs("div", { className: "usa-modal__content", children: [
2587
+ /* @__PURE__ */ jsxs("div", { className: "usa-modal__main", children: [
2588
+ /* @__PURE__ */ jsx("h2", { className: "usa-modal__heading", id: `${modalId}-heading`, children: props.heading }),
2589
+ /* @__PURE__ */ jsxs("div", { className: "usa-prose", id: `${modalId}-description`, children: [
2590
+ props.description && /* @__PURE__ */ jsx("p", { children: props.description }),
2591
+ children
2592
+ ] })
2593
+ ] }),
2594
+ /* @__PURE__ */ jsx(
2595
+ "button",
2596
+ {
2597
+ type: "button",
2598
+ className: "usa-button usa-modal__close",
2599
+ "aria-label": "Close this window",
2600
+ onClick: () => setOpen(false),
2601
+ children: /* @__PURE__ */ jsx(
2602
+ "svg",
2603
+ {
2604
+ className: "usa-icon",
2605
+ "aria-hidden": "true",
2606
+ focusable: "false",
2607
+ role: "img",
2608
+ viewBox: "0 0 24 24",
2609
+ width: "24",
2610
+ height: "24",
2611
+ children: /* @__PURE__ */ 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" })
2612
+ }
2613
+ )
2614
+ }
2615
+ )
2616
+ ] })
2617
+ }
2618
+ )
2619
+ }
2620
+ ) });
2621
+ }
2622
+ };
2623
+ export {
2624
+ uswdsComponentDefinitions,
2625
+ uswdsComponents
2626
+ };
2627
+ //# sourceMappingURL=index.mjs.map