@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,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ClassNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export interface FormGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
error?: boolean;
|
|
7
|
+
success?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function FormGroup({ children = null, className = '', error = false, ...props }: FormGroupProps) {
|
|
12
|
+
const classes = ClassNames(
|
|
13
|
+
'usa-form-group',
|
|
14
|
+
'usx-form-group',
|
|
15
|
+
{
|
|
16
|
+
'usa-form-group--error': error,
|
|
17
|
+
},
|
|
18
|
+
className,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={classes} {...props}>
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "form-group",
|
|
3
|
+
"template": "form-group/form-group.django.html",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"props": {
|
|
6
|
+
"children": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"default": null,
|
|
9
|
+
"description": "Inner HTML content of the form group."
|
|
10
|
+
},
|
|
11
|
+
"error": {
|
|
12
|
+
"type": "boolean",
|
|
13
|
+
"default": false,
|
|
14
|
+
"description": "Applies the error modifier class to the form group wrapper."
|
|
15
|
+
},
|
|
16
|
+
"className": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"default": "",
|
|
19
|
+
"description": "Additional CSS classes to apply to the form group wrapper."
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Default -->
|
|
2
|
+
<div class="usa-form-group usx-form-group">
|
|
3
|
+
<label class="usa-label usx-label" for="fg-1">Form group label</label>
|
|
4
|
+
<input class="usa-input usx-input" id="fg-1" placeholder="Type here" />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<!-- ErrorState -->
|
|
8
|
+
<div class="usa-form-group usx-form-group usa-form-group--error">
|
|
9
|
+
<label class="usa-label usx-label" for="fg-2">Error state</label>
|
|
10
|
+
<input class="usa-input usx-input usa-input--error" id="fg-2" aria-invalid="true" />
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<!-- SuccessState -->
|
|
14
|
+
<div class="usa-form-group usx-form-group">
|
|
15
|
+
<label class="usa-label usx-label" for="fg-3">Success state</label>
|
|
16
|
+
<input class="usa-input usx-input usa-input--success" id="fg-3" />
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from '../image/Image';
|
|
3
|
+
import ClassNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface BrandingLogoSource {
|
|
6
|
+
srcSet: string;
|
|
7
|
+
media?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
sizes?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface BrandingLogo {
|
|
13
|
+
fallback: string;
|
|
14
|
+
sources: BrandingLogoSource[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface BrandingConfig {
|
|
18
|
+
title?: string;
|
|
19
|
+
symbol?: string;
|
|
20
|
+
symbolInverse?: string;
|
|
21
|
+
alt?: string;
|
|
22
|
+
logo?: string | BrandingLogo;
|
|
23
|
+
logoInverse?: string | BrandingLogo;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface BrandingProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
27
|
+
branding: BrandingConfig;
|
|
28
|
+
projectUrl?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function BrandingContent({ config, projectUrl }: { config: BrandingConfig; projectUrl?: string }) {
|
|
33
|
+
const { title, symbol, symbolInverse, logo, logoInverse, alt } = config;
|
|
34
|
+
const label = alt ?? title ?? '';
|
|
35
|
+
|
|
36
|
+
if (logo) {
|
|
37
|
+
const Wrapper: React.ElementType = projectUrl ? 'a' : 'div';
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Wrapper
|
|
41
|
+
{...(projectUrl ? { href: projectUrl } : {})}
|
|
42
|
+
className="usx-image usx-logo__image"
|
|
43
|
+
>
|
|
44
|
+
<Image src={logo} alt={label} className="usx-logo__variant" />
|
|
45
|
+
{logoInverse && (
|
|
46
|
+
<Image
|
|
47
|
+
src={logoInverse}
|
|
48
|
+
alt={label}
|
|
49
|
+
className="usx-logo__variant usx-logo__variant--inverse"
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
</Wrapper>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<em className="usa-logo__text">
|
|
58
|
+
{symbol && (
|
|
59
|
+
<img src={symbol} alt="" aria-hidden="true" className="usx-logo__symbol usx-logo__variant" />
|
|
60
|
+
)}
|
|
61
|
+
{symbolInverse && (
|
|
62
|
+
<img
|
|
63
|
+
src={symbolInverse}
|
|
64
|
+
alt=""
|
|
65
|
+
aria-hidden="true"
|
|
66
|
+
className="usx-logo__symbol usx-logo__variant usx-logo__variant--inverse"
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
{title && (
|
|
70
|
+
projectUrl
|
|
71
|
+
? <a href={projectUrl} className="usx-logo__title">{title}</a>
|
|
72
|
+
: <span className="usx-logo__title">{title}</span>
|
|
73
|
+
)}
|
|
74
|
+
</em>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default function Branding({ branding, projectUrl = '/', className = '', ...props }: BrandingProps) {
|
|
79
|
+
if (!branding) return null;
|
|
80
|
+
|
|
81
|
+
const classes = ClassNames(
|
|
82
|
+
'usa-logo',
|
|
83
|
+
'usx-logo',
|
|
84
|
+
className
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className={classes} {...props}>
|
|
89
|
+
<BrandingContent config={branding} projectUrl={projectUrl} />
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const brandingShape = {
|
|
95
|
+
title: 'string',
|
|
96
|
+
symbol: 'string',
|
|
97
|
+
symbolInverse: 'string',
|
|
98
|
+
alt: 'string',
|
|
99
|
+
logo: 'string|object',
|
|
100
|
+
logoInverse: 'string|object',
|
|
101
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ClassNames from 'classnames';
|
|
3
|
+
import Icon from '../icon/Icon';
|
|
4
|
+
import Search, { SearchProps } from '../search/Search';
|
|
5
|
+
import Branding, { BrandingProps } from './Branding';
|
|
6
|
+
|
|
7
|
+
export interface HeaderNavLink {
|
|
8
|
+
text: string;
|
|
9
|
+
href: string;
|
|
10
|
+
ariaLabel?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface HeaderNavSection {
|
|
14
|
+
title: string;
|
|
15
|
+
links?: HeaderNavLink[];
|
|
16
|
+
href?: string;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface PrimaryNavProps {
|
|
21
|
+
navSections: HeaderNavSection[];
|
|
22
|
+
megamenu: boolean;
|
|
23
|
+
showSecondary?: boolean;
|
|
24
|
+
secondaryLinks?: HeaderNavLink[];
|
|
25
|
+
searchProps?: SearchProps | null;
|
|
26
|
+
headerId?: string;
|
|
27
|
+
renderSearchDirectly?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function PrimaryNav({
|
|
31
|
+
navSections,
|
|
32
|
+
megamenu,
|
|
33
|
+
showSecondary = false,
|
|
34
|
+
secondaryLinks = [],
|
|
35
|
+
searchProps = null,
|
|
36
|
+
headerId = 'header',
|
|
37
|
+
renderSearchDirectly = false,
|
|
38
|
+
}: PrimaryNavProps) {
|
|
39
|
+
const navClasses = ClassNames('usa-nav__primary', 'usa-accordion');
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<>
|
|
43
|
+
<button type="button" className="usa-nav__close">
|
|
44
|
+
<Icon name="close" />
|
|
45
|
+
</button>
|
|
46
|
+
<ul className={navClasses}>
|
|
47
|
+
{navSections.map((section, index) => (
|
|
48
|
+
<li key={index} className="usa-nav__primary-item">
|
|
49
|
+
{section.href ? (
|
|
50
|
+
<a href={section.href} className="usa-nav__link" aria-label={section.ariaLabel}>
|
|
51
|
+
<span>{section.title}</span>
|
|
52
|
+
</a>
|
|
53
|
+
) : (
|
|
54
|
+
<>
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
className="usa-accordion__button usa-nav__link"
|
|
58
|
+
aria-expanded="false"
|
|
59
|
+
aria-controls={`${headerId}-nav-section-${index}`}
|
|
60
|
+
>
|
|
61
|
+
<span>{section.title}</span>
|
|
62
|
+
</button>
|
|
63
|
+
{section.links && (
|
|
64
|
+
megamenu ? (
|
|
65
|
+
<div id={`${headerId}-nav-section-${index}`} className="usa-nav__submenu usa-megamenu" hidden={true}>
|
|
66
|
+
<div className="grid-row grid-gap-4">
|
|
67
|
+
{(() => {
|
|
68
|
+
const links = section.links!;
|
|
69
|
+
const numColumns = Math.min(4, Math.max(1, Math.ceil(links.length / 3)));
|
|
70
|
+
const linksPerColumn = Math.ceil(links.length / numColumns);
|
|
71
|
+
return Array.from({ length: numColumns }, (_, colIndex) => {
|
|
72
|
+
const startIndex = colIndex * linksPerColumn;
|
|
73
|
+
const endIndex = Math.min(startIndex + linksPerColumn, links.length);
|
|
74
|
+
const columnLinks = links.slice(startIndex, endIndex);
|
|
75
|
+
return (
|
|
76
|
+
<div key={colIndex} className="usa-col">
|
|
77
|
+
<ul className="usa-nav__submenu-list">
|
|
78
|
+
{columnLinks.map((link, linkIndex) => (
|
|
79
|
+
<li key={linkIndex} className="usa-nav__submenu-item">
|
|
80
|
+
<a href={link.href} aria-label={link.ariaLabel}>
|
|
81
|
+
{link.text}
|
|
82
|
+
</a>
|
|
83
|
+
</li>
|
|
84
|
+
))}
|
|
85
|
+
</ul>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
})()}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
) : (
|
|
93
|
+
<ul id={`${headerId}-nav-section-${index}`} className="usa-nav__submenu" hidden={true}>
|
|
94
|
+
{section.links!.map((link, linkIndex) => (
|
|
95
|
+
<li key={linkIndex} className="usa-nav__submenu-item">
|
|
96
|
+
<a href={link.href} aria-label={link.ariaLabel}>
|
|
97
|
+
<span>{link.text}</span>
|
|
98
|
+
</a>
|
|
99
|
+
</li>
|
|
100
|
+
))}
|
|
101
|
+
</ul>
|
|
102
|
+
)
|
|
103
|
+
)}
|
|
104
|
+
</>
|
|
105
|
+
)}
|
|
106
|
+
</li>
|
|
107
|
+
))}
|
|
108
|
+
</ul>
|
|
109
|
+
{showSecondary && (
|
|
110
|
+
<div className="usa-nav__secondary">
|
|
111
|
+
<ul className="usa-nav__secondary-links">
|
|
112
|
+
{secondaryLinks.map((link, index) => (
|
|
113
|
+
<li key={index} className="usa-nav__secondary-item">
|
|
114
|
+
<a href={link.href} aria-label={link.ariaLabel}>
|
|
115
|
+
<span>{link.text}</span>
|
|
116
|
+
</a>
|
|
117
|
+
</li>
|
|
118
|
+
))}
|
|
119
|
+
</ul>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
{renderSearchDirectly && searchProps && <Search {...searchProps} />}
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
|
|
128
|
+
id?: string;
|
|
129
|
+
branding: BrandingProps;
|
|
130
|
+
projectUrl?: string;
|
|
131
|
+
navSections?: HeaderNavSection[];
|
|
132
|
+
secondaryLinks?: HeaderNavLink[];
|
|
133
|
+
searchProps?: SearchProps | null;
|
|
134
|
+
extended?: boolean;
|
|
135
|
+
megamenu?: boolean;
|
|
136
|
+
useMenuIcon?: boolean;
|
|
137
|
+
stickyNav?: boolean;
|
|
138
|
+
className?: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default function Header({
|
|
142
|
+
id = 'header',
|
|
143
|
+
branding,
|
|
144
|
+
projectUrl = '/',
|
|
145
|
+
navSections = [],
|
|
146
|
+
secondaryLinks = [],
|
|
147
|
+
searchProps = null,
|
|
148
|
+
extended = false,
|
|
149
|
+
megamenu = false,
|
|
150
|
+
useMenuIcon = false,
|
|
151
|
+
stickyNav = false,
|
|
152
|
+
className = '',
|
|
153
|
+
...props
|
|
154
|
+
}: HeaderProps) {
|
|
155
|
+
const headerClasses = ClassNames(
|
|
156
|
+
'usa-header',
|
|
157
|
+
'usx-header',
|
|
158
|
+
{ 'usa-header--basic': !extended },
|
|
159
|
+
{ 'usa-header--megamenu': megamenu && !extended },
|
|
160
|
+
{ 'usa-header--extended': extended },
|
|
161
|
+
className
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const navClasses = ClassNames(
|
|
165
|
+
'usa-nav',
|
|
166
|
+
'usx-nav',
|
|
167
|
+
{ 'usx-nav--sticky': stickyNav },
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const navbar = (
|
|
171
|
+
<div className="usa-navbar">
|
|
172
|
+
<Branding branding={branding} projectUrl={projectUrl} />
|
|
173
|
+
<button type="button" className="usa-menu-btn align-center">
|
|
174
|
+
{useMenuIcon ? <Icon name="menu" size={3} /> : 'Menu'}
|
|
175
|
+
</button>
|
|
176
|
+
</div>
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
if (extended) {
|
|
180
|
+
return (
|
|
181
|
+
<>
|
|
182
|
+
<header className={headerClasses} {...props}>
|
|
183
|
+
{navbar}
|
|
184
|
+
</header>
|
|
185
|
+
<nav aria-label="Primary navigation" className={navClasses}>
|
|
186
|
+
<div className="usa-nav__inner">
|
|
187
|
+
<PrimaryNav
|
|
188
|
+
navSections={navSections}
|
|
189
|
+
megamenu={megamenu}
|
|
190
|
+
showSecondary={false}
|
|
191
|
+
headerId={id}
|
|
192
|
+
/>
|
|
193
|
+
<div className="usa-nav__secondary">
|
|
194
|
+
<ul className="usa-nav__secondary-links">
|
|
195
|
+
{secondaryLinks.map((link, index) => (
|
|
196
|
+
<li key={index} className="usa-nav__secondary-item">
|
|
197
|
+
<a href={link.href} aria-label={link.ariaLabel}>
|
|
198
|
+
<span>{link.text}</span>
|
|
199
|
+
</a>
|
|
200
|
+
</li>
|
|
201
|
+
))}
|
|
202
|
+
</ul>
|
|
203
|
+
{searchProps && <Search {...searchProps} />}
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
</nav>
|
|
207
|
+
</>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<header className={headerClasses} {...props}>
|
|
213
|
+
<div className="usa-nav-container">
|
|
214
|
+
{navbar}
|
|
215
|
+
<nav aria-label="Primary navigation" className={navClasses}>
|
|
216
|
+
<PrimaryNav
|
|
217
|
+
navSections={navSections}
|
|
218
|
+
megamenu={megamenu}
|
|
219
|
+
showSecondary={false}
|
|
220
|
+
secondaryLinks={secondaryLinks}
|
|
221
|
+
searchProps={searchProps}
|
|
222
|
+
headerId={id}
|
|
223
|
+
renderSearchDirectly={true}
|
|
224
|
+
/>
|
|
225
|
+
</nav>
|
|
226
|
+
</div>
|
|
227
|
+
</header>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "header",
|
|
3
|
+
"template": "header/header.django.html",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"props": {
|
|
6
|
+
"id": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"default": "header",
|
|
9
|
+
"description": "Unique identifier for the header component"
|
|
10
|
+
},
|
|
11
|
+
"branding": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"description": "Branding config. Flat: { title?, symbol?, logo?, alt? }. Responsive: { responsive: { base: {...}, lg: {...} } }. Theme-responsive: add symbolInverse/logoInverse to supply dark-shell artwork the theme swaps to."
|
|
14
|
+
},
|
|
15
|
+
"projectUrl": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"default": "/",
|
|
18
|
+
"description": "URL for the branding link"
|
|
19
|
+
},
|
|
20
|
+
"navSections": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"description": "Array of menu section objects with 'title', and mutually exclusive 'links' or 'href' properties"
|
|
23
|
+
},
|
|
24
|
+
"secondaryLinks": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"description": "Array of secondary link objects with 'href' and 'text' properties"
|
|
27
|
+
},
|
|
28
|
+
"searchProps": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"description": "(OPTIONAL) Configuration object for the search component",
|
|
31
|
+
"component": "search"
|
|
32
|
+
},
|
|
33
|
+
"extended": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"default": false,
|
|
36
|
+
"description": "Whether to use the extended header style"
|
|
37
|
+
},
|
|
38
|
+
"megamenu": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"default": false,
|
|
41
|
+
"description": "Whether to use the megamenu style for navigation sections"
|
|
42
|
+
},
|
|
43
|
+
"useMenuIcon": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"default": false,
|
|
46
|
+
"description": "Whether to use a menu icon instead of the word 'Menu'"
|
|
47
|
+
},
|
|
48
|
+
"stickyNav": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"default": false,
|
|
51
|
+
"description": "Whether the navigation should become sticky when scrolling"
|
|
52
|
+
},
|
|
53
|
+
"className": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "Additional classes"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
{% load components %}
|
|
2
|
+
{# Django template for Header #}
|
|
3
|
+
<header class="
|
|
4
|
+
usa-header
|
|
5
|
+
usx-header
|
|
6
|
+
{% if not extended %}usa-header--basic{% endif %}
|
|
7
|
+
{% if megamenu and not extended %}usa-header--megamenu{% endif %}
|
|
8
|
+
{% if extended %}usa-header--extended{% endif %}
|
|
9
|
+
{{ className }}
|
|
10
|
+
" {% if id %}id="{{ id }}"{% endif %} {% if styles %}style="{{ styles|safe }}"{% endif %}>
|
|
11
|
+
{% if not extended %}
|
|
12
|
+
<div class="usa-nav-container">
|
|
13
|
+
{% endif %}
|
|
14
|
+
<div class="usa-navbar">
|
|
15
|
+
<div class="usa-logo usx-logo">
|
|
16
|
+
{% if branding.logo %}
|
|
17
|
+
<a href="{{ projectUrl|default:'/' }}" class="usx-image usx-logo__image">
|
|
18
|
+
<div class="usx-image usx-logo__variant">
|
|
19
|
+
{% if branding.logo.fallback %}
|
|
20
|
+
<picture>
|
|
21
|
+
{% for source in branding.logo.sources %}
|
|
22
|
+
<source srcset="{{ source.srcSet }}"{% if source.media %} media="{{ source.media }}"{% endif %}{% if source.type %} type="{{ source.type }}"{% endif %}{% if source.sizes %} sizes="{{ source.sizes }}"{% endif %} />
|
|
23
|
+
{% endfor %}
|
|
24
|
+
<img src="{{ branding.logo.fallback }}" alt="{{ branding.title }}" />
|
|
25
|
+
</picture>
|
|
26
|
+
{% else %}
|
|
27
|
+
<img src="{{ branding.logo }}" alt="{{ branding.title }}" />
|
|
28
|
+
{% endif %}
|
|
29
|
+
</div>
|
|
30
|
+
{% if branding.logoInverse %}
|
|
31
|
+
<div class="usx-image usx-logo__variant usx-logo__variant--inverse">
|
|
32
|
+
{% if branding.logoInverse.fallback %}
|
|
33
|
+
<picture>
|
|
34
|
+
{% for source in branding.logoInverse.sources %}
|
|
35
|
+
<source srcset="{{ source.srcSet }}"{% if source.media %} media="{{ source.media }}"{% endif %}{% if source.type %} type="{{ source.type }}"{% endif %}{% if source.sizes %} sizes="{{ source.sizes }}"{% endif %} />
|
|
36
|
+
{% endfor %}
|
|
37
|
+
<img src="{{ branding.logoInverse.fallback }}" alt="{{ branding.title }}" />
|
|
38
|
+
</picture>
|
|
39
|
+
{% else %}
|
|
40
|
+
<img src="{{ branding.logoInverse }}" alt="{{ branding.title }}" />
|
|
41
|
+
{% endif %}
|
|
42
|
+
</div>
|
|
43
|
+
{% endif %}
|
|
44
|
+
</a>
|
|
45
|
+
{% elif branding.symbol or branding.symbolInverse or branding.title %}
|
|
46
|
+
<em class="usa-logo__text">
|
|
47
|
+
{% if branding.symbol %}
|
|
48
|
+
<img src="{{ branding.symbol }}" alt="" aria-hidden="true" class="usx-logo__symbol usx-logo__variant" />
|
|
49
|
+
{% endif %}
|
|
50
|
+
{% if branding.symbolInverse %}
|
|
51
|
+
<img src="{{ branding.symbolInverse }}" alt="" aria-hidden="true" class="usx-logo__symbol usx-logo__variant usx-logo__variant--inverse" />
|
|
52
|
+
{% endif %}
|
|
53
|
+
{% if branding.title %}
|
|
54
|
+
<a href="{{ projectUrl|default:'/' }}" class="usx-logo__title">{{ branding.title }}</a>
|
|
55
|
+
{% endif %}
|
|
56
|
+
</em>
|
|
57
|
+
{% endif %}
|
|
58
|
+
</div>
|
|
59
|
+
<button type="button" class="usa-menu-btn">
|
|
60
|
+
{% if useMenuIcon %}
|
|
61
|
+
{% icon name='menu' size=3 %}{% endicon %}
|
|
62
|
+
{% else %}
|
|
63
|
+
Menu
|
|
64
|
+
{% endif %}
|
|
65
|
+
</button>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{% if extended %}
|
|
69
|
+
<nav aria-label="Primary navigation" class="usa-nav usx-nav">
|
|
70
|
+
<div class="usa-nav__inner">
|
|
71
|
+
<button type="button" class="usa-nav__close">
|
|
72
|
+
{% icon name='close' %}{% endicon %}
|
|
73
|
+
</button>
|
|
74
|
+
<ul class="usa-nav__primary usa-accordion">
|
|
75
|
+
{% for section in navSections %}
|
|
76
|
+
<li class="usa-nav__primary-item">
|
|
77
|
+
{% if section.href %}
|
|
78
|
+
<a href="{{ section.href }}" class="usa-nav__link" {% if section.ariaLabel %}aria-label="{{ section.ariaLabel }}"{% endif %}>
|
|
79
|
+
<span>{{ section.title }}</span>
|
|
80
|
+
</a>
|
|
81
|
+
{% else %}
|
|
82
|
+
<button type="button" class="usa-accordion__button usa-nav__link" aria-expanded="false" aria-controls="{{ id }}-nav-section-{{ forloop.counter0 }}">
|
|
83
|
+
<span>{{ section.title }}</span>
|
|
84
|
+
</button>
|
|
85
|
+
{% if section.links %}
|
|
86
|
+
{% if megamenu %}
|
|
87
|
+
<div id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu usa-megamenu" hidden="hidden">
|
|
88
|
+
<div class="grid-row grid-gap-4">
|
|
89
|
+
<div class="usa-col">
|
|
90
|
+
<ul class="usa-nav__submenu-list">
|
|
91
|
+
{% for link in section.links %}
|
|
92
|
+
<li class="usa-nav__submenu-item">
|
|
93
|
+
<a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
|
|
94
|
+
{{ link.text }}
|
|
95
|
+
</a>
|
|
96
|
+
</li>
|
|
97
|
+
{% endfor %}
|
|
98
|
+
</ul>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
{% else %}
|
|
103
|
+
<ul id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu" hidden="hidden">
|
|
104
|
+
{% for link in section.links %}
|
|
105
|
+
<li class="usa-nav__submenu-item">
|
|
106
|
+
<a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
|
|
107
|
+
<span>{{ link.text }}</span>
|
|
108
|
+
</a>
|
|
109
|
+
</li>
|
|
110
|
+
{% endfor %}
|
|
111
|
+
</ul>
|
|
112
|
+
{% endif %}
|
|
113
|
+
{% endif %}
|
|
114
|
+
{% endif %}
|
|
115
|
+
</li>
|
|
116
|
+
{% endfor %}
|
|
117
|
+
</ul>
|
|
118
|
+
<div class="usa-nav__secondary">
|
|
119
|
+
<ul class="usa-nav__secondary-links">
|
|
120
|
+
{% for link in secondaryLinks %}
|
|
121
|
+
<li class="usa-nav__secondary-item">
|
|
122
|
+
<a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
|
|
123
|
+
<span>{{ link.text }}</span>
|
|
124
|
+
</a>
|
|
125
|
+
</li>
|
|
126
|
+
{% endfor %}
|
|
127
|
+
</ul>
|
|
128
|
+
{% if searchProps %}
|
|
129
|
+
{% search id=searchProps.id ariaLabel=searchProps.ariaLabel searchKey=searchProps.searchKey label=searchProps.label icon=searchProps.icon iconOnly=searchProps.iconOnly buttonVariant=searchProps.buttonVariant big=searchProps.big action=searchProps.action placeholder=searchProps.placeholder defaultValue=searchProps.defaultValue onSubmit=searchProps.onSubmit className=searchProps.className|default:'' %}{% endsearch %}
|
|
130
|
+
{% endif %}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</nav>
|
|
134
|
+
{% else %}
|
|
135
|
+
|
|
136
|
+
<nav aria-label="Primary navigation" class="usa-nav usx-nav">
|
|
137
|
+
<button type="button" class="usa-nav__close">
|
|
138
|
+
{% icon name='close' %}{% endicon %}
|
|
139
|
+
</button>
|
|
140
|
+
<ul class="usa-nav__primary usa-accordion">
|
|
141
|
+
{% for section in navSections %}
|
|
142
|
+
<li class="usa-nav__primary-item">
|
|
143
|
+
{% if section.href %}
|
|
144
|
+
<a href="{{ section.href }}" class="usa-nav__link" {% if section.ariaLabel %}aria-label="{{ section.ariaLabel }}"{% endif %}>
|
|
145
|
+
<span>{{ section.title }}</span>
|
|
146
|
+
</a>
|
|
147
|
+
{% else %}
|
|
148
|
+
<button type="button" class="usa-accordion__button usa-nav__link" aria-expanded="false" aria-controls="{{ id }}-nav-section-{{ forloop.counter0 }}">
|
|
149
|
+
<span>{{ section.title }}</span>
|
|
150
|
+
</button>
|
|
151
|
+
{% if section.links %}
|
|
152
|
+
{% if megamenu %}
|
|
153
|
+
<div id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu usa-megamenu" hidden="hidden">
|
|
154
|
+
<div class="grid-row grid-gap-4">
|
|
155
|
+
<div class="usa-col">
|
|
156
|
+
<ul class="usa-nav__submenu-list">
|
|
157
|
+
{% for link in section.links %}
|
|
158
|
+
<li class="usa-nav__submenu-item">
|
|
159
|
+
<a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
|
|
160
|
+
{{ link.text }}
|
|
161
|
+
</a>
|
|
162
|
+
</li>
|
|
163
|
+
{% endfor %}
|
|
164
|
+
</ul>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
{% else %}
|
|
169
|
+
<ul id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu" hidden="hidden">
|
|
170
|
+
{% for link in section.links %}
|
|
171
|
+
<li class="usa-nav__submenu-item">
|
|
172
|
+
<a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
|
|
173
|
+
<span>{{ link.text }}</span>
|
|
174
|
+
</a>
|
|
175
|
+
</li>
|
|
176
|
+
{% endfor %}
|
|
177
|
+
</ul>
|
|
178
|
+
{% endif %}
|
|
179
|
+
{% endif %}
|
|
180
|
+
{% endif %}
|
|
181
|
+
</li>
|
|
182
|
+
{% endfor %}
|
|
183
|
+
</ul>
|
|
184
|
+
{% if searchProps %}
|
|
185
|
+
{% search id=searchProps.id ariaLabel=searchProps.ariaLabel searchKey=searchProps.searchKey label=searchProps.label icon=searchProps.icon iconOnly=searchProps.iconOnly buttonVariant=searchProps.buttonVariant big=searchProps.big action=searchProps.action placeholder=searchProps.placeholder defaultValue=searchProps.defaultValue onSubmit=searchProps.onSubmit className=searchProps.className|default:'' %}{% endsearch %}
|
|
186
|
+
{% endif %}
|
|
187
|
+
</nav>
|
|
188
|
+
</div>
|
|
189
|
+
{% endif %}
|
|
190
|
+
|
|
191
|
+
{% if not extended %}
|
|
192
|
+
</div>
|
|
193
|
+
{% endif %}
|
|
194
|
+
</header>
|