@solexllc/usx-react 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/README.md +45 -0
- package/dist/index.cjs +6017 -0
- package/dist/index.js +6015 -0
- package/package.json +48 -0
- package/src/components/accordion/Accordion.jsx +170 -0
- package/src/components/accordion/accordion.django.html +47 -0
- package/src/components/accordion/accordion.html +304 -0
- package/src/components/accordion/config.json +31 -0
- package/src/components/alert/Alert.tsx +88 -0
- package/src/components/alert/alert.django.html +45 -0
- package/src/components/alert/alert.html +192 -0
- package/src/components/alert/config.json +70 -0
- package/src/components/attribution/Attribution.tsx +40 -0
- package/src/components/attribution/attribution.django.html +21 -0
- package/src/components/attribution/attribution.html +26 -0
- package/src/components/attribution/config.json +32 -0
- package/src/components/avatar/Avatar.tsx +85 -0
- package/src/components/avatar/avatar.django.html +27 -0
- package/src/components/avatar/avatar.html +101 -0
- package/src/components/avatar/config.json +59 -0
- package/src/components/avatar-group/AvatarGroup.tsx +43 -0
- package/src/components/avatar-group/avatar-group.django.html +8 -0
- package/src/components/avatar-group/avatar-group.html +208 -0
- package/src/components/avatar-group/config.json +60 -0
- package/src/components/back-to-top/BackToTop.tsx +60 -0
- package/src/components/back-to-top/back-to-top.django.html +38 -0
- package/src/components/back-to-top/back-to-top.html +107 -0
- package/src/components/back-to-top/config.json +44 -0
- package/src/components/banner/Banner.tsx +111 -0
- package/src/components/banner/banner.django.html +80 -0
- package/src/components/banner/banner.html +411 -0
- package/src/components/banner/config.json +47 -0
- package/src/components/block/Block.tsx +78 -0
- package/src/components/block/block.django.html +26 -0
- package/src/components/block/block.html +162 -0
- package/src/components/block/config.json +88 -0
- package/src/components/breadcrumb/Breadcrumb.tsx +83 -0
- package/src/components/breadcrumb/breadcrumb.django.html +24 -0
- package/src/components/breadcrumb/breadcrumb.html +108 -0
- package/src/components/breadcrumb/config.json +74 -0
- package/src/components/button/Button.tsx +121 -0
- package/src/components/button/button.django.html +58 -0
- package/src/components/button/button.html +363 -0
- package/src/components/button/config.json +103 -0
- package/src/components/button-group/ButtonGroup.tsx +33 -0
- package/src/components/button-group/button-group.django.html +9 -0
- package/src/components/button-group/button-group.html +159 -0
- package/src/components/button-group/config.json +25 -0
- package/src/components/calendar-date/CalendarDate.tsx +40 -0
- package/src/components/calendar-date/calendar-date.django.html +8 -0
- package/src/components/calendar-date/calendar-date.html +17 -0
- package/src/components/calendar-date/config.json +17 -0
- package/src/components/card/Card.tsx +137 -0
- package/src/components/card/card.django.html +40 -0
- package/src/components/card/card.html +67 -0
- package/src/components/card/config.json +115 -0
- package/src/components/card-group/CardGroup.tsx +23 -0
- package/src/components/card-group/card-group.django.html +6 -0
- package/src/components/card-group/card-group.html +164 -0
- package/src/components/card-group/config.json +21 -0
- package/src/components/carousel/Carousel.tsx +101 -0
- package/src/components/carousel/carousel.django.html +41 -0
- package/src/components/carousel/carousel.html +64 -0
- package/src/components/carousel/config.json +38 -0
- package/src/components/character-count/CharacterCount.tsx +77 -0
- package/src/components/character-count/character-count.django.html +19 -0
- package/src/components/character-count/character-count.html +110 -0
- package/src/components/character-count/config.json +78 -0
- package/src/components/checkbox/Checkbox.tsx +90 -0
- package/src/components/checkbox/checkbox.django.html +16 -0
- package/src/components/checkbox/checkbox.html +266 -0
- package/src/components/checkbox/config.json +71 -0
- package/src/components/checkbox-group/CheckboxGroup.tsx +67 -0
- package/src/components/checkbox-group/checkbox-group.django.html +12 -0
- package/src/components/checkbox-group/checkbox-group.html +36 -0
- package/src/components/checkbox-group/config.json +50 -0
- package/src/components/clickable/Clickable.tsx +78 -0
- package/src/components/clickable/clickable.django.html +5 -0
- package/src/components/clickable/clickable.html +133 -0
- package/src/components/clickable/config.json +26 -0
- package/src/components/code/Code.tsx +60 -0
- package/src/components/code/code.django.html +21 -0
- package/src/components/code/code.html +71 -0
- package/src/components/code/config.json +40 -0
- package/src/components/collection/Collection.tsx +99 -0
- package/src/components/collection/collection.django.html +48 -0
- package/src/components/collection/collection.html +384 -0
- package/src/components/collection/config.json +60 -0
- package/src/components/combobox/Combobox.tsx +114 -0
- package/src/components/combobox/combobox.django.html +61 -0
- package/src/components/combobox/combobox.html +509 -0
- package/src/components/combobox/config.json +80 -0
- package/src/components/copy-to-clipboard/CopyToClipboard.tsx +48 -0
- package/src/components/copy-to-clipboard/config.json +30 -0
- package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +16 -0
- package/src/components/copy-to-clipboard/copy-to-clipboard.html +68 -0
- package/src/components/date-picker/DatePicker.jsx +83 -0
- package/src/components/date-picker/config.json +71 -0
- package/src/components/date-picker/date-picker.django.html +67 -0
- package/src/components/date-picker/date-picker.html +104 -0
- package/src/components/date-range-picker/DateRangePicker.jsx +113 -0
- package/src/components/date-range-picker/config.json +92 -0
- package/src/components/date-range-picker/date-range-picker.django.html +66 -0
- package/src/components/date-range-picker/date-range-picker.html +190 -0
- package/src/components/error-message/ErrorMessage.tsx +23 -0
- package/src/components/error-message/config.json +19 -0
- package/src/components/error-message/error-message.django.html +2 -0
- package/src/components/error-message/error-message.html +2 -0
- package/src/components/eyebrow/Eyebrow.tsx +15 -0
- package/src/components/eyebrow/config.json +15 -0
- package/src/components/eyebrow/eyebrow.django.html +4 -0
- package/src/components/eyebrow/eyebrow.html +4 -0
- package/src/components/fieldset/Fieldset.tsx +54 -0
- package/src/components/fieldset/config.json +47 -0
- package/src/components/fieldset/fieldset.django.html +22 -0
- package/src/components/fieldset/fieldset.html +17 -0
- package/src/components/file-input/FileInput.jsx +174 -0
- package/src/components/file-input/config.json +80 -0
- package/src/components/file-input/file-input.django.html +57 -0
- package/src/components/file-input/file-input.html +258 -0
- package/src/components/file-list/FileList.jsx +105 -0
- package/src/components/file-list/config.json +43 -0
- package/src/components/file-list/file-list.django.html +30 -0
- package/src/components/file-list/file-list.html +61 -0
- package/src/components/footer/Footer.tsx +365 -0
- package/src/components/footer/config.json +83 -0
- package/src/components/footer/footer.django.html +260 -0
- package/src/components/footer/footer.html +392 -0
- package/src/components/form-group/FormGroup.tsx +26 -0
- package/src/components/form-group/config.json +22 -0
- package/src/components/form-group/form-group.django.html +4 -0
- package/src/components/form-group/form-group.html +17 -0
- package/src/components/header/Branding.tsx +101 -0
- package/src/components/header/Header.tsx +229 -0
- package/src/components/header/HeaderBranding.jsx +4 -0
- package/src/components/header/config.json +58 -0
- package/src/components/header/header.django.html +194 -0
- package/src/components/header/header.html +823 -0
- package/src/components/hero/Hero.tsx +64 -0
- package/src/components/hero/config.json +70 -0
- package/src/components/hero/hero.django.html +22 -0
- package/src/components/hero/hero.html +75 -0
- package/src/components/hint/Hint.tsx +23 -0
- package/src/components/hint/config.json +19 -0
- package/src/components/hint/hint.django.html +2 -0
- package/src/components/hint/hint.html +2 -0
- package/src/components/icon/Icon.tsx +46 -0
- package/src/components/icon/config.json +60 -0
- package/src/components/icon/icon.django.html +26 -0
- package/src/components/icon/icon.html +289 -0
- package/src/components/icon/icons_list.json +247 -0
- package/src/components/icon-list/IconList.tsx +59 -0
- package/src/components/icon-list/config.json +86 -0
- package/src/components/icon-list/icon-list.django.html +17 -0
- package/src/components/icon-list/icon-list.html +227 -0
- package/src/components/identifier/Identifier.tsx +193 -0
- package/src/components/identifier/config.json +133 -0
- package/src/components/identifier/identifier.django.html +99 -0
- package/src/components/identifier/identifier.html +737 -0
- package/src/components/image/Image.tsx +106 -0
- package/src/components/image/config.json +64 -0
- package/src/components/image/image.django.html +62 -0
- package/src/components/image/image.html +53 -0
- package/src/components/in-page-nav/InPageNav.jsx +76 -0
- package/src/components/in-page-nav/config.json +69 -0
- package/src/components/in-page-nav/in-page-nav.django.html +28 -0
- package/src/components/in-page-nav/in-page-nav.html +183 -0
- package/src/components/indicator/Indicator.tsx +32 -0
- package/src/components/indicator/README.md +1 -0
- package/src/components/indicator/config.json +19 -0
- package/src/components/indicator/indicator.django.html +10 -0
- package/src/components/indicator/indicator.html +42 -0
- package/src/components/input/Input.tsx +85 -0
- package/src/components/input/config.json +73 -0
- package/src/components/input/input.django.html +55 -0
- package/src/components/input/input.html +59 -0
- package/src/components/label/Label.tsx +42 -0
- package/src/components/label/config.json +39 -0
- package/src/components/label/label.django.html +23 -0
- package/src/components/label/label.html +23 -0
- package/src/components/language-selector/LanguageSelector.jsx +224 -0
- package/src/components/language-selector/config.json +107 -0
- package/src/components/language-selector/language-selector.django.html +40 -0
- package/src/components/language-selector/language-selector.html +85 -0
- package/src/components/layout/Layout.tsx +131 -0
- package/src/components/layout/config.json +36 -0
- package/src/components/layout/layout.django.html +28 -0
- package/src/components/layout/layout.html +29 -0
- package/src/components/legend/Legend.tsx +34 -0
- package/src/components/legend/config.json +27 -0
- package/src/components/legend/legend.django.html +11 -0
- package/src/components/legend/legend.html +12 -0
- package/src/components/link/Link.tsx +45 -0
- package/src/components/link/config.json +39 -0
- package/src/components/link/link.django.html +8 -0
- package/src/components/link/link.html +47 -0
- package/src/components/list/List.tsx +82 -0
- package/src/components/list/_list-items.django.html +17 -0
- package/src/components/list/config.json +25 -0
- package/src/components/list/list.django.html +11 -0
- package/src/components/list/list.html +26 -0
- package/src/components/memorable-date/MemorableDate.jsx +167 -0
- package/src/components/memorable-date/config.json +104 -0
- package/src/components/memorable-date/memorable-date.django.html +86 -0
- package/src/components/memorable-date/memorable-date.html +275 -0
- package/src/components/misc-banner/MiscBanner.tsx +112 -0
- package/src/components/misc-banner/config.json +57 -0
- package/src/components/misc-banner/misc-banner.django.html +63 -0
- package/src/components/misc-banner/misc-banner.html +191 -0
- package/src/components/modal/Modal.tsx +71 -0
- package/src/components/modal/config.json +57 -0
- package/src/components/modal/modal.django.html +43 -0
- package/src/components/modal/modal.html +222 -0
- package/src/components/page/Page.jsx +34 -0
- package/src/components/page/config.json +34 -0
- package/src/components/page/page.django.html +5 -0
- package/src/components/page/page.html +23 -0
- package/src/components/pagination/Pagination.tsx +112 -0
- package/src/components/pagination/config.json +135 -0
- package/src/components/pagination/container/PaginationContainer.tsx +38 -0
- package/src/components/pagination/navigation/PaginationNavigation.tsx +219 -0
- package/src/components/pagination/navigation/pagination-navigation.django.html +64 -0
- package/src/components/pagination/pagination.django.html +48 -0
- package/src/components/pagination/pagination.html +613 -0
- package/src/components/pagination/step-options/PaginationStepOptions.tsx +43 -0
- package/src/components/pagination/step-options/pagination-step-options.django.html +7 -0
- package/src/components/pagination/summary/PaginationSummary.tsx +33 -0
- package/src/components/pagination/summary/pagination-summary.django.html +12 -0
- package/src/components/process-list/ProcessList.tsx +52 -0
- package/src/components/process-list/config.json +15 -0
- package/src/components/process-list/process-list.django.html +15 -0
- package/src/components/process-list/process-list.html +90 -0
- package/src/components/prose/Prose.tsx +32 -0
- package/src/components/prose/config.json +28 -0
- package/src/components/prose/prose.django.html +35 -0
- package/src/components/prose/prose.html +91 -0
- package/src/components/radio-buttons/RadioButtons.tsx +82 -0
- package/src/components/radio-buttons/config.json +57 -0
- package/src/components/radio-buttons/radio-buttons.django.html +28 -0
- package/src/components/radio-buttons/radio-buttons.html +189 -0
- package/src/components/range-slider/RangeSlider.jsx +84 -0
- package/src/components/range-slider/config.json +89 -0
- package/src/components/range-slider/range-slider.django.html +65 -0
- package/src/components/range-slider/range-slider.html +106 -0
- package/src/components/required/Required.tsx +25 -0
- package/src/components/required/config.json +20 -0
- package/src/components/required/required.django.html +2 -0
- package/src/components/required/required.html +6 -0
- package/src/components/search/Search.tsx +92 -0
- package/src/components/search/config.json +69 -0
- package/src/components/search/search.django.html +59 -0
- package/src/components/search/search.html +76 -0
- package/src/components/section/Section.tsx +28 -0
- package/src/components/section/config.json +27 -0
- package/src/components/section/section.django.html +5 -0
- package/src/components/section/section.html +16 -0
- package/src/components/select/Select.tsx +107 -0
- package/src/components/select/config.json +80 -0
- package/src/components/select/select.django.html +64 -0
- package/src/components/select/select.html +62 -0
- package/src/components/sidenav/SideNav.tsx +74 -0
- package/src/components/sidenav/config.json +45 -0
- package/src/components/sidenav/sidenav.django.html +29 -0
- package/src/components/sidenav/sidenav.html +84 -0
- package/src/components/site-alert/SiteAlert.tsx +101 -0
- package/src/components/site-alert/config.json +62 -0
- package/src/components/site-alert/site-alert.django.html +34 -0
- package/src/components/site-alert/site-alert.html +312 -0
- package/src/components/skipnav/Skipnav.tsx +41 -0
- package/src/components/skipnav/config.json +29 -0
- package/src/components/skipnav/skipnav.django.html +11 -0
- package/src/components/skipnav/skipnav.html +1 -0
- package/src/components/spinner/Spinner.tsx +46 -0
- package/src/components/spinner/config.json +44 -0
- package/src/components/spinner/spinner.django.html +8 -0
- package/src/components/spinner/spinner.html +219 -0
- package/src/components/status/Status.tsx +28 -0
- package/src/components/status/config.json +47 -0
- package/src/components/status/status.django.html +2 -0
- package/src/components/status/status.html +31 -0
- package/src/components/step-indicator/StepIndicator.tsx +80 -0
- package/src/components/step-indicator/config.json +54 -0
- package/src/components/step-indicator/step-indicator.django.html +29 -0
- package/src/components/step-indicator/step-indicator.html +243 -0
- package/src/components/summary-box/SummaryBox.tsx +41 -0
- package/src/components/summary-box/config.json +30 -0
- package/src/components/summary-box/summary-box.django.html +19 -0
- package/src/components/summary-box/summary-box.html +210 -0
- package/src/components/swap/Swap.tsx +47 -0
- package/src/components/swap/config.json +61 -0
- package/src/components/swap/swap.django.html +14 -0
- package/src/components/swap/swap.html +163 -0
- package/src/components/switch/Switch.tsx +73 -0
- package/src/components/switch/config.json +55 -0
- package/src/components/switch/switch.django.html +28 -0
- package/src/components/switch/switch.html +56 -0
- package/src/components/table/Table.tsx +334 -0
- package/src/components/table/TableBody.tsx +253 -0
- package/src/components/table/TableCell.tsx +37 -0
- package/src/components/table/TableContext.tsx +87 -0
- package/src/components/table/TableFoot.tsx +68 -0
- package/src/components/table/TableGroup.tsx +69 -0
- package/src/components/table/TableHead.tsx +139 -0
- package/src/components/table/TableRow.tsx +56 -0
- package/src/components/table/__pycache__/table_helper.cpython-312.pyc +0 -0
- package/src/components/table/config.json +297 -0
- package/src/components/table/hooks/useRowDetails.ts +34 -0
- package/src/components/table/hooks/useTableGroups.ts +61 -0
- package/src/components/table/hooks/useTableSelect.ts +82 -0
- package/src/components/table/hooks/useTableSort.ts +60 -0
- package/src/components/table/table-body.django.html +68 -0
- package/src/components/table/table-detail-row.django.html +14 -0
- package/src/components/table/table-foot.django.html +31 -0
- package/src/components/table/table-group.django.html +40 -0
- package/src/components/table/table-head.django.html +85 -0
- package/src/components/table/table-row.django.html +98 -0
- package/src/components/table/table.django.html +60 -0
- package/src/components/table/table.html +1186 -0
- package/src/components/table/table_helper.py +298 -0
- package/src/components/table/types.ts +68 -0
- package/src/components/tag/Tag.tsx +75 -0
- package/src/components/tag/config.json +54 -0
- package/src/components/tag/tag.django.html +39 -0
- package/src/components/tag/tag.html +45 -0
- package/src/components/tag-group/TagGroup.tsx +35 -0
- package/src/components/tag-group/config.json +24 -0
- package/src/components/tag-group/tag-group.django.html +11 -0
- package/src/components/tag-group/tag-group.html +36 -0
- package/src/components/task-list/TaskList.tsx +40 -0
- package/src/components/task-list/config.json +41 -0
- package/src/components/task-list/task-list.django.html +21 -0
- package/src/components/task-list/task-list.html +24 -0
- package/src/components/text-area/TextArea.tsx +78 -0
- package/src/components/text-area/config.json +78 -0
- package/src/components/text-area/text-area.django.html +53 -0
- package/src/components/text-area/text-area.html +59 -0
- package/src/components/theme-picker/ThemePicker.tsx +106 -0
- package/src/components/theme-picker/config.json +39 -0
- package/src/components/theme-picker/theme-picker.django.html +32 -0
- package/src/components/theme-picker/theme-picker.html +67 -0
- package/src/components/time-picker/TimePicker.jsx +87 -0
- package/src/components/time-picker/config.json +76 -0
- package/src/components/time-picker/time-picker.django.html +67 -0
- package/src/components/time-picker/time-picker.html +123 -0
- package/src/components/toggle/Toggle.tsx +80 -0
- package/src/components/toggle/config.json +69 -0
- package/src/components/toggle/toggle.django.html +19 -0
- package/src/components/toggle/toggle.html +85 -0
- package/src/components/tooltip/Tooltip.tsx +33 -0
- package/src/components/tooltip/config.json +33 -0
- package/src/components/tooltip/tooltip.django.html +5 -0
- package/src/components/tooltip/tooltip.html +57 -0
- package/src/components/villain/Villain.tsx +47 -0
- package/src/components/villain/config.json +44 -0
- package/src/components/villain/villain.django.html +19 -0
- package/src/components/villain/villain.html +39 -0
- package/src/declarations.d.ts +1 -0
- package/src/index.js +82 -0
- package/src/styles/core.scss +12 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Branding, { BrandingProps } from '../header/Branding';
|
|
3
|
+
import Input from '../input/Input';
|
|
4
|
+
import Button from '../button/Button';
|
|
5
|
+
import Icon from '../icon/Icon';
|
|
6
|
+
import ClassNames from 'classnames';
|
|
7
|
+
|
|
8
|
+
// ── Sub-components ──────────────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export interface FooterReturnToTopProps {
|
|
11
|
+
label?: string;
|
|
12
|
+
href?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export function FooterReturnToTop({ label = 'Return to top', href = '#', className = '' }: FooterReturnToTopProps) {
|
|
16
|
+
const classes = ClassNames(
|
|
17
|
+
'grid-container',
|
|
18
|
+
'usa-footer__return-to-top',
|
|
19
|
+
'usx-footer__return-to-top',
|
|
20
|
+
className
|
|
21
|
+
)
|
|
22
|
+
return (
|
|
23
|
+
<div className={classes}>
|
|
24
|
+
<a href={href} className="usa-link usx-link usx-footer__return-to-top">{label}<Icon name="arrow_upward" /></a>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface FooterNavLink {
|
|
30
|
+
text: string;
|
|
31
|
+
href: string;
|
|
32
|
+
ariaLabel?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface FooterNavColumnProps {
|
|
35
|
+
heading?: string;
|
|
36
|
+
links?: FooterNavLink[];
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
export function FooterNavColumn({ heading, links = [], className = '' }: FooterNavColumnProps) {
|
|
40
|
+
return (
|
|
41
|
+
<section className={['usa-footer__primary-content usa-footer__primary-content--collapsible usx-footer__nav-column', className].filter(Boolean).join(' ')}>
|
|
42
|
+
{heading && <h4 className="usa-footer__primary-link">{heading}</h4>}
|
|
43
|
+
{links.length > 0 && (
|
|
44
|
+
<ul className="usa-list usa-list--unstyled">
|
|
45
|
+
{links.map((link, i) => (
|
|
46
|
+
<li key={i} className="usa-footer__secondary-link">
|
|
47
|
+
<a href={link.href} aria-label={link.ariaLabel || undefined}>{link.text}</a>
|
|
48
|
+
</li>
|
|
49
|
+
))}
|
|
50
|
+
</ul>
|
|
51
|
+
)}
|
|
52
|
+
</section>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface FooterSignUpProps {
|
|
57
|
+
heading?: string;
|
|
58
|
+
emailLabel?: string;
|
|
59
|
+
emailId?: string;
|
|
60
|
+
buttonText?: string;
|
|
61
|
+
action?: string;
|
|
62
|
+
onSubmit?: React.FormEventHandler<HTMLFormElement> | null;
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
export function FooterSignUp({
|
|
66
|
+
heading = 'Sign up',
|
|
67
|
+
emailLabel = 'Your email address',
|
|
68
|
+
emailId = 'footer-email',
|
|
69
|
+
buttonText = 'Sign up',
|
|
70
|
+
action = '',
|
|
71
|
+
onSubmit = null,
|
|
72
|
+
className = '',
|
|
73
|
+
}: FooterSignUpProps) {
|
|
74
|
+
return (
|
|
75
|
+
<div className={['usa-sign-up usx-footer__sign-up', className].filter(Boolean).join(' ')}>
|
|
76
|
+
<h3 className="usa-sign-up__heading">{heading}</h3>
|
|
77
|
+
<form className="usa-form" action={action || undefined} onSubmit={onSubmit || undefined}>
|
|
78
|
+
<Input
|
|
79
|
+
id={emailId}
|
|
80
|
+
name="email"
|
|
81
|
+
type="email"
|
|
82
|
+
label={emailLabel}
|
|
83
|
+
autoComplete="email"
|
|
84
|
+
/>
|
|
85
|
+
<Button type="submit" variant="primary">{buttonText}</Button>
|
|
86
|
+
</form>
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface FooterSocialLink {
|
|
92
|
+
icon: string;
|
|
93
|
+
href: string;
|
|
94
|
+
alt: string;
|
|
95
|
+
}
|
|
96
|
+
export interface FooterSocialLinksProps {
|
|
97
|
+
links?: FooterSocialLink[];
|
|
98
|
+
className?: string;
|
|
99
|
+
}
|
|
100
|
+
export function FooterSocialLinks({ links = [], className = '' }: FooterSocialLinksProps) {
|
|
101
|
+
if (!links.length) return null;
|
|
102
|
+
return (
|
|
103
|
+
<div className={['usa-footer__social-links grid-row grid-gap-1 usx-footer__social-links', className].filter(Boolean).join(' ')}>
|
|
104
|
+
{links.map((link, i) => (
|
|
105
|
+
<div key={i} className="grid-col-auto">
|
|
106
|
+
<a className="usa-social-link" href={link.href} aria-label={link.alt}>
|
|
107
|
+
<img className="usa-social-link__icon" src={link.icon} alt={link.alt} />
|
|
108
|
+
</a>
|
|
109
|
+
</div>
|
|
110
|
+
))}
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
type LinkShape = string | { href: string; text: string };
|
|
116
|
+
function normalizeContactLink(value: LinkShape | null | undefined, scheme: string) {
|
|
117
|
+
if (!value) return null;
|
|
118
|
+
if (typeof value === 'string') return { href: `${scheme}${value}`, text: value };
|
|
119
|
+
const href = value.href?.startsWith(scheme) ? value.href : `${scheme}${value.href}`;
|
|
120
|
+
return { href, text: value.text };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface FooterContactLink {
|
|
124
|
+
href: string;
|
|
125
|
+
text: string;
|
|
126
|
+
}
|
|
127
|
+
export interface FooterContactProps {
|
|
128
|
+
heading?: string | null;
|
|
129
|
+
phone?: LinkShape | null;
|
|
130
|
+
email?: LinkShape | null;
|
|
131
|
+
links?: FooterContactLink[];
|
|
132
|
+
className?: string;
|
|
133
|
+
}
|
|
134
|
+
export function FooterContact({
|
|
135
|
+
heading = null,
|
|
136
|
+
phone = null,
|
|
137
|
+
email = null,
|
|
138
|
+
links = [],
|
|
139
|
+
className = '',
|
|
140
|
+
}: FooterContactProps) {
|
|
141
|
+
const allLinks = [
|
|
142
|
+
normalizeContactLink(phone, 'tel:'),
|
|
143
|
+
normalizeContactLink(email, 'mailto:'),
|
|
144
|
+
...links,
|
|
145
|
+
].filter(Boolean) as FooterContactLink[];
|
|
146
|
+
|
|
147
|
+
if (!heading && allLinks.length === 0) return null;
|
|
148
|
+
return (
|
|
149
|
+
<address className={['usa-footer__address usx-footer__contact', className].filter(Boolean).join(' ')}>
|
|
150
|
+
{heading && <p className="usa-footer__contact-heading">{heading}</p>}
|
|
151
|
+
{allLinks.length > 0 && (
|
|
152
|
+
<div className="usa-footer__contact-info grid-row grid-gap">
|
|
153
|
+
{allLinks.map((link, i) => (
|
|
154
|
+
<div key={i} className="grid-col-auto">
|
|
155
|
+
<a href={link.href}>{link.text}</a>
|
|
156
|
+
</div>
|
|
157
|
+
))}
|
|
158
|
+
</div>
|
|
159
|
+
)}
|
|
160
|
+
</address>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface FooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
165
|
+
variant?: 'big' | 'medium' | 'slim';
|
|
166
|
+
returnToTop?: boolean | string;
|
|
167
|
+
returnToTopLabel?: string;
|
|
168
|
+
returnToTopHref?: string;
|
|
169
|
+
navColumns?: FooterNavColumnProps[];
|
|
170
|
+
navLinks?: FooterNavLink[];
|
|
171
|
+
navAriaLabel?: string;
|
|
172
|
+
signUp?: FooterSignUpProps | null;
|
|
173
|
+
branding?: BrandingProps | null;
|
|
174
|
+
brandingUrl?: string;
|
|
175
|
+
socialLinks?: FooterSocialLink[];
|
|
176
|
+
contactHeading?: string | null;
|
|
177
|
+
contactPhone?: LinkShape | null;
|
|
178
|
+
contactEmail?: LinkShape | null;
|
|
179
|
+
contactLinks?: FooterContactLink[];
|
|
180
|
+
primaryChildren?: React.ReactNode;
|
|
181
|
+
secondaryChildren?: React.ReactNode;
|
|
182
|
+
className?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export default function Footer({
|
|
186
|
+
variant = 'medium',
|
|
187
|
+
returnToTop = true,
|
|
188
|
+
returnToTopLabel = 'Return to top',
|
|
189
|
+
returnToTopHref = '#',
|
|
190
|
+
navColumns = [],
|
|
191
|
+
navLinks = [],
|
|
192
|
+
navAriaLabel = 'Footer navigation',
|
|
193
|
+
signUp = null,
|
|
194
|
+
branding = null,
|
|
195
|
+
brandingUrl = '/',
|
|
196
|
+
socialLinks = [],
|
|
197
|
+
contactHeading = null,
|
|
198
|
+
contactPhone = null,
|
|
199
|
+
contactEmail = null,
|
|
200
|
+
contactLinks = [],
|
|
201
|
+
primaryChildren = null,
|
|
202
|
+
secondaryChildren = null,
|
|
203
|
+
className = '',
|
|
204
|
+
...props
|
|
205
|
+
}: FooterProps) {
|
|
206
|
+
const variantClass = variant === 'big' ? 'usa-footer--big'
|
|
207
|
+
: variant === 'slim' ? 'usa-footer--slim'
|
|
208
|
+
: '';
|
|
209
|
+
const classes = ['usa-footer', variantClass, 'usx-footer', className].filter(Boolean).join(' ');
|
|
210
|
+
|
|
211
|
+
const returnToTopEl = returnToTop ? (
|
|
212
|
+
<FooterReturnToTop
|
|
213
|
+
label={typeof returnToTop === 'string' ? returnToTop : returnToTopLabel}
|
|
214
|
+
href={returnToTopHref}
|
|
215
|
+
/>
|
|
216
|
+
) : null;
|
|
217
|
+
|
|
218
|
+
const hasContact = contactHeading || contactPhone || contactEmail || contactLinks.length > 0;
|
|
219
|
+
const contactEl = hasContact ? (
|
|
220
|
+
<FooterContact
|
|
221
|
+
heading={contactHeading}
|
|
222
|
+
phone={contactPhone}
|
|
223
|
+
email={contactEmail}
|
|
224
|
+
links={contactLinks}
|
|
225
|
+
/>
|
|
226
|
+
) : null;
|
|
227
|
+
|
|
228
|
+
const socialEl = socialLinks.length > 0 ? <FooterSocialLinks links={socialLinks} /> : null;
|
|
229
|
+
const logoClassName = variant === 'slim'
|
|
230
|
+
? 'usa-footer__logo grid-row grid-gap-2 usx-footer__logo'
|
|
231
|
+
: 'usa-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2 usx-footer__logo';
|
|
232
|
+
const brandingEl = branding ? (
|
|
233
|
+
<Branding branding={branding} projectUrl={brandingUrl} className={logoClassName} />
|
|
234
|
+
) : null;
|
|
235
|
+
|
|
236
|
+
const secondaryContactBlock = (socialEl || contactEl) ? (
|
|
237
|
+
<div className="usa-footer__contact-links mobile-lg:grid-col-6">
|
|
238
|
+
{socialEl}
|
|
239
|
+
{contactEl}
|
|
240
|
+
</div>
|
|
241
|
+
) : null;
|
|
242
|
+
|
|
243
|
+
// ── Big footer ────────────────────────────────────────────────────────────
|
|
244
|
+
if (variant === 'big') {
|
|
245
|
+
return (
|
|
246
|
+
<footer className={classes} {...props}>
|
|
247
|
+
{returnToTopEl}
|
|
248
|
+
<div className="usa-footer__primary-section">
|
|
249
|
+
{primaryChildren ?? (
|
|
250
|
+
<div className="grid-container">
|
|
251
|
+
<div className="grid-row grid-gap">
|
|
252
|
+
{navColumns.length > 0 && (
|
|
253
|
+
<div className="tablet:grid-col-8">
|
|
254
|
+
<nav className="usa-footer__nav" aria-label={navAriaLabel}>
|
|
255
|
+
<div className="grid-row grid-gap-4">
|
|
256
|
+
{navColumns.map((col, i) => (
|
|
257
|
+
<div key={i} className="mobile-lg:grid-col-6 desktop:grid-col-3">
|
|
258
|
+
<FooterNavColumn heading={col.heading} links={col.links} />
|
|
259
|
+
</div>
|
|
260
|
+
))}
|
|
261
|
+
</div>
|
|
262
|
+
</nav>
|
|
263
|
+
</div>
|
|
264
|
+
)}
|
|
265
|
+
{signUp && (
|
|
266
|
+
<div className={navColumns.length > 0 ? 'tablet:grid-col-4' : 'tablet:grid-col-12'}>
|
|
267
|
+
<FooterSignUp {...signUp} />
|
|
268
|
+
</div>
|
|
269
|
+
)}
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
)}
|
|
273
|
+
</div>
|
|
274
|
+
<div className="usa-footer__secondary-section">
|
|
275
|
+
{secondaryChildren ?? (
|
|
276
|
+
<div className="grid-container">
|
|
277
|
+
<div className="grid-row grid-gap">
|
|
278
|
+
{brandingEl}
|
|
279
|
+
{secondaryContactBlock}
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
)}
|
|
283
|
+
</div>
|
|
284
|
+
</footer>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// ── Slim footer ───────────────────────────────────────────────────────────
|
|
289
|
+
if (variant === 'slim') {
|
|
290
|
+
return (
|
|
291
|
+
<footer className={classes} {...props}>
|
|
292
|
+
{returnToTopEl}
|
|
293
|
+
<div className="usa-footer__primary-section">
|
|
294
|
+
{primaryChildren ?? (
|
|
295
|
+
<div className="usa-footer__primary-container grid-row">
|
|
296
|
+
{navLinks.length > 0 && (
|
|
297
|
+
<div className="mobile-lg:grid-col-8">
|
|
298
|
+
<nav className="usa-footer__nav" aria-label={navAriaLabel}>
|
|
299
|
+
<ul className="grid-row grid-gap">
|
|
300
|
+
{navLinks.map((link, i) => (
|
|
301
|
+
<li key={i} className="mobile-lg:grid-col-6 desktop:grid-col-auto usa-footer__primary-content">
|
|
302
|
+
<a className="usa-footer__primary-link" href={link.href} aria-label={link.ariaLabel || undefined}>
|
|
303
|
+
{link.text}
|
|
304
|
+
</a>
|
|
305
|
+
</li>
|
|
306
|
+
))}
|
|
307
|
+
</ul>
|
|
308
|
+
</nav>
|
|
309
|
+
</div>
|
|
310
|
+
)}
|
|
311
|
+
{contactEl && (
|
|
312
|
+
<div className="mobile-lg:grid-col-4">
|
|
313
|
+
{contactEl}
|
|
314
|
+
</div>
|
|
315
|
+
)}
|
|
316
|
+
</div>
|
|
317
|
+
)}
|
|
318
|
+
</div>
|
|
319
|
+
{(brandingEl || secondaryChildren) && (
|
|
320
|
+
<div className="usa-footer__secondary-section">
|
|
321
|
+
{secondaryChildren ?? (
|
|
322
|
+
<div className="grid-container">
|
|
323
|
+
{brandingEl}
|
|
324
|
+
</div>
|
|
325
|
+
)}
|
|
326
|
+
</div>
|
|
327
|
+
)}
|
|
328
|
+
</footer>
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// ── Medium footer (default) ───────────────────────────────────────────────
|
|
333
|
+
return (
|
|
334
|
+
<footer className={classes} {...props}>
|
|
335
|
+
{returnToTopEl}
|
|
336
|
+
<div className="usa-footer__primary-section">
|
|
337
|
+
{primaryChildren ?? (
|
|
338
|
+
navLinks.length > 0 && (
|
|
339
|
+
<nav className="usa-footer__nav" aria-label={navAriaLabel}>
|
|
340
|
+
<ul className="grid-row grid-gap">
|
|
341
|
+
{navLinks.map((link, i) => (
|
|
342
|
+
<li key={i} className="mobile-lg:grid-col-4 desktop:grid-col-auto usa-footer__primary-content">
|
|
343
|
+
<a className="usa-footer__primary-link" href={link.href} aria-label={link.ariaLabel || undefined}>
|
|
344
|
+
{link.text}
|
|
345
|
+
</a>
|
|
346
|
+
</li>
|
|
347
|
+
))}
|
|
348
|
+
</ul>
|
|
349
|
+
</nav>
|
|
350
|
+
)
|
|
351
|
+
)}
|
|
352
|
+
</div>
|
|
353
|
+
<div className="usa-footer__secondary-section">
|
|
354
|
+
{secondaryChildren ?? (
|
|
355
|
+
<div className="grid-container">
|
|
356
|
+
<div className="grid-row grid-gap">
|
|
357
|
+
{brandingEl}
|
|
358
|
+
{secondaryContactBlock}
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
)}
|
|
362
|
+
</div>
|
|
363
|
+
</footer>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "footer",
|
|
3
|
+
"template": "footer/footer.django.html",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"props": {
|
|
6
|
+
"variant": {
|
|
7
|
+
"type": "select",
|
|
8
|
+
"options": [
|
|
9
|
+
"big",
|
|
10
|
+
"medium",
|
|
11
|
+
"slim"
|
|
12
|
+
],
|
|
13
|
+
"default": "medium",
|
|
14
|
+
"description": "Footer layout variant. 'big' includes collapsible nav columns and an optional sign-up form. 'medium' shows flat primary links. 'slim' puts contact info in the primary bar."
|
|
15
|
+
},
|
|
16
|
+
"returnToTop": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": true,
|
|
19
|
+
"description": "Show the 'Return to top' link. Set false to hide."
|
|
20
|
+
},
|
|
21
|
+
"returnToTopLabel": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"default": "Return to top",
|
|
24
|
+
"description": "Label for the return-to-top link."
|
|
25
|
+
},
|
|
26
|
+
"returnToTopHref": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"default": "#",
|
|
29
|
+
"description": "Anchor href for the return-to-top link."
|
|
30
|
+
},
|
|
31
|
+
"navColumns": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"description": "(big variant) Array of nav column objects: [{ heading, links: [{ text, href, ariaLabel? }] }]"
|
|
34
|
+
},
|
|
35
|
+
"navLinks": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"description": "(medium/slim variants) Array of primary nav links: [{ text, href, ariaLabel? }]"
|
|
38
|
+
},
|
|
39
|
+
"navAriaLabel": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "Footer navigation",
|
|
42
|
+
"description": "Accessible aria-label for the footer nav element."
|
|
43
|
+
},
|
|
44
|
+
"signUp": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"description": "(big variant, optional) Email sign-up config: { heading?, emailLabel?, emailId?, buttonText?, action? }"
|
|
47
|
+
},
|
|
48
|
+
"branding": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "Branding config (same shape as Header branding): { title?, symbol?, logo?, alt? }. Use 'symbol' + 'title' to show a decorative image beside agency name text. Use 'logo' for a full standalone logo image (title used as alt text). Add 'symbolInverse'/'logoInverse' to supply dark-shell artwork the theme swaps to."
|
|
51
|
+
},
|
|
52
|
+
"brandingUrl": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"default": "/",
|
|
55
|
+
"description": "URL for the branding link (wraps the logo/symbol image and title)."
|
|
56
|
+
},
|
|
57
|
+
"socialLinks": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"description": "Array of social icon links: [{ icon (img src), href, alt }]"
|
|
60
|
+
},
|
|
61
|
+
"contactHeading": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "Heading label above the contact info block."
|
|
64
|
+
},
|
|
65
|
+
"contactPhone": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"description": "Phone contact. Object: { href, text } — or a plain string (auto-prefixed with tel:)."
|
|
68
|
+
},
|
|
69
|
+
"contactEmail": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"description": "Email contact. Object: { href, text } — or a plain string (auto-prefixed with mailto:)."
|
|
72
|
+
},
|
|
73
|
+
"contactLinks": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"description": "Additional contact links: [{ href, text }]"
|
|
76
|
+
},
|
|
77
|
+
"className": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"default": "",
|
|
80
|
+
"description": "Additional CSS classes applied to the root footer element."
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|